Skip to content

Commit 45d6808

Browse files
committed
glHW: Don't use a separate clear framebuffer.
There were cases where the attachments were not fully cleared when using a separate framebuffer.
1 parent 1c7e3a9 commit 45d6808

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

src/Layers/xrRenderGL/glHW.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,6 @@ void CHW::UpdateViews()
345345
glGenFramebuffers(1, &pFB);
346346
CHK_GL(glBindFramebuffer(GL_FRAMEBUFFER, pFB));
347347

348-
// Create the clear framebuffer
349-
glGenFramebuffers(1, &pCFB);
350-
351348
// Create a color render target
352349
glGenTextures(1, &HW.pBaseRT);
353350
CHK_GL(glBindTexture(GL_TEXTURE_2D, HW.pBaseRT));
@@ -365,8 +362,7 @@ void CHW::ClearRenderTargetView(GLuint pRenderTargetView, const FLOAT ColorRGBA[
365362
if (pRenderTargetView == 0)
366363
return;
367364

368-
// Bind the clear framebuffer and attach the render target
369-
RCache.set_FB(pCFB);
365+
// Attach the render target
370366
CHK_GL(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, pRenderTargetView, 0));
371367

372368
// Clear the color buffer without affecting the global state
@@ -375,17 +371,14 @@ void CHW::ClearRenderTargetView(GLuint pRenderTargetView, const FLOAT ColorRGBA[
375371
glClearColor(ColorRGBA[0], ColorRGBA[1], ColorRGBA[2], ColorRGBA[3]);
376372
CHK_GL(glClear(GL_COLOR_BUFFER_BIT));
377373
glPopAttrib();
378-
379-
RCache.set_FB(pFB);
380374
}
381375

382376
void CHW::ClearDepthStencilView(GLuint pDepthStencilView, UINT ClearFlags, FLOAT Depth, UINT8 Stencil)
383377
{
384378
if (pDepthStencilView == 0)
385379
return;
386380

387-
// Bind the clear framebuffer and attach the render target
388-
RCache.set_FB(pCFB);
381+
// Attach the depth buffer
389382
CHK_GL(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, pDepthStencilView, 0));
390383

391384
u32 mask = 0;
@@ -408,8 +401,6 @@ void CHW::ClearDepthStencilView(GLuint pDepthStencilView, UINT ClearFlags, FLOAT
408401
}
409402
CHK_GL(glClear(mask));
410403
glPopAttrib();
411-
412-
RCache.set_FB(pFB);
413404
}
414405

415406
HRESULT CHW::Present(UINT SyncInterval, UINT Flags)

0 commit comments

Comments
 (0)