diff options
author | bunnei <bunneidev@gmail.com> | 2019-07-21 06:59:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-21 06:59:52 +0200 |
commit | 27e10e0442dfd347387c6eaf148b27f5cc38bcaf (patch) | |
tree | c078fc3f0e62e55fc92a0c8b582666deece0a968 /src/video_core/engines/maxwell_3d.h | |
parent | Update README.md (diff) | |
parent | Maxwell3D: Reorganize and address feedback (diff) | |
download | yuzu-27e10e0442dfd347387c6eaf148b27f5cc38bcaf.tar yuzu-27e10e0442dfd347387c6eaf148b27f5cc38bcaf.tar.gz yuzu-27e10e0442dfd347387c6eaf148b27f5cc38bcaf.tar.bz2 yuzu-27e10e0442dfd347387c6eaf148b27f5cc38bcaf.tar.lz yuzu-27e10e0442dfd347387c6eaf148b27f5cc38bcaf.tar.xz yuzu-27e10e0442dfd347387c6eaf148b27f5cc38bcaf.tar.zst yuzu-27e10e0442dfd347387c6eaf148b27f5cc38bcaf.zip |
Diffstat (limited to 'src/video_core/engines/maxwell_3d.h')
-rw-r--r-- | src/video_core/engines/maxwell_3d.h | 89 |
1 files changed, 78 insertions, 11 deletions
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 8d15c8a48..ac300bf76 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h @@ -1124,23 +1124,77 @@ public: State state{}; - struct DirtyFlags { - std::bitset<8> color_buffer{0xFF}; - std::bitset<32> vertex_array{0xFFFFFFFF}; + struct DirtyRegs { + static constexpr std::size_t NUM_REGS = 256; + union { + struct { + bool null_dirty; + + // Vertex Attributes + bool vertex_attrib_format; + + // Vertex Arrays + std::array<bool, 32> vertex_array; + + bool vertex_array_buffers; + + // Vertex Instances + std::array<bool, 32> vertex_instance; + + bool vertex_instances; + + // Render Targets + std::array<bool, 8> render_target; + bool depth_buffer; + + bool render_settings; + + // Shaders + bool shaders; + + // Rasterizer State + bool viewport; + bool clip_coefficient; + bool cull_mode; + bool primitive_restart; + bool depth_test; + bool stencil_test; + bool blend_state; + bool scissor_test; + bool transform_feedback; + bool color_mask; + bool polygon_offset; - bool vertex_attrib_format = true; - bool zeta_buffer = true; - bool shaders = true; + // Complementary + bool viewport_transform; + bool screen_y_control; + + bool memory_general; + }; + std::array<bool, NUM_REGS> regs; + }; + + void ResetVertexArrays() { + vertex_array.fill(true); + vertex_array_buffers = true; + } + + void ResetRenderTargets() { + depth_buffer = true; + render_target.fill(true); + render_settings = true; + } void OnMemoryWrite() { - zeta_buffer = true; shaders = true; - color_buffer.set(); - vertex_array.set(); + memory_general = true; + ResetRenderTargets(); + ResetVertexArrays(); } - }; - DirtyFlags dirty_flags; + } dirty{}; + + std::array<u8, Regs::NUM_REGS> dirty_pointers{}; /// Reads a register value located at the input method address u32 GetRegisterValue(u32 method) const; @@ -1192,6 +1246,15 @@ private: /// Interpreter for the macro codes uploaded to the GPU. MacroInterpreter macro_interpreter; + static constexpr u32 null_cb_data = 0xFFFFFFFF; + struct { + std::array<std::array<u32, 0x4000>, 16> buffer; + u32 current{null_cb_data}; + u32 id{null_cb_data}; + u32 start_pos{}; + u32 counter{}; + } cb_data_state; + Upload::State upload_state; /// Retrieves information about a specific TIC entry from the TIC buffer. @@ -1200,6 +1263,8 @@ private: /// Retrieves information about a specific TSC entry from the TSC buffer. Texture::TSCEntry GetTSCEntry(u32 tsc_index) const; + void InitDirtySettings(); + /** * Call a macro on this engine. * @param method Method to call @@ -1223,7 +1288,9 @@ private: void ProcessSyncPoint(); /// Handles a write to the CB_DATA[i] register. + void StartCBData(u32 method); void ProcessCBData(u32 value); + void FinishCBData(); /// Handles a write to the CB_BIND register. void ProcessCBBind(Regs::ShaderStage stage); |