mesa: Move _mesa_all_buffers_are_unmapped to arrayobj.c.
[mesa.git] / src / mesa / main / compute.c
index 5756666b6093f686938521046c13fb1b0665b8aa..b71430f2b12ac150a9cc79f6f4c915964eb77f95 100644 (file)
@@ -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,13 +32,19 @@ _mesa_DispatchCompute(GLuint num_groups_x,
                       GLuint num_groups_z)
 {
    GET_CURRENT_CONTEXT(ctx);
+   const GLuint num_groups[3] = { num_groups_x, num_groups_y, num_groups_z };
 
-   if (ctx->Extensions.ARB_compute_shader) {
-      assert(!"TODO");
-   } else {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "unsupported function (glDispatchCompute) called");
-   }
+   if (MESA_VERBOSE & VERBOSE_API)
+      _mesa_debug(ctx, "glDispatchCompute(%d, %d, %d)\n",
+                  num_groups_x, num_groups_y, num_groups_z);
+
+   if (!_mesa_validate_DispatchCompute(ctx, num_groups))
+      return;
+
+   if (num_groups_x == 0u || num_groups_y == 0u || num_groups_z == 0u)
+       return;
+
+   ctx->Driver.DispatchCompute(ctx, num_groups);
 }
 
 extern void GLAPIENTRY
@@ -45,10 +52,11 @@ _mesa_DispatchComputeIndirect(GLintptr indirect)
 {
    GET_CURRENT_CONTEXT(ctx);
 
-   if (ctx->Extensions.ARB_compute_shader) {
-      assert(!"TODO");
-   } else {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "unsupported function (glDispatchComputeIndirect) called");
-   }
+   if (MESA_VERBOSE & VERBOSE_API)
+      _mesa_debug(ctx, "glDispatchComputeIndirect(%ld)\n", (long) indirect);
+
+   if (!_mesa_validate_DispatchComputeIndirect(ctx, indirect))
+      return;
+
+   ctx->Driver.DispatchComputeIndirect(ctx, indirect);
 }