Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

igl | OpenGL | Only execute glClear() when the load action of the attachment is LoadAction::Clear. #194

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
vinsentli marked this conversation as resolved.
Show resolved Hide resolved
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