Merge branch 'mesa_7_7_branch'
[mesa.git] / src / gallium / auxiliary / tgsi / tgsi_exec.h
index 8a9100f4c3e8c3f94685d69273c8745abe0ff74a..fd94c1bc44005fb4cc82e5e1a7c46d6d986418a8 100644 (file)
@@ -168,13 +168,18 @@ struct tgsi_exec_labels
 
 #define TGSI_EXEC_TEMP_ADDR         (TGSI_EXEC_NUM_TEMPS + 8)
 #define TGSI_EXEC_NUM_ADDRS         1
-#define TGSI_EXEC_NUM_TEMP_EXTRAS   9
 
+/* predicate register */
+#define TGSI_EXEC_TEMP_P0           (TGSI_EXEC_NUM_TEMPS + 9)
+#define TGSI_EXEC_NUM_PREDS         1
 
+#define TGSI_EXEC_NUM_TEMP_EXTRAS   10
 
-#define TGSI_EXEC_MAX_COND_NESTING  20
-#define TGSI_EXEC_MAX_LOOP_NESTING  20
-#define TGSI_EXEC_MAX_CALL_NESTING  20
+
+
+#define TGSI_EXEC_MAX_COND_NESTING  32
+#define TGSI_EXEC_MAX_LOOP_NESTING  32
+#define TGSI_EXEC_MAX_CALL_NESTING  32
 
 /* The maximum number of input attributes per vertex. For 2D
  * input register files, this is the stride between two 1D
@@ -186,6 +191,17 @@ struct tgsi_exec_labels
  */
 #define TGSI_EXEC_MAX_CONST_BUFFER  4096
 
+
+/** function call/activation record */
+struct tgsi_call_record
+{
+   uint CondStackTop;
+   uint LoopStackTop;
+   uint ContStackTop;
+   uint ReturnAddr;
+};
+
+
 /**
  * Run-time virtual machine state for executing TGSI shader.
  */
@@ -202,6 +218,7 @@ struct tgsi_exec_machine
    struct tgsi_exec_vector       Outputs[PIPE_MAX_ATTRIBS];
 
    struct tgsi_exec_vector       *Addrs;
+   struct tgsi_exec_vector       *Predicates;
 
    struct tgsi_sampler           **Samplers;
 
@@ -216,6 +233,7 @@ struct tgsi_exec_machine
    /* FRAGMENT processor only. */
    const struct tgsi_interp_coef *InterpCoefs;
    struct tgsi_exec_vector       QuadPos;
+   float                         Face;    /**< +1 if front facing, -1 if back facing */
 
    /* Conditional execution masks */
    uint CondMask;  /**< For IF/ELSE/ENDIF */
@@ -232,6 +250,14 @@ struct tgsi_exec_machine
    uint LoopStack[TGSI_EXEC_MAX_LOOP_NESTING];
    int LoopStackTop;
 
+   /** Loop label stack */
+   uint LoopLabelStack[TGSI_EXEC_MAX_LOOP_NESTING];
+   int LoopLabelStackTop;
+
+   /** Loop counter stack (x = index, y = counter, z = step) */
+   struct tgsi_exec_vector LoopCounterStack[TGSI_EXEC_MAX_LOOP_NESTING];
+   int LoopCounterStackTop;
+   
    /** Loop continue mask stack (see comments in tgsi_exec.c) */
    uint ContStack[TGSI_EXEC_MAX_LOOP_NESTING];
    int ContStackTop;
@@ -241,7 +267,7 @@ struct tgsi_exec_machine
    int FuncStackTop;
 
    /** Function call stack for saving/restoring the program counter */
-   uint CallStack[TGSI_EXEC_MAX_CALL_NESTING];
+   struct tgsi_call_record CallStack[TGSI_EXEC_MAX_CALL_NESTING];
    int CallStackTop;
 
    struct tgsi_full_instruction *Instructions;
@@ -272,6 +298,14 @@ tgsi_exec_machine_run(
    struct tgsi_exec_machine *mach );
 
 
+void
+tgsi_exec_machine_free_data(struct tgsi_exec_machine *mach);
+
+
+boolean
+tgsi_check_soa_dependencies(const struct tgsi_full_instruction *inst);
+
+
 static INLINE void
 tgsi_set_kill_mask(struct tgsi_exec_machine *mach, unsigned mask)
 {