Commit bd2bdf9f by Jamie Madill

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: 's avatarTobin Ehlis <tobine@google.com>
parent 0bba1100
...@@ -679,31 +679,35 @@ bool FramebufferState::isDefault() const ...@@ -679,31 +679,35 @@ bool FramebufferState::isDefault() const
return mId == Framebuffer::kDefaultDrawFramebufferHandle; return mId == Framebuffer::kDefaultDrawFramebufferHandle;
} }
bool FramebufferState::updateAttachmentFeedbackLoop(size_t dirtyBit) bool FramebufferState::updateAttachmentFeedbackLoopAndReturnIfChanged(size_t dirtyBit)
{ {
bool previous;
bool loop; bool loop;
switch (dirtyBit) switch (dirtyBit)
{ {
case Framebuffer::DIRTY_BIT_DEPTH_ATTACHMENT: case Framebuffer::DIRTY_BIT_DEPTH_ATTACHMENT:
previous = mDepthBufferFeedbackLoop;
loop = mDepthAttachment.isBoundAsSamplerOrImage(); loop = mDepthAttachment.isBoundAsSamplerOrImage();
mDepthBufferFeedbackLoop = loop; mDepthBufferFeedbackLoop = loop;
break; break;
case Framebuffer::DIRTY_BIT_STENCIL_ATTACHMENT: case Framebuffer::DIRTY_BIT_STENCIL_ATTACHMENT:
previous = mStencilBufferFeedbackLoop;
loop = mStencilAttachment.isBoundAsSamplerOrImage(); loop = mStencilAttachment.isBoundAsSamplerOrImage();
mStencilBufferFeedbackLoop = loop; mStencilBufferFeedbackLoop = loop;
break; break;
default: default:
ASSERT(dirtyBit <= Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_MAX); ASSERT(dirtyBit <= Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_MAX);
loop = mColorAttachments[dirtyBit].isBoundAsSamplerOrImage(); previous = mDrawBufferFeedbackLoops.test(dirtyBit);
loop = mColorAttachments[dirtyBit].isBoundAsSamplerOrImage();
mDrawBufferFeedbackLoops[dirtyBit] = loop; mDrawBufferFeedbackLoops[dirtyBit] = loop;
break; break;
} }
updateHasRenderingFeedbackLoop(); updateHasRenderingFeedbackLoop();
return loop; return previous != loop;
} }
void FramebufferState::updateHasRenderingFeedbackLoop() void FramebufferState::updateHasRenderingFeedbackLoop()
...@@ -1942,7 +1946,7 @@ void Framebuffer::updateAttachment(const Context *context, ...@@ -1942,7 +1946,7 @@ void Framebuffer::updateAttachment(const Context *context,
mState.mResourceNeedsInit.set(dirtyBit, attachment->initState() == InitState::MayNeedInit); mState.mResourceNeedsInit.set(dirtyBit, attachment->initState() == InitState::MayNeedInit);
onDirtyBinding->bind(resource); onDirtyBinding->bind(resource);
mState.updateAttachmentFeedbackLoop(dirtyBit); mState.updateAttachmentFeedbackLoopAndReturnIfChanged(dirtyBit);
invalidateCompletenessCache(); invalidateCompletenessCache();
} }
...@@ -1978,7 +1982,7 @@ void Framebuffer::onSubjectStateChange(angle::SubjectIndex index, angle::Subject ...@@ -1978,7 +1982,7 @@ void Framebuffer::onSubjectStateChange(angle::SubjectIndex index, angle::Subject
// Triggered by changes to Texture feedback loops. // Triggered by changes to Texture feedback loops.
if (message == angle::SubjectMessage::BindingChanged) if (message == angle::SubjectMessage::BindingChanged)
{ {
if (mState.updateAttachmentFeedbackLoop(index)) if (mState.updateAttachmentFeedbackLoopAndReturnIfChanged(index))
{ {
mDirtyBits.set(index); mDirtyBits.set(index);
onStateChange(angle::SubjectMessage::DirtyBitsFlagged); onStateChange(angle::SubjectMessage::DirtyBitsFlagged);
......
...@@ -132,7 +132,9 @@ class FramebufferState final : angle::NonCopyable ...@@ -132,7 +132,9 @@ class FramebufferState final : angle::NonCopyable
const FramebufferAttachment *getWebGLDepthStencilAttachment() const; const FramebufferAttachment *getWebGLDepthStencilAttachment() const;
const FramebufferAttachment *getWebGLDepthAttachment() const; const FramebufferAttachment *getWebGLDepthAttachment() const;
const FramebufferAttachment *getWebGLStencilAttachment() 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(); void updateHasRenderingFeedbackLoop();
friend class Framebuffer; friend class Framebuffer;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment