r600: add assembler support for literal(inline) constants
[mesa.git] / src / mesa / drivers / dri / r600 / r700_assembler.h
index 85d32212c07df2edf4a507cc5084bdbcb1871dd4..3fe65654ca0323a9b9f19ac60c0f5a33a7fc36c4 100644 (file)
@@ -114,20 +114,22 @@ typedef struct PVSDSTtag
 
 typedef struct PVSINSTtag
 {
-    BITS literal      :2; 
+    BITS literal_slots      :2; 
     BITS SaturateMode :2; 
+    BITS index_mode   :3;
 } PVSINST;
 
 typedef struct PVSSRCtag 
 {
-       BITS rtype:4;            
+       BITS rtype:3;            
        BITS addrmode0:1;        
-       BITS reg:10;      //15     (8)
+       BITS reg:10;      //14     (8)
        BITS swizzlex:3;
        BITS swizzley:3;
        BITS swizzlez:3;
-       BITS swizzlew:3;  //27        
+       BITS swizzlew:3;  //26        
 
+       BITS abs:1;
        BITS negx:1;
        BITS negy:1;
        BITS negz:1;
@@ -259,6 +261,8 @@ enum
     FC_IF = 1,
     FC_LOOP = 2,
     FC_REP = 3,
+    FC_PUSH_VPM = 4,
+    FC_PUSH_WQM = 5,
 
     COND_NONE = 0,
     COND_BOOL = 1,
@@ -271,27 +275,27 @@ enum
 
 typedef struct FC_LEVEL 
 {
-       R700ControlFlowGenericClause *  first;
+    R700ControlFlowGenericClause *  first;
     R700ControlFlowGenericClause ** mid;
     unsigned int unNumMid;
-       unsigned int midLen;
-       unsigned int type;
-       unsigned int cond;
-       unsigned int inv;
-       unsigned int bpush; ///< 1 if first instruction does branch stack push
-                        int id; ///< id of bool or int variable
+    unsigned int midLen;
+    unsigned int type;
+    unsigned int cond;
+    unsigned int inv;
+    int id; ///< id of bool or int variable
 } FC_LEVEL;
 
 typedef struct VTX_FETCH_METHOD 
 {
-       GLboolean bEnableMini;
-       GLuint mega_fetch_remainder;
+    GLboolean bEnableMini;
+    GLuint mega_fetch_remainder;
 } VTX_FETCH_METHOD;
 
 typedef struct SUB_OFFSET
 {
     GLint  subIL_Offset;
     GLuint unCFoffset;
+    GLuint unStackDepthMax;
     TypedShaderList lstCFInstructions_local;
 } SUB_OFFSET;
 
@@ -307,9 +311,16 @@ typedef struct CALLER_POINTER
 typedef struct CALL_LEVEL
 {
     unsigned int      FCSP_BeforeEntry;
+    GLint             subDescIndex;
+    GLushort          current;
+    GLushort          max;
     TypedShaderList * plstCFInstructions_local;
 } CALL_LEVEL;
 
+#define HAS_CURRENT_LOOPRET 0x1L
+#define HAS_LOOPRET         0x2L
+#define LOOPRET_FLAGS       HAS_LOOPRET | HAS_CURRENT_LOOPRET
+
 typedef struct r700_AssemblerBase 
 {
        R700ControlFlowSXClause*      cf_last_export_ptr;
@@ -334,8 +345,10 @@ typedef struct r700_AssemblerBase
        PVSDWORD D;
     PVSDWORD D2;
        PVSDWORD S[3];
+        PVSDWORD C[4];
 
        unsigned int uLastPosUpdate;
+       unsigned int last_cond_register;
 
        OUT_FRAGMENT_FMT_0     fp_stOutFmt0;
 
@@ -366,9 +379,6 @@ typedef struct r700_AssemblerBase
        unsigned int FCSP;
        FC_LEVEL fc_stack[32];
 
-       unsigned int branch_depth;
-       unsigned int max_branch_depth;
-
        //-----------------------------------------------------------------------------------
        // ArgSubst used in Assemble_Source() function
        //-----------------------------------------------------------------------------------
@@ -409,6 +419,7 @@ typedef struct r700_AssemblerBase
     SHADER_PIPE_TYPE currentShaderType;
     struct prog_instruction * pILInst;
     GLuint             uiCurInst;
+    GLubyte SamplerUnits[MAX_SAMPLERS];
     GLboolean   bR6xx;
     /* helper to decide which type of instruction to assemble */
     GLboolean is_tex;
@@ -520,10 +531,7 @@ GLboolean check_vector(r700_AssemblerBase* pAsm,
 GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm);
 GLboolean next_ins(r700_AssemblerBase *pAsm);
 
-GLboolean next_ins2(r700_AssemblerBase *pAsm);
-GLboolean assemble_alu_instruction2(r700_AssemblerBase *pAsm);
-
-/* TODO : merge next_ins/2/literal, assemble_alu_instruction/2/literal */
+/* TODO : merge next_ins/literal, assemble_alu_instruction/literal */
 GLboolean next_ins_literal(r700_AssemblerBase *pAsm, GLfloat * pLiteral);
 GLboolean assemble_alu_instruction_literal(r700_AssemblerBase *pAsm, GLfloat * pLiteral);
 
@@ -532,7 +540,7 @@ GLboolean jumpToOffest(r700_AssemblerBase *pAsm, GLuint pops, GLint offset);
 GLboolean setRetInLoopFlag(r700_AssemblerBase *pAsm, GLuint flagValue);
 GLboolean testFlag(r700_AssemblerBase *pAsm);
 GLboolean breakLoopOnFlag(r700_AssemblerBase *pAsm, GLuint unFCSP);
-GLboolean returnOnFlag(r700_AssemblerBase *pAsm);
+GLboolean returnOnFlag(r700_AssemblerBase *pAsm, GLuint unIF);
 
 GLboolean assemble_math_function(r700_AssemblerBase* pAsm, BITS opcode);
 GLboolean assemble_ABS(r700_AssemblerBase *pAsm);
@@ -548,7 +556,7 @@ GLboolean assemble_EXP(r700_AssemblerBase *pAsm);
 GLboolean assemble_FLR(r700_AssemblerBase *pAsm);
 GLboolean assemble_FLR_INT(r700_AssemblerBase *pAsm);
 GLboolean assemble_FRC(r700_AssemblerBase *pAsm);
-GLboolean assemble_KIL(r700_AssemblerBase *pAsm);
+GLboolean assemble_KIL(r700_AssemblerBase *pAsm, GLuint opcode);
 GLboolean assemble_LG2(r700_AssemblerBase *pAsm);
 GLboolean assemble_LRP(r700_AssemblerBase *pAsm);
 GLboolean assemble_LOG(r700_AssemblerBase *pAsm);