OSDN Git Service

driconf, glsl: Add a vs_position_always_invariant option
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 22 Nov 2019 00:11:15 +0000 (16:11 -0800)
committerDylan Baker <dylan@pnwbakers.com>
Tue, 3 Dec 2019 18:23:03 +0000 (10:23 -0800)
commitf63c3ecaa071d87c1b06c0bb263525cba2197e79
tree8c543ea727eaef071520ca0ca20e46a47e6ced5e
parentd438ccdedf927e4ec3b0853fc7df753c9d246e8c
driconf, glsl: Add a vs_position_always_invariant option

Many applications use multi-pass rendering and require their vertex
shader position to be computed the same way each time.  Optimizations
may consider, say, fusing a multiply-add based on global usage of an
expression in a shader.  But a second shader with the same expression
may have different code, causing that optimization to make the other
choice the second time around.

The correct solution is for applications to mark their VS outputs
'invariant', indicating they need multiple shaders to compute that
output in the same manner.  However, most applications fail to do so.

So, we add a new driconf option - vs_position_always_invariant - which
forces the gl_Position output in vertex shaders to be marked invariant.

Fixes: 7025dbe794b ("nir: Skip emitting no-op movs from the builder.")
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 9b577f2a887968483b88b629673d3f9904a179ff)
src/compiler/glsl/builtin_variables.cpp
src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
src/gallium/include/state_tracker/st_api.h
src/gallium/state_trackers/dri/dri_screen.c
src/mesa/drivers/dri/i965/intel_screen.c
src/mesa/main/mtypes.h
src/mesa/state_tracker/st_context.c
src/util/xmlpool/t_options.h