glthread: track primitive restart state
[mesa.git] / src / mesa / main / compute.c
index 794b5d035bf8ee71448c83b6a488a6e39a400f50..8e446afa9ee2ebc4b8bc8dac05e3dd88ed2e8b39 100644 (file)
@@ -178,6 +178,37 @@ validate_DispatchComputeGroupSizeARB(struct gl_context *ctx,
       return GL_FALSE;
    }
 
+   /* The NV_compute_shader_derivatives spec says:
+    *
+    * "An INVALID_VALUE error is generated by DispatchComputeGroupSizeARB if
+    *  the active program for the compute shader stage has a compute shader
+    *  using the "derivative_group_quadsNV" layout qualifier and
+    *  <group_size_x> or <group_size_y> is not a multiple of two.
+    *
+    *  An INVALID_VALUE error is generated by DispatchComputeGroupSizeARB if
+    *  the active program for the compute shader stage has a compute shader
+    *  using the "derivative_group_linearNV" layout qualifier and the product
+    *  of <group_size_x>, <group_size_y>, and <group_size_z> is not a multiple
+    *  of four."
+    */
+   if (prog->info.cs.derivative_group == DERIVATIVE_GROUP_QUADS &&
+       ((group_size[0] & 1) || (group_size[1] & 1))) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glDispatchComputeGroupSizeARB(derivative_group_quadsNV "
+                  "requires group_size_x (%d) and group_size_y (%d) to be "
+                  "divisble by 2)", group_size[0], group_size[1]);
+      return GL_FALSE;
+   }
+
+   if (prog->info.cs.derivative_group == DERIVATIVE_GROUP_LINEAR &&
+       total_invocations & 3) {
+      _mesa_error(ctx, GL_INVALID_VALUE,
+                  "glDispatchComputeGroupSizeARB(derivative_group_linearNV "
+                  "requires product of group sizes (%"PRIu64") to be divisible "
+                  "by 4)", total_invocations);
+      return GL_FALSE;
+   }
+
    return GL_TRUE;
 }
 
@@ -214,7 +245,7 @@ valid_dispatch_indirect(struct gl_context *ctx,  GLintptr indirect)
     *  DRAW_INDIRECT_BUFFER binding, or if the command would source data
     *  beyond the end of the buffer object."
     */
-   if (!_mesa_is_bufferobj(ctx->DispatchIndirectBuffer)) {
+   if (!ctx->DispatchIndirectBuffer) {
       _mesa_error(ctx, GL_INVALID_OPERATION,
                   "%s: no buffer bound to DISPATCH_INDIRECT_BUFFER", name);
       return GL_FALSE;