Skip to content

Commit

Permalink
LoadAction::Clear
Browse files Browse the repository at this point in the history
  • Loading branch information
vinsentli committed Nov 4, 2024
1 parent fb1583c commit 8838b58
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/igl/opengl/Framebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -879,18 +879,18 @@ void CurrentFramebuffer::bind(const RenderPassDesc& renderPass) const {

// clear the buffers if we're not loading previous contents
GLbitfield clearMask = 0;
if (renderPass.colorAttachments[0].loadAction != LoadAction::Load) {
if (renderPass.colorAttachments[0].loadAction == LoadAction::Clear) {
clearMask |= GL_COLOR_BUFFER_BIT;
auto clearColor = renderPass.colorAttachments[0].clearColor;
getContext().colorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
getContext().clearColor(clearColor.r, clearColor.g, clearColor.b, clearColor.a);
}
if (renderPass.depthAttachment.loadAction != LoadAction::Load) {
if (renderPass.depthAttachment.loadAction == LoadAction::Clear) {
clearMask |= GL_DEPTH_BUFFER_BIT;
getContext().depthMask(GL_TRUE);
getContext().clearDepthf(renderPass.depthAttachment.clearDepth);
}
if (renderPass.stencilAttachment.loadAction != LoadAction::Load) {
if (renderPass.stencilAttachment.loadAction == LoadAction::Clear) {
clearMask |= GL_STENCIL_BUFFER_BIT;
getContext().stencilMask(0xFF);
getContext().clearStencil(renderPass.stencilAttachment.clearStencil);
Expand Down

0 comments on commit 8838b58

Please sign in to comment.