summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-05-15 12:13:01 +1000
committerTimothy Arceri <[email protected]>2017-05-17 10:12:04 +1000
commitd1894c42efb97fe5af09f235be5658558ee24346 (patch)
tree7e51c3504eef59dec3c89c2a51a8037f3ece007d /src
parent07e14d561c7ab9ed379f33cfad56a578752ee2f9 (diff)
mesa: add DispatchCompute* helpers
These will be used to add KHR_no_error support. Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/compute.c51
1 files changed, 38 insertions, 13 deletions
diff --git a/src/mesa/main/compute.c b/src/mesa/main/compute.c
index f3cc6afd406..16bb11f64d1 100644
--- a/src/mesa/main/compute.c
+++ b/src/mesa/main/compute.c
@@ -243,10 +243,9 @@ valid_dispatch_indirect(struct gl_context *ctx, GLintptr indirect)
return GL_TRUE;
}
-void GLAPIENTRY
-_mesa_DispatchCompute(GLuint num_groups_x,
- GLuint num_groups_y,
- GLuint num_groups_z)
+static ALWAYS_INLINE void
+dispatch_compute(GLuint num_groups_x, GLuint num_groups_y,
+ GLuint num_groups_z, bool no_error)
{
GET_CURRENT_CONTEXT(ctx);
const GLuint num_groups[3] = { num_groups_x, num_groups_y, num_groups_z };
@@ -257,7 +256,7 @@ _mesa_DispatchCompute(GLuint num_groups_x,
_mesa_debug(ctx, "glDispatchCompute(%d, %d, %d)\n",
num_groups_x, num_groups_y, num_groups_z);
- if (!validate_DispatchCompute(ctx, num_groups))
+ if (!no_error && !validate_DispatchCompute(ctx, num_groups))
return;
if (num_groups_x == 0u || num_groups_y == 0u || num_groups_z == 0u)
@@ -266,8 +265,16 @@ _mesa_DispatchCompute(GLuint num_groups_x,
ctx->Driver.DispatchCompute(ctx, num_groups);
}
-extern void GLAPIENTRY
-_mesa_DispatchComputeIndirect(GLintptr indirect)
+void GLAPIENTRY
+_mesa_DispatchCompute(GLuint num_groups_x,
+ GLuint num_groups_y,
+ GLuint num_groups_z)
+{
+ dispatch_compute(num_groups_x, num_groups_y, num_groups_z, false);
+}
+
+static ALWAYS_INLINE void
+dispatch_compute_indirect(GLintptr indirect, bool no_error)
{
GET_CURRENT_CONTEXT(ctx);
@@ -276,16 +283,23 @@ _mesa_DispatchComputeIndirect(GLintptr indirect)
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glDispatchComputeIndirect(%ld)\n", (long) indirect);
- if (!valid_dispatch_indirect(ctx, indirect))
+ if (!no_error && !valid_dispatch_indirect(ctx, indirect))
return;
ctx->Driver.DispatchComputeIndirect(ctx, indirect);
}
-void GLAPIENTRY
-_mesa_DispatchComputeGroupSizeARB(GLuint num_groups_x, GLuint num_groups_y,
- GLuint num_groups_z, GLuint group_size_x,
- GLuint group_size_y, GLuint group_size_z)
+extern void GLAPIENTRY
+_mesa_DispatchComputeIndirect(GLintptr indirect)
+{
+ dispatch_compute_indirect(indirect, false);
+}
+
+static ALWAYS_INLINE void
+dispatch_compute_group_size(GLuint num_groups_x, GLuint num_groups_y,
+ GLuint num_groups_z, GLuint group_size_x,
+ GLuint group_size_y, GLuint group_size_z,
+ bool no_error)
{
GET_CURRENT_CONTEXT(ctx);
const GLuint num_groups[3] = { num_groups_x, num_groups_y, num_groups_z };
@@ -299,7 +313,8 @@ _mesa_DispatchComputeGroupSizeARB(GLuint num_groups_x, GLuint num_groups_y,
num_groups_x, num_groups_y, num_groups_z,
group_size_x, group_size_y, group_size_z);
- if (!validate_DispatchComputeGroupSizeARB(ctx, num_groups, group_size))
+ if (!no_error &&
+ !validate_DispatchComputeGroupSizeARB(ctx, num_groups, group_size))
return;
if (num_groups_x == 0u || num_groups_y == 0u || num_groups_z == 0u)
@@ -307,3 +322,13 @@ _mesa_DispatchComputeGroupSizeARB(GLuint num_groups_x, GLuint num_groups_y,
ctx->Driver.DispatchComputeGroupSize(ctx, num_groups, group_size);
}
+
+void GLAPIENTRY
+_mesa_DispatchComputeGroupSizeARB(GLuint num_groups_x, GLuint num_groups_y,
+ GLuint num_groups_z, GLuint group_size_x,
+ GLuint group_size_y, GLuint group_size_z)
+{
+ dispatch_compute_group_size(num_groups_x, num_groups_y, num_groups_z,
+ group_size_x, group_size_y, group_size_z,
+ false);
+}