[Mesa-dev] [PATCH v3 18/19] st/mesa: implement limits for ARB_compute_shader
Ilia Mirkin
imirkin at alum.mit.edu
Thu Feb 11 17:33:44 UTC 2016
On Wed, Feb 10, 2016 at 1:10 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> According to the spec, this also increases the following minimum values:
> - MAX_COMBINED_TEXTURE_IMAGE_UNITS 96 (6*16), was 80
> - MAX_UNIFORM_BUFFER_BINDINGS 72 (6*12), was 60
>
> ARB_compute_shader is not enabled by default because images support is
> still not implemented yet. If you want to use it you need to set
> MESA_EXTENSION_OVERRIDE=GL_ARB_compute_shader.
>
> Changes from v2:
> - make use of the new PIPE_CAP_SHADER_SUPPORTED_IRS cap instead of
> enabling the extension when PIPE_CAP_COMPUTE is enabled.
> - query for PIPE_CAP_COMPUTE first
> - s/shader_supported_irs/compute_supported_irs/
> - disable ARB_compute_shader and add a comment which explains why
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> Reviewed-by: Marek Olšák <marek.olsak at amd.com> (v1)
> Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu> (v1)
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu> [i.e. for the v2 as well]
> ---
> src/mesa/state_tracker/st_extensions.c | 33 +++++++++++++++++++++++++++++++--
> 1 file changed, 31 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index 6736ebc..bdfbded 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -276,7 +276,8 @@ void st_init_limits(struct pipe_screen *screen,
> c->Program[MESA_SHADER_TESS_CTRL].MaxTextureImageUnits +
> c->Program[MESA_SHADER_TESS_EVAL].MaxTextureImageUnits +
> c->Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits +
> - c->Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits,
> + c->Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits +
> + c->Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits,
> MAX_COMBINED_TEXTURE_IMAGE_UNITS);
>
> /* This depends on program constants. */
> @@ -336,7 +337,8 @@ void st_init_limits(struct pipe_screen *screen,
> c->Program[MESA_SHADER_TESS_CTRL].MaxUniformBlocks +
> c->Program[MESA_SHADER_TESS_EVAL].MaxUniformBlocks +
> c->Program[MESA_SHADER_GEOMETRY].MaxUniformBlocks +
> - c->Program[MESA_SHADER_FRAGMENT].MaxUniformBlocks;
> + c->Program[MESA_SHADER_FRAGMENT].MaxUniformBlocks +
> + c->Program[MESA_SHADER_COMPUTE].MaxUniformBlocks;
> assert(c->MaxCombinedUniformBlocks <= MAX_COMBINED_UNIFORM_BUFFERS);
> }
>
> @@ -1018,4 +1020,31 @@ void st_init_extensions(struct pipe_screen *screen,
> if ((ST_DEBUG & DEBUG_GREMEDY) &&
> screen->get_param(screen, PIPE_CAP_STRING_MARKER))
> extensions->GREMEDY_string_marker = GL_TRUE;
> +
> + if (screen->get_param(screen, PIPE_CAP_COMPUTE)) {
> + int compute_supported_irs =
> + screen->get_shader_param(screen, PIPE_SHADER_COMPUTE,
> + PIPE_SHADER_CAP_SUPPORTED_IRS);
> + if (compute_supported_irs & (1 << PIPE_SHADER_IR_TGSI)) {
> + uint64_t grid_size[3], block_size[3];
> +
> + screen->get_compute_param(screen, PIPE_COMPUTE_CAP_MAX_GRID_SIZE,
> + grid_size);
> + screen->get_compute_param(screen, PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE,
> + block_size);
> + screen->get_compute_param(screen,
> + PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK,
> + &consts->MaxComputeWorkGroupInvocations);
> + screen->get_compute_param(screen, PIPE_COMPUTE_CAP_MAX_LOCAL_SIZE,
> + &consts->MaxComputeSharedMemorySize);
> +
> + for (i = 0; i < 3; i++) {
> + consts->MaxComputeWorkGroupCount[i] = grid_size[i];
> + consts->MaxComputeWorkGroupSize[i] = block_size[i];
> + }
> + /* XXX: ARB_compute_shader is not enabled by default because images
> + * support is still not implemented yet. */
> + /* extensions->ARB_compute_shader = true; */
> + }
> + }
> }
> --
> 2.6.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list