summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/ir_validate.cpp
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2016-05-20 10:19:14 +1000
committerDave Airlie <[email protected]>2016-05-24 11:27:29 +1000
commit8c628ab13e4fa86ee662dcddb0f5a89b2d30e1a4 (patch)
treec7a3ca763ab93784e855bcdef773ea9c75e6bfeb /src/compiler/glsl/ir_validate.cpp
parent2ae493d68647af26c64ae59f0127349d75817b91 (diff)
glsl: make max array trackers ints and use -1 as base. (v2)
This fixes a bug that breaks cull distances. The problem is the max array accessors can't tell the difference between an never accessed unsized array and an accessed at location 0 unsized array. This leads to converting an undeclared unused gl_ClipDistance inside or outside gl_PerVertex to a size 1 array. However we need to the number of active clip distances to work out the starting point for the cull distances, and this offset by one when it's not being used isn't possible to distinguish from the case were only the first element is accessed. I tried to use ->used for this, but that doesn't work when gl_ClipDistance is part of an interface block. So this changes things so that max_array_access is an int and initialised to -1. This also allows unsized arrays to proceed further than that could before, but we really shouldn't mind as they will get eliminated if nothing uses them later. For initialised uniforms we no longer change their array size at runtime, if these are unused they will get eliminated eventually. v2: use ralloc_array (Ilia) Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/compiler/glsl/ir_validate.cpp')
-rw-r--r--src/compiler/glsl/ir_validate.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler/glsl/ir_validate.cpp b/src/compiler/glsl/ir_validate.cpp
index 2ec5a3f73f7..9d05e7e00a9 100644
--- a/src/compiler/glsl/ir_validate.cpp
+++ b/src/compiler/glsl/ir_validate.cpp
@@ -727,7 +727,7 @@ ir_validate::visit(ir_variable *ir)
* to be out of bounds.
*/
if (ir->type->array_size() > 0) {
- if (ir->data.max_array_access >= ir->type->length) {
+ if (ir->data.max_array_access >= (int)ir->type->length) {
printf("ir_variable has maximum access out of bounds (%d vs %d)\n",
ir->data.max_array_access, ir->type->length - 1);
ir->print();
@@ -744,12 +744,12 @@ ir_validate::visit(ir_variable *ir)
ir->get_interface_type()->fields.structure;
for (unsigned i = 0; i < ir->get_interface_type()->length; i++) {
if (fields[i].type->array_size() > 0) {
- const unsigned *const max_ifc_array_access =
+ const int *const max_ifc_array_access =
ir->get_max_ifc_array_access();
assert(max_ifc_array_access != NULL);
- if (max_ifc_array_access[i] >= fields[i].type->length) {
+ if (max_ifc_array_access[i] >= (int)fields[i].type->length) {
printf("ir_variable has maximum access out of bounds for "
"field %s (%d vs %d)\n", fields[i].name,
max_ifc_array_access[i], fields[i].type->length);