[Mesa-dev] [PATCH 17/17] mesa: add KHR_no_error support for glDispatchCompute*()
Nicolai Hähnle
nhaehnle at gmail.com
Mon May 15 14:31:55 UTC 2017
For the series:
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
On 15.05.2017 08:19, Timothy Arceri wrote:
> ---
> src/mapi/glapi/gen/ARB_compute_shader.xml | 4 ++--
> .../glapi/gen/ARB_compute_variable_group_size.xml | 2 +-
> src/mesa/main/compute.c | 26 ++++++++++++++++++++++
> src/mesa/main/compute.h | 12 ++++++++++
> 4 files changed, 41 insertions(+), 3 deletions(-)
>
> diff --git a/src/mapi/glapi/gen/ARB_compute_shader.xml b/src/mapi/glapi/gen/ARB_compute_shader.xml
> index c2ec842..84cbdf3 100644
> --- a/src/mapi/glapi/gen/ARB_compute_shader.xml
> +++ b/src/mapi/glapi/gen/ARB_compute_shader.xml
> @@ -19,22 +19,22 @@
> <enum name="MAX_COMPUTE_WORK_GROUP_INVOCATIONS" value="0x90EB"/>
> <enum name="MAX_COMPUTE_WORK_GROUP_COUNT" value="0x91BE"/>
> <enum name="MAX_COMPUTE_WORK_GROUP_SIZE" value="0x91BF"/>
> <enum name="COMPUTE_WORK_GROUP_SIZE" value="0x8267"/>
> <enum name="UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER" value="0x90EC"/>
> <enum name="ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER" value="0x90ED"/>
> <enum name="DISPATCH_INDIRECT_BUFFER" value="0x90EE"/>
> <enum name="DISPATCH_INDIRECT_BUFFER_BINDING" value="0x90EF"/>
> <enum name="COMPUTE_SHADER_BIT" value="0x00000020"/>
>
> - <function name="DispatchCompute" es2="3.1">
> + <function name="DispatchCompute" es2="3.1" no_error="true">
> <param name="num_groups_x" type="GLuint"/>
> <param name="num_groups_y" type="GLuint"/>
> <param name="num_groups_z" type="GLuint"/>
> </function>
>
> - <function name="DispatchComputeIndirect" es2="3.1">
> + <function name="DispatchComputeIndirect" es2="3.1" no_error="true">
> <param name="indirect" type="GLintptr"/>
> </function>
> </category>
>
> </OpenGLAPI>
> diff --git a/src/mapi/glapi/gen/ARB_compute_variable_group_size.xml b/src/mapi/glapi/gen/ARB_compute_variable_group_size.xml
> index b21c52f..a54c591 100644
> --- a/src/mapi/glapi/gen/ARB_compute_variable_group_size.xml
> +++ b/src/mapi/glapi/gen/ARB_compute_variable_group_size.xml
> @@ -5,21 +5,21 @@
>
>
> <OpenGLAPI>
>
> <category name="GL_ARB_compute_variable_group_size" number="153">
> <enum name="MAX_COMPUTE_VARIABLE_GROUP_INVOCATIONS_ARB" value="0x9344"/>
> <enum name="MAX_COMPUTE_FIXED_GROUP_INVOCATIONS_ARB" value="0x90EB"/>
> <enum name="MAX_COMPUTE_VARIABLE_GROUP_SIZE_ARB" value="0x9345"/>
> <enum name="MAX_COMPUTE_FIXED_GROUP_SIZE_ARB" value="0x91BF"/>
>
> - <function name="DispatchComputeGroupSizeARB">
> + <function name="DispatchComputeGroupSizeARB" no_error="true">
> <param name="num_groups_x" type="GLuint"/>
> <param name="num_groups_y" type="GLuint"/>
> <param name="num_groups_z" type="GLuint"/>
> <param name="group_size_x" type="GLuint"/>
> <param name="group_size_y" type="GLuint"/>
> <param name="group_size_z" type="GLuint"/>
> </function>
> </category>
>
> </OpenGLAPI>
> diff --git a/src/mesa/main/compute.c b/src/mesa/main/compute.c
> index 16bb11f..cbd166b 100644
> --- a/src/mesa/main/compute.c
> +++ b/src/mesa/main/compute.c
> @@ -259,20 +259,27 @@ dispatch_compute(GLuint num_groups_x, GLuint num_groups_y,
> if (!no_error && !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);
> }
>
> void GLAPIENTRY
> +_mesa_DispatchCompute_no_error(GLuint num_groups_x, GLuint num_groups_y,
> + GLuint num_groups_z)
> +{
> + dispatch_compute(num_groups_x, num_groups_y, num_groups_z, true);
> +}
> +
> +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)
> {
> @@ -283,20 +290,26 @@ dispatch_compute_indirect(GLintptr indirect, bool no_error)
> if (MESA_VERBOSE & VERBOSE_API)
> _mesa_debug(ctx, "glDispatchComputeIndirect(%ld)\n", (long) indirect);
>
> if (!no_error && !valid_dispatch_indirect(ctx, indirect))
> return;
>
> ctx->Driver.DispatchComputeIndirect(ctx, indirect);
> }
>
> extern void GLAPIENTRY
> +_mesa_DispatchComputeIndirect_no_error(GLintptr indirect)
> +{
> + dispatch_compute_indirect(indirect, true);
> +}
> +
> +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)
> @@ -317,18 +330,31 @@ dispatch_compute_group_size(GLuint num_groups_x, GLuint num_groups_y,
> !validate_DispatchComputeGroupSizeARB(ctx, num_groups, group_size))
> return;
>
> if (num_groups_x == 0u || num_groups_y == 0u || num_groups_z == 0u)
> return;
>
> ctx->Driver.DispatchComputeGroupSize(ctx, num_groups, group_size);
> }
>
> void GLAPIENTRY
> +_mesa_DispatchComputeGroupSizeARB_no_error(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,
> + true);
> +}
> +
> +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);
> }
> diff --git a/src/mesa/main/compute.h b/src/mesa/main/compute.h
> index 8018bbb..bfb3223 100644
> --- a/src/mesa/main/compute.h
> +++ b/src/mesa/main/compute.h
> @@ -21,23 +21,35 @@
> * DEALINGS IN THE SOFTWARE.
> */
>
> #ifndef COMPUTE_H
> #define COMPUTE_H
>
>
> #include "glheader.h"
>
> extern void GLAPIENTRY
> +_mesa_DispatchCompute_no_error(GLuint num_groups_x, GLuint num_groups_y,
> + GLuint num_groups_z);
> +extern void GLAPIENTRY
> _mesa_DispatchCompute(GLuint num_groups_x,
> GLuint num_groups_y,
> GLuint num_groups_z);
>
> extern void GLAPIENTRY
> +_mesa_DispatchComputeIndirect_no_error(GLintptr indirect);
> +extern void GLAPIENTRY
> _mesa_DispatchComputeIndirect(GLintptr indirect);
>
> extern void GLAPIENTRY
> +_mesa_DispatchComputeGroupSizeARB_no_error(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_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);
>
> #endif
>
--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
More information about the mesa-dev
mailing list