tgsi: Update for gallium interface changes.
[mesa.git] / src / gallium / auxiliary / tgsi / tgsi_exec.h
index 2c46e8839963750b0660869fa49c6301efb24f3a..08df15ec6a087c751810573ae6616be4baefcd97 100644 (file)
@@ -29,6 +29,7 @@
 #define TGSI_EXEC_H
 
 #include "pipe/p_compiler.h"
+#include "pipe/p_state.h"
 
 #if defined __cplusplus
 extern "C" {
@@ -167,7 +168,12 @@ 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
 
 
 
@@ -185,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.
  */
@@ -197,14 +214,15 @@ struct tgsi_exec_machine
 
    float                         Imms[TGSI_EXEC_NUM_IMMEDIATES][4];
 
+   struct tgsi_exec_vector       Inputs[PIPE_MAX_ATTRIBS];
+   struct tgsi_exec_vector       Outputs[PIPE_MAX_ATTRIBS];
+
    struct tgsi_exec_vector       *Addrs;
 
    struct tgsi_sampler           **Samplers;
 
    unsigned                      ImmLimit;
    const float                   (*Consts)[4];
-   struct tgsi_exec_vector       *Inputs;
-   struct tgsi_exec_vector       *Outputs;
    const struct tgsi_token       *Tokens;   /**< Declarations, instructions */
    unsigned                      Processor; /**< TGSI_PROCESSOR_x */
 
@@ -230,6 +248,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 = count, y = current, 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;
@@ -239,7 +265,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;
@@ -270,6 +296,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)
 {