glsl: Refactor AST-to-HIR code handling variable initializers
[mesa.git] / src / glsl / ir_clone.cpp
index 1522af682bb5d46ad0f185eb90d8cb36a214ac65..2c0574dc6bf9bb5059808856cff23a12f191f6f9 100644 (file)
@@ -217,8 +217,8 @@ ir_texture::clone(void *mem_ctx, struct hash_table *ht) const
       new_tex->shadow_comparitor = this->shadow_comparitor->clone(mem_ctx, ht);
    }
 
-   for (int i = 0; i < 3; i++)
-      new_tex->offsets[i] = this->offsets[i];
+   if (this->offset != NULL)
+      new_tex->offset = this->offset->clone(mem_ctx, ht);
 
    switch (this->op) {
    case ir_tex:
@@ -346,7 +346,7 @@ ir_constant::clone(void *mem_ctx, struct hash_table *ht) const
       ir_constant *c = new(mem_ctx) ir_constant;
 
       c->type = this->type;
-      c->array_elements = talloc_array(c, ir_constant *, this->type->length);
+      c->array_elements = ralloc_array(c, ir_constant *, this->type->length);
       for (unsigned i = 0; i < this->type->length; i++) {
         c->array_elements[i] = this->array_elements[i]->clone(mem_ctx, NULL);
       }