Commit 2a018158 by Brandon Jones Committed by Commit Bot

Change Validation For Indexed Draw Without ELEMENT_ARRAY_BUFFER

Changed WebGL Validation to return INVALID_OPERATION any time an indexed draw call is made without a bound ELEMENT_ARRAY_BUFFER. Spec was changed to no longer require count > 0 in order to cause error. Make same spec change to GL_ANGLE_client_arrays extension. BUG:angleproject:2639 Change-Id: I23963f357119d081890aa5387b2863e1d42b92a5 Reviewed-on: https://chromium-review.googlesource.com/1093984 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 7df52383
...@@ -70,9 +70,9 @@ Additions to the OpenGL ES Specification ...@@ -70,9 +70,9 @@ Additions to the OpenGL ES Specification
Add to the end of section 2.9.2 "Array Indices in Buffer Objects": Add to the end of section 2.9.2 "Array Indices in Buffer Objects":
Rendering commands that draw more than 0 primitives using index data when Rendering commands that draw using index data when no buffer is bound to
no buffer is bound to the ELEMENT_ARRAY_BUFFER binding point when the ELEMENT_ARRAY_BUFFER binding point when CLIENT_ARRAYS_ANGLE is TRUE
CLIENT_ARRAYS_ANGLE is TRUE generate an INVALID_OPERATION error. generate an INVALID_OPERATION error.
New State New State
...@@ -95,6 +95,9 @@ Issues ...@@ -95,6 +95,9 @@ Issues
Revision History Revision History
Rev. Date Author Changes Rev. Date Author Changes
---- ------------- --------- ---------------------------------------- ---- ------------- --------- ----------------------------------------
1 Feb 13, 2016 geofflang Initial version 2 Jun 12, 2018 Brandon Jones (Intel) Remove primitives > 0 requirement to error
when doing an indexed draw with no bound
ELEMENT_ARRAY_BUFFER
1 Feb 13, 2016 geofflang Initial version
...@@ -3055,11 +3055,11 @@ bool ValidateDrawElementsCommon(Context *context, ...@@ -3055,11 +3055,11 @@ bool ValidateDrawElementsCommon(Context *context,
if (context->getExtensions().webglCompatibility || if (context->getExtensions().webglCompatibility ||
!context->getGLState().areClientArraysEnabled()) !context->getGLState().areClientArraysEnabled())
{ {
if (!elementArrayBuffer && count > 0) if (!elementArrayBuffer)
{ {
// [WebGL 1.0] Section 6.2 No Client Side Arrays // [WebGL 1.0] Section 6.2 No Client Side Arrays
// If drawElements is called with a count greater than zero, and no WebGLBuffer is bound // If an indexed draw command (drawElements) is called and no WebGLBuffer is bound to
// to the ELEMENT_ARRAY_BUFFER binding point, an INVALID_OPERATION error is generated. // the ELEMENT_ARRAY_BUFFER binding point, an INVALID_OPERATION error is generated.
ANGLE_VALIDATION_ERR(context, InvalidOperation(), MustHaveElementArrayBinding); ANGLE_VALIDATION_ERR(context, InvalidOperation(), MustHaveElementArrayBinding);
return false; return false;
} }
......
...@@ -1470,6 +1470,26 @@ TEST_P(WebGLCompatibilityTest, DrawArraysBufferOutOfBoundsNonInstanced) ...@@ -1470,6 +1470,26 @@ TEST_P(WebGLCompatibilityTest, DrawArraysBufferOutOfBoundsNonInstanced)
EXPECT_GL_ERROR(GL_INVALID_OPERATION); EXPECT_GL_ERROR(GL_INVALID_OPERATION);
} }
// Test for drawing with a null index buffer
TEST_P(WebGLCompatibilityTest, NullIndexBuffer)
{
const std::string &vert =
"attribute float a_pos;\n"
"void main()\n"
"{\n"
" gl_Position = vec4(a_pos, a_pos, a_pos, 1.0);\n"
"}\n";
ANGLE_GL_PROGRAM(program, vert, essl1_shaders::fs::Red());
glUseProgram(program.get());
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glEnableVertexAttribArray(0);
glDrawElements(GL_TRIANGLES, 0, GL_UNSIGNED_BYTE, 0);
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
}
// Test the checks for OOB reads in the vertex buffers, instanced version // Test the checks for OOB reads in the vertex buffers, instanced version
TEST_P(WebGL2CompatibilityTest, DrawArraysBufferOutOfBoundsInstanced) TEST_P(WebGL2CompatibilityTest, DrawArraysBufferOutOfBoundsInstanced)
{ {
......
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