summaryrefslogtreecommitdiff
path: root/ir.cpp
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-04-01 18:02:48 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-04-01 18:02:48 -0700
commit63af4b0e99420efd5ad6ecb638f39dc2c5c5e3cf (patch)
tree0c0a3cb0a24b1513fffebaf11ca4023f8ccf2f57 /ir.cpp
parenta4f308f0663208eec07cc320ff4a67589d4b5a7f (diff)
Fix type handling in ir_dereference array dereference constructor
Diffstat (limited to 'ir.cpp')
-rw-r--r--ir.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/ir.cpp b/ir.cpp
index 90df67bbf1..60f34ca9be 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;
}