gallium: add PIPE_CAP_VIEWPORT_TRANSFORM_LOWERED
authorLouis-Francis Ratté-Boulianne <lfrb@collabora.com>
Sat, 12 Oct 2019 06:59:53 +0000 (02:59 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 3 Mar 2020 12:28:23 +0000 (12:28 +0000)
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 <lfrb@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2433>

src/gallium/auxiliary/util/u_screen.c
src/gallium/include/pipe/p_defines.h
src/mesa/state_tracker/st_extensions.c

index 510c46aca5fa0fd2dfbfb1db8fdf8802add08df2..d94f082ba9631279682050f5a500dff55c6aa003 100644 (file)
@@ -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_*");
    }
index aad67725f36ba0ee4071bbc93a7e345d1f77cb3a..7ae6dd4c9f54ae827de8feb58f8257cb1611301f 100644 (file)
@@ -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,
 };
 
 /**
index d44c2c4ee9d2a51c375822807cbaed2416ddbc68..229319af690766a9f90c49df3c051bce131c10ec 100644 (file)
@@ -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 =