From: Louis-Francis Ratté-Boulianne Date: Sat, 12 Oct 2019 06:59:53 +0000 (-0400) Subject: gallium: add PIPE_CAP_VIEWPORT_TRANSFORM_LOWERED X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=babf7357d24b88a548f50aebca74c6ffd8f81d52;p=mesa.git gallium: add PIPE_CAP_VIEWPORT_TRANSFORM_LOWERED This new capability indicates that the nir_lower_viewport_transform pass is enabled. This also means that the gl_Position value is modified and should be lowered for transform feedback, if needed. Signed-off-by: Louis-Francis Ratté-Boulianne Reviewed-by: Alyssa Rosenzweig Acked-by: Daniel Stone Part-of: --- diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c index 510c46aca5f..d94f082ba96 100644 --- a/src/gallium/auxiliary/util/u_screen.c +++ b/src/gallium/auxiliary/util/u_screen.c @@ -417,6 +417,9 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen, case PIPE_CAP_PACKED_STREAM_OUTPUT: return 1; + case PIPE_CAP_VIEWPORT_TRANSFORM_LOWERED: + return 0; + default: unreachable("bad PIPE_CAP_*"); } diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index aad67725f36..7ae6dd4c9f5 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -916,6 +916,7 @@ enum pipe_cap PIPE_CAP_FRONTEND_NOOP, PIPE_CAP_NIR_IMAGES_AS_DEREF, PIPE_CAP_PACKED_STREAM_OUTPUT, + PIPE_CAP_VIEWPORT_TRANSFORM_LOWERED, }; /** diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index d44c2c4ee9d..229319af690 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -331,6 +331,11 @@ void st_init_limits(struct pipe_screen *screen, * because it can actually optimize SSBO access. */ options->LowerBufferInterfaceBlocks = !prefer_nir; + + if (sh == MESA_SHADER_VERTEX) { + if (screen->get_param(screen, PIPE_CAP_VIEWPORT_TRANSFORM_LOWERED)) + options->LowerBuiltinVariablesXfb |= VARYING_BIT_POS; + } } c->MaxUserAssignableUniformLocations =