diff options
author | Jordan Justen <[email protected]> | 2015-09-17 10:05:22 -0700 |
---|---|---|
committer | Jordan Justen <[email protected]> | 2015-09-24 19:15:13 -0700 |
commit | 4a1ba7e6bd3ddcab4647a1382d14165a08c0d3b0 (patch) | |
tree | 796a311e1d620c680189375727407d3500acf35c /src/mesa/main/compute.c | |
parent | 19604d30e1351868f7f54847c91ffec7b3fcd27e (diff) |
mesa/cs: Add _mesa_validate_DispatchCompute
Move API validation to _mesa_validate_DispatchCompute in
api_validate.c.
Signed-off-by: Jordan Justen <[email protected]>
Reviewed-by: Tapani Pälli <[email protected]>
Reviewed-by: Kristian Høgsberg <[email protected]>
Diffstat (limited to 'src/mesa/main/compute.c')
-rw-r--r-- | src/mesa/main/compute.c | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/src/mesa/main/compute.c b/src/mesa/main/compute.c index 37a4ba70eed..f67ffbb6bfa 100644 --- a/src/mesa/main/compute.c +++ b/src/mesa/main/compute.c @@ -24,6 +24,7 @@ #include "glheader.h" #include "compute.h" #include "context.h" +#include "api_validate.h" void GLAPIENTRY _mesa_DispatchCompute(GLuint num_groups_x, @@ -31,31 +32,12 @@ _mesa_DispatchCompute(GLuint num_groups_x, GLuint num_groups_z) { GET_CURRENT_CONTEXT(ctx); - int i; - struct gl_shader_program *prog; const GLuint num_groups[3] = { num_groups_x, num_groups_y, num_groups_z }; - if (ctx->Extensions.ARB_compute_shader) { - for (i = 0; i < 3; i++) { - if (num_groups[i] > ctx->Const.MaxComputeWorkGroupCount[i]) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glDispatchCompute(num_groups_%c)", 'x' + i); - return; - } - } - if (!_mesa_valid_to_render(ctx, "glDispatchCompute")) - return; - prog = ctx->Shader.CurrentProgram[MESA_SHADER_COMPUTE]; - if (prog == NULL || prog->_LinkedShaders[MESA_SHADER_COMPUTE] == NULL) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glDispatchCompute(no active compute shader)"); - return; - } - ctx->Driver.DispatchCompute(ctx, num_groups); - } else { - _mesa_error(ctx, GL_INVALID_OPERATION, - "unsupported function (glDispatchCompute) called"); - } + if (!_mesa_validate_DispatchCompute(ctx, num_groups)) + return; + + ctx->Driver.DispatchCompute(ctx, num_groups); } extern void GLAPIENTRY |