From 46de3beab1f4145d23567f95db4e5e4c5adbe5db Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Sun, 9 Jun 2019 20:56:09 -0700 Subject: [PATCH] gallium: Add PIPE_CAP_CS_DERIVED_SYSTEM_VALUES_SUPPORTED Tells whether or not the driver can handle gl_LocalInvocationIndex and gl_GlobalInvocationID. If not supported (the default), state tracker will lower those on behalf of the driver. v2: Add case to u_screen.c. (Anholt) Reviewed-by: Eric Anholt Reviewed-by: Kenneth Graunke --- src/gallium/auxiliary/util/u_screen.c | 1 + src/gallium/docs/source/screen.rst | 3 +++ src/gallium/include/pipe/p_defines.h | 1 + src/mesa/state_tracker/st_extensions.c | 3 ++- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c index 6457bcffda1..e4648594614 100644 --- a/src/gallium/auxiliary/util/u_screen.c +++ b/src/gallium/auxiliary/util/u_screen.c @@ -328,6 +328,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen, case PIPE_CAP_IMAGE_LOAD_FORMATTED: case PIPE_CAP_PREFER_COMPUTE_BLIT_FOR_MULTIMEDIA: case PIPE_CAP_FRAGMENT_SHADER_INTERLOCK: + case PIPE_CAP_CS_DERIVED_SYSTEM_VALUES_SUPPORTED: return 0; case PIPE_CAP_MAX_GS_INVOCATIONS: diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index 70810418f8a..fd8b7a9f68c 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -528,6 +528,9 @@ The integer capabilities: OpenMAX should use a compute-based blit instead of pipe_context::blit. * ``PIPE_CAP_FRAGMENT_SHADER_INTERLOCK``: True if fragment shader interlock functionality is supported. +* ``PIPE_CAP_CS_DERIVED_SYSTEM_VALUES_SUPPORTED``: True if driver handles + gl_LocalInvocationIndex and gl_GlobalInvocationID. Otherwise, state tracker will + lower those system values. .. _pipe_capf: diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index d3c951279d9..261f6c51ec1 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -885,6 +885,7 @@ enum pipe_cap PIPE_CAP_PREFER_COMPUTE_BLIT_FOR_MULTIMEDIA, PIPE_CAP_FRAGMENT_SHADER_INTERLOCK, PIPE_CAP_FBFETCH_COHERENT, + PIPE_CAP_CS_DERIVED_SYSTEM_VALUES_SUPPORTED, }; /** diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index f930d3caff9..cb340b3edc9 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -348,7 +348,8 @@ void st_init_limits(struct pipe_screen *screen, screen->get_param(screen, PIPE_CAP_GLSL_TESS_LEVELS_AS_INPUTS); c->LowerTessLevel = !screen->get_param(screen, PIPE_CAP_NIR_COMPACT_ARRAYS); - c->LowerCsDerivedVariables = true; + c->LowerCsDerivedVariables = + !screen->get_param(screen, PIPE_CAP_CS_DERIVED_SYSTEM_VALUES_SUPPORTED); c->PrimitiveRestartForPatches = screen->get_param(screen, PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES); -- 2.30.2