ir_constant_expression: Add support for constant arrays.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 20 Jul 2010 08:31:29 +0000 (01:31 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 21 Jul 2010 23:38:33 +0000 (16:38 -0700)
Fixes piglit test const-array-02.frag.

src/glsl/ir_constant_expression.cpp

index acfbb8645972609ce59af47d554f1579592f1938..d72a57c66abe9c2fe7337b8194ef75f8c6ec4926 100644 (file)
@@ -712,7 +712,8 @@ ir_dereference_array::constant_expression_value()
 
         return new(ctx) ir_constant(array, component);
       } else {
-        /* FINISHME: Handle access of constant arrays. */
+        const unsigned index = idx->value.u[0];
+        return array->get_array_element(index)->clone(NULL);
       }
    }
    return NULL;