diff options
author | Eric Anholt <[email protected]> | 2012-03-19 16:37:23 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2012-04-13 17:01:20 -0700 |
commit | 8bb0091e6838aeee2a5819850c334fde71b5a439 (patch) | |
tree | 2aa35bf31aff1f780a002efaaf3a7b4c4f9020af /src/glsl | |
parent | d32780d5041a6d241834fe565739104f86300425 (diff) |
glsl: Add a helper for generating temporary variables in ir_builder.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/ir_builder.cpp | 11 | ||||
-rw-r--r-- | src/glsl/ir_builder.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/glsl/ir_builder.cpp b/src/glsl/ir_builder.cpp index 0c8a15bc86e..9a16c90e5cd 100644 --- a/src/glsl/ir_builder.cpp +++ b/src/glsl/ir_builder.cpp @@ -34,6 +34,17 @@ ir_factory::emit(ir_instruction *ir) instructions->push_tail(ir); } +ir_variable * +ir_factory::make_temp(const glsl_type *type, const char *name) +{ + ir_variable *var; + + var = new(mem_ctx) ir_variable(type, name, ir_var_temporary); + emit(var); + + return var; +} + ir_assignment * assign(deref lhs, operand rhs, int writemask) { diff --git a/src/glsl/ir_builder.h b/src/glsl/ir_builder.h index af9d1600f68..0ebcbab95c2 100644 --- a/src/glsl/ir_builder.h +++ b/src/glsl/ir_builder.h @@ -74,6 +74,7 @@ public: class ir_factory { public: void emit(ir_instruction *ir); + ir_variable *make_temp(const glsl_type *type, const char *name); exec_list *instructions; void *mem_ctx; |