Add dereference constructor for array element dereferences

This should have gone in before the previous commit.
This commit is contained in:
Ian Romanick 2010-03-25 17:01:15 -07:00
parent 720c88eab9
commit 9546997736
2 changed files with 13 additions and 1 deletions

10
ir.cpp
View file

@ -87,6 +87,16 @@ ir_dereference::ir_dereference(ir_instruction *var)
}
ir_dereference::ir_dereference(ir_instruction *var,
ir_instruction *array_index)
: ir_instruction(ir_op_dereference), mode(ir_reference_array),
var(var)
{
this->type = (var != NULL) ? var->type : glsl_error_type;
this->selector.array_index = array_index;
}
void
ir_dereference::set_swizzle(unsigned x, unsigned y, unsigned z, unsigned w,
unsigned count)

4
ir.h
View file

@ -393,6 +393,8 @@ class ir_dereference : public ir_instruction {
public:
ir_dereference(struct ir_instruction *);
ir_dereference(ir_instruction *variable, ir_instruction *array_index);
virtual void accept(ir_visitor *v)
{
v->visit(this);
@ -419,7 +421,7 @@ public:
ir_instruction *var;
union {
ir_expression *array_index;
ir_instruction *array_index;
const char *field;
struct ir_swizzle_mask swizzle;
} selector;