Pass Context to VertexArray and Framebuffer syncstate.
This will enable more Vulkan-friendly idioms like clearing the
vulkan pipeline caches correctly on GL state changes immediately
because we have access to the ContextVk.
BUG=angleproject:1898
Change-Id: I16c848d8abdde8e26a38d384e565cec8548a66d0
Reviewed-on: https://chromium-review.googlesource.com/459079
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/Framebuffer.cpp b/src/libANGLE/Framebuffer.cpp
index 216eecb..daa9261 100644
--- a/src/libANGLE/Framebuffer.cpp
+++ b/src/libANGLE/Framebuffer.cpp
@@ -568,7 +568,7 @@
return false;
}
-GLenum Framebuffer::checkStatus(const ContextState &state)
+GLenum Framebuffer::checkStatus(const Context *context)
{
// The default framebuffer is always complete except when it is surfaceless in which
// case it is always unsupported. We return early because the default framebuffer may
@@ -583,14 +583,16 @@
if (hasAnyDirtyBit() || !mCachedStatus.valid())
{
- mCachedStatus = checkStatusImpl(state);
+ mCachedStatus = checkStatusImpl(context);
}
return mCachedStatus.value();
}
-GLenum Framebuffer::checkStatusImpl(const ContextState &state)
+GLenum Framebuffer::checkStatusImpl(const Context *context)
{
+ const ContextState &state = context->getContextState();
+
ASSERT(mId != 0);
unsigned int colorbufferSize = 0;
@@ -855,7 +857,7 @@
return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;
}
- syncState();
+ syncState(context);
if (!mImpl->checkStatus())
{
return GL_FRAMEBUFFER_UNSUPPORTED;
@@ -1002,9 +1004,9 @@
return mImpl->blit(context, sourceArea, destArea, blitMask, filter);
}
-int Framebuffer::getSamples(const ContextState &state)
+int Framebuffer::getSamples(const Context *context)
{
- if (complete(state))
+ if (complete(context))
{
// For a complete framebuffer, all attachments must have the same sample count.
// In this case return the first nonzero sample size.
@@ -1197,11 +1199,11 @@
setAttachment(context, GL_NONE, binding, ImageIndex::MakeInvalid(), nullptr);
}
-void Framebuffer::syncState()
+void Framebuffer::syncState(const Context *context)
{
if (mDirtyBits.any())
{
- mImpl->syncState(mDirtyBits);
+ mImpl->syncState(rx::SafeGetImpl(context), mDirtyBits);
mDirtyBits.reset();
if (mId != 0)
{
@@ -1216,9 +1218,14 @@
mCachedStatus.reset();
}
-bool Framebuffer::complete(const ContextState &state)
+bool Framebuffer::complete(const Context *context)
{
- return (checkStatus(state) == GL_FRAMEBUFFER_COMPLETE);
+ return (checkStatus(context) == GL_FRAMEBUFFER_COMPLETE);
+}
+
+bool Framebuffer::cachedComplete() const
+{
+ return (mCachedStatus.valid() && mCachedStatus == GL_FRAMEBUFFER_COMPLETE);
}
bool Framebuffer::formsRenderingFeedbackLoopWith(const State &state) const
@@ -1348,4 +1355,15 @@
mDirtyBits.set(DIRTY_BIT_DEFAULT_FIXED_SAMPLE_LOCATIONS);
}
+// TODO(jmadill): Remove this kludge.
+GLenum Framebuffer::checkStatus(const ValidationContext *context)
+{
+ return checkStatus(static_cast<const Context *>(context));
+}
+
+int Framebuffer::getSamples(const ValidationContext *context)
+{
+ return getSamples(static_cast<const Context *>(context));
+}
+
} // namespace gl