summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2012-03-19 16:01:52 -0700
committerEric Anholt <[email protected]>2012-04-13 17:01:14 -0700
commit7e88f8ce8f9d72bbda248554e0630b4aca7e1154 (patch)
treeb5826b0f173c1df998b0eb077392d9bad56f0ccf /src/glsl
parentb782352745d322596a9122969f5c0e57ea032c1b (diff)
glsl: Make a little tracking class for emitting IR lists.
This lets us significantly shorten p->instructions->push_tail(ir), and will be used in a few more places. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/ir_builder.cpp6
-rw-r--r--src/glsl/ir_builder.h8
2 files changed, 14 insertions, 0 deletions
diff --git a/src/glsl/ir_builder.cpp b/src/glsl/ir_builder.cpp
index 29cc9bc851f..98ac3c100a1 100644
--- a/src/glsl/ir_builder.cpp
+++ b/src/glsl/ir_builder.cpp
@@ -28,6 +28,12 @@ using namespace ir_builder;
namespace ir_builder {
+void
+ir_factory::emit(ir_instruction *ir)
+{
+ instructions->push_tail(ir);
+}
+
ir_swizzle *
swizzle(operand a, int swizzle, int components)
{
diff --git a/src/glsl/ir_builder.h b/src/glsl/ir_builder.h
index d2c729abdbc..350f9a33a81 100644
--- a/src/glsl/ir_builder.h
+++ b/src/glsl/ir_builder.h
@@ -50,6 +50,14 @@ public:
ir_rvalue *val;
};
+class ir_factory {
+public:
+ void emit(ir_instruction *ir);
+
+ exec_list *instructions;
+ void *mem_ctx;
+};
+
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);