Context: Remove mutable gl::State getter.
This will preserve layering - the API layer doesn't mutate the state
directly, it passes the API call through to the Context. Is also
removes the possiblity of any shenanigans of the Validation layer
changing the GL state.
Also, this CL refactors a few validation entry points to take
ValidationContext instead of Context. ValidationContext will be the
correct way to interact with the gl::Context in the Validation code.
Finally, additional refactorings make ContextState a proper class with
private data. This allows the ContextState itself to keep a mutable
pointer to the gl::State, so ValidationContext can modify it if
necessary (and it will be necessary for Framebuffer completeness
caching).
BUG=angleproject:1388
Change-Id: I86ab3561573caa9535c8d1b8aad4ab3d0e7cd470
Reviewed-on: https://chromium-review.googlesource.com/348954
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/Compiler.cpp b/src/libANGLE/Compiler.cpp
index 127ecd8..33ce14b 100644
--- a/src/libANGLE/Compiler.cpp
+++ b/src/libANGLE/Compiler.cpp
@@ -25,18 +25,18 @@
} // anonymous namespace
-Compiler::Compiler(rx::GLImplFactory *implFactory, const ContextState &data)
+Compiler::Compiler(rx::GLImplFactory *implFactory, const ContextState &state)
: mImplementation(implFactory->createCompiler()),
- mSpec(data.clientVersion > 2 ? SH_GLES3_SPEC : SH_GLES2_SPEC),
+ mSpec(state.getClientVersion() > 2 ? SH_GLES3_SPEC : SH_GLES2_SPEC),
mOutputType(mImplementation->getTranslatorOutputType()),
mResources(),
mFragmentCompiler(nullptr),
mVertexCompiler(nullptr)
{
- ASSERT(data.clientVersion == 2 || data.clientVersion == 3);
+ ASSERT(state.getClientVersion() == 2 || state.getClientVersion() == 3);
- const gl::Caps &caps = *data.caps;
- const gl::Extensions &extensions = *data.extensions;
+ const gl::Caps &caps = state.getCaps();
+ const gl::Extensions &extensions = state.getExtensions();
ShInitBuiltInResources(&mResources);
mResources.MaxVertexAttribs = caps.maxVertexAttributes;