From: Ian Romanick Date: Mon, 19 Apr 2010 22:40:49 +0000 (-0700) Subject: Add ir_dereference constructor for structure field dereferences X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7ee79fb6b78012abd0ae8e874a7c64550b1cb707;p=mesa.git Add ir_dereference constructor for structure field dereferences --- diff --git a/ir.cpp b/ir.cpp index 63135e35533..7ada145d53b 100644 --- a/ir.cpp +++ b/ir.cpp @@ -246,6 +246,14 @@ ir_dereference::ir_dereference(ir_instruction *var, this->selector.array_index = array_index; } +ir_dereference::ir_dereference(ir_instruction *variable, const char *field) + : mode(ir_reference_record), var(variable) +{ + this->selector.field = field; + this->type = (var != NULL) + ? var->type->field_type(field) : glsl_type::error_type; +} + bool ir_dereference::is_lvalue() { diff --git a/ir.h b/ir.h index 42e8264d41d..b3fb06d2c7b 100644 --- a/ir.h +++ b/ir.h @@ -749,6 +749,8 @@ public: ir_dereference(ir_instruction *variable, ir_rvalue *array_index); + ir_dereference(ir_instruction *variable, const char *field); + virtual ir_dereference *as_dereference() { return this;