glsl2: Don't assert in a couple of places when encountering sampler arrays.
authorEric Anholt <eric@anholt.net>
Thu, 5 Aug 2010 23:00:46 +0000 (16:00 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 6 Aug 2010 07:42:59 +0000 (00:42 -0700)
Fixes glean shaderAPI.

src/glsl/linker.cpp
src/mesa/program/ir_to_mesa.cpp

index 9d6de242f5f4257da49629141247eff1761503e8..e93c2f555492912b06dd09910c560cc482aacbea 100644 (file)
@@ -793,11 +793,13 @@ assign_uniform_locations(struct gl_shader_program *prog)
         if ((var == NULL) || (var->mode != ir_var_uniform))
            continue;
 
-        if (var->type->is_sampler())
-           continue;
-
         const unsigned vec4_slots = (var->component_slots() + 3) / 4;
-        assert(vec4_slots != 0);
+        if (vec4_slots == 0) {
+           /* If we've got a sampler or an aggregate of them, the size can
+            * end up zero.  Don't allocate any space.
+            */
+           continue;
+        }
 
         uniform_node *n = (uniform_node *) hash_table_find(ht, var->name);
         if (n == NULL) {
index 9979e6e3e079795d202ae4591bac43ce058a71dd..66b1a2f9d9a6d89642519ddbec0f424698159efa 100644 (file)
@@ -518,6 +518,11 @@ type_size(const struct glsl_type *type)
         size += type_size(type->fields.structure[i].type);
       }
       return size;
+   case GLSL_TYPE_SAMPLER:
+      /* Samplers take up no register space, since they're baked in at
+       * link time.
+       */
+      return 0;
    default:
       assert(0);
    }