diff options
author | Eric Anholt <[email protected]> | 2012-03-19 16:27:34 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2012-04-13 17:01:17 -0700 |
commit | d32780d5041a6d241834fe565739104f86300425 (patch) | |
tree | 5e6e53978ce49f6a292623bd656fada08af8ad59 /src/glsl/ir_builder.h | |
parent | 7e88f8ce8f9d72bbda248554e0630b4aca7e1154 (diff) |
glsl: Add a helper for ir_builder to make dereferences for assignments.
v2: Fix writemask setup for non-vec4 assignments.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/ir_builder.h')
-rw-r--r-- | src/glsl/ir_builder.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/glsl/ir_builder.h b/src/glsl/ir_builder.h index 350f9a33a81..af9d1600f68 100644 --- a/src/glsl/ir_builder.h +++ b/src/glsl/ir_builder.h @@ -50,6 +50,27 @@ public: ir_rvalue *val; }; +/** Automatic generator for ir_dereference_variable on assignment LHS. + * + * \sa operand + */ +class deref { +public: + deref(ir_dereference *val) + : val(val) + { + } + + deref(ir_variable *var) + { + void *mem_ctx = ralloc_parent(var); + val = new(mem_ctx) ir_dereference_variable(var); + } + + + ir_dereference *val; +}; + class ir_factory { public: void emit(ir_instruction *ir); @@ -58,6 +79,9 @@ public: void *mem_ctx; }; +ir_assignment *assign(deref lhs, operand rhs); +ir_assignment *assign(deref lhs, operand rhs, int writemask); + ir_expression *expr(ir_expression_operation op, operand a, operand b); ir_expression *add(operand a, operand b); ir_expression *sub(operand a, operand b); |