[Mesa-dev] [PATCH 0/3][RFC] Improve GLSL support of GL_ARB_separate_shader_objects
Gregory Hainaut
gregory.hainaut at gmail.com
Sun Sep 20 13:15:32 PDT 2015
Current GLSL badly optimizes the code making it incompatible with the
GL_ARB_separate_shader_objects extension.
Typical example of the current behavior:
VS:
out SHADER
{
vec4 var_zero; // location will always be 0
vec2 var_one; // location will always be 1
} VSout;
FS:
in SHADER
{
vec4 var_zero;
vec2 var_one; // ERROR: location would be wrongly set to 0 if var_zero is inactive
} PSin;
In short, SSO allow to match by name but you can't make any hypothesis on the
previous/next stage. Therefore you must consider all inputs as actives.
Commit decription:
patch 1/ Tighten up some linker error checks to avoid dependency with the
deadcode optimization phase. Phase that will be partially removed in
patch 3.
patch 2/ Add a new variable flags in the AST to distinguish attribute from
varying. It is still legal to removed unused attribute.
patch 3/ Disable the optimization of varying inputs that don't have an explicit
location. The idea was to keep the optimization for all builtins
varyings. Besides it won't trigger the bug if explicit location are
used for all variables. I'm not sure what it is the best solutions.
Piglit test done on older Mesa/Nouveau (8276ba260) due to libdrm newer requirement.
[30454/30454] crash: 29, fail: 221, pass: 20749, skip: 9451, warn: 4 -
The fix was validated on the PCSX2 application. I will try to create a
piglit tests of the above situation.
Gregory Hainaut (3):
glsl/link: don't consider unused variable as read variable.
glsl/ast2hir: add a new flag attribute_input for VS input
glsl/opt: disable optimization of varying input
src/glsl/ast_to_hir.cpp | 4 ++++
src/glsl/ir.h | 9 +++++++++
src/glsl/link_varyings.cpp | 4 ++--
src/glsl/opt_dead_code.cpp | 16 ++++++++++++++++
4 files changed, 31 insertions(+), 2 deletions(-)
--
2.1.4
More information about the mesa-dev
mailing list