Commit 78ef4133 by shrekshao Committed by Commit Bot

Fix invalid enums for OES_draw_buffers_indexed

Make sure the new enums are invalid before the extension is enabled. Add a angle_end2end_test for that. Bug: angleproject:4394, chromium:1058744 Change-Id: Ib88f6159294dab2eb7d3662b96c44424ab132782 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2205179Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Shrek Shao <shrekshao@google.com>
parent ab851162
...@@ -85,6 +85,7 @@ MSG kDestinationTextureTooSmall = "Destination texture too small."; ...@@ -85,6 +85,7 @@ MSG kDestinationTextureTooSmall = "Destination texture too small.";
MSG kDimensionsMustBePow2 = "Texture dimensions must be power-of-two."; MSG kDimensionsMustBePow2 = "Texture dimensions must be power-of-two.";
MSG kDispatchIndirectBufferNotBound = "Dispatch indirect buffer must be bound."; MSG kDispatchIndirectBufferNotBound = "Dispatch indirect buffer must be bound.";
MSG kDrawBufferMaskMismatch = "Active draw buffers with missing fragment shader outputs."; MSG kDrawBufferMaskMismatch = "Active draw buffers with missing fragment shader outputs.";
MSG kDrawBuffersIndexedExtensionNotAvailable = "EXT/OES_draw_buffers_indexed is not available.";
MSG kES31OrDrawBuffersIndexedExtensionNotAvailable = "EXT/OES_draw_buffers_indexed or ES 3.1 are required but not available."; MSG kES31OrDrawBuffersIndexedExtensionNotAvailable = "EXT/OES_draw_buffers_indexed or ES 3.1 are required but not available.";
MSG kDrawBufferTypeMismatch = "Fragment shader output type does not match the bound framebuffer attachment type."; MSG kDrawBufferTypeMismatch = "Fragment shader output type does not match the bound framebuffer attachment type.";
MSG kDrawFramebufferIncomplete = "Draw framebuffer is incomplete"; MSG kDrawFramebufferIncomplete = "Draw framebuffer is incomplete";
......
...@@ -2690,6 +2690,11 @@ bool ValidateIndexedStateQuery(const Context *context, GLenum pname, GLuint inde ...@@ -2690,6 +2690,11 @@ bool ValidateIndexedStateQuery(const Context *context, GLenum pname, GLuint inde
case GL_BLEND_EQUATION_RGB: case GL_BLEND_EQUATION_RGB:
case GL_BLEND_EQUATION_ALPHA: case GL_BLEND_EQUATION_ALPHA:
case GL_COLOR_WRITEMASK: case GL_COLOR_WRITEMASK:
if (!context->getExtensions().drawBuffersIndexedAny())
{
context->validationError(GL_INVALID_ENUM, kDrawBuffersIndexedExtensionNotAvailable);
return false;
}
if (index >= static_cast<GLuint>(caps.maxDrawBuffers)) if (index >= static_cast<GLuint>(caps.maxDrawBuffers))
{ {
context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxDrawBuffer); context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxDrawBuffer);
......
...@@ -2028,6 +2028,69 @@ void main() ...@@ -2028,6 +2028,69 @@ void main()
EXPECT_GL_ERROR(GL_INVALID_OPERATION); EXPECT_GL_ERROR(GL_INVALID_OPERATION);
} }
// Test getIndexedParameter wrt GL_OES_draw_buffers_indexed.
TEST_P(WebGLCompatibilityTest, DrawBuffersIndexedGetIndexedParameter)
{
ANGLE_SKIP_TEST_IF(getClientMajorVersion() < 3);
ANGLE_SKIP_TEST_IF(!IsGLExtensionRequestable("GL_OES_draw_buffers_indexed"));
GLint value;
GLboolean data[4];
glGetIntegeri_v(GL_BLEND_EQUATION_RGB, 0, &value);
EXPECT_GL_ERROR(GL_INVALID_ENUM);
glGetIntegeri_v(GL_BLEND_EQUATION_ALPHA, 0, &value);
EXPECT_GL_ERROR(GL_INVALID_ENUM);
glGetIntegeri_v(GL_BLEND_SRC_RGB, 0, &value);
EXPECT_GL_ERROR(GL_INVALID_ENUM);
glGetIntegeri_v(GL_BLEND_SRC_ALPHA, 0, &value);
EXPECT_GL_ERROR(GL_INVALID_ENUM);
glGetIntegeri_v(GL_BLEND_DST_RGB, 0, &value);
EXPECT_GL_ERROR(GL_INVALID_ENUM);
glGetIntegeri_v(GL_BLEND_DST_ALPHA, 0, &value);
EXPECT_GL_ERROR(GL_INVALID_ENUM);
glGetBooleani_v(GL_COLOR_WRITEMASK, 0, data);
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
glRequestExtensionANGLE("GL_OES_draw_buffers_indexed");
EXPECT_GL_NO_ERROR();
EXPECT_TRUE(IsGLExtensionEnabled("GL_OES_draw_buffers_indexed"));
glDisable(GL_BLEND);
glEnableiOES(GL_BLEND, 0);
glBlendEquationSeparateiOES(0, GL_FUNC_ADD, GL_FUNC_SUBTRACT);
glBlendFuncSeparateiOES(0, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ZERO, GL_ZERO);
glColorMaskiOES(0, true, false, true, false);
EXPECT_GL_NO_ERROR();
EXPECT_EQ(true, glIsEnablediOES(GL_BLEND, 0));
EXPECT_GL_NO_ERROR();
glGetIntegeri_v(GL_BLEND_EQUATION_RGB, 0, &value);
EXPECT_GL_NO_ERROR();
EXPECT_EQ(GL_FUNC_ADD, value);
glGetIntegeri_v(GL_BLEND_EQUATION_ALPHA, 0, &value);
EXPECT_GL_NO_ERROR();
EXPECT_EQ(GL_FUNC_SUBTRACT, value);
glGetIntegeri_v(GL_BLEND_SRC_RGB, 0, &value);
EXPECT_GL_NO_ERROR();
EXPECT_EQ(GL_SRC_ALPHA, value);
glGetIntegeri_v(GL_BLEND_SRC_ALPHA, 0, &value);
EXPECT_GL_NO_ERROR();
EXPECT_EQ(GL_ZERO, value);
glGetIntegeri_v(GL_BLEND_DST_RGB, 0, &value);
EXPECT_GL_NO_ERROR();
EXPECT_EQ(GL_ONE_MINUS_SRC_ALPHA, value);
glGetIntegeri_v(GL_BLEND_DST_ALPHA, 0, &value);
EXPECT_GL_NO_ERROR();
EXPECT_EQ(GL_ZERO, value);
glGetBooleani_v(GL_COLOR_WRITEMASK, 0, data);
EXPECT_GL_NO_ERROR();
EXPECT_EQ(true, data[0]);
EXPECT_EQ(false, data[1]);
EXPECT_EQ(true, data[2]);
EXPECT_EQ(false, data[3]);
}
// Test that binding/querying uniforms and attributes with invalid names generates errors // Test that binding/querying uniforms and attributes with invalid names generates errors
TEST_P(WebGLCompatibilityTest, InvalidAttributeAndUniformNames) TEST_P(WebGLCompatibilityTest, InvalidAttributeAndUniformNames)
{ {
......
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