Fix feedback loop clearing detection.
Bug: angleproject:4517
Change-Id: I3231b129718019f83495843404cd011eb2cd480d
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2122689
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Tobin Ehlis <tobine@google.com>
diff --git a/src/libANGLE/Framebuffer.cpp b/src/libANGLE/Framebuffer.cpp
index 8a2508f..f1c009c 100644
--- a/src/libANGLE/Framebuffer.cpp
+++ b/src/libANGLE/Framebuffer.cpp
@@ -679,31 +679,35 @@
return mId == Framebuffer::kDefaultDrawFramebufferHandle;
}
-bool FramebufferState::updateAttachmentFeedbackLoop(size_t dirtyBit)
+bool FramebufferState::updateAttachmentFeedbackLoopAndReturnIfChanged(size_t dirtyBit)
{
+ bool previous;
bool loop;
switch (dirtyBit)
{
case Framebuffer::DIRTY_BIT_DEPTH_ATTACHMENT:
+ previous = mDepthBufferFeedbackLoop;
loop = mDepthAttachment.isBoundAsSamplerOrImage();
mDepthBufferFeedbackLoop = loop;
break;
case Framebuffer::DIRTY_BIT_STENCIL_ATTACHMENT:
+ previous = mStencilBufferFeedbackLoop;
loop = mStencilAttachment.isBoundAsSamplerOrImage();
mStencilBufferFeedbackLoop = loop;
break;
default:
ASSERT(dirtyBit <= Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_MAX);
- loop = mColorAttachments[dirtyBit].isBoundAsSamplerOrImage();
+ previous = mDrawBufferFeedbackLoops.test(dirtyBit);
+ loop = mColorAttachments[dirtyBit].isBoundAsSamplerOrImage();
mDrawBufferFeedbackLoops[dirtyBit] = loop;
break;
}
updateHasRenderingFeedbackLoop();
- return loop;
+ return previous != loop;
}
void FramebufferState::updateHasRenderingFeedbackLoop()
@@ -1942,7 +1946,7 @@
mState.mResourceNeedsInit.set(dirtyBit, attachment->initState() == InitState::MayNeedInit);
onDirtyBinding->bind(resource);
- mState.updateAttachmentFeedbackLoop(dirtyBit);
+ mState.updateAttachmentFeedbackLoopAndReturnIfChanged(dirtyBit);
invalidateCompletenessCache();
}
@@ -1978,7 +1982,7 @@
// Triggered by changes to Texture feedback loops.
if (message == angle::SubjectMessage::BindingChanged)
{
- if (mState.updateAttachmentFeedbackLoop(index))
+ if (mState.updateAttachmentFeedbackLoopAndReturnIfChanged(index))
{
mDirtyBits.set(index);
onStateChange(angle::SubjectMessage::DirtyBitsFlagged);
diff --git a/src/libANGLE/Framebuffer.h b/src/libANGLE/Framebuffer.h
index 39bcdf1..7a30997 100644
--- a/src/libANGLE/Framebuffer.h
+++ b/src/libANGLE/Framebuffer.h
@@ -132,7 +132,9 @@
const FramebufferAttachment *getWebGLDepthStencilAttachment() const;
const FramebufferAttachment *getWebGLDepthAttachment() const;
const FramebufferAttachment *getWebGLStencilAttachment() const;
- bool updateAttachmentFeedbackLoop(size_t dirtyBit);
+
+ // Returns true if there was a change in this attachments feedback-loop-ness.
+ bool updateAttachmentFeedbackLoopAndReturnIfChanged(size_t dirtyBit);
void updateHasRenderingFeedbackLoop();
friend class Framebuffer;