Cache ValidateDrawStates.
This improves performance of all draw call validation. The error that
should be generated on the draw call is cached in the Context. The
cache is updated in several places.
Bug: angleproject:2747
Change-Id: I178617623731608e2e7166b53ab6489d8b742ff5
Reviewed-on: https://chromium-review.googlesource.com/1158612
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index eedc1af..5b4ccad 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -2566,7 +2566,10 @@
// WebGL buffers cannot be mapped/unmapped because the MapBufferRange, FlushMappedBufferRange,
// and UnmapBuffer entry points are removed from the WebGL 2.0 API.
// https://www.khronos.org/registry/webgl/specs/latest/2.0/#5.14
- if (!extensions.webglCompatibility && state.getVertexArray()->hasMappedEnabledArrayBuffer())
+ VertexArray *vertexArray = state.getVertexArray();
+ ASSERT(vertexArray);
+
+ if (!extensions.webglCompatibility && vertexArray->hasMappedEnabledArrayBuffer())
{
return kErrorBufferMapped;
}
@@ -2574,6 +2577,8 @@
// Note: these separate values are not supported in WebGL, due to D3D's limitations. See
// Section 6.10 of the WebGL 1.0 spec.
Framebuffer *framebuffer = state.getDrawFramebuffer();
+ ASSERT(framebuffer);
+
if (context->getLimitations().noSeparateStencilRefsAndMasks || extensions.webglCompatibility)
{
ASSERT(framebuffer);
@@ -2785,9 +2790,11 @@
const State &state = context->getGLState();
- const char *errorMessage = ValidateDrawStates(context);
- if (errorMessage)
+ intptr_t drawStatesError = context->getStateCache().getBasicDrawStatesError(context);
+ if (drawStatesError)
{
+ const char *errorMessage = reinterpret_cast<const char *>(drawStatesError);
+
// All errors from ValidateDrawStates should return INVALID_OPERATION except Framebuffer
// Incomplete.
GLenum errorCode =