mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 09:30:44 +00:00
Clear mips/slices in overlay on GL to avoid undefined contents
This commit is contained in:
@@ -419,6 +419,26 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, const Subresource &sub, Com
|
||||
drv.glTexParameteri(texBindingEnum, eGL_TEXTURE_WRAP_S, eGL_CLAMP_TO_EDGE);
|
||||
drv.glTexParameteri(texBindingEnum, eGL_TEXTURE_WRAP_T, eGL_CLAMP_TO_EDGE);
|
||||
}
|
||||
|
||||
// clear all mips first
|
||||
drv.glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
drv.glDisable(eGL_BLEND);
|
||||
drv.glDisable(eGL_SCISSOR_TEST);
|
||||
drv.glDepthMask(GL_FALSE);
|
||||
drv.glDisable(eGL_CULL_FACE);
|
||||
drv.glDisable(eGL_DEPTH_TEST);
|
||||
drv.glDisable(eGL_STENCIL_TEST);
|
||||
drv.glStencilMask(0);
|
||||
|
||||
GLfloat black[4] = {};
|
||||
for(GLint i = 0; i < texMips; i++)
|
||||
{
|
||||
drv.glFramebufferTexture2D(eGL_FRAMEBUFFER, eGL_COLOR_ATTACHMENT0, texBindingEnum,
|
||||
DebugData.overlayTex, i);
|
||||
drv.glClearBufferfv(eGL_COLOR, 0, black);
|
||||
}
|
||||
|
||||
// bind the desired mip
|
||||
drv.glFramebufferTexture2D(eGL_FRAMEBUFFER, eGL_COLOR_ATTACHMENT0, texBindingEnum,
|
||||
DebugData.overlayTex, sub.mip);
|
||||
|
||||
|
||||
@@ -192,6 +192,18 @@ void main()
|
||||
|
||||
GLuint subfbo = MakeFBO();
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, subfbo);
|
||||
|
||||
// clear all mips/slices first
|
||||
GLfloat black[4] = {};
|
||||
for(GLint s = 0; s < 5; s++)
|
||||
{
|
||||
for(GLint m = 0; m < 4; m++)
|
||||
{
|
||||
glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, subtex, m, s);
|
||||
glClearBufferfv(GL_COLOR, 0, black);
|
||||
}
|
||||
}
|
||||
|
||||
glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, subtex, 2, 2);
|
||||
|
||||
while(Running())
|
||||
|
||||
Reference in New Issue
Block a user