glsl: fix validation of ES vertex attribs
From OpenGL ES 3.0 spec, page 56:
"Binding more than one attribute name to the same location
is referred to as aliasing, and is not permitted in OpenGL
ES Shading Language 3.00 vertex shaders. LinkProgram will
fail when this condition exists. However, aliasing is
possible in OpenGL ES Shading Language 1.00 vertex shaders.
This will only work if only one of the aliased attributes
is active in the executable program, or if no path through
the shader consumes more than one attribute of a set of
attributes aliased to the same location. A link error can
occur if the linker determines that every path through the
shader consumes multiple aliased attributes, but implemen-
tations are not required to generate an error in this case."
So here we make sure to allow the optimisations before validation
for earlier ES shader versions.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Fixes: 80c001013c
("glsl: do vs attribute validation in NIR linker")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9342
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24205>
This commit is contained in:

committed by
Marge Bot

parent
28b07a7bd2
commit
c64ad299e4
@@ -1082,10 +1082,11 @@ prelink_lowering(const struct gl_constants *consts,
|
||||
consts->ShaderCompilerOptions[shader->Stage].NirOptions;
|
||||
struct gl_program *prog = shader->Program;
|
||||
|
||||
/* ES vertex shaders still have dead varyings but its now safe to remove
|
||||
* them as validation is now done according to the spec.
|
||||
/* ES 3.0+ vertex shaders may still have dead varyings but its now safe
|
||||
* to remove them as validation is now done according to the spec.
|
||||
*/
|
||||
if (shader_program->IsES && i == MESA_SHADER_VERTEX)
|
||||
if (shader_program->IsES && shader_program->GLSL_Version >= 300 &&
|
||||
i == MESA_SHADER_VERTEX)
|
||||
remove_dead_varyings_pre_linking(prog->nir);
|
||||
|
||||
preprocess_shader(consts, exts, prog, shader_program, shader->Stage);
|
||||
@@ -1348,7 +1349,7 @@ gl_nir_link_glsl(const struct gl_constants *consts,
|
||||
* Because of this rule, we don't remove dead attributes before
|
||||
* attribute assignment for vertex shader inputs here.
|
||||
*/
|
||||
if (!(prog->IsES && i == MESA_SHADER_VERTEX))
|
||||
if (!(prog->IsES && prog->GLSL_Version >= 300 && i == MESA_SHADER_VERTEX))
|
||||
remove_dead_varyings_pre_linking(prog->_LinkedShaders[i]->Program->nir);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user