summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2018-07-03 02:09:03 +0200
committerSubv <subv2112@gmail.com>2018-07-03 23:56:47 +0200
commitc1811ed3d1805e0d0ab536762692e7c0e80f14dc (patch)
tree620e2bd9d9ce15cbc0faaf3bc634ea00824c57b4 /src
parentGPU: Bind and clear the render target when the CLEAR_BUFFERS register is written to. (diff)
downloadyuzu-c1811ed3d1805e0d0ab536762692e7c0e80f14dc.tar
yuzu-c1811ed3d1805e0d0ab536762692e7c0e80f14dc.tar.gz
yuzu-c1811ed3d1805e0d0ab536762692e7c0e80f14dc.tar.bz2
yuzu-c1811ed3d1805e0d0ab536762692e7c0e80f14dc.tar.lz
yuzu-c1811ed3d1805e0d0ab536762692e7c0e80f14dc.tar.xz
yuzu-c1811ed3d1805e0d0ab536762692e7c0e80f14dc.tar.zst
yuzu-c1811ed3d1805e0d0ab536762692e7c0e80f14dc.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/engines/maxwell_3d.cpp5
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp18
2 files changed, 17 insertions, 6 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index 78f1c0ea7..4d1a79c55 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -420,8 +420,9 @@ bool Maxwell3D::IsShaderStageEnabled(Regs::ShaderStage stage) const {
}
void Maxwell3D::ProcessClearBuffers() {
- ASSERT(regs.clear_buffers.R && regs.clear_buffers.G && regs.clear_buffers.B &&
- regs.clear_buffers.A);
+ ASSERT(regs.clear_buffers.R == regs.clear_buffers.G &&
+ regs.clear_buffers.R == regs.clear_buffers.B &&
+ regs.clear_buffers.R == regs.clear_buffers.A);
VideoCore::g_renderer->Rasterizer()->Clear();
}
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 8e1171161..08c4df5dc 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -300,6 +300,20 @@ bool RasterizerOpenGL::AccelerateDrawBatch(bool is_indexed) {
void RasterizerOpenGL::Clear() {
const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs;
+ GLbitfield clear_mask = 0;
+ if (regs.clear_buffers.R && regs.clear_buffers.G && regs.clear_buffers.B &&
+ regs.clear_buffers.A) {
+ clear_mask |= GL_COLOR_BUFFER_BIT;
+ }
+ if (regs.clear_buffers.Z)
+ clear_mask |= GL_DEPTH_BUFFER_BIT;
+
+ if (clear_mask == 0)
+ return;
+
+ // Sync the depth test state before configuring the framebuffer surfaces.
+ SyncDepthTestState();
+
// TODO(bunnei): Implement these
const bool has_stencil = false;
const bool using_color_fb = true;
@@ -353,10 +367,6 @@ void RasterizerOpenGL::Clear() {
regs.clear_color[3]);
glClearDepth(regs.clear_depth);
- GLbitfield clear_mask = GL_COLOR_BUFFER_BIT;
- if (regs.clear_buffers.Z)
- clear_mask |= GL_DEPTH_BUFFER_BIT;
-
glClear(clear_mask);
// Mark framebuffer surfaces as dirty