summaryrefslogtreecommitdiffstats
path: root/src/glsl/linker.cpp
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2011-01-25 10:41:20 -0800
committerIan Romanick <[email protected]>2011-03-29 13:21:08 -0700
commit89d81ab16c05818b290ed735c1343d3abde449bf (patch)
tree256104ebb7bdcc721ff0d70178047acb8c83ed21 /src/glsl/linker.cpp
parent92e412e788931ad464125113a64eec8a8223cda3 (diff)
glsl: Calcluate Mesa state slots in front-end instead of back-end
This should be the last bit of infrastructure changes before generating GLSL IR for assembly shaders. This commit leaves some odd code formatting in ir_to_mesa and brw_fs. This was done to minimize whitespace changes / reindentation in some loops. The following commit will restore formatting sanity. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/glsl/linker.cpp')
-rw-r--r--src/glsl/linker.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 7db5c5e8d53..17492357f2d 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -994,6 +994,19 @@ update_array_sizes(struct gl_shader_program *prog)
}
if (size + 1 != var->type->fields.array->length) {
+ /* If this is a built-in uniform (i.e., it's backed by some
+ * fixed-function state), adjust the number of state slots to
+ * match the new array size. The number of slots per array entry
+ * is not known. It seems saft to assume that the total number of
+ * slots is an integer multiple of the number of array elements.
+ * Determine the number of slots per array element by dividing by
+ * the old (total) size.
+ */
+ if (var->num_state_slots > 0) {
+ var->num_state_slots = (size + 1)
+ * (var->num_state_slots / var->type->length);
+ }
+
var->type = glsl_type::get_array_instance(var->type->fields.array,
size + 1);
/* FINISHME: We should update the types of array