glsl/linker: add xfb workaround for modified built-in variables
authorLouis-Francis Ratté-Boulianne <lfrb@collabora.com>
Sat, 12 Oct 2019 05:13:54 +0000 (01:13 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 3 Mar 2020 12:28:23 +0000 (12:28 +0000)
commit82dc149254a791de1835e2402ed9a73511f42fdf
tree8d5d4c9e1cea109c4a54e8c5cba5ecb9ee7c1c3b
parent4a329bea44fca8607a3e4538b18fd93864d99c18
glsl/linker: add xfb workaround for modified built-in variables

Some lowering passes modify the value of built-in variables in
order for drivers to work properly. However, modifying such values
will also break transform feedback as the captured value won't
match what's expected.

For example, on some hardware, the vertex shaders are expected to
output gl_Position in screen space. However, the transform
feedback captured value is still supposed to be the world-space
coordinates (see nir_lower_viewport_transform).

To fix that, we create a new variable that contains the
pre-transformation value and use it for transform feedback instead
of the built-in one.

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/compiler/glsl/link_varyings.cpp
src/mesa/main/mtypes.h