main/cs: Implement query for COMPUTE_WORK_GROUP_SIZE.
authorPaul Berry <stereotype441@gmail.com>
Thu, 9 Jan 2014 12:03:30 +0000 (04:03 -0800)
committerPaul Berry <stereotype441@gmail.com>
Wed, 5 Feb 2014 17:04:55 +0000 (09:04 -0800)
v2: Improve error message.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/mesa/main/shaderapi.c

index 571e13ca9b91637d733b11b3152239422b02815e..65b6b16bbc0c10c2cc7de057187ef616322f9a5e 100644 (file)
@@ -663,6 +663,24 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param
 
       *params = shProg->NumAtomicBuffers;
       return;
+   case GL_COMPUTE_WORK_GROUP_SIZE: {
+      int i;
+      if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_compute_shader)
+         break;
+      if (!shProg->LinkStatus) {
+         _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramiv(program not "
+                     "linked)");
+         return;
+      }
+      if (shProg->_LinkedShaders[MESA_SHADER_COMPUTE] == NULL) {
+         _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramiv(no compute "
+                     "shaders)");
+         return;
+      }
+      for (i = 0; i < 3; i++)
+         params[i] = shProg->Comp.LocalSize[i];
+      return;
+   }
    default:
       break;
    }