<div dir="ltr"><div dir="ltr"><div>Hello,</div><div><br></div><div>+ <a href="mailto:idr@freedesktop.org" class="gmail-jzcNb gmail-sxpygb gmail-AL18ce" target="_blank">idr@freedesktop.org</a></div><div>and add missing bugzilla link<br></div><div>Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=108247">https://bugs.freedesktop.org/show_bug.cgi?id=108247</a><br></div><div><br></div><div>Regards,</div><div>Andrii.<br></div><div><br></div><div class="gmail_quote"><div dir="ltr">On Thu, Oct 4, 2018 at 5:08 PM <<a href="mailto:asimiklit.work@gmail.com">asimiklit.work@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Andrii Simiklit <<a href="mailto:andrii.simiklit@globallogic.com" target="_blank">andrii.simiklit@globallogic.com</a>><br>
<br>
GLSL 3.7 (Identifiers):<br>
"However, as noted in the specification, there are some cases where<br>
previously declared variables can be redeclared to change or add some<br>
property, and predeclared "gl_" names are allowed to be redeclared in a<br>
shader only for these specific purposes.  More generally, it is an error to<br>
redeclare a variable, including those starting "gl_"."<br>
<br>
This patch should fix piglit tests:<br>
'clip-distance-redeclare-without-inout.frag'<br>
'clip-distance-redeclare-without-inout.vert'<br>
and leads to regression in clip-distance-out-values.shader_test<br>
but probably a fix should be made in the test.<br>
<br>
As far as I understood following mailing thread:<br>
<a href="https://lists.freedesktop.org/archives/piglit/2013-October/007935.html" rel="noreferrer" target="_blank">https://lists.freedesktop.org/archives/piglit/2013-October/007935.html</a><br>
looks like we have accepted to remove an ability to change qualifiers<br>
but have not done it yet. Unless I missed something)<br>
<br>
Fixes: 8e6cb9fe51a2 "glsl: Refactor AST-to-HIR code handling variable<br>
                                         redeclarations"<br>
Signed-off-by: Andrii Simiklit <<a href="mailto:andrii.simiklit@globallogic.com" target="_blank">andrii.simiklit@globallogic.com</a>><br>
---<br>
 src/compiler/glsl/ast_to_hir.cpp | 13 +++++++++----<br>
 1 file changed, 9 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp<br>
index 93e7c8ec33..e26ae6b92a 100644<br>
--- a/src/compiler/glsl/ast_to_hir.cpp<br>
+++ b/src/compiler/glsl/ast_to_hir.cpp<br>
@@ -4240,10 +4240,15 @@ get_variable_being_redeclared(ir_variable **var_ptr, YYLTYPE loc,<br>
     */<br>
    if (earlier->type->is_unsized_array() && var->type->is_array()<br>
        && (var->type->fields.array == earlier->type->fields.array)) {<br>
-      /* FINISHME: This doesn't match the qualifiers on the two<br>
-       * FINISHME: declarations.  It's not 100% clear whether this is<br>
-       * FINISHME: required or not.<br>
-       */<br>
+<br>
+      if ((strcmp("gl_ClipDistance", var->name) == 0) &&<br>
+          earlier->data.mode != var->data.mode) {<br>
+         _mesa_glsl_error(&loc, state,<br>
+                          "redeclaration of '%s %s' with incorrect qualifiers '%s'.",<br>
+                          mode_string(earlier),<br>
+                          var->name,<br>
+                          mode_string(var));<br>
+      }<br>
<br>
       const int size = var->type->array_size();<br>
       check_builtin_array_max_size(var->name, size, loc, state);<br>
-- <br>
2.17.1<br>
<br>
</blockquote></div></div></div>