From f2e7b29c14e0207e0476299d69dac7ed4c213c74 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Wed, 10 Jul 2019 15:38:31 -0400 Subject: Maxwell3D: Rework the dirty system to be more consistant and scaleable --- src/video_core/engines/maxwell_3d.h | 74 +++++++++++++++++++++++++++++++------ 1 file changed, 63 insertions(+), 11 deletions(-) (limited to 'src/video_core/engines/maxwell_3d.h') diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 8d15c8a48..84e6ca145 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h @@ -1124,23 +1124,73 @@ 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 vertex_array; + + bool vertex_array_buffers; + // Vertex Instances + std::array vertex_instance; + + bool vertex_instances; + // Render Targets + std::array render_target; + bool depth_buffer; + + bool render_settings; + // Shaders + bool shaders; + // State + bool viewport; + bool clip_enabled; + bool clip_coefficient; + bool cull_mode; + bool primitive_restart; + bool depth_test; + bool stencil_test; + bool blend_state; + bool logic_op; + bool fragment_color_clamp; + bool multi_sample; + bool scissor_test; + bool transform_feedback; + bool point; + bool color_mask; + bool polygon_offset; + bool alpha_test; + + bool memory_general; + }; + std::array regs; + }; + + void ResetVertexArrays() { + std::fill(vertex_array.begin(), vertex_array.end(), true); + vertex_array_buffers = true; + } - bool vertex_attrib_format = true; - bool zeta_buffer = true; - bool shaders = true; + void ResetRenderTargets() { + depth_buffer = true; + std::fill(render_target.begin(), render_target.end(), 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 dirty_pointers{}; /// Reads a register value located at the input method address u32 GetRegisterValue(u32 method) const; @@ -1200,6 +1250,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 -- cgit v1.2.3 From 0d3db58657ce5352d90a70ee8d6c0334d9119366 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Fri, 12 Jul 2019 09:25:47 -0400 Subject: Maxwell3D: Rework CBData Upload --- src/video_core/engines/maxwell_3d.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/video_core/engines/maxwell_3d.h') diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 84e6ca145..318078f36 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h @@ -1244,6 +1244,15 @@ private: Upload::State upload_state; + static constexpr u32 null_cb_data = 0xFFFFFFFF; + struct { + std::array, 16> buff; + u32 current{null_cb_data}; + u32 id{null_cb_data}; + u32 start_pos{}; + u32 counter{}; + } cb_data_state; + /// Retrieves information about a specific TIC entry from the TIC buffer. Texture::TICEntry GetTICEntry(u32 tic_index) const; @@ -1275,7 +1284,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); -- cgit v1.2.3 From a081dea8abd9539ab45e53fbfb0e9c6243b87180 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sat, 13 Jul 2019 16:52:32 -0400 Subject: Maxwell3D: Implement State Dirty Flags. --- src/video_core/engines/maxwell_3d.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/video_core/engines/maxwell_3d.h') diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 318078f36..abc69cc65 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h @@ -1148,22 +1148,20 @@ public: bool shaders; // State bool viewport; - bool clip_enabled; bool clip_coefficient; bool cull_mode; bool primitive_restart; bool depth_test; bool stencil_test; bool blend_state; - bool logic_op; - bool fragment_color_clamp; - bool multi_sample; bool scissor_test; bool transform_feedback; - bool point; bool color_mask; bool polygon_offset; - bool alpha_test; + + // Complementary + bool viewport_transform; + bool screen_y_control; bool memory_general; }; -- cgit v1.2.3 From 5ad889f6fdb4a2d331e8e80e82fef8b8d582d7f7 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Mon, 15 Jul 2019 10:24:01 -0400 Subject: Maxwell3D: Address Feedback --- src/video_core/engines/maxwell_3d.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/video_core/engines/maxwell_3d.h') diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index abc69cc65..6bf8d0603 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h @@ -1169,13 +1169,13 @@ public: }; void ResetVertexArrays() { - std::fill(vertex_array.begin(), vertex_array.end(), true); + vertex_array.fill(true); vertex_array_buffers = true; } void ResetRenderTargets() { depth_buffer = true; - std::fill(render_target.begin(), render_target.end(), true); + render_target.fill(true); render_settings = true; } @@ -1244,7 +1244,7 @@ private: static constexpr u32 null_cb_data = 0xFFFFFFFF; struct { - std::array, 16> buff; + std::array, 16> buffer; u32 current{null_cb_data}; u32 id{null_cb_data}; u32 start_pos{}; -- cgit v1.2.3 From 4be61013a1e26414b37abb35e82b48600c05628b Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Wed, 17 Jul 2019 17:00:06 -0400 Subject: GL_State: Feedback and fixes --- src/video_core/engines/maxwell_3d.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/video_core/engines/maxwell_3d.h') diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 6bf8d0603..42feb0345 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h @@ -1129,24 +1129,30 @@ public: union { struct { bool null_dirty; + // Vertex Attributes bool vertex_attrib_format; + // Vertex Arrays std::array vertex_array; bool vertex_array_buffers; + // Vertex Instances std::array vertex_instance; bool vertex_instances; + // Render Targets std::array render_target; bool depth_buffer; bool render_settings; + // Shaders bool shaders; - // State + + // Rasterizer State bool viewport; bool clip_coefficient; bool cull_mode; -- cgit v1.2.3 From 7a35178ee2c8ce60c87654ed2d80cc76abb0380b Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Wed, 17 Jul 2019 19:37:01 -0400 Subject: Maxwell3D: Reorganize and address feedback --- src/video_core/engines/maxwell_3d.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/video_core/engines/maxwell_3d.h') diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 42feb0345..ac300bf76 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h @@ -1246,8 +1246,6 @@ private: /// Interpreter for the macro codes uploaded to the GPU. MacroInterpreter macro_interpreter; - Upload::State upload_state; - static constexpr u32 null_cb_data = 0xFFFFFFFF; struct { std::array, 16> buffer; @@ -1257,6 +1255,8 @@ private: u32 counter{}; } cb_data_state; + Upload::State upload_state; + /// Retrieves information about a specific TIC entry from the TIC buffer. Texture::TICEntry GetTICEntry(u32 tic_index) const; -- cgit v1.2.3