Commit 6ae51611 by Jiawei Shao Committed by Commit Bot

ES31: Add missing checks for querying GL_COMPUTE_WORK_GROUP_SIZE

This patch adds missing checks for querying GL_COMPUTE_WORK_GROUP_SIZE by glGetProgramiv. When querying GL_COMPUTE_WORK_GROUP_SIZE, an INVALID_OPERATION error should be generated when this program hasn't been linked successfully or it doesn't contain any objects to form a compute shader. BUG=angleproject:2324 TEST=angle_end2end_tests dEQP-GLES31.functional.debug.negative_coverage.get_error.compute.invalid_program_query Change-Id: I13dcebef8a0abede5c18a038d4cf915ee4164e2e Reviewed-on: https://chromium-review.googlesource.com/933627 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent b52fac03
...@@ -134,6 +134,7 @@ ERRMSG(NegativePrimcount, "Primcount must be greater than or equal to zero."); ...@@ -134,6 +134,7 @@ ERRMSG(NegativePrimcount, "Primcount must be greater than or equal to zero.");
ERRMSG(NegativeSize, "Cannot have negative height or width."); ERRMSG(NegativeSize, "Cannot have negative height or width.");
ERRMSG(NegativeStart, "Cannot have negative start."); ERRMSG(NegativeStart, "Cannot have negative start.");
ERRMSG(NegativeStride, "Cannot have negative stride."); ERRMSG(NegativeStride, "Cannot have negative stride.");
ERRMSG(NoActiveComputeShaderStage, "No active compute shader stage in this program.");
ERRMSG(NoActiveProgramWithComputeShader, "No active program for the compute shader stage."); ERRMSG(NoActiveProgramWithComputeShader, "No active program for the compute shader stage.");
ERRMSG(NoSuchPath, "No such path object."); ERRMSG(NoSuchPath, "No such path object.");
ERRMSG(NoTransformFeedbackOutputVariables, ERRMSG(NoTransformFeedbackOutputVariables,
......
...@@ -4168,7 +4168,6 @@ bool ValidateGetProgramivBase(ValidationContext *context, ...@@ -4168,7 +4168,6 @@ bool ValidateGetProgramivBase(ValidationContext *context,
break; break;
case GL_PROGRAM_SEPARABLE: case GL_PROGRAM_SEPARABLE:
case GL_COMPUTE_WORK_GROUP_SIZE:
case GL_ACTIVE_ATOMIC_COUNTER_BUFFERS: case GL_ACTIVE_ATOMIC_COUNTER_BUFFERS:
if (context->getClientVersion() < Version(3, 1)) if (context->getClientVersion() < Version(3, 1))
{ {
...@@ -4177,6 +4176,29 @@ bool ValidateGetProgramivBase(ValidationContext *context, ...@@ -4177,6 +4176,29 @@ bool ValidateGetProgramivBase(ValidationContext *context,
} }
break; break;
case GL_COMPUTE_WORK_GROUP_SIZE:
if (context->getClientVersion() < Version(3, 1))
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(), ES31Required);
return false;
}
// [OpenGL ES 3.1] Chapter 7.12 Page 122
// An INVALID_OPERATION error is generated if COMPUTE_WORK_GROUP_SIZE is queried for a
// program which has not been linked successfully, or which does not contain objects to
// form a compute shader.
if (!programObject->isLinked())
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotLinked);
return false;
}
if (!programObject->hasLinkedComputeShader())
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoActiveComputeShaderStage);
return false;
}
break;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported); ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
return false; return false;
......
...@@ -1654,7 +1654,6 @@ ...@@ -1654,7 +1654,6 @@
2324 DEBUG RELEASE : dEQP-GLES31.functional.debug.negative_coverage.callbacks.compute.program_not_active = FAIL 2324 DEBUG RELEASE : dEQP-GLES31.functional.debug.negative_coverage.callbacks.compute.program_not_active = FAIL
2324 DEBUG RELEASE : dEQP-GLES31.functional.debug.negative_coverage.log.compute.program_not_active = FAIL 2324 DEBUG RELEASE : dEQP-GLES31.functional.debug.negative_coverage.log.compute.program_not_active = FAIL
2324 DEBUG RELEASE : dEQP-GLES31.functional.debug.negative_coverage.get_error.compute.program_not_active = FAIL 2324 DEBUG RELEASE : dEQP-GLES31.functional.debug.negative_coverage.get_error.compute.program_not_active = FAIL
2324 DEBUG RELEASE : dEQP-GLES31.functional.debug.negative_coverage.get_error.compute.invalid_program_query = FAIL
2324 DEBUG RELEASE : dEQP-GLES31.functional.debug.negative_coverage.get_error.shader_storage.block_number_limits = FAIL 2324 DEBUG RELEASE : dEQP-GLES31.functional.debug.negative_coverage.get_error.shader_storage.block_number_limits = FAIL
2324 DEBUG RELEASE : dEQP-GLES31.functional.debug.negative_coverage.log.shader_storage.block_number_limits = FAIL 2324 DEBUG RELEASE : dEQP-GLES31.functional.debug.negative_coverage.log.shader_storage.block_number_limits = FAIL
2324 DEBUG RELEASE : dEQP-GLES31.functional.debug.negative_coverage.callbacks.shader_storage.block_number_limits = FAIL 2324 DEBUG RELEASE : dEQP-GLES31.functional.debug.negative_coverage.callbacks.shader_storage.block_number_limits = FAIL
...@@ -1152,6 +1152,47 @@ TEST_P(ComputeShaderTest, BindImageTextureWithOneLayerTextureCube) ...@@ -1152,6 +1152,47 @@ TEST_P(ComputeShaderTest, BindImageTextureWithOneLayerTextureCube)
} }
} }
// Verify an INVALID_OPERATION error is reported when querying GL_COMPUTE_WORK_GROUP_SIZE for a
// program which has not been linked successfully or which does not contain objects to form a
// compute shader.
TEST_P(ComputeShaderTest, QueryComputeWorkGroupSize)
{
const std::string vsSource =
R"(#version 310 es
void main()
{
})";
const std::string fsSource =
R"(#version 310 es
void main()
{
})";
GLint workGroupSize[3];
ANGLE_GL_PROGRAM(graphicsProgram, vsSource, fsSource);
glGetProgramiv(graphicsProgram, GL_COMPUTE_WORK_GROUP_SIZE, workGroupSize);
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
GLuint computeProgram = glCreateProgram();
GLShader computeShader(GL_COMPUTE_SHADER);
glAttachShader(computeProgram, computeShader);
glLinkProgram(computeProgram);
glDetachShader(computeProgram, computeShader);
GLint linkStatus;
glGetProgramiv(computeProgram, GL_LINK_STATUS, &linkStatus);
ASSERT_GL_FALSE(linkStatus);
glGetProgramiv(computeProgram, GL_COMPUTE_WORK_GROUP_SIZE, workGroupSize);
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
glDeleteProgram(computeProgram);
ASSERT_GL_NO_ERROR();
}
// Check that it is not possible to create a compute shader when the context does not support ES // Check that it is not possible to create a compute shader when the context does not support ES
// 3.10 // 3.10
TEST_P(ComputeShaderTestES3, NotSupported) TEST_P(ComputeShaderTestES3, NotSupported)
......
...@@ -75,6 +75,22 @@ using GLTransformFeedback = GLWrapper<glGenTransformFeedbacks, glDeleteTransform ...@@ -75,6 +75,22 @@ using GLTransformFeedback = GLWrapper<glGenTransformFeedbacks, glDeleteTransform
using GLProgramPipeline = GLWrapper<glGenProgramPipelines, glDeleteProgramPipelines>; using GLProgramPipeline = GLWrapper<glGenProgramPipelines, glDeleteProgramPipelines>;
using GLQueryEXT = GLWrapper<glGenQueriesEXT, glDeleteQueriesEXT>; using GLQueryEXT = GLWrapper<glGenQueriesEXT, glDeleteQueriesEXT>;
class GLShader : angle::NonCopyable
{
public:
GLShader() = delete;
explicit GLShader(GLenum shaderType) { mHandle = glCreateShader(shaderType); }
~GLShader() { glDeleteShader(mHandle); }
GLuint get() { return mHandle; }
operator GLuint() { return get(); }
private:
GLuint mHandle;
};
// Don't use GLProgram directly, use ANGLE_GL_PROGRAM. // Don't use GLProgram directly, use ANGLE_GL_PROGRAM.
namespace priv namespace priv
{ {
......
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