Revert "glcpp: Rewrite line-continuation support to act globally."
[mesa.git] / src / glsl / ir_builder.h
index d2c729abdbc7e789fb525693554e7b307f772cad..067858df45bf7c89e8cc3e80a421ada2f0f0d75b 100644 (file)
@@ -50,6 +50,40 @@ 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);
+   ir_variable *make_temp(const glsl_type *type, const char *name);
+
+   exec_list *instructions;
+   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);
 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);
@@ -57,6 +91,11 @@ ir_expression *mul(operand a, operand b);
 ir_expression *dot(operand a, operand b);
 ir_expression *saturate(operand a);
 
+/**
+ * Swizzle away later components, but preserve the ordering.
+ */
+ir_swizzle *swizzle_for_size(operand a, unsigned components);
+
 ir_swizzle *swizzle_xxxx(operand a);
 ir_swizzle *swizzle_yyyy(operand a);
 ir_swizzle *swizzle_zzzz(operand a);