The warning is now handled earlier in the ast to hir code,
and the name was only generated for arrays of arrays in which
case this just breaks the Uniform hash lookup.
---
 src/mesa/program/sampler.cpp | 38 +++++++++++++-------------------------
 1 file changed, 13 insertions(+), 25 deletions(-)

diff --git a/src/mesa/program/sampler.cpp b/src/mesa/program/sampler.cpp
index ea3024d..34567d2 100644
--- a/src/mesa/program/sampler.cpp
+++ b/src/mesa/program/sampler.cpp
@@ -38,14 +38,12 @@
 class get_sampler_name : public ir_hierarchical_visitor
 {
 public:
-   get_sampler_name(ir_dereference *last,
-                   struct gl_shader_program *shader_program)
+   get_sampler_name(struct gl_shader_program *shader_program)
    {
       this->mem_ctx = ralloc_context(NULL);
       this->shader_program = shader_program;
       this->name = NULL;
       this->offset = 0;
-      this->last = last;
    }
 
    ~get_sampler_name()
@@ -68,29 +66,20 @@ public:
    virtual ir_visitor_status visit_leave(ir_dereference_array *ir)
    {
       ir_constant *index = ir->array_index->as_constant();
-      int i;
+
+      /* GLSL 1.10 and 1.20 allowed variable sampler array indices,
+       * while GLSL 1.30 requires that the array indices be
+       * constant integer expressions.  We don't expect any driver
+       * to actually work with a really variable array index, so
+       * all that would work would be an unrolled loop counter so
+       * the index must be constant at this point.
+       */
+      assert(index != NULL);
 
       if (index) {
-        i = index->value.i[0];
-      } else {
-        /* GLSL 1.10 and 1.20 allowed variable sampler array indices,
-         * while GLSL 1.30 requires that the array indices be
-         * constant integer expressions.  We don't expect any driver
-         * to actually work with a really variable array index, so
-         * all that would work would be an unrolled loop counter that ends
-         * up being constant above.
-         */
-        ralloc_strcat(&shader_program->InfoLog,
-                      "warning: Variable sampler array index unsupported.\n"
-                      "This feature of the language was removed in GLSL 1.20 "
-                      "and is unlikely to be supported for 1.10 in Mesa.\n");
-        i = 0;
-      }
-      if (ir != last) {
-        this->name = ralloc_asprintf(mem_ctx, "%s[%d]", name, i);
-      } else {
-        offset = i;
+        offset = index->value.i[0];
       }
+
       return visit_continue;
    }
 
@@ -98,7 +87,6 @@ public:
    const char *name;
    void *mem_ctx;
    int offset;
-   ir_dereference *last;
 };
 
 
@@ -107,7 +95,7 @@ _mesa_get_sampler_uniform_value(class ir_dereference 
*sampler,
                                struct gl_shader_program *shader_program,
                                const struct gl_program *prog)
 {
-   get_sampler_name getname(sampler, shader_program);
+   get_sampler_name getname(shader_program);
 
    GLuint shader = _mesa_program_enum_to_shader_stage(prog->Target);
 
-- 
2.1.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to