From 7ee79fb6b78012abd0ae8e874a7c64550b1cb707 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 19 Apr 2010 15:40:49 -0700 Subject: [PATCH] Add ir_dereference constructor for structure field dereferences --- ir.cpp | 8 ++++++++ ir.h | 2 ++ 2 files changed, 10 insertions(+) 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; -- 2.30.2