Mesa (glsl2): glsl2: Don' t assert in a couple of places when encountering sampler arrays.
Eric Anholt
anholt at kemper.freedesktop.org
Fri Aug 6 07:53:21 UTC 2010
Module: Mesa
Branch: glsl2
Commit: 8d61a23b1a1d0d4b21f0fab64f6d863a8ee3d7f1
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8d61a23b1a1d0d4b21f0fab64f6d863a8ee3d7f1
Author: Eric Anholt <eric at anholt.net>
Date: Thu Aug 5 16:00:46 2010 -0700
glsl2: Don't assert in a couple of places when encountering sampler arrays.
Fixes glean shaderAPI.
---
src/glsl/linker.cpp | 10 ++++++----
src/mesa/program/ir_to_mesa.cpp | 5 +++++
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 9d6de24..e93c2f5 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -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) {
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 9979e6e..66b1a2f 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -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);
}
More information about the mesa-commit
mailing list