driconf, glsl: Add a vs_position_always_invariant option

Graphics / Mesa 3D Graphics Library / Mesa - Kenneth Graunke [whitecape.org] - 27 November 2019 18:48 EST

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.")

9b577f2a887 driconf, glsl: Add a vs_position_always_invariant option
src/compiler/glsl/builtin_variables.cpp | 6 ++++++
src/gallium/auxiliary/pipe-loader/driinfo_gallium.h | 1 +
src/gallium/include/state_tracker/st_api.h | 1 +
src/gallium/state_trackers/dri/dri_screen.c | 2 ++
src/mesa/drivers/dri/i965/intel_screen.c | 3 +++
src/mesa/main/mtypes.h | 3 +++
src/mesa/state_tracker/st_context.c | 2 ++
src/util/xmlpool/t_options.h | 5 +++++
8 files changed, 23 insertions(+)

Upstream: cgit.freedesktop.org

  • Share