mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-18 03:31:31 +12:00
[GL] Fix glClear call
This commit is contained in:
parent
60655febba
commit
1ea0b39a3b
1 changed files with 8 additions and 4 deletions
|
@ -488,6 +488,8 @@ void RendererGL::clearBuffer(u32 startAddress, u32 endAddress, u32 value, u32 co
|
||||||
|
|
||||||
const auto depth = depthBufferCache.findFromAddress(startAddress);
|
const auto depth = depthBufferCache.findFromAddress(startAddress);
|
||||||
if (depth) {
|
if (depth) {
|
||||||
|
depth->get().fbo.bind(OpenGL::DrawFramebuffer);
|
||||||
|
|
||||||
float depthVal;
|
float depthVal;
|
||||||
const auto format = depth->get().format;
|
const auto format = depth->get().format;
|
||||||
if (format == DepthFmt::Depth16) {
|
if (format == DepthFmt::Depth16) {
|
||||||
|
@ -495,15 +497,17 @@ void RendererGL::clearBuffer(u32 startAddress, u32 endAddress, u32 value, u32 co
|
||||||
} else {
|
} else {
|
||||||
depthVal = (value & 0xffffff) / 16777215.0f;
|
depthVal = (value & 0xffffff) / 16777215.0f;
|
||||||
}
|
}
|
||||||
depth->get().fbo.bind(OpenGL::DrawFramebuffer);
|
|
||||||
gl.setDepthMask(true);
|
gl.setDepthMask(true);
|
||||||
OpenGL::setClearDepth(depthVal);
|
OpenGL::setClearDepth(depthVal);
|
||||||
OpenGL::clearDepth();
|
|
||||||
if (format == DepthFmt::Depth24Stencil8) {
|
if (format == DepthFmt::Depth24Stencil8) {
|
||||||
const u8 stencil = (value >> 24);
|
const u8 stencil = (value >> 24);
|
||||||
OpenGL::setStencilMask(0xFF);
|
OpenGL::setStencilMask(0xff);
|
||||||
OpenGL::setClearStencil(stencil);
|
OpenGL::setClearStencil(stencil);
|
||||||
OpenGL::clearStencil();
|
OpenGL::clearDepthAndStencil();
|
||||||
|
} else {
|
||||||
|
OpenGL::clearDepth();
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue