diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 25 |
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() { | |||
| 237 | 237 | ||
| 238 | glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, | 238 | glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, |
| 239 | color_surface != nullptr ? color_surface->texture.handle : 0, 0); | 239 | color_surface != nullptr ? color_surface->texture.handle : 0, 0); |
| 240 | glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, | 240 | if (depth_surface != nullptr) { |
| 241 | depth_surface != nullptr ? depth_surface->texture.handle : 0, 0); | 241 | if (regs.framebuffer.framebuffer.depth_format == |
| 242 | bool has_stencil = | 242 | Pica::FramebufferRegs::DepthFormat::D24S8) { |
| 243 | regs.framebuffer.framebuffer.depth_format == Pica::FramebufferRegs::DepthFormat::D24S8; | 243 | // attach both depth and stencil |
| 244 | glFramebufferTexture2D( | 244 | glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, |
| 245 | GL_DRAW_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, | 245 | depth_surface->texture.handle, 0); |
| 246 | (has_stencil && depth_surface != nullptr) ? depth_surface->texture.handle : 0, 0); | 246 | } else { |
| 247 | // attach depth | ||
| 248 | glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, | ||
| 249 | depth_surface->texture.handle, 0); | ||
| 250 | // clear stencil attachment | ||
| 251 | glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0); | ||
| 252 | } | ||
| 253 | } else { | ||
| 254 | // clear both depth and stencil attachment | ||
| 255 | glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, | ||
| 256 | 0); | ||
| 257 | } | ||
| 247 | 258 | ||
| 248 | // Sync the viewport | 259 | // Sync the viewport |
| 249 | // These registers hold half-width and half-height, so must be multiplied by 2 | 260 | // These registers hold half-width and half-height, so must be multiplied by 2 |