Commit 2882e1af by Jamie Madill Committed by Commit Bot

Fix missing validation cache update on VAO binding.

Bug: chromium:1139398 Change-Id: I85a0d7a72bc2c97b07ebc5f86effd8e36aefd544 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2485581Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 6e125937
......@@ -8705,6 +8705,7 @@ void StateCache::onVertexArrayBindingChange(Context *context)
updateActiveAttribsMask(context);
updateVertexElementLimits(context);
updateBasicDrawStatesError();
updateBasicDrawElementsError();
}
void StateCache::onProgramExecutableChange(Context *context)
......
......@@ -204,6 +204,7 @@ class StateCache final : angle::NonCopyable
// 2. onVertexArrayBufferStateChange.
// 3. onBufferBindingChange.
// 4. onVertexArrayStateChange.
// 5. onVertexArrayBindingStateChange.
intptr_t getBasicDrawElementsError(const Context *context) const
{
if (mCachedBasicDrawElementsError != kInvalidPointer)
......
......@@ -5800,6 +5800,25 @@ TEST_P(RobustBufferAccessWebGL2ValidationStateChangeTest, BindZeroSizeBufferThen
ASSERT_GL_NO_ERROR();
}
// Tests DrawElements with an empty buffer using a VAO.
TEST_P(WebGL2ValidationStateChangeTest, DrawElementsEmptyVertexArray)
{
ANGLE_GL_PROGRAM(program, essl1_shaders::vs::Simple(), essl1_shaders::fs::Red());
glUseProgram(program);
// Draw with empty buffer. Out of range but valid.
GLBuffer buffer;
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer);
glDrawElements(GL_TRIANGLES, 0, GL_UNSIGNED_SHORT, reinterpret_cast<const GLvoid *>(0x1000));
// Switch VAO. No buffer bound, should be an error.
GLVertexArray vao;
glBindVertexArray(vao);
glDrawElements(GL_LINE_STRIP, 0x1000, GL_UNSIGNED_SHORT,
reinterpret_cast<const GLvoid *>(0x1000));
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
}
} // anonymous namespace
ANGLE_INSTANTIATE_TEST_ES2(StateChangeTest);
......
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