Previously we disallowed any redeclarations after any use, and detected conflicting layout qualifiers based on what we know the default to be.
Use ir_variable::data::how_declared instead to determine whether this has already been redeclared, and allow identical redeclarations after use, provided the first redeclaration was before the first use. (These are the same rules as for gl_FragCoord, since the spec language is identical.) Signed-off-by: Chris Forbes <chr...@ijw.co.nz> --- src/glsl/ast_to_hir.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index d1eb3e2..535b11b 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2770,14 +2770,15 @@ get_variable_being_redeclared(ir_variable *var, YYLTYPE loc, * Within any shader, the first redeclarations of gl_FragDepth * must appear before any use of gl_FragDepth. */ - if (earlier->data.used) { - _mesa_glsl_error(&loc, state, - "the first redeclaration of gl_FragDepth " - "must appear before any use of gl_FragDepth"); + if (earlier->data.used && + earlier->data.how_declared == ir_var_declared_implicitly) { + _mesa_glsl_error(&loc, state, + "the first redeclaration of gl_FragDepth " + "must appear before any use of gl_FragDepth"); } /* Prevent inconsistent redeclaration of depth layout qualifier. */ - if (earlier->data.depth_layout != ir_depth_layout_none + if (earlier->data.how_declared != ir_var_declared_implicitly && earlier->data.depth_layout != var->data.depth_layout) { _mesa_glsl_error(&loc, state, "gl_FragDepth: depth layout is declared here " -- 1.9.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev