Mesa (master): mesa: add interaction between compute derivatives and variable local sizes
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Apr 17 14:08:22 UTC 2020
Module: Mesa
Branch: master
Commit: ac0b8d58b963efbeadb4461b39f7d910996c2db7
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ac0b8d58b963efbeadb4461b39f7d910996c2db7
Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date: Wed Apr 15 22:27:11 2020 -0400
mesa: add interaction between compute derivatives and variable local sizes
This is an added interaction in NV_compute_shader_derivatives added in
Sep 2019.
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4583>
---
src/mesa/main/compute.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/src/mesa/main/compute.c b/src/mesa/main/compute.c
index 013d6a68567..8e446afa9ee 100644
--- a/src/mesa/main/compute.c
+++ b/src/mesa/main/compute.c
@@ -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;
}
More information about the mesa-commit
mailing list