[Mesa-dev] [PATCH (gles3) 10/20] glsl/ir_factory: Add helper method for making an ir_constant

Chad Versace chad.versace at linux.intel.com
Mon Jan 21 00:49:22 PST 2013


Add method ir_factory::constant.  This little method constructs an
ir_constant using the factory's mem_ctx.

Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 src/glsl/ir_builder.h | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/src/glsl/ir_builder.h b/src/glsl/ir_builder.h
index 01c7f96..f3aa0d7 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;
 };
-- 
1.8.1.1



More information about the mesa-dev mailing list