mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-11-01 04:37:52 +00:00
Fixed framebuffer warning
This commit is contained in:
parent
255fd8768d
commit
6a110ac5f5
1 changed files with 18 additions and 7 deletions
|
@ -237,13 +237,24 @@ void RasterizerOpenGL::DrawTriangles() {
|
||||||
|
|
||||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
|
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
|
||||||
color_surface != nullptr ? color_surface->texture.handle : 0, 0);
|
color_surface != nullptr ? color_surface->texture.handle : 0, 0);
|
||||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D,
|
if (depth_surface != nullptr) {
|
||||||
depth_surface != nullptr ? depth_surface->texture.handle : 0, 0);
|
if (regs.framebuffer.framebuffer.depth_format ==
|
||||||
bool has_stencil =
|
Pica::FramebufferRegs::DepthFormat::D24S8) {
|
||||||
regs.framebuffer.framebuffer.depth_format == Pica::FramebufferRegs::DepthFormat::D24S8;
|
// attach both depth and stencil
|
||||||
glFramebufferTexture2D(
|
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D,
|
||||||
GL_DRAW_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D,
|
depth_surface->texture.handle, 0);
|
||||||
(has_stencil && depth_surface != nullptr) ? depth_surface->texture.handle : 0, 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
|
// Sync the viewport
|
||||||
// These registers hold half-width and half-height, so must be multiplied by 2
|
// These registers hold half-width and half-height, so must be multiplied by 2
|
||||||
|
|
Loading…
Reference in a new issue