Commit fee4fc12 by Jamie Madill

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> (cherry picked from commit 2882e1af) Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2506197Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 8fe03094
...@@ -8591,6 +8591,7 @@ void StateCache::onVertexArrayBindingChange(Context *context) ...@@ -8591,6 +8591,7 @@ void StateCache::onVertexArrayBindingChange(Context *context)
updateActiveAttribsMask(context); updateActiveAttribsMask(context);
updateVertexElementLimits(context); updateVertexElementLimits(context);
updateBasicDrawStatesError(); updateBasicDrawStatesError();
updateBasicDrawElementsError();
} }
void StateCache::onProgramExecutableChange(Context *context) void StateCache::onProgramExecutableChange(Context *context)
......
...@@ -203,6 +203,7 @@ class StateCache final : angle::NonCopyable ...@@ -203,6 +203,7 @@ class StateCache final : angle::NonCopyable
// 2. onVertexArrayBufferStateChange. // 2. onVertexArrayBufferStateChange.
// 3. onBufferBindingChange. // 3. onBufferBindingChange.
// 4. onVertexArrayStateChange. // 4. onVertexArrayStateChange.
// 5. onVertexArrayBindingStateChange.
intptr_t getBasicDrawElementsError(const Context *context) const intptr_t getBasicDrawElementsError(const Context *context) const
{ {
if (mCachedBasicDrawElementsError != kInvalidPointer) if (mCachedBasicDrawElementsError != kInvalidPointer)
......
...@@ -5744,6 +5744,25 @@ TEST_P(RobustBufferAccessWebGL2ValidationStateChangeTest, BindZeroSizeBufferThen ...@@ -5744,6 +5744,25 @@ TEST_P(RobustBufferAccessWebGL2ValidationStateChangeTest, BindZeroSizeBufferThen
ASSERT_GL_NO_ERROR(); 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 } // anonymous namespace
ANGLE_INSTANTIATE_TEST_ES2(StateChangeTest); 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