mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 00:00:11 +01:00
main/cs: Implement front end code for glDispatchCompute().
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
4d0f3d2319
commit
8f1423b2c4
1 changed files with 19 additions and 1 deletions
|
|
@ -31,9 +31,27 @@ _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) {
|
||||
assert(!"TODO");
|
||||
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");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue