summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2017-09-22 04:06:38 +0200
committerGitHub <noreply@github.com>2017-09-22 04:06:38 +0200
commita7758b0b36f50b0d0f20149134551f4dfee01442 (patch)
tree303c41d39384e510d6990cb347800aff14c5e8d3 /src
parentMerge pull request #2933 from huwpascoe/perf-1 (diff)
parentFixed framebuffer warning (diff)
downloadyuzu-a7758b0b36f50b0d0f20149134551f4dfee01442.tar
yuzu-a7758b0b36f50b0d0f20149134551f4dfee01442.tar.gz
yuzu-a7758b0b36f50b0d0f20149134551f4dfee01442.tar.bz2
yuzu-a7758b0b36f50b0d0f20149134551f4dfee01442.tar.lz
yuzu-a7758b0b36f50b0d0f20149134551f4dfee01442.tar.xz
yuzu-a7758b0b36f50b0d0f20149134551f4dfee01442.tar.zst
yuzu-a7758b0b36f50b0d0f20149134551f4dfee01442.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 7b0cd1b66..7e09e4712 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -237,13 +237,24 @@ void RasterizerOpenGL::DrawTriangles() {
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
color_surface != nullptr ? color_surface->texture.handle : 0, 0);
- glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D,
- depth_surface != nullptr ? depth_surface->texture.handle : 0, 0);
- bool has_stencil =
- regs.framebuffer.framebuffer.depth_format == Pica::FramebufferRegs::DepthFormat::D24S8;
- glFramebufferTexture2D(
- GL_DRAW_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D,
- (has_stencil && depth_surface != nullptr) ? depth_surface->texture.handle : 0, 0);
+ if (depth_surface != nullptr) {
+ if (regs.framebuffer.framebuffer.depth_format ==
+ Pica::FramebufferRegs::DepthFormat::D24S8) {
+ // attach both depth and stencil
+ glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D,
+ depth_surface->texture.handle, 0);
+ } else {
+ // attach depth
+ glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D,
+ depth_surface->texture.handle, 0);
+ // clear stencil attachment
+ glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
+ }
+ } else {
+ // clear both depth and stencil attachment
+ glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0,
+ 0);
+ }
// Sync the viewport
// These registers hold half-width and half-height, so must be multiplied by 2