summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2013-01-11 15:46:24 -0800
committerChad Versace <[email protected]>2013-01-24 21:24:10 -0800
commita6479ef9687b8d996a908127fccad0ec897bb9ee (patch)
tree74b9b647eea7fd1978f48bda44951bd7a1a85d44 /src
parent5790174e376e2b3543b902ae14c790c6eed2dd88 (diff)
glsl/ir_factory: Add helper method for making an ir_constant
Add method ir_factory::constant. This little method constructs an ir_constant using the factory's mem_ctx. Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Chad Versace <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glsl/ir_builder.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/glsl/ir_builder.h b/src/glsl/ir_builder.h
index 01c7f9666c9..f3aa0d76220 100644
--- a/src/glsl/ir_builder.h
+++ b/src/glsl/ir_builder.h
@@ -83,6 +83,30 @@ public:
void emit(ir_instruction *ir);
ir_variable *make_temp(const glsl_type *type, const char *name);
+ ir_constant*
+ constant(float f)
+ {
+ return new(mem_ctx) ir_constant(f);
+ }
+
+ ir_constant*
+ constant(int i)
+ {
+ return new(mem_ctx) ir_constant(i);
+ }
+
+ ir_constant*
+ constant(unsigned u)
+ {
+ return new(mem_ctx) ir_constant(u);
+ }
+
+ ir_constant*
+ constant(bool b)
+ {
+ return new(mem_ctx) ir_constant(b);
+ }
+
exec_list *instructions;
void *mem_ctx;
};