Commit 0dc97810 by Corentin Wallez Committed by Commit Bot

WebGL2 Compat: having no 0 divisor is now valid

BUG=angleproject:TBD Change-Id: Icb19a685290f4313ad567391cab5152eda91a346 Reviewed-on: https://chromium-review.googlesource.com/544545Reviewed-by: 's avatarZhenyao Mo <zmo@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Zhenyao Mo <zmo@chromium.org>
parent aed7c570
...@@ -890,7 +890,7 @@ bool ValidateDrawArraysInstancedBase(Context *context, ...@@ -890,7 +890,7 @@ bool ValidateDrawArraysInstancedBase(Context *context,
return (primcount > 0); return (primcount > 0);
} }
bool ValidateDrawInstancedANGLEAndWebGL(ValidationContext *context) bool ValidateDrawInstancedANGLE(ValidationContext *context)
{ {
// Verify there is at least one active attribute with a divisor of zero // Verify there is at least one active attribute with a divisor of zero
const State &state = context->getGLState(); const State &state = context->getGLState();
...@@ -2849,13 +2849,7 @@ bool ValidateDrawArraysInstanced(Context *context, ...@@ -2849,13 +2849,7 @@ bool ValidateDrawArraysInstanced(Context *context,
GLsizei count, GLsizei count,
GLsizei primcount) GLsizei primcount)
{ {
if (!ValidateDrawArraysInstancedBase(context, mode, first, count, primcount)) return ValidateDrawArraysInstancedBase(context, mode, first, count, primcount);
{
return false;
}
return !context->getExtensions().webglCompatibility ||
ValidateDrawInstancedANGLEAndWebGL(context);
} }
bool ValidateDrawArraysInstancedANGLE(Context *context, bool ValidateDrawArraysInstancedANGLE(Context *context,
...@@ -2869,7 +2863,7 @@ bool ValidateDrawArraysInstancedANGLE(Context *context, ...@@ -2869,7 +2863,7 @@ bool ValidateDrawArraysInstancedANGLE(Context *context,
return false; return false;
} }
return ValidateDrawInstancedANGLEAndWebGL(context); return ValidateDrawInstancedANGLE(context);
} }
bool ValidateDrawElementsBase(ValidationContext *context, GLenum type) bool ValidateDrawElementsBase(ValidationContext *context, GLenum type)
...@@ -3054,13 +3048,7 @@ bool ValidateDrawElementsInstancedCommon(ValidationContext *context, ...@@ -3054,13 +3048,7 @@ bool ValidateDrawElementsInstancedCommon(ValidationContext *context,
const void *indices, const void *indices,
GLsizei primcount) GLsizei primcount)
{ {
if (!ValidateDrawElementsInstancedBase(context, mode, count, type, indices, primcount)) return ValidateDrawElementsInstancedBase(context, mode, count, type, indices, primcount);
{
return false;
}
return !context->getExtensions().webglCompatibility ||
ValidateDrawInstancedANGLEAndWebGL(context);
} }
bool ValidateDrawElementsInstancedANGLE(Context *context, bool ValidateDrawElementsInstancedANGLE(Context *context,
...@@ -3075,7 +3063,7 @@ bool ValidateDrawElementsInstancedANGLE(Context *context, ...@@ -3075,7 +3063,7 @@ bool ValidateDrawElementsInstancedANGLE(Context *context,
return false; return false;
} }
return ValidateDrawInstancedANGLEAndWebGL(context); return ValidateDrawInstancedANGLE(context);
} }
bool ValidateFramebufferTextureBase(Context *context, bool ValidateFramebufferTextureBase(Context *context,
......
...@@ -1009,7 +1009,7 @@ TEST_P(WebGL2CompatibilityTest, DrawArraysBufferOutOfBoundsInstanced) ...@@ -1009,7 +1009,7 @@ TEST_P(WebGL2CompatibilityTest, DrawArraysBufferOutOfBoundsInstanced)
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
} }
// Test that at least one attribute has a zero divisor for WebGL // Test that having no attributes with a zero divisor is valid in WebGL2
TEST_P(WebGL2CompatibilityTest, InstancedDrawZeroDivisor) TEST_P(WebGL2CompatibilityTest, InstancedDrawZeroDivisor)
{ {
const std::string &vert = const std::string &vert =
...@@ -1040,12 +1040,8 @@ TEST_P(WebGL2CompatibilityTest, InstancedDrawZeroDivisor) ...@@ -1040,12 +1040,8 @@ TEST_P(WebGL2CompatibilityTest, InstancedDrawZeroDivisor)
glEnableVertexAttribArray(posLocation); glEnableVertexAttribArray(posLocation);
glVertexAttribDivisor(posLocation, 1); glVertexAttribDivisor(posLocation, 1);
// Test touching the last element is valid.
glVertexAttribPointer(0, 1, GL_UNSIGNED_BYTE, GL_FALSE, 0, nullptr); glVertexAttribPointer(0, 1, GL_UNSIGNED_BYTE, GL_FALSE, 0, nullptr);
glDrawArraysInstanced(GL_POINTS, 0, 1, 4); glDrawArraysInstanced(GL_POINTS, 0, 1, 4);
ASSERT_GL_ERROR(GL_INVALID_OPERATION);
glVertexAttribDivisor(posLocation, 0);
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
} }
......
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