Refactor StateManager11 for dirty bits.
This will make iterating over an internal set of dirty bits simpler.
This also reorganizes the framebuffer invalidation logic a bit,
including how the sample count is pulled from the Framebuffer.
BUG=angleproject:1156
Change-Id: I79dbcd11704ab52568c587d836af9c1bff1d2d1f
Reviewed-on: https://chromium-review.googlesource.com/529708
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/Framebuffer.cpp b/src/libANGLE/Framebuffer.cpp
index c3d3ead..10525b2 100644
--- a/src/libANGLE/Framebuffer.cpp
+++ b/src/libANGLE/Framebuffer.cpp
@@ -418,6 +418,16 @@
return true;
}
+bool FramebufferState::hasDepth() const
+{
+ return (mDepthAttachment.isAttached() && mDepthAttachment.getDepthSize() > 0);
+}
+
+bool FramebufferState::hasStencil() const
+{
+ return (mStencilAttachment.isAttached() && mStencilAttachment.getStencilSize() > 0);
+}
+
Framebuffer::Framebuffer(const Caps &caps, rx::GLImplFactory *factory, GLuint id)
: mState(caps),
mImpl(factory->createFramebuffer(mState)),
@@ -711,13 +721,12 @@
bool Framebuffer::hasDepth() const
{
- return (mState.mDepthAttachment.isAttached() && mState.mDepthAttachment.getDepthSize() > 0);
+ return mState.hasDepth();
}
bool Framebuffer::hasStencil() const
{
- return (mState.mStencilAttachment.isAttached() &&
- mState.mStencilAttachment.getStencilSize() > 0);
+ return mState.hasStencil();
}
bool Framebuffer::usingExtendedDrawBuffers() const
@@ -1079,19 +1088,27 @@
{
if (complete(context))
{
- // For a complete framebuffer, all attachments must have the same sample count.
- // In this case return the first nonzero sample size.
- const auto *firstNonNullAttachment = mState.getFirstNonNullAttachment();
- if (firstNonNullAttachment)
- {
- ASSERT(firstNonNullAttachment->isAttached());
- return firstNonNullAttachment->getSamples();
- }
+ return getCachedSamples(context);
}
return 0;
}
+int Framebuffer::getCachedSamples(const Context *context)
+{
+ // For a complete framebuffer, all attachments must have the same sample count.
+ // In this case return the first nonzero sample size.
+ const auto *firstNonNullAttachment = mState.getFirstNonNullAttachment();
+ if (firstNonNullAttachment)
+ {
+ ASSERT(firstNonNullAttachment->isAttached());
+ return firstNonNullAttachment->getSamples();
+ }
+
+ // No attachments found.
+ return 0;
+}
+
Error Framebuffer::getSamplePosition(size_t index, GLfloat *xy) const
{
ANGLE_TRY(mImpl->getSamplePosition(index, xy));