glsl2: Skip talloc_parent in constant_expression of non-constant arrays.
authorEric Anholt <eric@anholt.net>
Wed, 4 Aug 2010 19:57:58 +0000 (12:57 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 4 Aug 2010 19:57:58 +0000 (12:57 -0700)
src/glsl/ir_constant_expression.cpp
src/mesa/program/ir_to_mesa.cpp

index 677353e..0a92424 100644 (file)
@@ -690,11 +690,11 @@ ir_dereference_variable::constant_expression_value()
 ir_constant *
 ir_dereference_array::constant_expression_value()
 {
-   void *ctx = talloc_parent(this);
    ir_constant *array = this->array->constant_expression_value();
    ir_constant *idx = this->array_index->constant_expression_value();
 
    if ((array != NULL) && (idx != NULL)) {
+      void *ctx = talloc_parent(this);
       if (array->type->is_matrix()) {
         /* Array access of a matrix results in a vector.
          */
index ba0934c..dcf8c49 100644 (file)
@@ -2622,7 +2622,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader)
         progress = do_constant_folding(shader->ir) || progress;
         progress = do_algebraic(shader->ir) || progress;
         progress = do_if_return(shader->ir) || progress;
-        if (ctx->Shader.EmitNoIfs)
+        if (1 || ctx->Shader.EmitNoIfs)
            progress = do_if_to_cond_assign(shader->ir) || progress;
 
         progress = do_vec_index_to_swizzle(shader->ir) || progress;