From: Ian Romanick Date: Fri, 2 Apr 2010 01:02:48 +0000 (-0700) Subject: Fix type handling in ir_dereference array dereference constructor X-Git-Tag: 062012170305~10660^2~625^2~467 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=63af4b0e99420efd5ad6ecb638f39dc2c5c5e3cf;p=profile%2Fivi%2Fmesa.git Fix type handling in ir_dereference array dereference constructor --- diff --git a/ir.cpp b/ir.cpp index 90df67b..60f34ca 100644 --- a/ir.cpp +++ b/ir.cpp @@ -117,7 +117,18 @@ ir_dereference::ir_dereference(ir_instruction *var, : ir_rvalue(), mode(ir_reference_array), var(var) { - this->type = (var != NULL) ? var->type : glsl_type::error_type; + type = glsl_type::error_type; + + if (var != NULL) { + const glsl_type *const vt = var->type; + + if (vt->is_array()) { + type = vt->element_type(); + } else if (vt->is_matrix() || vt->is_vector()) { + type = vt->get_base_type(); + } + } + this->selector.array_index = array_index; }