summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2019-07-14 15:00:37 -0400
committerGravatar FernandoS272019-07-17 17:29:54 -0400
commit8cdbfe69b1211431536414e375f0fd49222d9a29 (patch)
treedac0320358b55acc6a431c07e38d7da4fb156ec2 /src
parentMaxwell3D: Correct marking dirtiness on CB upload (diff)
downloadyuzu-8cdbfe69b1211431536414e375f0fd49222d9a29.tar.gz
yuzu-8cdbfe69b1211431536414e375f0fd49222d9a29.tar.xz
yuzu-8cdbfe69b1211431536414e375f0fd49222d9a29.zip
GL_Rasterizer: Corrections to Clearing.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/engines/maxwell_3d.cpp2
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp12
-rw-r--r--src/video_core/renderer_opengl/gl_state.cpp20
-rw-r--r--src/video_core/renderer_opengl/gl_state.h6
4 files changed, 28 insertions, 12 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index 0c4e72dfe..97422e700 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -568,7 +568,7 @@ void Maxwell3D::FinishCBData() {
568 568
569 const u32 id = cb_data_state.id; 569 const u32 id = cb_data_state.id;
570 memory_manager.WriteBlock(address, cb_data_state.buff[id].data(), size); 570 memory_manager.WriteBlock(address, cb_data_state.buff[id].data(), size);
571 dirty.ResetVertexArrays(); 571 dirty.OnMemoryWrite();
572 572
573 cb_data_state.id = null_cb_data; 573 cb_data_state.id = null_cb_data;
574 cb_data_state.current = null_cb_data; 574 cb_data_state.current = null_cb_data;
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 4aa3d6548..77195ad93 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -604,7 +604,8 @@ void RasterizerOpenGL::Clear() {
604 prev_state.Apply(); 604 prev_state.Apply();
605 }); 605 });
606 606
607 OpenGLState clear_state; 607 OpenGLState clear_state{OpenGLState::GetCurState()};
608 clear_state.DefaultViewports();
608 if (regs.clear_buffers.R || regs.clear_buffers.G || regs.clear_buffers.B || 609 if (regs.clear_buffers.R || regs.clear_buffers.G || regs.clear_buffers.B ||
609 regs.clear_buffers.A) { 610 regs.clear_buffers.A) {
610 use_color = true; 611 use_color = true;
@@ -624,6 +625,7 @@ void RasterizerOpenGL::Clear() {
624 // true. 625 // true.
625 clear_state.depth.test_enabled = true; 626 clear_state.depth.test_enabled = true;
626 clear_state.depth.test_func = GL_ALWAYS; 627 clear_state.depth.test_func = GL_ALWAYS;
628 clear_state.depth.write_mask = GL_TRUE;
627 } 629 }
628 if (regs.clear_buffers.S) { 630 if (regs.clear_buffers.S) {
629 ASSERT_MSG(regs.zeta_enable != 0, "Tried to clear stencil but buffer is not enabled!"); 631 ASSERT_MSG(regs.zeta_enable != 0, "Tried to clear stencil but buffer is not enabled!");
@@ -661,6 +663,7 @@ void RasterizerOpenGL::Clear() {
661 } 663 }
662 664
663 ConfigureClearFramebuffer(clear_state, use_color, use_depth, use_stencil); 665 ConfigureClearFramebuffer(clear_state, use_color, use_depth, use_stencil);
666
664 SyncViewport(clear_state); 667 SyncViewport(clear_state);
665 if (regs.clear_flags.scissor) { 668 if (regs.clear_flags.scissor) {
666 SyncScissorTest(clear_state); 669 SyncScissorTest(clear_state);
@@ -670,11 +673,8 @@ void RasterizerOpenGL::Clear() {
670 clear_state.EmulateViewportWithScissor(); 673 clear_state.EmulateViewportWithScissor();
671 } 674 }
672 675
673 clear_state.ApplyColorMask(); 676 clear_state.AllDirty();
674 clear_state.ApplyDepth(); 677 clear_state.Apply();
675 clear_state.ApplyStencilTest();
676 clear_state.ApplyViewport();
677 clear_state.ApplyFramebufferState();
678 678
679 if (use_color) { 679 if (use_color) {
680 glClearBufferfv(GL_COLOR, 0, regs.clear_color); 680 glClearBufferfv(GL_COLOR, 0, regs.clear_color);
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp
index cac03dc31..8d62045b0 100644
--- a/src/video_core/renderer_opengl/gl_state.cpp
+++ b/src/video_core/renderer_opengl/gl_state.cpp
@@ -165,6 +165,26 @@ OpenGLState::OpenGLState() {
165 alpha_test.ref = 0.0f; 165 alpha_test.ref = 0.0f;
166} 166}
167 167
168void OpenGLState::DefaultViewports() {
169 for (auto& item : viewports) {
170 item.x = 0;
171 item.y = 0;
172 item.width = 0;
173 item.height = 0;
174 item.depth_range_near = 0.0f;
175 item.depth_range_far = 1.0f;
176 item.scissor.enabled = false;
177 item.scissor.x = 0;
178 item.scissor.y = 0;
179 item.scissor.width = 0;
180 item.scissor.height = 0;
181 }
182
183 depth_clamp.far_plane = false;
184 depth_clamp.near_plane = false;
185
186}
187
168void OpenGLState::ApplyDefaultState() { 188void OpenGLState::ApplyDefaultState() {
169 glEnable(GL_BLEND); 189 glEnable(GL_BLEND);
170 glDisable(GL_FRAMEBUFFER_SRGB); 190 glDisable(GL_FRAMEBUFFER_SRGB);
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h
index 3d0f6747f..2860a2c82 100644
--- a/src/video_core/renderer_opengl/gl_state.h
+++ b/src/video_core/renderer_opengl/gl_state.h
@@ -195,6 +195,7 @@ public:
195 s_rgb_used = false; 195 s_rgb_used = false;
196 } 196 }
197 197
198 void DefaultViewports();
198 /// Apply this state as the current OpenGL state 199 /// Apply this state as the current OpenGL state
199 void Apply(); 200 void Apply();
200 201
@@ -245,10 +246,6 @@ public:
245 dirty.stencil_state = is_dirty; 246 dirty.stencil_state = is_dirty;
246 } 247 }
247 248
248 void MarkDirtyViewportState(const bool is_dirty) {
249 dirty.viewport_state = is_dirty;
250 }
251
252 void MarkDirtyPolygonOffset(const bool is_dirty) { 249 void MarkDirtyPolygonOffset(const bool is_dirty) {
253 dirty.polygon_offset = is_dirty; 250 dirty.polygon_offset = is_dirty;
254 } 251 }
@@ -260,7 +257,6 @@ public:
260 void AllDirty() { 257 void AllDirty() {
261 dirty.blend_state = true; 258 dirty.blend_state = true;
262 dirty.stencil_state = true; 259 dirty.stencil_state = true;
263 dirty.viewport_state = true;
264 dirty.polygon_offset = true; 260 dirty.polygon_offset = true;
265 dirty.color_mask = true; 261 dirty.color_mask = true;
266 } 262 }