gallium: reorg tgsi directories.
authorMichal Krol <michal@tungstengraphics.com>
Fri, 23 Nov 2007 13:28:16 +0000 (13:28 +0000)
committerMichal Krol <michal@tungstengraphics.com>
Fri, 23 Nov 2007 13:28:16 +0000 (13:28 +0000)
43 files changed:
src/mesa/pipe/draw/draw_private.h
src/mesa/pipe/draw/draw_vertex_fetch.c
src/mesa/pipe/draw/draw_vertex_shader.c
src/mesa/pipe/draw/draw_wide_prims.c
src/mesa/pipe/i915simple/i915_fpc_translate.c
src/mesa/pipe/i915simple/i915_state_derived.c
src/mesa/pipe/p_shader_tokens.h [new file with mode: 0644]
src/mesa/pipe/softpipe/sp_headers.h
src/mesa/pipe/softpipe/sp_quad.c
src/mesa/pipe/softpipe/sp_quad_fs.c
src/mesa/pipe/softpipe/sp_state_derived.c
src/mesa/pipe/softpipe/sp_state_fs.c
src/mesa/pipe/tgsi/deco/Makefile [deleted file]
src/mesa/pipe/tgsi/deco/deco_caps.c [deleted file]
src/mesa/pipe/tgsi/deco/deco_caps.h [deleted file]
src/mesa/pipe/tgsi/deco/tgsi_deco.h [deleted file]
src/mesa/pipe/tgsi/exec/tgsi_build.c [deleted file]
src/mesa/pipe/tgsi/exec/tgsi_build.h [deleted file]
src/mesa/pipe/tgsi/exec/tgsi_core.h [deleted file]
src/mesa/pipe/tgsi/exec/tgsi_dump.c [deleted file]
src/mesa/pipe/tgsi/exec/tgsi_dump.h [deleted file]
src/mesa/pipe/tgsi/exec/tgsi_exec.c
src/mesa/pipe/tgsi/exec/tgsi_parse.c [deleted file]
src/mesa/pipe/tgsi/exec/tgsi_parse.h [deleted file]
src/mesa/pipe/tgsi/exec/tgsi_sse2.c
src/mesa/pipe/tgsi/exec/tgsi_token.h [deleted file]
src/mesa/pipe/tgsi/exec/tgsi_util.c [deleted file]
src/mesa/pipe/tgsi/exec/tgsi_util.h [deleted file]
src/mesa/pipe/tgsi/tgsi_platform.h [deleted file]
src/mesa/pipe/tgsi/util/tgsi_build.c [new file with mode: 0644]
src/mesa/pipe/tgsi/util/tgsi_build.h [new file with mode: 0644]
src/mesa/pipe/tgsi/util/tgsi_dump.c [new file with mode: 0644]
src/mesa/pipe/tgsi/util/tgsi_dump.h [new file with mode: 0644]
src/mesa/pipe/tgsi/util/tgsi_parse.c [new file with mode: 0644]
src/mesa/pipe/tgsi/util/tgsi_parse.h [new file with mode: 0644]
src/mesa/pipe/tgsi/util/tgsi_util.c [new file with mode: 0644]
src/mesa/pipe/tgsi/util/tgsi_util.h [new file with mode: 0644]
src/mesa/sources
src/mesa/state_tracker/st_atom_shader.c
src/mesa/state_tracker/st_debug.c
src/mesa/state_tracker/st_mesa_to_tgsi.c
src/mesa/state_tracker/st_program.c
src/mesa/state_tracker/st_program.h

index 09acf69623bc7388d6556fbbe1fcedc081a3e854..53d7451113111421f41f4a9554c7b044af16f2a8 100644 (file)
@@ -47,7 +47,7 @@
 #include "draw_vertex.h"
 
 #include "x86/rtasm/x86sse.h"
-#include "pipe/tgsi/exec/tgsi_core.h"
+#include "pipe/tgsi/exec/tgsi_exec.h"
 
 
 struct gallivm_prog;
index 88fa80dddcd334ba248f37646c0a909bc5cdc8fc..5510b3674eb4aa8cca98b3af00bb3aa375e5779e 100644 (file)
   */
 
 #include "pipe/p_util.h"
+#include "pipe/p_shader_tokens.h"
 #include "draw_private.h"
 #include "draw_context.h"
 #include "draw_vertex.h"
 
-#include "pipe/tgsi/exec/tgsi_core.h"
-
 
 #define DBG 0
 
index 52fb2d85962b1fb32af32ec2badd459bca865249..eef71a7a4a39825d9ff8ad841003d18edb6e9b0a 100644 (file)
   */
 
 #include "pipe/p_util.h"
+#include "pipe/p_shader_tokens.h"
 #include "draw_private.h"
 #include "draw_context.h"
 #include "draw_vertex.h"
 
 #include "x86/rtasm/x86sse.h"
 
-#include "pipe/tgsi/exec/tgsi_core.h"
 #include "pipe/llvm/gallivm.h"
 
 
index f3b4478f9a337d5d8df6e3a1db7c6a223718cb03..494a2bc619985552f26a8efaad66e8a10625664f 100644 (file)
 
 #include "pipe/p_util.h"
 #include "pipe/p_defines.h"
+#include "pipe/p_shader_tokens.h"
 #include "draw_private.h"
 
 
-
 struct wide_stage {
    struct draw_stage stage;
 
index 0382aa26a987d26b4a577d22ca0cb7c770d23bde..1cd554250cc4c960c5b2892e3b60fcf5a5a68048 100644 (file)
@@ -32,8 +32,8 @@
 #include "i915_context.h"
 #include "i915_fpc.h"
 
-#include "pipe/tgsi/exec/tgsi_token.h"
-#include "pipe/tgsi/exec/tgsi_parse.h"
+#include "pipe/p_shader_tokens.h"
+#include "pipe/tgsi/util/tgsi_parse.h"
 
 #include "pipe/draw/draw_vertex.h"
 
index 688c0c5798b5525bab8c9d0ee6689248e2ea7320..be73769cf2f65787770bac1955276d603817fe66 100644 (file)
@@ -33,7 +33,7 @@
 #include "i915_state.h"
 #include "i915_reg.h"
 #include "i915_fpc.h"
-#include "pipe/tgsi/exec/tgsi_token.h"
+#include "pipe/p_shader_tokens.h"
 
 
 /**
diff --git a/src/mesa/pipe/p_shader_tokens.h b/src/mesa/pipe/p_shader_tokens.h
new file mode 100644 (file)
index 0000000..e5922b4
--- /dev/null
@@ -0,0 +1,805 @@
+#if !defined TGSI_TOKEN_H
+#define TGSI_TOKEN_H
+
+#if defined __cplusplus
+extern "C" {
+#endif // defined __cplusplus
+
+struct tgsi_version
+{
+   unsigned MajorVersion  : 8;
+   unsigned MinorVersion  : 8;
+   unsigned Padding       : 16;
+};
+
+struct tgsi_header
+{
+   unsigned HeaderSize : 8;
+   unsigned BodySize   : 24;
+};
+
+#define TGSI_PROCESSOR_FRAGMENT  0
+#define TGSI_PROCESSOR_VERTEX    1
+#define TGSI_PROCESSOR_GEOMETRY  2
+
+struct tgsi_processor
+{
+   unsigned Processor  : 4;  /* TGSI_PROCESSOR_ */
+   unsigned Padding    : 28;
+};
+
+#define TGSI_TOKEN_TYPE_DECLARATION    0
+#define TGSI_TOKEN_TYPE_IMMEDIATE      1
+#define TGSI_TOKEN_TYPE_INSTRUCTION    2
+
+struct tgsi_token
+{
+   unsigned Type       : 4;  /* TGSI_TOKEN_TYPE_ */
+   unsigned Size       : 8;  /* UINT */
+   unsigned Padding    : 19;
+   unsigned Extended   : 1;  /* BOOL */
+};
+
+#define TGSI_FILE_NULL        0
+#define TGSI_FILE_CONSTANT    1
+#define TGSI_FILE_INPUT       2
+#define TGSI_FILE_OUTPUT      3
+#define TGSI_FILE_TEMPORARY   4
+#define TGSI_FILE_SAMPLER     5
+#define TGSI_FILE_ADDRESS     6
+#define TGSI_FILE_IMMEDIATE   7
+
+#define TGSI_DECLARE_RANGE    0
+#define TGSI_DECLARE_MASK     1
+
+#define TGSI_WRITEMASK_NONE     0x00
+#define TGSI_WRITEMASK_X        0x01
+#define TGSI_WRITEMASK_Y        0x02
+#define TGSI_WRITEMASK_XY       0x03
+#define TGSI_WRITEMASK_Z        0x04
+#define TGSI_WRITEMASK_XZ       0x05
+#define TGSI_WRITEMASK_YZ       0x06
+#define TGSI_WRITEMASK_XYZ      0x07
+#define TGSI_WRITEMASK_W        0x08
+#define TGSI_WRITEMASK_XW       0x09
+#define TGSI_WRITEMASK_YW       0x0A
+#define TGSI_WRITEMASK_XYW      0x0B
+#define TGSI_WRITEMASK_ZW       0x0C
+#define TGSI_WRITEMASK_XZW      0x0D
+#define TGSI_WRITEMASK_YZW      0x0E
+#define TGSI_WRITEMASK_XYZW     0x0F
+
+struct tgsi_declaration
+{
+   unsigned Type        : 4;  /* TGSI_TOKEN_TYPE_DECLARATION */
+   unsigned Size        : 8;  /* UINT */
+   unsigned File        : 4;  /* one of TGSI_FILE_x */
+   unsigned Declare     : 4;  /* one of TGSI_DECLARE_x */
+   unsigned UsageMask   : 4;  /* bitmask of TGSI_WRITEMASK_x flags */
+   unsigned Interpolate : 1;  /* BOOL, any interpolation info? */
+   unsigned Semantic    : 1;  /* BOOL, any semantic info? */
+   unsigned Padding     : 5;
+   unsigned Extended    : 1;  /* BOOL */
+};
+
+struct tgsi_declaration_range
+{
+   unsigned First   : 16; /* UINT */
+   unsigned Last    : 16; /* UINT */
+};
+
+struct tgsi_declaration_mask
+{
+   unsigned Mask : 32; /* UINT */
+};
+
+#define TGSI_INTERPOLATE_CONSTANT      0
+#define TGSI_INTERPOLATE_LINEAR        1
+#define TGSI_INTERPOLATE_PERSPECTIVE   2
+
+struct tgsi_declaration_interpolation
+{
+   unsigned Interpolate   : 4;  /* TGSI_INTERPOLATE_ */
+   unsigned Padding       : 28;
+};
+
+#define TGSI_SEMANTIC_POSITION 0
+#define TGSI_SEMANTIC_COLOR    1
+#define TGSI_SEMANTIC_BCOLOR   2 /**< back-face color */
+#define TGSI_SEMANTIC_FOG      3
+#define TGSI_SEMANTIC_PSIZE    4
+#define TGSI_SEMANTIC_GENERIC  5
+#define TGSI_SEMANTIC_COUNT    6 /**< number of semantic values */
+
+struct tgsi_declaration_semantic
+{
+   unsigned SemanticName   : 8;  /* one of TGSI_SEMANTIC_ */
+   unsigned SemanticIndex  : 16; /* UINT */
+   unsigned Padding        : 8;
+};
+
+#define TGSI_IMM_FLOAT32   0
+
+struct tgsi_immediate
+{
+   unsigned Type       : 4;  /* TGSI_TOKEN_TYPE_IMMEDIATE */
+   unsigned Size       : 8;  /* UINT */
+   unsigned DataType   : 4;  /* TGSI_IMM_ */
+   unsigned Padding    : 15;
+   unsigned Extended   : 1;  /* BOOL */
+};
+
+struct tgsi_immediate_float32
+{
+   float Float;
+};
+
+/*
+ * GL_NV_vertex_program
+ */
+#define TGSI_OPCODE_ARL                 0
+#define TGSI_OPCODE_MOV                 1
+#define TGSI_OPCODE_LIT                 2
+#define TGSI_OPCODE_RCP                 3
+#define TGSI_OPCODE_RSQ                 4
+#define TGSI_OPCODE_EXP                 5
+#define TGSI_OPCODE_LOG                 6
+#define TGSI_OPCODE_MUL                 7
+#define TGSI_OPCODE_ADD                 8
+#define TGSI_OPCODE_DP3                 9
+#define TGSI_OPCODE_DP4                 10
+#define TGSI_OPCODE_DST                 11
+#define TGSI_OPCODE_MIN                 12
+#define TGSI_OPCODE_MAX                 13
+#define TGSI_OPCODE_SLT                 14
+#define TGSI_OPCODE_SGE                 15
+#define TGSI_OPCODE_MAD                 16
+
+/*
+ * GL_ATI_fragment_shader
+ */
+#define TGSI_OPCODE_SUB                 17
+#define TGSI_OPCODE_DOT3                TGSI_OPCODE_DP3
+#define TGSI_OPCODE_DOT4                TGSI_OPCODE_DP4
+#define TGSI_OPCODE_LERP                18
+#define TGSI_OPCODE_CND                 19
+#define TGSI_OPCODE_CND0                20
+#define TGSI_OPCODE_DOT2ADD             21
+
+/*
+ * GL_EXT_vertex_shader
+ */
+#define TGSI_OPCODE_INDEX               22
+#define TGSI_OPCODE_NEGATE              23
+#define TGSI_OPCODE_MADD                TGSI_OPCODE_MAD
+#define TGSI_OPCODE_FRAC                24
+#define TGSI_OPCODE_SETGE               TGSI_OPCODE_SGE
+#define TGSI_OPCODE_SETLT               TGSI_OPCODE_SLT
+#define TGSI_OPCODE_CLAMP               25
+#define TGSI_OPCODE_FLOOR               26
+#define TGSI_OPCODE_ROUND               27
+#define TGSI_OPCODE_EXPBASE2            28
+#define TGSI_OPCODE_LOGBASE2            29
+#define TGSI_OPCODE_POWER               30
+#define TGSI_OPCODE_RECIP               TGSI_OPCODE_RCP
+#define TGSI_OPCODE_RECIPSQRT           TGSI_OPCODE_RSQ
+#define TGSI_OPCODE_CROSSPRODUCT        31
+#define TGSI_OPCODE_MULTIPLYMATRIX      32
+
+/*
+ * GL_NV_vertex_program1_1
+ */
+#define TGSI_OPCODE_ABS                 33
+#define TGSI_OPCODE_RCC                 34
+#define TGSI_OPCODE_DPH                 35
+
+/*
+ * GL_NV_fragment_program
+ */
+#define TGSI_OPCODE_COS                 36
+#define TGSI_OPCODE_DDX                 37
+#define TGSI_OPCODE_DDY                 38
+#define TGSI_OPCODE_EX2                 TGSI_OPCODE_EXPBASE2
+#define TGSI_OPCODE_FLR                 TGSI_OPCODE_FLOOR
+#define TGSI_OPCODE_FRC                 TGSI_OPCODE_FRAC
+#define TGSI_OPCODE_KILP                39  /* predicated kill */
+#define TGSI_OPCODE_LG2                 TGSI_OPCODE_LOGBASE2
+#define TGSI_OPCODE_LRP                 TGSI_OPCODE_LERP
+#define TGSI_OPCODE_PK2H                40
+#define TGSI_OPCODE_PK2US               41
+#define TGSI_OPCODE_PK4B                42
+#define TGSI_OPCODE_PK4UB               43
+#define TGSI_OPCODE_POW                 TGSI_OPCODE_POWER
+#define TGSI_OPCODE_RFL                 44
+#define TGSI_OPCODE_SEQ                 45
+#define TGSI_OPCODE_SFL                 46
+#define TGSI_OPCODE_SGT                 47
+#define TGSI_OPCODE_SIN                 48
+#define TGSI_OPCODE_SLE                 49
+#define TGSI_OPCODE_SNE                 50
+#define TGSI_OPCODE_STR                 51
+#define TGSI_OPCODE_TEX                 52
+#define TGSI_OPCODE_TXD                 53
+#define TGSI_OPCODE_UP2H                54
+#define TGSI_OPCODE_UP2US               55
+#define TGSI_OPCODE_UP4B                56
+#define TGSI_OPCODE_UP4UB               57
+#define TGSI_OPCODE_X2D                 58
+
+/*
+ * GL_NV_vertex_program2
+ */
+#define TGSI_OPCODE_ARA                 59
+#define TGSI_OPCODE_ARR                 60
+#define TGSI_OPCODE_BRA                 61
+#define TGSI_OPCODE_CAL                 62
+#define TGSI_OPCODE_RET                 63
+#define TGSI_OPCODE_SSG                 64
+
+/*
+ * GL_ARB_vertex_program
+ */
+#define TGSI_OPCODE_SWZ                 TGSI_OPCODE_MOV
+#define TGSI_OPCODE_XPD                 TGSI_OPCODE_CROSSPRODUCT
+
+/*
+ * GL_ARB_fragment_program
+ */
+#define TGSI_OPCODE_CMP                 65
+#define TGSI_OPCODE_SCS                 66
+#define TGSI_OPCODE_TXB                 67
+
+/*
+ * GL_NV_fragment_program_option
+ */
+/* No new opcode */
+
+/*
+ * GL_NV_fragment_program2
+ */
+#define TGSI_OPCODE_NRM                 68
+#define TGSI_OPCODE_DIV                 69
+#define TGSI_OPCODE_DP2                 70
+#define TGSI_OPCODE_DP2A                TGSI_OPCODE_DOT2ADD
+#define TGSI_OPCODE_TXL                 71
+#define TGSI_OPCODE_BRK                 72
+#define TGSI_OPCODE_IF                  73
+#define TGSI_OPCODE_LOOP                74
+#define TGSI_OPCODE_REP                 75
+#define TGSI_OPCODE_ELSE                76
+#define TGSI_OPCODE_ENDIF               77
+#define TGSI_OPCODE_ENDLOOP             78
+#define TGSI_OPCODE_ENDREP              79
+
+/*
+ * GL_NV_vertex_program2_option
+ */
+
+/*
+ * GL_NV_vertex_program3
+ */
+#define TGSI_OPCODE_PUSHA               80
+#define TGSI_OPCODE_POPA                81
+
+/*
+ * GL_NV_gpu_program4
+ */
+#define TGSI_OPCODE_CEIL                82
+#define TGSI_OPCODE_I2F                 83
+#define TGSI_OPCODE_NOT                 84
+#define TGSI_OPCODE_TRUNC               85
+#define TGSI_OPCODE_SHL                 86
+#define TGSI_OPCODE_SHR                 87
+#define TGSI_OPCODE_AND                 88
+#define TGSI_OPCODE_OR                  89
+#define TGSI_OPCODE_MOD                 90
+#define TGSI_OPCODE_XOR                 91
+#define TGSI_OPCODE_SAD                 92
+#define TGSI_OPCODE_TXF                 93
+#define TGSI_OPCODE_TXQ                 94
+#define TGSI_OPCODE_CONT                95
+
+/*
+ * GL_NV_vertex_program4
+ */
+/* Same as GL_NV_gpu_program4 */
+
+/*
+ * GL_NV_fragment_program4
+ */
+/* Same as GL_NV_gpu_program4 */
+
+/*
+ * GL_NV_geometry_program4
+ */
+/* Same as GL_NV_gpu_program4 */
+#define TGSI_OPCODE_EMIT                96
+#define TGSI_OPCODE_ENDPRIM             97
+
+/*
+ * GLSL
+ */
+#define TGSI_OPCODE_BGNLOOP2            98
+#define TGSI_OPCODE_BGNSUB              99
+#define TGSI_OPCODE_ENDLOOP2            100
+#define TGSI_OPCODE_ENDSUB              101
+#define TGSI_OPCODE_INT                 TGSI_OPCODE_TRUNC
+#define TGSI_OPCODE_NOISE1              102
+#define TGSI_OPCODE_NOISE2              103
+#define TGSI_OPCODE_NOISE3              104
+#define TGSI_OPCODE_NOISE4              105
+#define TGSI_OPCODE_NOP                 106
+
+/*
+ * ps_1_1
+ */
+#define TGSI_OPCODE_TEXCOORD            TGSI_OPCODE_NOP
+#define TGSI_OPCODE_TEXKILL             TGSI_OPCODE_KIL
+#define TGSI_OPCODE_TEXBEM              107
+#define TGSI_OPCODE_TEXBEML             108
+#define TGSI_OPCODE_TEXREG2AR           109
+#define TGSI_OPCODE_TEXM3X2PAD          110
+#define TGSI_OPCODE_TEXM3X2TEX          111
+#define TGSI_OPCODE_TEXM3X3PAD          112
+#define TGSI_OPCODE_TEXM3X3TEX          113
+#define TGSI_OPCODE_TEXM3X3SPEC         114
+#define TGSI_OPCODE_TEXM3X3VSPEC        115
+
+/*
+ * ps_1_2
+ */
+#define TGSI_OPCODE_TEXREG2GB           116
+#define TGSI_OPCODE_TEXREG2RGB          117
+#define TGSI_OPCODE_TEXDP3TEX           118
+#define TGSI_OPCODE_TEXDP3              119
+#define TGSI_OPCODE_TEXM3X3             120
+/* CMP - use TGSI_OPCODE_CND0 */
+
+/*
+ * ps_1_3
+ */
+#define TGSI_OPCODE_TEXM3X2DEPTH        121
+/* CMP - use TGSI_OPCODE_CND0 */
+
+/*
+ * ps_1_4
+ */
+#define TGSI_OPCODE_TEXCRD              TGSI_OPCODE_TEXCOORD
+#define TGSI_OPCODE_TEXLD               TGSI_OPCODE_TEX
+#define TGSI_OPCODE_TEXDEPTH            122
+#define TGSI_OPCODE_BEM                 123
+
+/*
+ * ps_2_0
+ */
+#define TGSI_OPCODE_M4X4                TGSI_OPCODE_MULTIPLYMATRIX
+#define TGSI_OPCODE_M4X3                124
+#define TGSI_OPCODE_M3X4                125
+#define TGSI_OPCODE_M3X3                126
+#define TGSI_OPCODE_M3X2                127
+#define TGSI_OPCODE_CRS                 TGSI_OPCODE_XPD
+#define TGSI_OPCODE_NRM4                128
+#define TGSI_OPCODE_SINCOS              TGSI_OPCODE_SCS
+#define TGSI_OPCODE_TEXLDB              TGSI_OPCODE_TXB
+#define TGSI_OPCODE_DP2ADD              TGSI_OPCODE_DP2A
+
+/*
+ * ps_2_x
+ */
+#define TGSI_OPCODE_CALL                TGSI_OPCODE_CAL
+#define TGSI_OPCODE_CALLNZ              129
+#define TGSI_OPCODE_IFC                 130
+#define TGSI_OPCODE_BREAK               TGSI_OPCODE_BRK
+#define TGSI_OPCODE_BREAKC              131
+#define TGSI_OPCODE_DSX                 TGSI_OPCODE_DDX
+#define TGSI_OPCODE_DSY                 TGSI_OPCODE_DDY
+#define TGSI_OPCODE_TEXLDD              TGSI_OPCODE_TXD
+
+/*
+ * vs_1_1
+ */
+#define TGSI_OPCODE_EXPP                TGSI_OPCODE_EXP
+#define TGSI_OPCODE_LOGP                TGSI_OPCODE_LG2
+
+/*
+ * vs_2_0
+ */
+#define TGSI_OPCODE_SGN                 TGSI_OPCODE_SSG
+#define TGSI_OPCODE_MOVA                TGSI_OPCODE_ARR
+
+/*
+ * vs_2_x
+ */
+
+#define TGSI_OPCODE_KIL                 132  /* unpredicated kill */
+#define TGSI_OPCODE_END                 133  /* aka HALT */
+
+#define TGSI_OPCODE_LAST                134
+
+#define TGSI_SAT_NONE            0  /* do not saturate */
+#define TGSI_SAT_ZERO_ONE        1  /* clamp to [0,1] */
+#define TGSI_SAT_MINUS_PLUS_ONE  2  /* clamp to [-1,1] */
+
+/*
+ * Opcode is the operation code to execute. A given operation defines the
+ * semantics how the source registers (if any) are interpreted and what is
+ * written to the destination registers (if any) as a result of execution.
+ *
+ * NumDstRegs and NumSrcRegs is the number of destination and source registers,
+ * respectively. For a given operation code, those numbers are fixed and are
+ * present here only for convenience.
+ *
+ * If Extended is TRUE, it is now executed.
+ *
+ * Saturate controls how are final results in destination registers modified.
+ */
+
+struct tgsi_instruction
+{
+   unsigned Type       : 4;  /* TGSI_TOKEN_TYPE_INSTRUCTION */
+   unsigned Size       : 8;  /* UINT */
+   unsigned Opcode     : 8;  /* TGSI_OPCODE_ */
+   unsigned Saturate   : 2;  /* TGSI_SAT_ */
+   unsigned NumDstRegs : 2;  /* UINT */
+   unsigned NumSrcRegs : 4;  /* UINT */
+   unsigned Padding    : 3;
+   unsigned Extended   : 1;  /* BOOL */
+};
+
+/*
+ * If tgsi_instruction::Extended is TRUE, tgsi_instruction_ext follows.
+ * 
+ * Then, tgsi_instruction::NumDstRegs of tgsi_dst_register follow.
+ * 
+ * Then, tgsi_instruction::NumSrcRegs of tgsi_src_register follow.
+ *
+ * tgsi_instruction::Size contains the total number of words that make the
+ * instruction, including the instruction word.
+ */
+
+#define TGSI_INSTRUCTION_EXT_TYPE_NV        0
+#define TGSI_INSTRUCTION_EXT_TYPE_LABEL     1
+#define TGSI_INSTRUCTION_EXT_TYPE_TEXTURE   2
+#define TGSI_INSTRUCTION_EXT_TYPE_PREDICATE 3
+
+struct tgsi_instruction_ext
+{
+   unsigned Type       : 4;  /* TGSI_INSTRUCTION_EXT_TYPE_ */
+   unsigned Padding    : 27;
+   unsigned Extended   : 1;  /* BOOL */
+};
+
+/*
+ * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_NV, it should
+ * be cast to tgsi_instruction_ext_nv.
+ * 
+ * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_LABEL, it
+ * should be cast to tgsi_instruction_ext_label.
+ * 
+ * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_TEXTURE, it
+ * should be cast to tgsi_instruction_ext_texture.
+ * 
+ * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_PREDICATE, it
+ * should be cast to tgsi_instruction_ext_predicate.
+ * 
+ * If tgsi_instruction_ext::Extended is TRUE, another tgsi_instruction_ext
+ * follows.
+ */
+
+#define TGSI_PRECISION_DEFAULT      0
+#define TGSI_PRECISION_FLOAT32      1
+#define TGSI_PRECISION_FLOAT16      2
+#define TGSI_PRECISION_FIXED12      3
+
+#define TGSI_CC_GT      0
+#define TGSI_CC_EQ      1
+#define TGSI_CC_LT      2
+#define TGSI_CC_UN      3
+#define TGSI_CC_GE      4
+#define TGSI_CC_LE      5
+#define TGSI_CC_NE      6
+#define TGSI_CC_TR      7
+#define TGSI_CC_FL      8
+
+#define TGSI_SWIZZLE_X      0
+#define TGSI_SWIZZLE_Y      1
+#define TGSI_SWIZZLE_Z      2
+#define TGSI_SWIZZLE_W      3
+
+/*
+ * Precision controls the precision at which the operation should be executed.
+ *
+ * CondDstUpdate enables condition code register writes. When this field is
+ * TRUE, CondDstIndex specifies the index of the condition code register to
+ * update.
+ *
+ * CondFlowEnable enables conditional execution of the operation. When this
+ * field is TRUE, CondFlowIndex specifies the index of the condition code
+ * register to test against CondMask with component swizzle controled by
+ * CondSwizzleX, CondSwizzleY, CondSwizzleZ and CondSwizzleW. If the test fails,
+ * the operation is not executed.
+ */
+
+struct tgsi_instruction_ext_nv
+{
+   unsigned Type             : 4;    /* TGSI_INSTRUCTION_EXT_TYPE_NV */
+   unsigned Precision        : 4;    /* TGSI_PRECISION_ */
+   unsigned CondDstIndex     : 4;    /* UINT */
+   unsigned CondFlowIndex    : 4;    /* UINT */
+   unsigned CondMask         : 4;    /* TGSI_CC_ */
+   unsigned CondSwizzleX     : 2;    /* TGSI_SWIZZLE_ */
+   unsigned CondSwizzleY     : 2;    /* TGSI_SWIZZLE_ */
+   unsigned CondSwizzleZ     : 2;    /* TGSI_SWIZZLE_ */
+   unsigned CondSwizzleW     : 2;    /* TGSI_SWIZZLE_ */
+   unsigned CondDstUpdate    : 1;    /* BOOL */
+   unsigned CondFlowEnable   : 1;    /* BOOL */
+   unsigned Padding          : 1;
+   unsigned Extended         : 1;    /* BOOL */
+};
+
+struct tgsi_instruction_ext_label
+{
+   unsigned Type     : 4;    /* TGSI_INSTRUCTION_EXT_TYPE_LABEL */
+   unsigned Label    : 24;   /* UINT */
+   unsigned Padding  : 3;
+   unsigned Extended : 1;    /* BOOL */
+};
+
+#define TGSI_TEXTURE_UNKNOWN        0
+#define TGSI_TEXTURE_1D             1
+#define TGSI_TEXTURE_2D             2
+#define TGSI_TEXTURE_3D             3
+#define TGSI_TEXTURE_CUBE           4
+#define TGSI_TEXTURE_RECT           5
+#define TGSI_TEXTURE_SHADOW1D       6
+#define TGSI_TEXTURE_SHADOW2D       7
+#define TGSI_TEXTURE_SHADOWRECT     8
+
+struct tgsi_instruction_ext_texture
+{
+   unsigned Type     : 4;    /* TGSI_INSTRUCTION_EXT_TYPE_TEXTURE */
+   unsigned Texture  : 8;    /* TGSI_TEXTURE_ */
+   unsigned Padding  : 19;
+   unsigned Extended : 1;    /* BOOL */
+};
+
+struct tgsi_instruction_ext_predicate
+{
+   unsigned Type             : 4;    /* TGSI_INSTRUCTION_EXT_TYPE_PREDICATE */
+   unsigned PredDstIndex     : 4;    /* UINT */
+   unsigned PredWriteMask    : 4;    /* TGSI_WRITEMASK_ */
+   unsigned Padding          : 19;
+   unsigned Extended         : 1;    /* BOOL */
+};
+
+/*
+ * File specifies the register array to access.
+ *
+ * Index specifies the element number of a register in the register file.
+ *
+ * If Indirect is TRUE, Index should be offset by the X component of a source
+ * register that follows. The register can be now fetched into local storage
+ * for further processing.
+ *
+ * If Negate is TRUE, all components of the fetched register are negated.
+ *
+ * The fetched register components are swizzled according to SwizzleX, SwizzleY,
+ * SwizzleZ and SwizzleW.
+ *
+ * If Extended is TRUE, any further modifications to the source register are
+ * made to this temporary storage.
+ */
+
+struct tgsi_src_register
+{
+   unsigned File        : 4;  /* TGSI_FILE_ */
+   unsigned SwizzleX    : 2;  /* TGSI_SWIZZLE_ */
+   unsigned SwizzleY    : 2;  /* TGSI_SWIZZLE_ */
+   unsigned SwizzleZ    : 2;  /* TGSI_SWIZZLE_ */
+   unsigned SwizzleW    : 2;  /* TGSI_SWIZZLE_ */
+   unsigned Negate      : 1;  /* BOOL */
+   unsigned Indirect    : 1;  /* BOOL */
+   unsigned Dimension   : 1;  /* BOOL */
+   int      Index       : 16; /* SINT */
+   unsigned Extended    : 1;  /* BOOL */
+};
+
+/*
+ * If tgsi_src_register::Extended is TRUE, tgsi_src_register_ext follows.
+ * 
+ * Then, if tgsi_src_register::Indirect is TRUE, another tgsi_src_register
+ * follows.
+ *
+ * Then, if tgsi_src_register::Dimension is TRUE, tgsi_dimension follows.
+ */
+
+#define TGSI_SRC_REGISTER_EXT_TYPE_SWZ      0
+#define TGSI_SRC_REGISTER_EXT_TYPE_MOD      1
+
+struct tgsi_src_register_ext
+{
+   unsigned Type     : 4;    /* TGSI_SRC_REGISTER_EXT_TYPE_ */
+   unsigned Padding  : 27;
+   unsigned Extended : 1;    /* BOOL */
+};
+
+/*
+ * If tgsi_src_register_ext::Type is TGSI_SRC_REGISTER_EXT_TYPE_SWZ,
+ * it should be cast to tgsi_src_register_ext_extswz.
+ * 
+ * If tgsi_src_register_ext::Type is TGSI_SRC_REGISTER_EXT_TYPE_MOD,
+ * it should be cast to tgsi_src_register_ext_mod.
+ * 
+ * If tgsi_dst_register_ext::Extended is TRUE, another tgsi_dst_register_ext
+ * follows.
+ */
+
+#define TGSI_EXTSWIZZLE_X       TGSI_SWIZZLE_X
+#define TGSI_EXTSWIZZLE_Y       TGSI_SWIZZLE_Y
+#define TGSI_EXTSWIZZLE_Z       TGSI_SWIZZLE_Z
+#define TGSI_EXTSWIZZLE_W       TGSI_SWIZZLE_W
+#define TGSI_EXTSWIZZLE_ZERO    4
+#define TGSI_EXTSWIZZLE_ONE     5
+
+/*
+ * ExtSwizzleX, ExtSwizzleY, ExtSwizzleZ and ExtSwizzleW swizzle the source
+ * register in an extended manner.
+ *
+ * NegateX, NegateY, NegateZ and NegateW negate individual components of the
+ * source register.
+ *
+ * ExtDivide specifies which component is used to divide all components of the
+ * source register.
+ */
+
+struct tgsi_src_register_ext_swz
+{
+   unsigned Type         : 4;    /* TGSI_SRC_REGISTER_EXT_TYPE_SWZ */
+   unsigned ExtSwizzleX  : 4;    /* TGSI_EXTSWIZZLE_ */
+   unsigned ExtSwizzleY  : 4;    /* TGSI_EXTSWIZZLE_ */
+   unsigned ExtSwizzleZ  : 4;    /* TGSI_EXTSWIZZLE_ */
+   unsigned ExtSwizzleW  : 4;    /* TGSI_EXTSWIZZLE_ */
+   unsigned NegateX      : 1;    /* BOOL */
+   unsigned NegateY      : 1;    /* BOOL */
+   unsigned NegateZ      : 1;    /* BOOL */
+   unsigned NegateW      : 1;    /* BOOL */
+   unsigned ExtDivide    : 4;    /* TGSI_EXTSWIZZLE_ */
+   unsigned Padding      : 3;
+   unsigned Extended     : 1;    /* BOOL */
+};
+
+/**
+ * Extra src register modifiers
+ *
+ * If Complement is TRUE, the source register is modified by subtracting it
+ * from 1.0.
+ *
+ * If Bias is TRUE, the source register is modified by subtracting 0.5 from it.
+ *
+ * If Scale2X is TRUE, the source register is modified by multiplying it by 2.0.
+ *
+ * If Absolute is TRUE, the source register is modified by removing the sign.
+ *
+ * If Negate is TRUE, the source register is modified by negating it.
+ */
+
+struct tgsi_src_register_ext_mod
+{
+   unsigned Type         : 4;    /* TGSI_SRC_REGISTER_EXT_TYPE_MOD */
+   unsigned Complement   : 1;    /* BOOL */
+   unsigned Bias         : 1;    /* BOOL */
+   unsigned Scale2X      : 1;    /* BOOL */
+   unsigned Absolute     : 1;    /* BOOL */
+   unsigned Negate       : 1;    /* BOOL */
+   unsigned Padding      : 22;
+   unsigned Extended     : 1;    /* BOOL */
+};
+
+struct tgsi_dimension
+{
+   unsigned Indirect    : 1;  /* BOOL */
+   unsigned Dimension   : 1;  /* BOOL */
+   unsigned Padding     : 13;
+   int      Index       : 16; /* SINT */
+   unsigned Extended    : 1;  /* BOOL */
+};
+
+struct tgsi_dst_register
+{
+   unsigned File        : 4;  /* TGSI_FILE_ */
+   unsigned WriteMask   : 4;  /* TGSI_WRITEMASK_ */
+   unsigned Indirect    : 1;  /* BOOL */
+   unsigned Dimension   : 1;  /* BOOL */
+   int      Index       : 16; /* SINT */
+   unsigned Padding     : 5;
+   unsigned Extended    : 1;  /* BOOL */
+};
+
+/*
+ * If tgsi_dst_register::Extended is TRUE, tgsi_dst_register_ext follows.
+ * 
+ * Then, if tgsi_dst_register::Indirect is TRUE, tgsi_src_register follows.
+ */
+
+#define TGSI_DST_REGISTER_EXT_TYPE_CONDCODE     0
+#define TGSI_DST_REGISTER_EXT_TYPE_MODULATE     1
+#define TGSI_DST_REGISTER_EXT_TYPE_PREDICATE    2
+
+struct tgsi_dst_register_ext
+{
+   unsigned Type     : 4;    /* TGSI_DST_REGISTER_EXT_TYPE_ */
+   unsigned Padding  : 27;
+   unsigned Extended : 1;    /* BOOL */
+};
+
+/**
+ * Extra destination register modifiers
+ *
+ * If tgsi_dst_register_ext::Type is TGSI_DST_REGISTER_EXT_TYPE_CONDCODE,
+ * it should be cast to tgsi_dst_register_ext_condcode.
+ * 
+ * If tgsi_dst_register_ext::Type is TGSI_DST_REGISTER_EXT_TYPE_MODULATE,
+ * it should be cast to tgsi_dst_register_ext_modulate.
+ * 
+ * If tgsi_dst_register_ext::Type is TGSI_DST_REGISTER_EXT_TYPE_PREDICATE,
+ * it should be cast to tgsi_dst_register_ext_predicate.
+ * 
+ * If tgsi_dst_register_ext::Extended is TRUE, another tgsi_dst_register_ext
+ * follows.
+ */
+struct tgsi_dst_register_ext_concode
+{
+   unsigned Type         : 4;    /* TGSI_DST_REGISTER_EXT_TYPE_CONDCODE */
+   unsigned CondMask     : 4;    /* TGSI_CC_ */
+   unsigned CondSwizzleX : 2;    /* TGSI_SWIZZLE_ */
+   unsigned CondSwizzleY : 2;    /* TGSI_SWIZZLE_ */
+   unsigned CondSwizzleZ : 2;    /* TGSI_SWIZZLE_ */
+   unsigned CondSwizzleW : 2;    /* TGSI_SWIZZLE_ */
+   unsigned CondSrcIndex : 4;    /* UINT */
+   unsigned Padding      : 11;
+   unsigned Extended     : 1;    /* BOOL */
+};
+
+#define TGSI_MODULATE_1X        0
+#define TGSI_MODULATE_2X        1
+#define TGSI_MODULATE_4X        2
+#define TGSI_MODULATE_8X        3
+#define TGSI_MODULATE_HALF      4
+#define TGSI_MODULATE_QUARTER   5
+#define TGSI_MODULATE_EIGHTH    6
+
+struct tgsi_dst_register_ext_modulate
+{
+   unsigned Type     : 4;    /* TGSI_DST_REGISTER_EXT_TYPE_MODULATE */
+   unsigned Modulate : 4;    /* TGSI_MODULATE_ */
+   unsigned Padding  : 23;
+   unsigned Extended : 1;    /* BOOL */
+};
+
+/*
+ * Currently, the following constraints apply.
+ *
+ * - PredSwizzleXYZW is either set to identity or replicate.
+ * - PredSrcIndex is 0.
+ */
+
+struct tgsi_dst_register_ext_predicate
+{
+   unsigned Type         : 4;    /* TGSI_DST_REGISTER_EXT_TYPE_PREDICATE */
+   unsigned PredSwizzleX : 2;    /* TGSI_SWIZZLE_ */
+   unsigned PredSwizzleY : 2;    /* TGSI_SWIZZLE_ */
+   unsigned PredSwizzleZ : 2;    /* TGSI_SWIZZLE_ */
+   unsigned PredSwizzleW : 2;    /* TGSI_SWIZZLE_ */
+   unsigned PredSrcIndex : 4;    /* UINT */
+   unsigned Negate       : 1;    /* BOOL */
+   unsigned Padding      : 14;
+   unsigned Extended     : 1;    /* BOOL */
+};
+
+
+#if defined __cplusplus
+} // extern "C"
+#endif // defined __cplusplus
+
+#endif // !defined TGSI_TOKEN_H
+
index e23742f80346c22bde7ed34796b08f3e5c1dc628..b9f2b2205a81850a4ac0afcee211d22de88fd77a 100644 (file)
@@ -31,7 +31,7 @@
 #ifndef SP_HEADERS_H
 #define SP_HEADERS_H
 
-#include "../tgsi/exec/tgsi_core.h"
+#include "pipe/tgsi/exec/tgsi_exec.h"
 
 #define PRIM_POINT 1
 #define PRIM_LINE  2
index 5a0df6de9d3b845355dab10fb59ce47facadd75c..13fb883ef0cc18ab6187ced65f06632003e445ad 100644 (file)
@@ -27,9 +27,9 @@
 
 
 #include "sp_context.h"
-
+#include "sp_headers.h"
 #include "sp_state.h"
-#include "pipe/tgsi/exec/tgsi_token.h"
+#include "pipe/p_shader_tokens.h"
 
 static void
 sp_push_quad_first(
index ed14dac18e4566487618ee31ee40cdfd2054ad59..24c8a44c47944d3f7c68ca574f1cc709b98ec3b1 100644 (file)
@@ -37,6 +37,7 @@
 
 #include "pipe/p_util.h"
 #include "pipe/p_defines.h"
+#include "pipe/p_shader_tokens.h"
 
 #include "x86/rtasm/x86sse.h"
 
index 7e5efbfde39899712bb9c6c60ab9f6e8e27b5d0d..33caab9372c679691b2b5b8db74f1ab5bde98161 100644 (file)
  **************************************************************************/
 
 #include "pipe/p_util.h"
-
+#include "pipe/p_shader_tokens.h"
 #include "pipe/draw/draw_context.h"
 #include "pipe/draw/draw_vertex.h"
-
+#include "sp_headers.h"
 #include "sp_context.h"
 #include "sp_state.h"
 
-#include "pipe/tgsi/exec/tgsi_token.h"
-
 
 /**
  * Determine which post-transform / pre-rasterization vertex attributes
index ba564b16e66ea013e2ce62dff649301e46682c7d..912f42d5688ee33b5c3e2e3ff752a6e1bcb29624 100644 (file)
@@ -32,7 +32,7 @@
 #include "pipe/p_util.h"
 #include "pipe/p_winsys.h"
 #include "pipe/draw/draw_context.h"
-#include "pipe/tgsi/exec/tgsi_core.h"
+#include "pipe/p_shader_tokens.h"
 #include "pipe/llvm/gallivm.h"
 
 
diff --git a/src/mesa/pipe/tgsi/deco/Makefile b/src/mesa/pipe/tgsi/deco/Makefile
deleted file mode 100644 (file)
index eb8b14e..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-default:
-       cd ../../.. ; make
-
diff --git a/src/mesa/pipe/tgsi/deco/deco_caps.c b/src/mesa/pipe/tgsi/deco/deco_caps.c
deleted file mode 100644 (file)
index 66df05a..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#include "tgsi_platform.h"
-#include "tgsi_deco.h"
-
-void
-tgsi_deco_caps_init(
-   struct tgsi_deco_caps *caps )
-{
-   memset( caps, 0, sizeof( *caps ) );
-}
-
diff --git a/src/mesa/pipe/tgsi/deco/deco_caps.h b/src/mesa/pipe/tgsi/deco/deco_caps.h
deleted file mode 100644 (file)
index 40ca1c9..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-#if !defined DECO_CAPS_H
-#define DECO_CAPS_H
-
-#if defined __cplusplus
-extern "C" {
-#endif // defined __cplusplus
-
-struct tgsi_deco_caps
-{
-   /*
-    * Predicates (D3D9-specific).
-    *
-    * Constraints:
-    *    1. Token tgsi_dst_register_ext_predicate must not be used.
-    *    2. Token tgsi_instruction_ext_predicate must not be used.
-    */
-   unsigned Predicates     : 1;
-
-   /*
-    * Destination register post-modulate.
-    *
-    * Constraints:
-    *    1. Field tgsi_dst_register_ext_modulate::Modulate
-    *       must be set to TGSI_MODULATE_1X.
-    */
-   unsigned DstModulate    : 1;
-
-   /*
-    * Condition codes (NVIDIA-specific).
-    *
-    * Constraints:
-    *    1. Token tgsi_dst_register_ext_concode must not be used.
-    *    2. Field tgsi_instruction_ext_nv::CondDstUpdate must be set to FALSE.
-    *    3. Field tgsi_instruction_ext_nv::CondFlowEnable must be set to FALSE.
-    */
-   unsigned ConCodes       : 1;
-
-   /*
-    * Source register invert.
-    *
-    * Constraints:
-    *    1. Field tgsi_src_register_ext_mod::Complement must be set to FALSE.
-    */
-   unsigned SrcInvert      : 1;
-
-   /*
-    * Source register bias.
-    *
-    * Constraints:
-    *    1. Field tgsi_src_register_ext_mod::Bias must be set to FALSE.
-    */
-   unsigned SrcBias        : 1;
-
-   /*
-    * Source register scale by 2.
-    *
-    * Constraints:
-    *    1. Field tgsi_src_register_ext_mod::Scale2X must be set to FALSE.
-    */
-   unsigned SrcScale       : 1;
-
-   /*
-    * Source register absolute.
-    *
-    * Constraints:
-    *    1. Field tgsi_src_register_ext_mod::Absolute must be set to FALSE.
-    */
-   unsigned SrcAbsolute    : 1;
-
-   /*
-    * Source register force sign.
-    *
-    * Constraints:
-    *    1. Fields tgsi_src_register_ext_mod::Absolute and
-    *       tgsi_src_register_ext_mod::Negate must not be both set to TRUE
-    *       at the same time.
-    */
-   unsigned SrcForceSign   : 1;
-
-   /*
-    * Source register divide.
-    *
-    * Constraints:
-    *    1. Field tgsi_src_register_ext_swz::ExtDivide
-    *       must be set to TGSI_EXTSWIZZLE_ONE.
-    */
-   unsigned SrcDivide      : 1;
-
-   /*
-    * Source register extended swizzle.
-    *
-    * Constraints:
-    *    1. Field tgsi_src_register_ext_swz::ExtSwizzleX/Y/Z/W
-    *       must be set to TGSI_EXTSWIZZLE_X/Y/Z/W.
-    *    2. Fields tgsi_src_register_ext_swz::NegateX/Y/Z/W
-    *       must all be set to the same value.
-    */
-   unsigned SrcExtSwizzle  : 1;
-
-   unsigned Padding        : 22;
-};
-
-void
-tgsi_deco_caps_init(
-   struct tgsi_deco_caps *caps );
-
-#if defined __cplusplus
-} // extern "C"
-#endif // defined __cplusplus
-
-#endif // !defined DECO_CAPS_H
-
diff --git a/src/mesa/pipe/tgsi/deco/tgsi_deco.h b/src/mesa/pipe/tgsi/deco/tgsi_deco.h
deleted file mode 100644 (file)
index 3560e45..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#if !defined TGSI_DECO_H
-#define TGSI_DECO_H
-
-#include "../exec/tgsi_core.h"
-#include "deco_caps.h"
-
-#endif // !defined TGSI_DECO_H
-
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_build.c b/src/mesa/pipe/tgsi/exec/tgsi_build.c
deleted file mode 100644 (file)
index 78f648a..0000000
+++ /dev/null
@@ -1,1368 +0,0 @@
-#include "tgsi_platform.h"
-#include "tgsi_core.h"
-
-/*
- * version
- */
-
-struct tgsi_version
-tgsi_build_version( void )
-{
-   struct tgsi_version  version;
-
-   version.MajorVersion = 1;
-   version.MinorVersion = 1;
-   version.Padding = 0;
-
-   return version;
-}
-
-/*
- * header
- */
-
-struct tgsi_header
-tgsi_build_header( void )
-{
-   struct tgsi_header header;
-
-   header.HeaderSize = 1;
-   header.BodySize = 0;
-
-   return header;
-}
-
-static void
-header_headersize_grow( struct tgsi_header *header )
-{
-   assert( header->HeaderSize < 0xFF );
-   assert( header->BodySize == 0 );
-
-   header->HeaderSize++;
-}
-
-static void
-header_bodysize_grow( struct tgsi_header *header )
-{
-   assert( header->BodySize < 0xFFFFFF );
-
-   header->BodySize++;
-}
-
-struct tgsi_processor
-tgsi_default_processor( void )
-{
-   struct tgsi_processor processor;
-
-   processor.Processor = TGSI_PROCESSOR_FRAGMENT;
-   processor.Padding = 0;
-
-   return processor;
-}
-
-struct tgsi_processor
-tgsi_build_processor(
-   unsigned type,
-   struct tgsi_header *header )
-{
-   struct tgsi_processor processor;
-
-   processor = tgsi_default_processor();
-   processor.Processor = type;
-
-   header_headersize_grow( header );
-
-   return processor;
-}
-
-/*
- * declaration
- */
-
-struct tgsi_declaration
-tgsi_default_declaration( void )
-{
-   struct tgsi_declaration declaration;
-
-   declaration.Type = TGSI_TOKEN_TYPE_DECLARATION;
-   declaration.Size = 1;
-   declaration.File = TGSI_FILE_NULL;
-   declaration.Declare = TGSI_DECLARE_RANGE;
-   declaration.UsageMask = TGSI_WRITEMASK_XYZW;
-   declaration.Interpolate = 0;
-   declaration.Semantic = 0;
-   declaration.Padding = 0;
-   declaration.Extended = 0;
-
-   return declaration;
-}
-
-struct tgsi_declaration
-tgsi_build_declaration(
-   unsigned file,
-   unsigned declare,
-   unsigned usage_mask,
-   unsigned interpolate,
-   unsigned semantic,
-   struct tgsi_header *header )
-{
-   struct tgsi_declaration declaration;
-
-   assert( file <= TGSI_FILE_IMMEDIATE );
-   assert( declare <= TGSI_DECLARE_MASK );
-
-   declaration = tgsi_default_declaration();
-   declaration.File = file;
-   declaration.Declare = declare;
-   declaration.UsageMask = usage_mask;
-   declaration.Interpolate = interpolate;
-   declaration.Semantic = semantic;
-
-   header_bodysize_grow( header );
-
-   return declaration;
-}
-
-static void
-declaration_grow(
-   struct tgsi_declaration *declaration,
-   struct tgsi_header *header )
-{
-   assert( declaration->Size < 0xFF );
-
-   declaration->Size++;
-
-   header_bodysize_grow( header );
-}
-
-struct tgsi_full_declaration
-tgsi_default_full_declaration( void )
-{
-   struct tgsi_full_declaration  full_declaration;
-
-   full_declaration.Declaration  = tgsi_default_declaration();
-   full_declaration.Interpolation = tgsi_default_declaration_interpolation();
-   full_declaration.Semantic = tgsi_default_declaration_semantic();
-
-   return full_declaration;
-}
-
-unsigned
-tgsi_build_full_declaration(
-   const struct tgsi_full_declaration *full_decl,
-   struct tgsi_token *tokens,
-   struct tgsi_header *header,
-   unsigned maxsize )
-{
-   unsigned size = 0;
-   struct tgsi_declaration *declaration;
-
-   if( maxsize <= size )
-     return 0;
-   declaration = (struct tgsi_declaration *) &tokens[size];
-   size++;
-
-   *declaration = tgsi_build_declaration(
-      full_decl->Declaration.File,
-      full_decl->Declaration.Declare,
-      full_decl->Declaration.UsageMask,
-      full_decl->Declaration.Interpolate,
-      full_decl->Declaration.Semantic,
-      header );
-
-   switch( full_decl->Declaration.Declare )  {
-   case TGSI_DECLARE_RANGE:
-   {
-      struct tgsi_declaration_range *dr;
-
-      if( maxsize <= size )
-         return 0;
-      dr = (struct tgsi_declaration_range *) &tokens[size];
-      size++;
-
-      *dr = tgsi_build_declaration_range(
-         full_decl->u.DeclarationRange.First,
-         full_decl->u.DeclarationRange.Last,
-         declaration,
-         header );
-      break;
-    }
-
-   case TGSI_DECLARE_MASK:
-   {
-      struct tgsi_declaration_mask *dm;
-
-      if( maxsize <= size )
-         return 0;
-      dm = (struct tgsi_declaration_mask  *) &tokens[size];
-      size++;
-
-      *dm = tgsi_build_declaration_mask(
-         full_decl->u.DeclarationMask.Mask,
-         declaration,
-         header );
-      break;
-   }
-
-   default:
-      assert( 0 );
-   }
-
-   if( full_decl->Declaration.Interpolate ) {
-      struct tgsi_declaration_interpolation *di;
-
-      if( maxsize <= size )
-         return  0;
-      di = (struct tgsi_declaration_interpolation *) &tokens[size];
-      size++;
-
-      *di = tgsi_build_declaration_interpolation(
-         full_decl->Interpolation.Interpolate,
-         declaration,
-         header );
-   }
-
-   if( full_decl->Declaration.Semantic ) {
-      struct tgsi_declaration_semantic *ds;
-
-      if( maxsize <= size )
-         return  0;
-      ds = (struct tgsi_declaration_semantic *) &tokens[size];
-      size++;
-
-      *ds = tgsi_build_declaration_semantic(
-         full_decl->Semantic.SemanticName,
-         full_decl->Semantic.SemanticIndex,
-         declaration,
-         header );
-   }
-
-   return size;
-}
-
-struct tgsi_declaration_range
-tgsi_build_declaration_range(
-   unsigned first,
-   unsigned last,
-   struct tgsi_declaration *declaration,
-   struct tgsi_header *header )
-{
-   struct tgsi_declaration_range declaration_range;
-
-   assert( last >= first );
-   assert( last <= 0xFFFF );
-
-   declaration_range.First = first;
-   declaration_range.Last = last;
-
-   declaration_grow( declaration, header );
-
-   return declaration_range;
-}
-
-struct tgsi_declaration_mask
-tgsi_build_declaration_mask(
-   unsigned mask,
-   struct tgsi_declaration *declaration,
-   struct tgsi_header *header )
-{
-   struct tgsi_declaration_mask  declaration_mask;
-
-   declaration_mask.Mask = mask;
-
-   declaration_grow( declaration, header );
-
-   return declaration_mask;
-}
-
-struct tgsi_declaration_interpolation
-tgsi_default_declaration_interpolation( void )
-{
-   struct tgsi_declaration_interpolation di;
-
-   di.Interpolate = TGSI_INTERPOLATE_CONSTANT;
-   di.Padding = 0;
-
-   return di;
-}
-
-struct tgsi_declaration_interpolation
-tgsi_build_declaration_interpolation(
-   unsigned interpolate,
-   struct tgsi_declaration *declaration,
-   struct tgsi_header *header )
-{
-   struct tgsi_declaration_interpolation di;
-
-   assert( interpolate <= TGSI_INTERPOLATE_PERSPECTIVE );
-
-   di = tgsi_default_declaration_interpolation();
-   di.Interpolate = interpolate;
-
-   declaration_grow( declaration, header );
-
-   return di;
-}
-
-struct tgsi_declaration_semantic
-tgsi_default_declaration_semantic( void )
-{
-   struct tgsi_declaration_semantic ds;
-
-   ds.SemanticName = TGSI_SEMANTIC_POSITION;
-   ds.SemanticIndex = 0;
-   ds.Padding = 0;
-
-   return ds;
-}
-
-struct tgsi_declaration_semantic
-tgsi_build_declaration_semantic(
-   unsigned semantic_name,
-   unsigned semantic_index,
-   struct tgsi_declaration *declaration,
-   struct tgsi_header *header )
-{
-   struct tgsi_declaration_semantic ds;
-
-   assert( semantic_name <= TGSI_SEMANTIC_COUNT );
-   assert( semantic_index <= 0xFFFF );
-
-   ds = tgsi_default_declaration_semantic();
-   ds.SemanticName = semantic_name;
-   ds.SemanticIndex = semantic_index;
-
-   declaration_grow( declaration, header );
-
-   return ds;
-}
-
-/*
- * immediate
- */
-
-struct tgsi_immediate
-tgsi_default_immediate( void )
-{
-   struct tgsi_immediate immediate;
-
-   immediate.Type = TGSI_TOKEN_TYPE_IMMEDIATE;
-   immediate.Size = 1;
-   immediate.DataType = TGSI_IMM_FLOAT32;
-   immediate.Padding = 0;
-   immediate.Extended = 0;
-
-   return immediate;
-}
-
-struct tgsi_immediate
-tgsi_build_immediate(
-   struct tgsi_header *header )
-{
-   struct tgsi_immediate immediate;
-
-   immediate = tgsi_default_immediate();
-
-   header_bodysize_grow( header  );
-
-   return immediate;
-}
-
-struct tgsi_full_immediate
-tgsi_default_full_immediate( void )
-{
-   struct tgsi_full_immediate fullimm;
-
-   fullimm.Immediate = tgsi_default_immediate();
-   fullimm.u.Pointer = (void *) 0;
-
-   return fullimm;
-}
-
-static void
-immediate_grow(
-   struct tgsi_immediate *immediate,
-   struct tgsi_header *header )
-{
-   assert( immediate->Size < 0xFF );
-
-   immediate->Size++;
-
-   header_bodysize_grow( header );
-}
-
-struct tgsi_immediate_float32
-tgsi_build_immediate_float32(
-   float value,
-   struct tgsi_immediate *immediate,
-   struct tgsi_header *header )
-{
-   struct tgsi_immediate_float32 immediate_float32;
-
-   immediate_float32.Float = value;
-
-   immediate_grow( immediate, header );
-
-   return immediate_float32;
-}
-
-unsigned
-tgsi_build_full_immediate(
-   const struct tgsi_full_immediate *full_imm,
-   struct tgsi_token *tokens,
-   struct tgsi_header *header,
-   unsigned maxsize )
-{
-   unsigned size = 0,  i;
-   struct tgsi_immediate *immediate;
-
-   if( maxsize <= size )
-      return 0;
-   immediate = (struct tgsi_immediate *) &tokens[size];
-   size++;
-
-   *immediate = tgsi_build_immediate( header );
-
-   for( i = 0; i < full_imm->Immediate.Size - 1; i++ ) {
-      struct tgsi_immediate_float32 *if32;
-
-      if( maxsize <= size )
-         return  0;
-      if32 = (struct tgsi_immediate_float32 *) &tokens[size];
-      size++;
-
-      *if32  = tgsi_build_immediate_float32(
-         full_imm->u.ImmediateFloat32[i].Float,
-         immediate,
-         header );
-   }
-
-   return size;
-}
-
-/*
- * instruction
- */
-
-struct tgsi_instruction
-tgsi_default_instruction( void )
-{
-   struct tgsi_instruction instruction;
-
-   instruction.Type = TGSI_TOKEN_TYPE_INSTRUCTION;
-   instruction.Size = 1;
-   instruction.Opcode = TGSI_OPCODE_MOV;
-   instruction.Saturate = TGSI_SAT_NONE;
-   instruction.NumDstRegs = 1;
-   instruction.NumSrcRegs = 1;
-   instruction.Padding  = 0;
-   instruction.Extended = 0;
-
-   return instruction;
-}
-
-struct tgsi_instruction
-tgsi_build_instruction(
-   unsigned opcode,
-   unsigned saturate,
-   unsigned num_dst_regs,
-   unsigned num_src_regs,
-   struct tgsi_header *header )
-{
-   struct tgsi_instruction instruction;
-
-   assert (opcode <= TGSI_OPCODE_LAST);
-   assert (saturate <= TGSI_SAT_MINUS_PLUS_ONE);
-   assert (num_dst_regs <= 3);
-   assert (num_src_regs <= 15);
-
-   instruction = tgsi_default_instruction();
-   instruction.Opcode = opcode;
-   instruction.Saturate = saturate;
-   instruction.NumDstRegs = num_dst_regs;
-   instruction.NumSrcRegs = num_src_regs;
-
-   header_bodysize_grow( header );
-
-   return instruction;
-}
-
-static void
-instruction_grow(
-   struct tgsi_instruction *instruction,
-   struct tgsi_header *header )
-{
-   assert (instruction->Size <   0xFF);
-
-   instruction->Size++;
-
-   header_bodysize_grow( header );
-}
-
-struct tgsi_full_instruction
-tgsi_default_full_instruction( void )
-{
-   struct tgsi_full_instruction full_instruction;
-   unsigned i;
-
-   full_instruction.Instruction = tgsi_default_instruction();
-   full_instruction.InstructionExtNv = tgsi_default_instruction_ext_nv();
-   full_instruction.InstructionExtLabel = tgsi_default_instruction_ext_label();
-   full_instruction.InstructionExtTexture = tgsi_default_instruction_ext_texture();
-   for( i = 0;  i < TGSI_FULL_MAX_DST_REGISTERS; i++ ) {
-      full_instruction.FullDstRegisters[i] = tgsi_default_full_dst_register();
-   }
-   for( i = 0;  i < TGSI_FULL_MAX_SRC_REGISTERS; i++ ) {
-      full_instruction.FullSrcRegisters[i] = tgsi_default_full_src_register();
-   }
-
-   return full_instruction;
-}
-
-unsigned
-tgsi_build_full_instruction(
-   const struct tgsi_full_instruction *full_inst,
-   struct  tgsi_token *tokens,
-   struct  tgsi_header *header,
-   unsigned  maxsize )
-{
-   unsigned size = 0;
-   unsigned i;
-   struct tgsi_instruction *instruction;
-   struct tgsi_token *prev_token;
-
-   if( maxsize <= size )
-      return 0;
-   instruction = (struct tgsi_instruction *) &tokens[size];
-   size++;
-
-   *instruction = tgsi_build_instruction(
-      full_inst->Instruction.Opcode,
-      full_inst->Instruction.Saturate,
-      full_inst->Instruction.NumDstRegs,
-      full_inst->Instruction.NumSrcRegs,
-      header );
-   prev_token = (struct tgsi_token  *) instruction;
-
-   if( tgsi_compare_instruction_ext_nv(
-         full_inst->InstructionExtNv,
-         tgsi_default_instruction_ext_nv() ) ) {
-      struct tgsi_instruction_ext_nv *instruction_ext_nv;
-
-      if( maxsize <= size )
-         return 0;
-      instruction_ext_nv =
-         (struct  tgsi_instruction_ext_nv *) &tokens[size];
-      size++;
-
-      *instruction_ext_nv  = tgsi_build_instruction_ext_nv(
-         full_inst->InstructionExtNv.Precision,
-         full_inst->InstructionExtNv.CondDstIndex,
-         full_inst->InstructionExtNv.CondFlowIndex,
-         full_inst->InstructionExtNv.CondMask,
-         full_inst->InstructionExtNv.CondSwizzleX,
-         full_inst->InstructionExtNv.CondSwizzleY,
-         full_inst->InstructionExtNv.CondSwizzleZ,
-         full_inst->InstructionExtNv.CondSwizzleW,
-         full_inst->InstructionExtNv.CondDstUpdate,
-         full_inst->InstructionExtNv.CondFlowEnable,
-         prev_token,
-         instruction,
-         header );
-      prev_token = (struct tgsi_token  *) instruction_ext_nv;
-   }
-
-   if( tgsi_compare_instruction_ext_label(
-         full_inst->InstructionExtLabel,
-         tgsi_default_instruction_ext_label() ) ) {
-      struct tgsi_instruction_ext_label *instruction_ext_label;
-
-      if( maxsize <= size )
-         return 0;
-      instruction_ext_label =
-         (struct  tgsi_instruction_ext_label *) &tokens[size];
-      size++;
-
-      *instruction_ext_label = tgsi_build_instruction_ext_label(
-         full_inst->InstructionExtLabel.Label,
-         prev_token,
-         instruction,
-         header );
-      prev_token = (struct tgsi_token  *) instruction_ext_label;
-   }
-
-   if( tgsi_compare_instruction_ext_texture(
-         full_inst->InstructionExtTexture,
-         tgsi_default_instruction_ext_texture() ) ) {
-      struct tgsi_instruction_ext_texture *instruction_ext_texture;
-
-      if( maxsize <= size )
-         return 0;
-      instruction_ext_texture =
-         (struct  tgsi_instruction_ext_texture *) &tokens[size];
-      size++;
-
-      *instruction_ext_texture = tgsi_build_instruction_ext_texture(
-         full_inst->InstructionExtTexture.Texture,
-         prev_token,
-         instruction,
-         header   );
-      prev_token = (struct tgsi_token  *) instruction_ext_texture;
-   }
-
-   for( i = 0;  i <   full_inst->Instruction.NumDstRegs; i++ ) {
-      const struct tgsi_full_dst_register *reg = &full_inst->FullDstRegisters[i];
-      struct tgsi_dst_register *dst_register;
-      struct tgsi_token *prev_token;
-
-      if( maxsize <= size )
-         return 0;
-      dst_register = (struct tgsi_dst_register *) &tokens[size];
-      size++;
-
-      *dst_register = tgsi_build_dst_register(
-         reg->DstRegister.File,
-         reg->DstRegister.WriteMask,
-         reg->DstRegister.Index,
-         instruction,
-         header );
-      prev_token = (struct tgsi_token  *) dst_register;
-
-      if( tgsi_compare_dst_register_ext_concode(
-            reg->DstRegisterExtConcode,
-            tgsi_default_dst_register_ext_concode() ) ) {
-         struct tgsi_dst_register_ext_concode *dst_register_ext_concode;
-
-         if( maxsize <= size )
-            return 0;
-         dst_register_ext_concode =
-            (struct  tgsi_dst_register_ext_concode *) &tokens[size];
-         size++;
-
-         *dst_register_ext_concode =   tgsi_build_dst_register_ext_concode(
-            reg->DstRegisterExtConcode.CondMask,
-            reg->DstRegisterExtConcode.CondSwizzleX,
-            reg->DstRegisterExtConcode.CondSwizzleY,
-            reg->DstRegisterExtConcode.CondSwizzleZ,
-            reg->DstRegisterExtConcode.CondSwizzleW,
-            reg->DstRegisterExtConcode.CondSrcIndex,
-            prev_token,
-            instruction,
-            header );
-         prev_token = (struct tgsi_token  *) dst_register_ext_concode;
-      }
-
-      if( tgsi_compare_dst_register_ext_modulate(
-            reg->DstRegisterExtModulate,
-            tgsi_default_dst_register_ext_modulate() ) ) {
-         struct tgsi_dst_register_ext_modulate *dst_register_ext_modulate;
-
-         if( maxsize <= size )
-            return 0;
-         dst_register_ext_modulate =
-            (struct  tgsi_dst_register_ext_modulate *) &tokens[size];
-         size++;
-
-         *dst_register_ext_modulate = tgsi_build_dst_register_ext_modulate(
-            reg->DstRegisterExtModulate.Modulate,
-            prev_token,
-            instruction,
-            header );
-         prev_token = (struct tgsi_token  *) dst_register_ext_modulate;
-      }
-   }
-
-   for( i = 0;  i < full_inst->Instruction.NumSrcRegs; i++ ) {
-      const struct tgsi_full_src_register *reg = &full_inst->FullSrcRegisters[i];
-      struct tgsi_src_register *src_register;
-      struct tgsi_token *prev_token;
-
-      if( maxsize <= size )
-         return 0;
-      src_register = (struct tgsi_src_register *)  &tokens[size];
-      size++;
-
-      *src_register = tgsi_build_src_register(
-         reg->SrcRegister.File,
-         reg->SrcRegister.SwizzleX,
-         reg->SrcRegister.SwizzleY,
-         reg->SrcRegister.SwizzleZ,
-         reg->SrcRegister.SwizzleW,
-         reg->SrcRegister.Negate,
-         reg->SrcRegister.Indirect,
-         reg->SrcRegister.Dimension,
-         reg->SrcRegister.Index,
-         instruction,
-         header );
-      prev_token = (struct tgsi_token  *) src_register;
-
-      if( tgsi_compare_src_register_ext_swz(
-            reg->SrcRegisterExtSwz,
-            tgsi_default_src_register_ext_swz() ) ) {
-         struct tgsi_src_register_ext_swz *src_register_ext_swz;
-
-         if( maxsize <= size )
-            return 0;
-         src_register_ext_swz =
-            (struct  tgsi_src_register_ext_swz *) &tokens[size];
-         size++;
-
-         *src_register_ext_swz = tgsi_build_src_register_ext_swz(
-            reg->SrcRegisterExtSwz.ExtSwizzleX,
-            reg->SrcRegisterExtSwz.ExtSwizzleY,
-            reg->SrcRegisterExtSwz.ExtSwizzleZ,
-            reg->SrcRegisterExtSwz.ExtSwizzleW,
-            reg->SrcRegisterExtSwz.NegateX,
-            reg->SrcRegisterExtSwz.NegateY,
-            reg->SrcRegisterExtSwz.NegateZ,
-            reg->SrcRegisterExtSwz.NegateW,
-            reg->SrcRegisterExtSwz.ExtDivide,
-            prev_token,
-            instruction,
-            header );
-         prev_token = (struct tgsi_token  *) src_register_ext_swz;
-      }
-
-      if( tgsi_compare_src_register_ext_mod(
-            reg->SrcRegisterExtMod,
-            tgsi_default_src_register_ext_mod() ) ) {
-         struct tgsi_src_register_ext_mod *src_register_ext_mod;
-
-         if( maxsize <= size )
-            return 0;
-         src_register_ext_mod =
-            (struct  tgsi_src_register_ext_mod *) &tokens[size];
-         size++;
-
-         *src_register_ext_mod = tgsi_build_src_register_ext_mod(
-            reg->SrcRegisterExtMod.Complement,
-            reg->SrcRegisterExtMod.Bias,
-            reg->SrcRegisterExtMod.Scale2X,
-            reg->SrcRegisterExtMod.Absolute,
-            reg->SrcRegisterExtMod.Negate,
-            prev_token,
-            instruction,
-            header );
-         prev_token = (struct tgsi_token  *) src_register_ext_mod;
-      }
-
-      if( reg->SrcRegister.Indirect ) {
-         struct  tgsi_src_register *ind;
-
-         if( maxsize <= size )
-            return 0;
-         ind = (struct tgsi_src_register *) &tokens[size];
-         size++;
-
-         *ind = tgsi_build_src_register(
-            reg->SrcRegisterInd.File,
-            reg->SrcRegisterInd.SwizzleX,
-            reg->SrcRegisterInd.SwizzleY,
-            reg->SrcRegisterInd.SwizzleZ,
-            reg->SrcRegisterInd.SwizzleW,
-            reg->SrcRegisterInd.Negate,
-            reg->SrcRegisterInd.Indirect,
-            reg->SrcRegisterInd.Dimension,
-            reg->SrcRegisterInd.Index,
-            instruction,
-            header );
-      }
-
-      if( reg->SrcRegister.Dimension ) {
-         struct  tgsi_dimension *dim;
-
-         assert( !reg->SrcRegisterDim.Dimension );
-
-         if( maxsize <= size )
-            return 0;
-         dim = (struct tgsi_dimension *) &tokens[size];
-         size++;
-
-         *dim = tgsi_build_dimension(
-            reg->SrcRegisterDim.Indirect,
-            reg->SrcRegisterDim.Index,
-            instruction,
-            header );
-
-         if( reg->SrcRegisterDim.Indirect ) {
-            struct tgsi_src_register *ind;
-
-            if( maxsize <= size )
-               return 0;
-            ind = (struct tgsi_src_register *) &tokens[size];
-            size++;
-
-            *ind = tgsi_build_src_register(
-               reg->SrcRegisterDimInd.File,
-               reg->SrcRegisterDimInd.SwizzleX,
-               reg->SrcRegisterDimInd.SwizzleY,
-               reg->SrcRegisterDimInd.SwizzleZ,
-               reg->SrcRegisterDimInd.SwizzleW,
-               reg->SrcRegisterDimInd.Negate,
-               reg->SrcRegisterDimInd.Indirect,
-               reg->SrcRegisterDimInd.Dimension,
-               reg->SrcRegisterDimInd.Index,
-               instruction,
-               header );
-         }
-      }
-   }
-
-   return size;
-}
-
-struct tgsi_instruction_ext_nv
-tgsi_default_instruction_ext_nv( void )
-{
-   struct tgsi_instruction_ext_nv instruction_ext_nv;
-
-   instruction_ext_nv.Type = TGSI_INSTRUCTION_EXT_TYPE_NV;
-   instruction_ext_nv.Precision = TGSI_PRECISION_DEFAULT;
-   instruction_ext_nv.CondDstIndex = 0;
-   instruction_ext_nv.CondFlowIndex = 0;
-   instruction_ext_nv.CondMask = TGSI_CC_TR;
-   instruction_ext_nv.CondSwizzleX = TGSI_SWIZZLE_X;
-   instruction_ext_nv.CondSwizzleY = TGSI_SWIZZLE_Y;
-   instruction_ext_nv.CondSwizzleZ = TGSI_SWIZZLE_Z;
-   instruction_ext_nv.CondSwizzleW = TGSI_SWIZZLE_W;
-   instruction_ext_nv.CondDstUpdate = 0;
-   instruction_ext_nv.CondFlowEnable = 0;
-   instruction_ext_nv.Padding = 0;
-   instruction_ext_nv.Extended = 0;
-
-   return instruction_ext_nv;
-}
-
-union token_u32
-{
-   unsigned u32;
-};
-
-unsigned
-tgsi_compare_instruction_ext_nv(
-   struct tgsi_instruction_ext_nv a,
-   struct tgsi_instruction_ext_nv b )
-{
-   a.Padding = b.Padding = 0;
-   a.Extended = b.Extended = 0;
-   return ((union token_u32 *) &a)->u32 != ((union token_u32 *) &b)->u32;
-}
-
-struct tgsi_instruction_ext_nv
-tgsi_build_instruction_ext_nv(
-   unsigned precision,
-   unsigned cond_dst_index,
-   unsigned cond_flow_index,
-   unsigned cond_mask,
-   unsigned cond_swizzle_x,
-   unsigned cond_swizzle_y,
-   unsigned cond_swizzle_z,
-   unsigned cond_swizzle_w,
-   unsigned cond_dst_update,
-   unsigned cond_flow_update,
-   struct tgsi_token *prev_token,
-   struct tgsi_instruction *instruction,
-   struct tgsi_header *header )
-{
-   struct tgsi_instruction_ext_nv instruction_ext_nv;
-
-   instruction_ext_nv = tgsi_default_instruction_ext_nv();
-   instruction_ext_nv.Precision = precision;
-   instruction_ext_nv.CondDstIndex = cond_dst_index;
-   instruction_ext_nv.CondFlowIndex = cond_flow_index;
-   instruction_ext_nv.CondMask = cond_mask;
-   instruction_ext_nv.CondSwizzleX = cond_swizzle_x;
-   instruction_ext_nv.CondSwizzleY = cond_swizzle_y;
-   instruction_ext_nv.CondSwizzleZ = cond_swizzle_z;
-   instruction_ext_nv.CondSwizzleW = cond_swizzle_w;
-   instruction_ext_nv.CondDstUpdate = cond_dst_update;
-   instruction_ext_nv.CondFlowEnable = cond_flow_update;
-
-   prev_token->Extended = 1;
-   instruction_grow( instruction, header );
-
-   return instruction_ext_nv;
-}
-
-struct tgsi_instruction_ext_label
-tgsi_default_instruction_ext_label( void )
-{
-   struct tgsi_instruction_ext_label instruction_ext_label;
-
-   instruction_ext_label.Type = TGSI_INSTRUCTION_EXT_TYPE_LABEL;
-   instruction_ext_label.Label = 0;
-   instruction_ext_label.Padding = 0;
-   instruction_ext_label.Extended = 0;
-
-   return instruction_ext_label;
-}
-
-unsigned
-tgsi_compare_instruction_ext_label(
-   struct tgsi_instruction_ext_label a,
-   struct tgsi_instruction_ext_label b )
-{
-   a.Padding = b.Padding = 0;
-   a.Extended = b.Extended = 0;
-   return ((union token_u32 *) &a)->u32 != ((union token_u32 *) &b)->u32;
-}
-
-struct tgsi_instruction_ext_label
-tgsi_build_instruction_ext_label(
-   unsigned label,
-   struct tgsi_token  *prev_token,
-   struct tgsi_instruction *instruction,
-   struct tgsi_header *header )
-{
-   struct tgsi_instruction_ext_label instruction_ext_label;
-
-   instruction_ext_label = tgsi_default_instruction_ext_label();
-   instruction_ext_label.Label = label;
-
-   prev_token->Extended = 1;
-   instruction_grow( instruction, header );
-
-   return instruction_ext_label;
-}
-
-struct tgsi_instruction_ext_texture
-tgsi_default_instruction_ext_texture( void )
-{
-   struct tgsi_instruction_ext_texture instruction_ext_texture;
-
-   instruction_ext_texture.Type = TGSI_INSTRUCTION_EXT_TYPE_TEXTURE;
-   instruction_ext_texture.Texture = TGSI_TEXTURE_UNKNOWN;
-   instruction_ext_texture.Padding = 0;
-   instruction_ext_texture.Extended = 0;
-
-   return instruction_ext_texture;
-}
-
-unsigned
-tgsi_compare_instruction_ext_texture(
-   struct tgsi_instruction_ext_texture a,
-   struct tgsi_instruction_ext_texture b )
-{
-   a.Padding = b.Padding = 0;
-   a.Extended = b.Extended = 0;
-   return ((union token_u32 *) &a)->u32 != ((union token_u32 *) &b)->u32;
-}
-
-struct tgsi_instruction_ext_texture
-tgsi_build_instruction_ext_texture(
-   unsigned texture,
-   struct tgsi_token *prev_token,
-   struct tgsi_instruction *instruction,
-   struct tgsi_header *header )
-{
-   struct tgsi_instruction_ext_texture instruction_ext_texture;
-
-   instruction_ext_texture = tgsi_default_instruction_ext_texture();
-   instruction_ext_texture.Texture = texture;
-
-   prev_token->Extended = 1;
-   instruction_grow( instruction, header );
-
-   return instruction_ext_texture;
-}
-
-struct tgsi_src_register
-tgsi_default_src_register( void )
-{
-   struct tgsi_src_register src_register;
-
-   src_register.File = TGSI_FILE_NULL;
-   src_register.SwizzleX = TGSI_SWIZZLE_X;
-   src_register.SwizzleY = TGSI_SWIZZLE_Y;
-   src_register.SwizzleZ = TGSI_SWIZZLE_Z;
-   src_register.SwizzleW = TGSI_SWIZZLE_W;
-   src_register.Negate = 0;
-   src_register.Indirect = 0;
-   src_register.Dimension = 0;
-   src_register.Index = 0;
-   src_register.Extended = 0;
-
-   return src_register;
-}
-
-struct tgsi_src_register
-tgsi_build_src_register(
-   unsigned file,
-   unsigned swizzle_x,
-   unsigned swizzle_y,
-   unsigned swizzle_z,
-   unsigned swizzle_w,
-   unsigned negate,
-   unsigned indirect,
-   unsigned dimension,
-   int index,
-   struct tgsi_instruction *instruction,
-   struct tgsi_header *header )
-{
-   struct tgsi_src_register   src_register;
-
-   assert( file <= TGSI_FILE_IMMEDIATE );
-   assert( swizzle_x <= TGSI_SWIZZLE_W );
-   assert( swizzle_y <= TGSI_SWIZZLE_W );
-   assert( swizzle_z <= TGSI_SWIZZLE_W );
-   assert( swizzle_w <= TGSI_SWIZZLE_W );
-   assert( negate <= 1 );
-   assert( index >= -0x8000 && index <= 0x7FFF );
-
-   src_register = tgsi_default_src_register();
-   src_register.File = file;
-   src_register.SwizzleX = swizzle_x;
-   src_register.SwizzleY = swizzle_y;
-   src_register.SwizzleZ = swizzle_z;
-   src_register.SwizzleW = swizzle_w;
-   src_register.Negate = negate;
-   src_register.Indirect = indirect;
-   src_register.Dimension = dimension;
-   src_register.Index = index;
-
-   instruction_grow( instruction, header );
-
-   return src_register;
-}
-
-struct tgsi_full_src_register
-tgsi_default_full_src_register( void )
-{
-   struct tgsi_full_src_register full_src_register;
-
-   full_src_register.SrcRegister = tgsi_default_src_register();
-   full_src_register.SrcRegisterExtSwz = tgsi_default_src_register_ext_swz();
-   full_src_register.SrcRegisterExtMod = tgsi_default_src_register_ext_mod();
-   full_src_register.SrcRegisterInd = tgsi_default_src_register();
-   full_src_register.SrcRegisterDim = tgsi_default_dimension();
-   full_src_register.SrcRegisterDimInd = tgsi_default_src_register();
-
-   return full_src_register;
-}
-
-struct tgsi_src_register_ext_swz
-tgsi_default_src_register_ext_swz( void )
-{
-   struct tgsi_src_register_ext_swz src_register_ext_swz;
-
-   src_register_ext_swz.Type = TGSI_SRC_REGISTER_EXT_TYPE_SWZ;
-   src_register_ext_swz.ExtSwizzleX = TGSI_EXTSWIZZLE_X;
-   src_register_ext_swz.ExtSwizzleY = TGSI_EXTSWIZZLE_Y;
-   src_register_ext_swz.ExtSwizzleZ = TGSI_EXTSWIZZLE_Z;
-   src_register_ext_swz.ExtSwizzleW = TGSI_EXTSWIZZLE_W;
-   src_register_ext_swz.NegateX = 0;
-   src_register_ext_swz.NegateY = 0;
-   src_register_ext_swz.NegateZ = 0;
-   src_register_ext_swz.NegateW = 0;
-   src_register_ext_swz.ExtDivide = TGSI_EXTSWIZZLE_ONE;
-   src_register_ext_swz.Padding = 0;
-   src_register_ext_swz.Extended = 0;
-
-   return src_register_ext_swz;
-}
-
-unsigned
-tgsi_compare_src_register_ext_swz(
-   struct tgsi_src_register_ext_swz a,
-   struct tgsi_src_register_ext_swz b )
-{
-   a.Padding = b.Padding = 0;
-   a.Extended = b.Extended = 0;
-   return ((union token_u32 *) &a)->u32 != ((union token_u32 *) &b)->u32;
-}
-
-struct tgsi_src_register_ext_swz
-tgsi_build_src_register_ext_swz(
-   unsigned ext_swizzle_x,
-   unsigned ext_swizzle_y,
-   unsigned ext_swizzle_z,
-   unsigned ext_swizzle_w,
-   unsigned negate_x,
-   unsigned negate_y,
-   unsigned negate_z,
-   unsigned negate_w,
-   unsigned ext_divide,
-   struct tgsi_token *prev_token,
-   struct tgsi_instruction *instruction,
-   struct tgsi_header *header )
-{
-   struct tgsi_src_register_ext_swz src_register_ext_swz;
-
-   assert( ext_swizzle_x <= TGSI_EXTSWIZZLE_ONE );
-   assert( ext_swizzle_y <= TGSI_EXTSWIZZLE_ONE );
-   assert( ext_swizzle_z <= TGSI_EXTSWIZZLE_ONE );
-   assert( ext_swizzle_w <= TGSI_EXTSWIZZLE_ONE );
-   assert( negate_x <= 1 );
-   assert( negate_y <= 1 );
-   assert( negate_z <= 1 );
-   assert( negate_w <= 1 );
-   assert( ext_divide <= TGSI_EXTSWIZZLE_ONE );
-
-   src_register_ext_swz = tgsi_default_src_register_ext_swz();
-   src_register_ext_swz.ExtSwizzleX = ext_swizzle_x;
-   src_register_ext_swz.ExtSwizzleY = ext_swizzle_y;
-   src_register_ext_swz.ExtSwizzleZ = ext_swizzle_z;
-   src_register_ext_swz.ExtSwizzleW = ext_swizzle_w;
-   src_register_ext_swz.NegateX = negate_x;
-   src_register_ext_swz.NegateY = negate_y;
-   src_register_ext_swz.NegateZ = negate_z;
-   src_register_ext_swz.NegateW = negate_w;
-   src_register_ext_swz.ExtDivide = ext_divide;
-
-   prev_token->Extended = 1;
-   instruction_grow( instruction, header );
-
-   return src_register_ext_swz;
-}
-
-struct tgsi_src_register_ext_mod
-tgsi_default_src_register_ext_mod( void )
-{
-   struct tgsi_src_register_ext_mod src_register_ext_mod;
-
-   src_register_ext_mod.Type = TGSI_SRC_REGISTER_EXT_TYPE_MOD;
-   src_register_ext_mod.Complement = 0;
-   src_register_ext_mod.Bias = 0;
-   src_register_ext_mod.Scale2X = 0;
-   src_register_ext_mod.Absolute = 0;
-   src_register_ext_mod.Negate = 0;
-   src_register_ext_mod.Padding = 0;
-   src_register_ext_mod.Extended = 0;
-
-   return src_register_ext_mod;
-}
-
-unsigned
-tgsi_compare_src_register_ext_mod(
-   struct tgsi_src_register_ext_mod a,
-   struct tgsi_src_register_ext_mod b )
-{
-   a.Padding = b.Padding = 0;
-   a.Extended = b.Extended = 0;
-   return ((union token_u32 *) &a)->u32 != ((union token_u32 *) &b)->u32;
-}
-
-struct tgsi_src_register_ext_mod
-tgsi_build_src_register_ext_mod(
-   unsigned complement,
-   unsigned bias,
-   unsigned scale_2x,
-   unsigned absolute,
-   unsigned negate,
-   struct tgsi_token *prev_token,
-   struct tgsi_instruction *instruction,
-   struct tgsi_header *header )
-{
-   struct tgsi_src_register_ext_mod src_register_ext_mod;
-
-   assert( complement <= 1 );
-   assert( bias <= 1 );
-   assert( scale_2x <= 1 );
-   assert( absolute <= 1 );
-   assert( negate <= 1 );
-
-   src_register_ext_mod = tgsi_default_src_register_ext_mod();
-   src_register_ext_mod.Complement = complement;
-   src_register_ext_mod.Bias = bias;
-   src_register_ext_mod.Scale2X = scale_2x;
-   src_register_ext_mod.Absolute = absolute;
-   src_register_ext_mod.Negate = negate;
-
-   prev_token->Extended = 1;
-   instruction_grow( instruction, header );
-
-   return src_register_ext_mod;
-}
-
-struct tgsi_dimension
-tgsi_default_dimension( void )
-{
-   struct tgsi_dimension dimension;
-
-   dimension.Indirect = 0;
-   dimension.Dimension = 0;
-   dimension.Padding = 0;
-   dimension.Index = 0;
-   dimension.Extended = 0;
-
-   return dimension;
-}
-
-struct tgsi_dimension
-tgsi_build_dimension(
-   unsigned indirect,
-   unsigned index,
-   struct tgsi_instruction *instruction,
-   struct tgsi_header *header )
-{
-   struct tgsi_dimension dimension;
-
-   dimension = tgsi_default_dimension();
-   dimension.Indirect = indirect;
-   dimension.Index = index;
-
-   instruction_grow( instruction, header );
-
-   return dimension;
-}
-
-struct tgsi_dst_register
-tgsi_default_dst_register( void )
-{
-   struct tgsi_dst_register dst_register;
-
-   dst_register.File = TGSI_FILE_NULL;
-   dst_register.WriteMask = TGSI_WRITEMASK_XYZW;
-   dst_register.Indirect = 0;
-   dst_register.Dimension = 0;
-   dst_register.Index = 0;
-   dst_register.Padding = 0;
-   dst_register.Extended = 0;
-
-   return dst_register;
-}
-
-struct tgsi_dst_register
-tgsi_build_dst_register(
-   unsigned file,
-   unsigned mask,
-   int index,
-   struct tgsi_instruction *instruction,
-   struct tgsi_header *header )
-{
-   struct tgsi_dst_register dst_register;
-
-   assert( file <= TGSI_FILE_IMMEDIATE );
-   assert( mask <= TGSI_WRITEMASK_XYZW );
-   assert( index >= -32768 && index <= 32767 );
-
-   dst_register = tgsi_default_dst_register();
-   dst_register.File = file;
-   dst_register.WriteMask = mask;
-   dst_register.Index = index;
-
-   instruction_grow( instruction, header );
-
-   return dst_register;
-}
-
-struct tgsi_full_dst_register
-tgsi_default_full_dst_register( void )
-{
-   struct tgsi_full_dst_register full_dst_register;
-
-   full_dst_register.DstRegister = tgsi_default_dst_register();
-   full_dst_register.DstRegisterExtConcode =
-      tgsi_default_dst_register_ext_concode();
-   full_dst_register.DstRegisterExtModulate =
-      tgsi_default_dst_register_ext_modulate();
-
-   return full_dst_register;
-}
-
-struct tgsi_dst_register_ext_concode
-tgsi_default_dst_register_ext_concode( void )
-{
-   struct tgsi_dst_register_ext_concode dst_register_ext_concode;
-
-   dst_register_ext_concode.Type = TGSI_DST_REGISTER_EXT_TYPE_CONDCODE;
-   dst_register_ext_concode.CondMask = TGSI_CC_TR;
-   dst_register_ext_concode.CondSwizzleX = TGSI_SWIZZLE_X;
-   dst_register_ext_concode.CondSwizzleY = TGSI_SWIZZLE_Y;
-   dst_register_ext_concode.CondSwizzleZ = TGSI_SWIZZLE_Z;
-   dst_register_ext_concode.CondSwizzleW = TGSI_SWIZZLE_W;
-   dst_register_ext_concode.CondSrcIndex = 0;
-   dst_register_ext_concode.Padding = 0;
-   dst_register_ext_concode.Extended = 0;
-
-   return dst_register_ext_concode;
-}
-
-unsigned
-tgsi_compare_dst_register_ext_concode(
-   struct tgsi_dst_register_ext_concode a,
-   struct tgsi_dst_register_ext_concode b )
-{
-   a.Padding = b.Padding = 0;
-   a.Extended = b.Extended = 0;
-   return ((union token_u32 *) &a)->u32 != ((union token_u32 *) &b)->u32;
-}
-
-struct tgsi_dst_register_ext_concode
-tgsi_build_dst_register_ext_concode(
-   unsigned cc,
-   unsigned swizzle_x,
-   unsigned swizzle_y,
-   unsigned swizzle_z,
-   unsigned swizzle_w,
-   int index,
-   struct tgsi_token *prev_token,
-   struct tgsi_instruction *instruction,
-   struct tgsi_header *header )
-{
-   struct tgsi_dst_register_ext_concode dst_register_ext_concode;
-
-   assert( cc <= TGSI_CC_FL );
-   assert( swizzle_x <= TGSI_SWIZZLE_W );
-   assert( swizzle_y <= TGSI_SWIZZLE_W );
-   assert( swizzle_z <= TGSI_SWIZZLE_W );
-   assert( swizzle_w <= TGSI_SWIZZLE_W );
-   assert( index >= -32768 && index <= 32767 );
-
-   dst_register_ext_concode = tgsi_default_dst_register_ext_concode();
-   dst_register_ext_concode.CondMask = cc;
-   dst_register_ext_concode.CondSwizzleX = swizzle_x;
-   dst_register_ext_concode.CondSwizzleY = swizzle_y;
-   dst_register_ext_concode.CondSwizzleZ = swizzle_z;
-   dst_register_ext_concode.CondSwizzleW = swizzle_w;
-   dst_register_ext_concode.CondSrcIndex = index;
-
-   prev_token->Extended = 1;
-   instruction_grow( instruction, header );
-
-   return dst_register_ext_concode;
-}
-
-struct tgsi_dst_register_ext_modulate
-tgsi_default_dst_register_ext_modulate( void )
-{
-   struct tgsi_dst_register_ext_modulate dst_register_ext_modulate;
-
-   dst_register_ext_modulate.Type = TGSI_DST_REGISTER_EXT_TYPE_MODULATE;
-   dst_register_ext_modulate.Modulate = TGSI_MODULATE_1X;
-   dst_register_ext_modulate.Padding = 0;
-   dst_register_ext_modulate.Extended = 0;
-
-   return dst_register_ext_modulate;
-}
-
-unsigned
-tgsi_compare_dst_register_ext_modulate(
-   struct tgsi_dst_register_ext_modulate a,
-   struct tgsi_dst_register_ext_modulate b )
-{
-   a.Padding = b.Padding = 0;
-   a.Extended = b.Extended = 0;
-   return ((union token_u32 *) &a)->u32 != ((union token_u32 *) &b)->u32;
-}
-
-struct tgsi_dst_register_ext_modulate
-tgsi_build_dst_register_ext_modulate(
-   unsigned modulate,
-   struct tgsi_token *prev_token,
-   struct tgsi_instruction *instruction,
-   struct tgsi_header *header )
-{
-   struct tgsi_dst_register_ext_modulate dst_register_ext_modulate;
-
-   assert( modulate <= TGSI_MODULATE_EIGHTH );
-
-   dst_register_ext_modulate = tgsi_default_dst_register_ext_modulate();
-   dst_register_ext_modulate.Modulate = modulate;
-
-   prev_token->Extended = 1;
-   instruction_grow( instruction, header );
-
-   return dst_register_ext_modulate;
-}
-
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_build.h b/src/mesa/pipe/tgsi/exec/tgsi_build.h
deleted file mode 100644 (file)
index 116c78a..0000000
+++ /dev/null
@@ -1,320 +0,0 @@
-#if !defined TGSI_BUILD_H
-#define TGSI_BUILD_H
-
-#if defined __cplusplus
-extern "C" {
-#endif // defined __cplusplus
-
-/*
- * version
- */
-
-struct tgsi_version
-tgsi_build_version( void );
-
-/*
- * header
- */
-
-struct tgsi_header
-tgsi_build_header( void );
-
-struct tgsi_processor
-tgsi_default_processor( void );
-
-struct tgsi_processor
-tgsi_build_processor(
-   unsigned processor,
-   struct tgsi_header *header );
-
-/*
- * declaration
- */
-
-struct tgsi_declaration
-tgsi_default_declaration( void );
-
-struct tgsi_declaration
-tgsi_build_declaration(
-   unsigned file,
-   unsigned declare,
-   unsigned usage_mask,
-   unsigned interpolate,
-   unsigned semantic,
-   struct tgsi_header *header );
-
-struct tgsi_full_declaration
-tgsi_default_full_declaration( void );
-
-unsigned
-tgsi_build_full_declaration(
-   const struct tgsi_full_declaration *full_decl,
-   struct tgsi_token *tokens,
-   struct tgsi_header *header,
-   unsigned maxsize );
-
-struct tgsi_declaration_range
-tgsi_build_declaration_range(
-   unsigned first,
-   unsigned last,
-   struct tgsi_declaration *declaration,
-   struct tgsi_header *header );
-
-struct tgsi_declaration_mask
-tgsi_build_declaration_mask(
-   unsigned mask,
-   struct tgsi_declaration *declaration,
-   struct tgsi_header *header );
-
-struct tgsi_declaration_interpolation
-tgsi_default_declaration_interpolation( void );
-
-struct tgsi_declaration_interpolation
-tgsi_build_declaration_interpolation(
-   unsigned interpolate,
-   struct tgsi_declaration *declaration,
-   struct tgsi_header *header );
-
-struct tgsi_declaration_semantic
-tgsi_default_declaration_semantic( void );
-
-struct tgsi_declaration_semantic
-tgsi_build_declaration_semantic(
-   unsigned semantic_name,
-   unsigned semantic_index,
-   struct tgsi_declaration *declaration,
-   struct tgsi_header *header );
-
-/*
- * immediate
- */
-
-struct tgsi_immediate
-tgsi_default_immediate( void );
-
-struct tgsi_immediate
-tgsi_build_immediate(
-   struct tgsi_header *header );
-
-struct tgsi_full_immediate
-tgsi_default_full_immediate( void );
-
-struct tgsi_immediate_float32
-tgsi_build_immediate_float32(
-   float value,
-   struct tgsi_immediate *immediate,
-   struct tgsi_header *header );
-
-unsigned
-tgsi_build_full_immediate(
-   const struct tgsi_full_immediate *full_imm,
-   struct tgsi_token *tokens,
-   struct tgsi_header *header,
-   unsigned maxsize );
-
-/*
- * instruction
- */
-
-struct tgsi_instruction
-tgsi_default_instruction( void );
-
-struct tgsi_instruction
-tgsi_build_instruction(
-   unsigned opcode,
-   unsigned saturate,
-   unsigned num_dst_regs,
-   unsigned num_src_regs,
-   struct tgsi_header *header );
-
-struct tgsi_full_instruction
-tgsi_default_full_instruction( void );
-
-unsigned
-tgsi_build_full_instruction(
-   const struct tgsi_full_instruction *full_inst,
-   struct tgsi_token *tokens,
-   struct tgsi_header *header,
-   unsigned maxsize );
-
-struct tgsi_instruction_ext_nv
-tgsi_default_instruction_ext_nv( void );
-
-unsigned
-tgsi_compare_instruction_ext_nv(
-   struct tgsi_instruction_ext_nv a,
-   struct tgsi_instruction_ext_nv b );
-
-struct tgsi_instruction_ext_nv
-tgsi_build_instruction_ext_nv(
-   unsigned precision,
-   unsigned cond_dst_index,
-   unsigned cond_flow_index,
-   unsigned cond_mask,
-   unsigned cond_swizzle_x,
-   unsigned cond_swizzle_y,
-   unsigned cond_swizzle_z,
-   unsigned cond_swizzle_w,
-   unsigned cond_dst_update,
-   unsigned cond_flow_update,
-   struct tgsi_token *prev_token,
-   struct tgsi_instruction *instruction,
-   struct tgsi_header *header );
-
-struct tgsi_instruction_ext_label
-tgsi_default_instruction_ext_label( void );
-
-unsigned
-tgsi_compare_instruction_ext_label(
-   struct tgsi_instruction_ext_label a,
-   struct tgsi_instruction_ext_label b );
-
-struct tgsi_instruction_ext_label
-tgsi_build_instruction_ext_label(
-   unsigned label,
-   struct tgsi_token *prev_token,
-   struct tgsi_instruction *instruction,
-   struct tgsi_header *header );
-
-struct tgsi_instruction_ext_texture
-tgsi_default_instruction_ext_texture( void );
-
-unsigned
-tgsi_compare_instruction_ext_texture(
-   struct tgsi_instruction_ext_texture a,
-   struct tgsi_instruction_ext_texture b );
-
-struct tgsi_instruction_ext_texture
-tgsi_build_instruction_ext_texture(
-   unsigned texture,
-   struct tgsi_token *prev_token,
-   struct tgsi_instruction *instruction,
-   struct tgsi_header *header );
-
-struct tgsi_src_register
-tgsi_default_src_register( void );
-
-struct tgsi_src_register
-tgsi_build_src_register(
-   unsigned file,
-   unsigned swizzle_x,
-   unsigned swizzle_y,
-   unsigned swizzle_z,
-   unsigned swizzle_w,
-   unsigned negate,
-   unsigned indirect,
-   unsigned dimension,
-   int index,
-   struct tgsi_instruction *instruction,
-   struct tgsi_header *header );
-
-struct tgsi_full_src_register
-tgsi_default_full_src_register( void );
-
-struct tgsi_src_register_ext_swz
-tgsi_default_src_register_ext_swz( void );
-
-unsigned
-tgsi_compare_src_register_ext_swz(
-   struct tgsi_src_register_ext_swz a,
-   struct tgsi_src_register_ext_swz b );
-
-struct tgsi_src_register_ext_swz
-tgsi_build_src_register_ext_swz(
-   unsigned ext_swizzle_x,
-   unsigned ext_swizzle_y,
-   unsigned ext_swizzle_z,
-   unsigned ext_swizzle_w,
-   unsigned negate_x,
-   unsigned negate_y,
-   unsigned negate_z,
-   unsigned negate_w,
-   unsigned ext_divide,
-   struct tgsi_token *prev_token,
-   struct tgsi_instruction *instruction,
-   struct tgsi_header *header );
-
-struct tgsi_src_register_ext_mod
-tgsi_default_src_register_ext_mod( void );
-
-unsigned
-tgsi_compare_src_register_ext_mod(
-   struct tgsi_src_register_ext_mod a,
-   struct tgsi_src_register_ext_mod b );
-
-struct tgsi_src_register_ext_mod
-tgsi_build_src_register_ext_mod(
-   unsigned complement,
-   unsigned bias,
-   unsigned scale_2x,
-   unsigned absolute,
-   unsigned negate,
-   struct tgsi_token *prev_token,
-   struct tgsi_instruction *instruction,
-   struct tgsi_header *header );
-
-struct tgsi_dimension
-tgsi_default_dimension( void );
-
-struct tgsi_dimension
-tgsi_build_dimension(
-   unsigned indirect,
-   unsigned index,
-   struct tgsi_instruction *instruction,
-   struct tgsi_header *header );
-
-struct tgsi_dst_register
-tgsi_default_dst_register( void );
-
-struct tgsi_dst_register
-tgsi_build_dst_register(
-   unsigned file,
-   unsigned mask,
-   int index,
-   struct tgsi_instruction *instruction,
-   struct tgsi_header *header );
-
-struct tgsi_full_dst_register
-tgsi_default_full_dst_register( void );
-
-struct tgsi_dst_register_ext_concode
-tgsi_default_dst_register_ext_concode( void );
-
-unsigned
-tgsi_compare_dst_register_ext_concode(
-   struct tgsi_dst_register_ext_concode a,
-   struct tgsi_dst_register_ext_concode b );
-
-struct tgsi_dst_register_ext_concode
-tgsi_build_dst_register_ext_concode(
-   unsigned cc,
-   unsigned swizzle_x,
-   unsigned swizzle_y,
-   unsigned swizzle_z,
-   unsigned swizzle_w,
-   int index,
-   struct tgsi_token *prev_token,
-   struct tgsi_instruction *instruction,
-   struct tgsi_header *header );
-
-struct tgsi_dst_register_ext_modulate
-tgsi_default_dst_register_ext_modulate( void );
-
-unsigned
-tgsi_compare_dst_register_ext_modulate(
-   struct tgsi_dst_register_ext_modulate a,
-   struct tgsi_dst_register_ext_modulate b );
-
-struct tgsi_dst_register_ext_modulate
-tgsi_build_dst_register_ext_modulate(
-   unsigned modulate,
-   struct tgsi_token *prev_token,
-   struct tgsi_instruction *instruction,
-   struct tgsi_header *header );
-
-#if defined __cplusplus
-} // extern "C"
-#endif // defined __cplusplus
-
-#endif // !defined TGSI_BUILD_H
-
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_core.h b/src/mesa/pipe/tgsi/exec/tgsi_core.h
deleted file mode 100644 (file)
index 30ad801..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#if !defined TGSI_CORE_H
-#define TGSI_CORE_H
-
-#include "tgsi_token.h"
-#include "tgsi_parse.h"
-#include "tgsi_build.h"
-#include "tgsi_exec.h"
-#include "tgsi_dump.h"
-#include "tgsi_util.h"
-#include "tgsi_sse2.h"
-
-#endif // !defined TGSI_CORE_H
-
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_dump.c b/src/mesa/pipe/tgsi/exec/tgsi_dump.c
deleted file mode 100644 (file)
index 1df71ef..0000000
+++ /dev/null
@@ -1,1456 +0,0 @@
-/**************************************************************************
- * 
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- * 
- **************************************************************************/
-
-#include "tgsi_platform.h"
-#include "tgsi_core.h"
-
-struct text_dump
-{
-   FILE     *file;
-   unsigned tabs;
-};
-
-static void
-text_dump_str(
-   struct text_dump *dump,
-   const char *str )
-{
-   unsigned i;
-   size_t len = strlen( str );
-
-   for( i = 0; i < len; i++ ) {
-      fprintf( dump->file, "%c", str[i] );
-
-      if( str[i] == '\n' ) {
-         unsigned i;
-
-         for( i = 0; i < dump->tabs; i++ ) {
-            fprintf( dump->file, "    " );
-         }
-      }
-   }
-}
-
-static void
-text_dump_chr(
-   struct text_dump *dump,
-   const char chr )
-{
-   char str[2];
-
-   str[0] = chr;
-   str[1] = '\0';
-   text_dump_str( dump, str );
-}
-
-static void
-text_dump_uix(
-   struct text_dump *dump,
-   const unsigned ui )
-{
-   char str[36];
-
-   sprintf( str, "0x%x", ui );
-   text_dump_str( dump, str );
-}
-
-static void
-text_dump_uid(
-   struct text_dump *dump,
-   const unsigned ui )
-{
-   char str[16];
-
-   sprintf( str, "%u", ui );
-   text_dump_str( dump, str );
-}
-
-static void
-text_dump_sid(
-   struct text_dump *dump,
-   const int si )
-{
-   char str[16];
-
-   sprintf( str, "%d", si );
-   text_dump_str( dump, str );
-}
-
-static void
-text_dump_flt(
-   struct text_dump *dump,
-   const float f )
-{
-   char str[48];
-
-   sprintf( str, "%10.4f", f );
-   text_dump_str( dump, str );
-}
-
-static void
-text_dump_enum(
-   struct text_dump *dump,
-   const unsigned e,
-   const char **enums,
-   const unsigned enums_count )
-{
-   if( e >= enums_count ) {
-      text_dump_uid( dump, e );
-   }
-   else {
-      text_dump_str( dump, enums[e] );
-   }
-}
-
-static void
-text_dump_tab(
-   struct text_dump *dump )
-{
-   dump->tabs++;
-}
-
-static void
-text_dump_untab(
-   struct text_dump *dump )
-{
-   assert( dump->tabs > 0 );
-
-   --dump->tabs;
-}
-
-#define TXT(S)          text_dump_str( dump, S )
-#define CHR(C)          text_dump_chr( dump, C )
-#define UIX(I)          text_dump_uix( dump, I )
-#define UID(I)          text_dump_uid( dump, I )
-#define SID(I)          text_dump_sid( dump, I )
-#define FLT(F)          text_dump_flt( dump, F )
-#define TAB()           text_dump_tab( dump )
-#define UNT()           text_dump_untab( dump )
-#define ENM(E,ENUMS)    text_dump_enum( dump, E, ENUMS, sizeof( ENUMS ) / sizeof( *ENUMS ) )
-
-static const char *TGSI_PROCESSOR_TYPES[] =
-{
-   "PROCESSOR_FRAGMENT",
-   "PROCESSOR_VERTEX",
-   "PROCESSOR_GEOMETRY"
-};
-
-static const char *TGSI_PROCESSOR_TYPES_SHORT[] =
-{
-   "FRAG",
-   "VERT",
-   "GEOM"
-};
-
-static const char *TGSI_TOKEN_TYPES[] =
-{
-   "TOKEN_TYPE_DECLARATION",
-   "TOKEN_TYPE_IMMEDIATE",
-   "TOKEN_TYPE_INSTRUCTION"
-};
-
-static const char *TGSI_FILES[] =
-{
-   "FILE_NULL",
-   "FILE_CONSTANT",
-   "FILE_INPUT",
-   "FILE_OUTPUT",
-   "FILE_TEMPORARY",
-   "FILE_SAMPLER",
-   "FILE_ADDRESS",
-   "FILE_IMMEDIATE"
-};
-
-static const char *TGSI_FILES_SHORT[] =
-{
-   "NULL",
-   "CONST",
-   "IN",
-   "OUT",
-   "TEMP",
-   "SAMP",
-   "ADDR",
-   "IMM"
-};
-
-static const char *TGSI_DECLARES[] =
-{
-   "DECLARE_RANGE",
-   "DECLARE_MASK"
-};
-
-static const char *TGSI_INTERPOLATES[] =
-{
-   "INTERPOLATE_CONSTANT",
-   "INTERPOLATE_LINEAR",
-   "INTERPOLATE_PERSPECTIVE",
-   "INTERPOLATE_ATTRIB"
-};
-
-static const char *TGSI_INTERPOLATES_SHORT[] =
-{
-   "CONSTANT",
-   "LINEAR",
-   "PERSPECTIVE",
-   "ATTRIB"
-};
-
-static const char *TGSI_SEMANTICS[] =
-{
-   "SEMANTIC_POSITION",
-   "SEMANTIC_COLOR",
-   "SEMANTIC_BCOLOR",
-   "SEMANTIC_FOG",
-   "SEMANTIC_PSIZE",
-   "SEMANTIC_GENERIC,"
-};
-
-static const char *TGSI_SEMANTICS_SHORT[] =
-{
-   "POSITION",
-   "COLOR",
-   "BCOLOR",
-   "FOG",
-   "PSIZE",
-   "GENERIC",
-};
-
-static const char *TGSI_IMMS[] =
-{
-   "IMM_FLOAT32"
-};
-
-static const char *TGSI_IMMS_SHORT[] =
-{
-   "FLT32"
-};
-
-static const char *TGSI_OPCODES[] =
-{
-   "OPCODE_ARL",
-   "OPCODE_MOV",
-   "OPCODE_LIT",
-   "OPCODE_RCP",
-   "OPCODE_RSQ",
-   "OPCODE_EXP",
-   "OPCODE_LOG",
-   "OPCODE_MUL",
-   "OPCODE_ADD",
-   "OPCODE_DP3",
-   "OPCODE_DP4",
-   "OPCODE_DST",
-   "OPCODE_MIN",
-   "OPCODE_MAX",
-   "OPCODE_SLT",
-   "OPCODE_SGE",
-   "OPCODE_MAD",
-   "OPCODE_SUB",
-   "OPCODE_LERP",
-   "OPCODE_CND",
-   "OPCODE_CND0",
-   "OPCODE_DOT2ADD",
-   "OPCODE_INDEX",
-   "OPCODE_NEGATE",
-   "OPCODE_FRAC",
-   "OPCODE_CLAMP",
-   "OPCODE_FLOOR",
-   "OPCODE_ROUND",
-   "OPCODE_EXPBASE2",
-   "OPCODE_LOGBASE2",
-   "OPCODE_POWER",
-   "OPCODE_CROSSPRODUCT",
-   "OPCODE_MULTIPLYMATRIX",
-   "OPCODE_ABS",
-   "OPCODE_RCC",
-   "OPCODE_DPH",
-   "OPCODE_COS",
-   "OPCODE_DDX",
-   "OPCODE_DDY",
-   "OPCODE_KILP",
-   "OPCODE_PK2H",
-   "OPCODE_PK2US",
-   "OPCODE_PK4B",
-   "OPCODE_PK4UB",
-   "OPCODE_RFL",
-   "OPCODE_SEQ",
-   "OPCODE_SFL",
-   "OPCODE_SGT",
-   "OPCODE_SIN",
-   "OPCODE_SLE",
-   "OPCODE_SNE",
-   "OPCODE_STR",
-   "OPCODE_TEX",
-   "OPCODE_TXD",
-   "OPCODE_UP2H",
-   "OPCODE_UP2US",
-   "OPCODE_UP4B",
-   "OPCODE_UP4UB",
-   "OPCODE_X2D",
-   "OPCODE_ARA",
-   "OPCODE_ARR",
-   "OPCODE_BRA",
-   "OPCODE_CAL",
-   "OPCODE_RET",
-   "OPCODE_SSG",
-   "OPCODE_CMP",
-   "OPCODE_SCS",
-   "OPCODE_TXB",
-   "OPCODE_NRM",
-   "OPCODE_DIV",
-   "OPCODE_DP2",
-   "OPCODE_TXL",
-   "OPCODE_BRK",
-   "OPCODE_IF",
-   "OPCODE_LOOP",
-   "OPCODE_REP",
-   "OPCODE_ELSE",
-   "OPCODE_ENDIF",
-   "OPCODE_ENDLOOP",
-   "OPCODE_ENDREP",
-   "OPCODE_PUSHA",
-   "OPCODE_POPA",
-   "OPCODE_CEIL",
-   "OPCODE_I2F",
-   "OPCODE_NOT",
-   "OPCODE_TRUNC",
-   "OPCODE_SHL",
-   "OPCODE_SHR",
-   "OPCODE_AND",
-   "OPCODE_OR",
-   "OPCODE_MOD",
-   "OPCODE_XOR",
-   "OPCODE_SAD",
-   "OPCODE_TXF",
-   "OPCODE_TXQ",
-   "OPCODE_CONT",
-   "OPCODE_EMIT",
-   "OPCODE_ENDPRIM",
-   "OPCODE_BGNLOOP2",
-   "OPCODE_BGNSUB",
-   "OPCODE_ENDLOOP2",
-   "OPCODE_ENDSUB",
-   "OPCODE_NOISE1",
-   "OPCODE_NOISE2",
-   "OPCODE_NOISE3",
-   "OPCODE_NOISE4",
-   "OPCODE_NOP",
-   "OPCODE_TEXBEM",
-   "OPCODE_TEXBEML",
-   "OPCODE_TEXREG2AR",
-   "OPCODE_TEXM3X2PAD",
-   "OPCODE_TEXM3X2TEX",
-   "OPCODE_TEXM3X3PAD",
-   "OPCODE_TEXM3X3TEX",
-   "OPCODE_TEXM3X3SPEC",
-   "OPCODE_TEXM3X3VSPEC",
-   "OPCODE_TEXREG2GB",
-   "OPCODE_TEXREG2RGB",
-   "OPCODE_TEXDP3TEX",
-   "OPCODE_TEXDP3",
-   "OPCODE_TEXM3X3",
-   "OPCODE_TEXM3X2DEPTH",
-   "OPCODE_TEXDEPTH",
-   "OPCODE_BEM",
-   "OPCODE_M4X3",
-   "OPCODE_M3X4",
-   "OPCODE_M3X3",
-   "OPCODE_M3X2",
-   "OPCODE_NRM4",
-   "OPCODE_CALLNZ",
-   "OPCODE_IFC",
-   "OPCODE_BREAKC",
-   "OPCODE_TXP",
-   "OPCODE_KIL",
-   "OPCODE_END"
-};
-
-static const char *TGSI_OPCODES_SHORT[] =
-{
-   "ARL",
-   "MOV",
-   "LIT",
-   "RCP",
-   "RSQ",
-   "EXP",
-   "LOG",
-   "MUL",
-   "ADD",
-   "DP3",
-   "DP4",
-   "DST",
-   "MIN",
-   "MAX",
-   "SLT",
-   "SGE",
-   "MAD",
-   "SUB",
-   "LERP",
-   "CND",
-   "CND0",
-   "DOT2ADD",
-   "INDEX",
-   "NEGATE",
-   "FRAC",
-   "CLAMP",
-   "FLOOR",
-   "ROUND",
-   "EXPBASE2",
-   "LOGBASE2",
-   "POWER",
-   "CROSSPRODUCT",
-   "MULTIPLYMATRIX",
-   "ABS",
-   "RCC",
-   "DPH",
-   "COS",
-   "DDX",
-   "DDY",
-   "KILP",
-   "PK2H",
-   "PK2US",
-   "PK4B",
-   "PK4UB",
-   "RFL",
-   "SEQ",
-   "SFL",
-   "SGT",
-   "SIN",
-   "SLE",
-   "SNE",
-   "STR",
-   "TEX",
-   "TXD",
-   "UP2H",
-   "UP2US",
-   "UP4B",
-   "UP4UB",
-   "X2D",
-   "ARA",
-   "ARR",
-   "BRA",
-   "CAL",
-   "RET",
-   "SSG",
-   "CMP",
-   "SCS",
-   "TXB",
-   "NRM",
-   "DIV",
-   "DP2",
-   "TXL",
-   "BRK",
-   "IF",
-   "LOOP",
-   "REP",
-   "ELSE",
-   "ENDIF",
-   "ENDLOOP",
-   "ENDREP",
-   "PUSHA",
-   "POPA",
-   "CEIL",
-   "I2F",
-   "NOT",
-   "TRUNC",
-   "SHL",
-   "SHR",
-   "AND",
-   "OR",
-   "MOD",
-   "XOR",
-   "SAD",
-   "TXF",
-   "TXQ",
-   "CONT",
-   "EMIT",
-   "ENDPRIM",
-   "BGNLOOP2",
-   "BGNSUB",
-   "ENDLOOP2",
-   "ENDSUB",
-   "NOISE1",
-   "NOISE2",
-   "NOISE3",
-   "NOISE4",
-   "NOP",
-   "TEXBEM",
-   "TEXBEML",
-   "TEXREG2AR",
-   "TEXM3X2PAD",
-   "TEXM3X2TEX",
-   "TEXM3X3PAD",
-   "TEXM3X3TEX",
-   "TEXM3X3SPEC",
-   "TEXM3X3VSPEC",
-   "TEXREG2GB",
-   "TEXREG2RGB",
-   "TEXDP3TEX",
-   "TEXDP3",
-   "TEXM3X3",
-   "TEXM3X2DEPTH",
-   "TEXDEPTH",
-   "BEM",
-   "M4X3",
-   "M3X4",
-   "M3X3",
-   "M3X2",
-   "NRM4",
-   "CALLNZ",
-   "IFC",
-   "BREAKC",
-   "TXP",
-   "KIL",
-   "END"
-};
-
-static const char *TGSI_SATS[] =
-{
-   "SAT_NONE",
-   "SAT_ZERO_ONE",
-   "SAT_MINUS_PLUS_ONE"
-};
-
-static const char *TGSI_INSTRUCTION_EXTS[] =
-{
-   "INSTRUCTION_EXT_TYPE_NV",
-   "INSTRUCTION_EXT_TYPE_LABEL",
-   "INSTRUCTION_EXT_TYPE_TEXTURE"
-};
-
-static const char *TGSI_PRECISIONS[] =
-{
-   "PRECISION_DEFAULT",
-   "TGSI_PRECISION_FLOAT32",
-   "TGSI_PRECISION_FLOAT16",
-   "TGSI_PRECISION_FIXED12"
-};
-
-static const char *TGSI_CCS[] =
-{
-   "CC_GT",
-   "CC_EQ",
-   "CC_LT",
-   "CC_UN",
-   "CC_GE",
-   "CC_LE",
-   "CC_NE",
-   "CC_TR",
-   "CC_FL"
-};
-
-static const char *TGSI_SWIZZLES[] =
-{
-   "SWIZZLE_X",
-   "SWIZZLE_Y",
-   "SWIZZLE_Z",
-   "SWIZZLE_W"
-};
-
-static const char *TGSI_SWIZZLES_SHORT[] =
-{
-   "x",
-   "y",
-   "z",
-   "w"
-};
-
-static const char *TGSI_TEXTURES[] =
-{
-   "TEXTURE_UNKNOWN",
-   "TEXTURE_1D",
-   "TEXTURE_2D",
-   "TEXTURE_3D",
-   "TEXTURE_CUBE",
-   "TEXTURE_RECT",
-   "TEXTURE_SHADOW1D",
-   "TEXTURE_SHADOW2D",
-   "TEXTURE_SHADOWRECT"
-};
-
-static const char *TGSI_SRC_REGISTER_EXTS[] =
-{
-   "SRC_REGISTER_EXT_TYPE_SWZ",
-   "SRC_REGISTER_EXT_TYPE_MOD"
-};
-
-static const char *TGSI_EXTSWIZZLES[] =
-{
-   "EXTSWIZZLE_X",
-   "EXTSWIZZLE_Y",
-   "EXTSWIZZLE_Z",
-   "EXTSWIZZLE_W",
-   "EXTSWIZZLE_ZERO",
-   "EXTSWIZZLE_ONE"
-};
-
-static const char *TGSI_EXTSWIZZLES_SHORT[] =
-{
-   "x",
-   "y",
-   "z",
-   "w",
-   "0",
-   "1"
-};
-
-static const char *TGSI_WRITEMASKS[] =
-{
-   "0",
-   "WRITEMASK_X",
-   "WRITEMASK_Y",
-   "WRITEMASK_XY",
-   "WRITEMASK_Z",
-   "WRITEMASK_XZ",
-   "WRITEMASK_YZ",
-   "WRITEMASK_XYZ",
-   "WRITEMASK_W",
-   "WRITEMASK_XW",
-   "WRITEMASK_YW",
-   "WRITEMASK_XYW",
-   "WRITEMASK_ZW",
-   "WRITEMASK_XZW",
-   "WRITEMASK_YZW",
-   "WRITEMASK_XYZW"
-};
-
-static const char *TGSI_DST_REGISTER_EXTS[] =
-{
-   "DST_REGISTER_EXT_TYPE_CONDCODE",
-   "DST_REGISTER_EXT_TYPE_MODULATE"
-};
-
-static const char *TGSI_MODULATES[] =
-{
-   "MODULATE_1X",
-   "MODULATE_2X",
-   "MODULATE_4X",
-   "MODULATE_8X",
-   "MODULATE_HALF",
-   "MODULATE_QUARTER",
-   "MODULATE_EIGHTH"
-};
-
-static void
-dump_declaration_short(
-   struct text_dump *dump,
-   struct tgsi_full_declaration *decl )
-{
-   TXT( "\nDCL " );
-   ENM( decl->Declaration.File, TGSI_FILES_SHORT );
-
-   switch( decl->Declaration.Declare ) {
-   case TGSI_DECLARE_RANGE:
-      CHR( '[' );
-      UID( decl->u.DeclarationRange.First );
-      if( decl->u.DeclarationRange.First != decl->u.DeclarationRange.Last ) {
-         TXT( ".." );
-         UID( decl->u.DeclarationRange.Last );
-      }
-      CHR( ']' );
-      break;
-   default:
-      assert( 0 );
-   }
-
-   if( decl->Declaration.UsageMask != TGSI_WRITEMASK_XYZW ) {
-      CHR( '.' );
-      if( decl->Declaration.UsageMask & TGSI_WRITEMASK_X ) {
-         CHR( 'x' );
-      }
-      if( decl->Declaration.UsageMask & TGSI_WRITEMASK_Y ) {
-         CHR( 'y' );
-      }
-      if( decl->Declaration.UsageMask & TGSI_WRITEMASK_Z ) {
-         CHR( 'z' );
-      }
-      if( decl->Declaration.UsageMask & TGSI_WRITEMASK_W ) {
-         CHR( 'w' );
-      }
-   }
-
-   if( decl->Declaration.Interpolate ) {
-      TXT( ", " );
-      ENM( decl->Interpolation.Interpolate, TGSI_INTERPOLATES_SHORT );
-   }
-
-   if( decl->Declaration.Semantic ) {
-      TXT( ", " );
-      ENM( decl->Semantic.SemanticName, TGSI_SEMANTICS_SHORT );
-      CHR( '[' );
-      UID( decl->Semantic.SemanticIndex );
-      CHR( ']' );
-   }
-}
-
-static void
-dump_declaration_verbose(
-   struct text_dump *dump,
-   struct tgsi_full_declaration *decl,
-   unsigned ignored,
-   unsigned deflt,
-   struct tgsi_full_declaration *fd )
-{
-   TXT( "\nFile       : " );
-   ENM( decl->Declaration.File, TGSI_FILES );
-   TXT( "\nDeclare    : " );
-   ENM( decl->Declaration.Declare, TGSI_DECLARES );
-   if( deflt || fd->Declaration.UsageMask != decl->Declaration.UsageMask ) {
-      TXT( "\nUsageMask  : " );
-      if( decl->Declaration.UsageMask & TGSI_WRITEMASK_X ) {
-         CHR( 'X' );
-      }
-      if( decl->Declaration.UsageMask & TGSI_WRITEMASK_Y ) {
-         CHR( 'Y' );
-      }
-      if( decl->Declaration.UsageMask & TGSI_WRITEMASK_Z ) {
-         CHR( 'Z' );
-      }
-      if( decl->Declaration.UsageMask & TGSI_WRITEMASK_W ) {
-         CHR( 'W' );
-      }
-   }
-   if( deflt || fd->Declaration.Interpolate != decl->Declaration.Interpolate ) {
-      TXT( "\nInterpolate: " );
-      UID( decl->Declaration.Interpolate );
-   }
-   if( deflt || fd->Declaration.Semantic != decl->Declaration.Semantic ) {
-      TXT( "\nSemantic   : " );
-      UID( decl->Declaration.Semantic );
-   }
-   if( ignored ) {
-      TXT( "\nPadding    : " );
-      UIX( decl->Declaration.Padding );
-   }
-
-   CHR( '\n' );
-   switch( decl->Declaration.Declare ) {
-   case TGSI_DECLARE_RANGE:
-      TXT( "\nFirst: " );
-      UID( decl->u.DeclarationRange.First );
-      TXT( "\nLast : " );
-      UID( decl->u.DeclarationRange.Last );
-      break;
-
-   case TGSI_DECLARE_MASK:
-      TXT( "\nMask: " );
-      UIX( decl->u.DeclarationMask.Mask );
-      break;
-
-   default:
-      assert( 0 );
-   }
-
-   if( decl->Declaration.Interpolate ) {
-      CHR( '\n' );
-      TXT( "\nInterpolate: " );
-      ENM( decl->Interpolation.Interpolate, TGSI_INTERPOLATES );
-      if( ignored ) {
-         TXT( "\nPadding    : " );
-         UIX( decl->Interpolation.Padding );
-      }
-   }
-
-   if( decl->Declaration.Semantic ) {
-      CHR( '\n' );
-      TXT( "\nSemanticName : " );
-      ENM( decl->Semantic.SemanticName, TGSI_SEMANTICS );
-      TXT( "\nSemanticIndex: " );
-      UID( decl->Semantic.SemanticIndex );
-      if( ignored ) {
-         TXT( "\nPadding      : " );
-         UIX( decl->Semantic.Padding );
-      }
-   }
-}
-
-static void
-dump_immediate_short(
-   struct text_dump *dump,
-   struct tgsi_full_immediate *imm )
-{
-   unsigned i;
-
-   TXT( "\nIMM " );
-   ENM( imm->Immediate.DataType, TGSI_IMMS_SHORT );
-
-   TXT( " { " );
-   for( i = 0; i < imm->Immediate.Size - 1; i++ ) {
-      switch( imm->Immediate.DataType ) {
-      case TGSI_IMM_FLOAT32:
-         FLT( imm->u.ImmediateFloat32[i].Float );
-         break;
-
-      default:
-         assert( 0 );
-      }
-
-      if( i < imm->Immediate.Size - 2 ) {
-         TXT( ", " );
-      }
-   }
-   TXT( " }" );
-}
-
-static void
-dump_immediate_verbose(
-   struct text_dump *dump,
-   struct tgsi_full_immediate *imm,
-   unsigned ignored )
-{
-   unsigned i;
-
-   TXT( "\nDataType   : " );
-   ENM( imm->Immediate.DataType, TGSI_IMMS );
-   if( ignored ) {
-      TXT( "\nPadding    : " );
-      UIX( imm->Immediate.Padding );
-   }
-
-   for( i = 0; i < imm->Immediate.Size - 1; i++ ) {
-      CHR( '\n' );
-      switch( imm->Immediate.DataType ) {
-      case TGSI_IMM_FLOAT32:
-         TXT( "\nFloat: " );
-         FLT( imm->u.ImmediateFloat32[i].Float );
-         break;
-
-      default:
-         assert( 0 );
-      }
-   }
-}
-
-static void
-dump_instruction_short(
-   struct text_dump *dump,
-   struct tgsi_full_instruction *inst,
-   unsigned instno )
-{
-   unsigned i;
-   boolean first_reg = TRUE;
-
-   CHR( '\n' );
-   UID( instno );
-   CHR( ':' );
-   ENM( inst->Instruction.Opcode, TGSI_OPCODES_SHORT );
-
-   switch( inst->Instruction.Saturate ) {
-   case TGSI_SAT_NONE:
-      break;
-   case TGSI_SAT_ZERO_ONE:
-      TXT( "_SAT" );
-      break;
-   case TGSI_SAT_MINUS_PLUS_ONE:
-      TXT( "_SAT[-1,1]" );
-      break;
-   default:
-      assert( 0 );
-   }
-
-   for( i = 0; i < inst->Instruction.NumDstRegs; i++ ) {
-      struct tgsi_full_dst_register *dst = &inst->FullDstRegisters[i];
-
-      if( !first_reg ) {
-         CHR( ',' );
-      }
-      CHR( ' ' );
-
-      ENM( dst->DstRegister.File, TGSI_FILES_SHORT );
-
-      CHR( '[' );
-      SID( dst->DstRegister.Index );
-      CHR( ']' );
-
-      if( dst->DstRegister.WriteMask != TGSI_WRITEMASK_XYZW ) {
-         CHR( '.' );
-         if( dst->DstRegister.WriteMask & TGSI_WRITEMASK_X ) {
-            CHR( 'x' );
-         }
-         if( dst->DstRegister.WriteMask & TGSI_WRITEMASK_Y ) {
-            CHR( 'y' );
-         }
-         if( dst->DstRegister.WriteMask & TGSI_WRITEMASK_Z ) {
-            CHR( 'z' );
-         }
-         if( dst->DstRegister.WriteMask & TGSI_WRITEMASK_W ) {
-            CHR( 'w' );
-         }
-      }
-
-      first_reg = FALSE;
-   }
-
-   for( i = 0; i < inst->Instruction.NumSrcRegs; i++ ) {
-      struct tgsi_full_src_register *src = &inst->FullSrcRegisters[i];
-
-      if( !first_reg ) {
-         CHR( ',' );
-      }
-      CHR( ' ' );
-
-      if( src->SrcRegisterExtMod.Negate  ) {
-         CHR( '-' );
-      }
-      if( src->SrcRegisterExtMod.Absolute ) {
-         CHR( '|' );
-      }
-      if( src->SrcRegister.Negate ) {
-         CHR( '-' );
-      }
-
-      ENM( src->SrcRegister.File, TGSI_FILES_SHORT );
-
-      CHR( '[' );
-      SID( src->SrcRegister.Index );
-      CHR( ']' );
-
-      if (src->SrcRegister.Extended) {
-         if (src->SrcRegisterExtSwz.ExtSwizzleX != TGSI_EXTSWIZZLE_X ||
-             src->SrcRegisterExtSwz.ExtSwizzleY != TGSI_EXTSWIZZLE_Y ||
-             src->SrcRegisterExtSwz.ExtSwizzleZ != TGSI_EXTSWIZZLE_Z ||
-             src->SrcRegisterExtSwz.ExtSwizzleW != TGSI_EXTSWIZZLE_W) {
-            CHR( '.' );
-            ENM( src->SrcRegisterExtSwz.ExtSwizzleX, TGSI_EXTSWIZZLES_SHORT );
-            ENM( src->SrcRegisterExtSwz.ExtSwizzleY, TGSI_EXTSWIZZLES_SHORT );
-            ENM( src->SrcRegisterExtSwz.ExtSwizzleZ, TGSI_EXTSWIZZLES_SHORT );
-            ENM( src->SrcRegisterExtSwz.ExtSwizzleW, TGSI_EXTSWIZZLES_SHORT );
-         }
-      }
-      else if( src->SrcRegister.SwizzleX != TGSI_SWIZZLE_X ||
-               src->SrcRegister.SwizzleY != TGSI_SWIZZLE_Y ||
-               src->SrcRegister.SwizzleZ != TGSI_SWIZZLE_Z ||
-               src->SrcRegister.SwizzleW != TGSI_SWIZZLE_W ) {
-         CHR( '.' );
-         ENM( src->SrcRegister.SwizzleX, TGSI_SWIZZLES_SHORT );
-         ENM( src->SrcRegister.SwizzleY, TGSI_SWIZZLES_SHORT );
-         ENM( src->SrcRegister.SwizzleZ, TGSI_SWIZZLES_SHORT );
-         ENM( src->SrcRegister.SwizzleW, TGSI_SWIZZLES_SHORT );
-      }
-
-      if( src->SrcRegisterExtMod.Absolute ) {
-         CHR( '|' );
-      }
-
-      first_reg = FALSE;
-   }
-
-   switch( inst->Instruction.Opcode ) {
-   case TGSI_OPCODE_IF:
-   case TGSI_OPCODE_ELSE:
-   case TGSI_OPCODE_BGNLOOP2:
-   case TGSI_OPCODE_ENDLOOP2:
-   case TGSI_OPCODE_CAL:
-      TXT( " :" );
-      UID( inst->InstructionExtLabel.Label );
-      break;
-   }
-}
-
-static void
-dump_instruction_verbose(
-   struct text_dump *dump,
-   struct tgsi_full_instruction *inst,
-   unsigned ignored,
-   unsigned deflt,
-   struct tgsi_full_instruction *fi )
-{
-   unsigned i;
-
-   TXT( "\nOpcode     : " );
-   ENM( inst->Instruction.Opcode, TGSI_OPCODES );
-   if( deflt || fi->Instruction.Saturate != inst->Instruction.Saturate ) {
-      TXT( "\nSaturate   : " );
-      ENM( inst->Instruction.Saturate, TGSI_SATS );
-   }
-   if( deflt || fi->Instruction.NumDstRegs != inst->Instruction.NumDstRegs ) {
-      TXT( "\nNumDstRegs : " );
-      UID( inst->Instruction.NumDstRegs );
-   }
-   if( deflt || fi->Instruction.NumSrcRegs != inst->Instruction.NumSrcRegs ) {
-      TXT( "\nNumSrcRegs : " );
-      UID( inst->Instruction.NumSrcRegs );
-   }
-   if( ignored ) {
-      TXT( "\nPadding    : " );
-      UIX( inst->Instruction.Padding );
-   }
-
-   if( deflt || tgsi_compare_instruction_ext_nv( inst->InstructionExtNv, fi->InstructionExtNv ) ) {
-      CHR( '\n' );
-      TXT( "\nType          : " );
-      ENM( inst->InstructionExtNv.Type, TGSI_INSTRUCTION_EXTS );
-      if( deflt || fi->InstructionExtNv.Precision != inst->InstructionExtNv.Precision ) {
-         TXT( "\nPrecision     : " );
-         ENM( inst->InstructionExtNv.Precision, TGSI_PRECISIONS );
-      }
-      if( deflt || fi->InstructionExtNv.CondDstIndex != inst->InstructionExtNv.CondDstIndex ) {
-         TXT( "\nCondDstIndex  : " );
-         UID( inst->InstructionExtNv.CondDstIndex );
-      }
-      if( deflt || fi->InstructionExtNv.CondFlowIndex != inst->InstructionExtNv.CondFlowIndex ) {
-         TXT( "\nCondFlowIndex : " );
-         UID( inst->InstructionExtNv.CondFlowIndex );
-      }
-      if( deflt || fi->InstructionExtNv.CondMask != inst->InstructionExtNv.CondMask ) {
-         TXT( "\nCondMask      : " );
-         ENM( inst->InstructionExtNv.CondMask, TGSI_CCS );
-      }
-      if( deflt || fi->InstructionExtNv.CondSwizzleX != inst->InstructionExtNv.CondSwizzleX ) {
-         TXT( "\nCondSwizzleX  : " );
-         ENM( inst->InstructionExtNv.CondSwizzleX, TGSI_SWIZZLES );
-      }
-      if( deflt || fi->InstructionExtNv.CondSwizzleY != inst->InstructionExtNv.CondSwizzleY ) {
-         TXT( "\nCondSwizzleY  : " );
-         ENM( inst->InstructionExtNv.CondSwizzleY, TGSI_SWIZZLES );
-      }
-      if( deflt || fi->InstructionExtNv.CondSwizzleZ != inst->InstructionExtNv.CondSwizzleZ ) {
-         TXT( "\nCondSwizzleZ  : " );
-         ENM( inst->InstructionExtNv.CondSwizzleZ, TGSI_SWIZZLES );
-      }
-      if( deflt || fi->InstructionExtNv.CondSwizzleW != inst->InstructionExtNv.CondSwizzleW ) {
-         TXT( "\nCondSwizzleW  : " );
-         ENM( inst->InstructionExtNv.CondSwizzleW, TGSI_SWIZZLES );
-      }
-      if( deflt || fi->InstructionExtNv.CondDstUpdate != inst->InstructionExtNv.CondDstUpdate ) {
-         TXT( "\nCondDstUpdate : " );
-         UID( inst->InstructionExtNv.CondDstUpdate );
-      }
-      if( deflt || fi->InstructionExtNv.CondFlowEnable != inst->InstructionExtNv.CondFlowEnable ) {
-         TXT( "\nCondFlowEnable: " );
-         UID( inst->InstructionExtNv.CondFlowEnable );
-      }
-      if( ignored ) {
-         TXT( "\nPadding       : " );
-         UIX( inst->InstructionExtNv.Padding );
-         if( deflt || fi->InstructionExtNv.Extended != inst->InstructionExtNv.Extended ) {
-            TXT( "\nExtended      : " );
-            UID( inst->InstructionExtNv.Extended );
-         }
-      }
-   }
-
-   if( deflt || tgsi_compare_instruction_ext_label( inst->InstructionExtLabel, fi->InstructionExtLabel ) ) {
-      CHR( '\n' );
-      TXT( "\nType    : " );
-      ENM( inst->InstructionExtLabel.Type, TGSI_INSTRUCTION_EXTS );
-      if( deflt || fi->InstructionExtLabel.Label != inst->InstructionExtLabel.Label ) {
-         TXT( "\nLabel   : " );
-         UID( inst->InstructionExtLabel.Label );
-      }
-      if( ignored ) {
-         TXT( "\nPadding : " );
-         UIX( inst->InstructionExtLabel.Padding );
-         if( deflt || fi->InstructionExtLabel.Extended != inst->InstructionExtLabel.Extended ) {
-            TXT( "\nExtended: " );
-            UID( inst->InstructionExtLabel.Extended );
-         }
-      }
-   }
-
-   if( deflt || tgsi_compare_instruction_ext_texture( inst->InstructionExtTexture, fi->InstructionExtTexture ) ) {
-      CHR( '\n' );
-      TXT( "\nType    : " );
-      ENM( inst->InstructionExtTexture.Type, TGSI_INSTRUCTION_EXTS );
-      if( deflt || fi->InstructionExtTexture.Texture != inst->InstructionExtTexture.Texture ) {
-         TXT( "\nTexture : " );
-         ENM( inst->InstructionExtTexture.Texture, TGSI_TEXTURES );
-      }
-      if( ignored ) {
-         TXT( "\nPadding : " );
-         UIX( inst->InstructionExtTexture.Padding );
-         if( deflt || fi->InstructionExtTexture.Extended != inst->InstructionExtTexture.Extended ) {
-            TXT( "\nExtended: " );
-            UID( inst->InstructionExtTexture.Extended );
-         }
-      }
-   }
-
-   for( i = 0; i < inst->Instruction.NumDstRegs; i++ ) {
-      struct tgsi_full_dst_register *dst = &inst->FullDstRegisters[i];
-      struct tgsi_full_dst_register *fd = &fi->FullDstRegisters[i];
-
-      CHR( '\n' );
-      TXT( "\nFile     : " );
-      ENM( dst->DstRegister.File, TGSI_FILES );
-      if( deflt || fd->DstRegister.WriteMask != dst->DstRegister.WriteMask ) {
-         TXT( "\nWriteMask: " );
-         ENM( dst->DstRegister.WriteMask, TGSI_WRITEMASKS );
-      }
-      if( ignored ) {
-         if( deflt || fd->DstRegister.Indirect != dst->DstRegister.Indirect ) {
-            TXT( "\nIndirect : " );
-            UID( dst->DstRegister.Indirect );
-         }
-         if( deflt || fd->DstRegister.Dimension != dst->DstRegister.Dimension ) {
-            TXT( "\nDimension: " );
-            UID( dst->DstRegister.Dimension );
-         }
-      }
-      if( deflt || fd->DstRegister.Index != dst->DstRegister.Index ) {
-         TXT( "\nIndex    : " );
-         SID( dst->DstRegister.Index );
-      }
-      if( ignored ) {
-         TXT( "\nPadding  : " );
-         UIX( dst->DstRegister.Padding );
-         if( deflt || fd->DstRegister.Extended != dst->DstRegister.Extended ) {
-            TXT( "\nExtended : " );
-            UID( dst->DstRegister.Extended );
-         }
-      }
-
-      if( deflt || tgsi_compare_dst_register_ext_concode( dst->DstRegisterExtConcode, fd->DstRegisterExtConcode ) ) {
-         CHR( '\n' );
-         TXT( "\nType        : " );
-         ENM( dst->DstRegisterExtConcode.Type, TGSI_DST_REGISTER_EXTS );
-         if( deflt || fd->DstRegisterExtConcode.CondMask != dst->DstRegisterExtConcode.CondMask ) {
-            TXT( "\nCondMask    : " );
-            ENM( dst->DstRegisterExtConcode.CondMask, TGSI_CCS );
-         }
-         if( deflt || fd->DstRegisterExtConcode.CondSwizzleX != dst->DstRegisterExtConcode.CondSwizzleX ) {
-            TXT( "\nCondSwizzleX: " );
-            ENM( dst->DstRegisterExtConcode.CondSwizzleX, TGSI_SWIZZLES );
-         }
-         if( deflt || fd->DstRegisterExtConcode.CondSwizzleY != dst->DstRegisterExtConcode.CondSwizzleY ) {
-            TXT( "\nCondSwizzleY: " );
-            ENM( dst->DstRegisterExtConcode.CondSwizzleY, TGSI_SWIZZLES );
-         }
-         if( deflt || fd->DstRegisterExtConcode.CondSwizzleZ != dst->DstRegisterExtConcode.CondSwizzleZ ) {
-            TXT( "\nCondSwizzleZ: " );
-            ENM( dst->DstRegisterExtConcode.CondSwizzleZ, TGSI_SWIZZLES );
-         }
-         if( deflt || fd->DstRegisterExtConcode.CondSwizzleW != dst->DstRegisterExtConcode.CondSwizzleW ) {
-            TXT( "\nCondSwizzleW: " );
-            ENM( dst->DstRegisterExtConcode.CondSwizzleW, TGSI_SWIZZLES );
-         }
-         if( deflt || fd->DstRegisterExtConcode.CondSrcIndex != dst->DstRegisterExtConcode.CondSrcIndex ) {
-            TXT( "\nCondSrcIndex: " );
-            UID( dst->DstRegisterExtConcode.CondSrcIndex );
-         }
-         if( ignored ) {
-            TXT( "\nPadding     : " );
-            UIX( dst->DstRegisterExtConcode.Padding );
-            if( deflt || fd->DstRegisterExtConcode.Extended != dst->DstRegisterExtConcode.Extended ) {
-               TXT( "\nExtended    : " );
-               UID( dst->DstRegisterExtConcode.Extended );
-            }
-         }
-      }
-
-      if( deflt || tgsi_compare_dst_register_ext_modulate( dst->DstRegisterExtModulate, fd->DstRegisterExtModulate ) ) {
-         CHR( '\n' );
-         TXT( "\nType    : " );
-         ENM( dst->DstRegisterExtModulate.Type, TGSI_DST_REGISTER_EXTS );
-         if( deflt || fd->DstRegisterExtModulate.Modulate != dst->DstRegisterExtModulate.Modulate ) {
-            TXT( "\nModulate: " );
-            ENM( dst->DstRegisterExtModulate.Modulate, TGSI_MODULATES );
-         }
-         if( ignored ) {
-            TXT( "\nPadding : " );
-            UIX( dst->DstRegisterExtModulate.Padding );
-            if( deflt || fd->DstRegisterExtModulate.Extended != dst->DstRegisterExtModulate.Extended ) {
-               TXT( "\nExtended: " );
-               UID( dst->DstRegisterExtModulate.Extended );
-            }
-         }
-      }
-   }
-
-   for( i = 0; i < inst->Instruction.NumSrcRegs; i++ ) {
-      struct tgsi_full_src_register *src = &inst->FullSrcRegisters[i];
-      struct tgsi_full_src_register *fs = &fi->FullSrcRegisters[i];
-
-      CHR( '\n' );
-      TXT( "\nFile     : ");
-      ENM( src->SrcRegister.File, TGSI_FILES );
-      if( deflt || fs->SrcRegister.SwizzleX != src->SrcRegister.SwizzleX ) {
-         TXT( "\nSwizzleX : " );
-         ENM( src->SrcRegister.SwizzleX, TGSI_SWIZZLES );
-      }
-      if( deflt || fs->SrcRegister.SwizzleY != src->SrcRegister.SwizzleY ) {
-         TXT( "\nSwizzleY : " );
-         ENM( src->SrcRegister.SwizzleY, TGSI_SWIZZLES );
-      }
-      if( deflt || fs->SrcRegister.SwizzleZ != src->SrcRegister.SwizzleZ ) {
-         TXT( "\nSwizzleZ : " );
-         ENM( src->SrcRegister.SwizzleZ, TGSI_SWIZZLES );
-      }
-      if( deflt || fs->SrcRegister.SwizzleW != src->SrcRegister.SwizzleW ) {
-         TXT( "\nSwizzleW : " );
-         ENM( src->SrcRegister.SwizzleW, TGSI_SWIZZLES );
-      }
-      if( deflt || fs->SrcRegister.Negate != src->SrcRegister.Negate ) {
-         TXT( "\nNegate   : " );
-         UID( src->SrcRegister.Negate );
-      }
-      if( ignored ) {
-         if( deflt || fs->SrcRegister.Indirect != src->SrcRegister.Indirect ) {
-            TXT( "\nIndirect : " );
-            UID( src->SrcRegister.Indirect );
-         }
-         if( deflt || fs->SrcRegister.Dimension != src->SrcRegister.Dimension ) {
-            TXT( "\nDimension: " );
-            UID( src->SrcRegister.Dimension );
-         }
-      }
-      if( deflt || fs->SrcRegister.Index != src->SrcRegister.Index ) {
-         TXT( "\nIndex    : " );
-         SID( src->SrcRegister.Index );
-      }
-      if( ignored ) {
-         if( deflt || fs->SrcRegister.Extended != src->SrcRegister.Extended ) {
-            TXT( "\nExtended : " );
-            UID( src->SrcRegister.Extended );
-         }
-      }
-
-      if( deflt || tgsi_compare_src_register_ext_swz( src->SrcRegisterExtSwz, fs->SrcRegisterExtSwz ) ) {
-         CHR( '\n' );
-         TXT( "\nType       : " );
-         ENM( src->SrcRegisterExtSwz.Type, TGSI_SRC_REGISTER_EXTS );
-         if( deflt || fs->SrcRegisterExtSwz.ExtSwizzleX != src->SrcRegisterExtSwz.ExtSwizzleX ) {
-            TXT( "\nExtSwizzleX: " );
-            ENM( src->SrcRegisterExtSwz.ExtSwizzleX, TGSI_EXTSWIZZLES );
-         }
-         if( deflt || fs->SrcRegisterExtSwz.ExtSwizzleY != src->SrcRegisterExtSwz.ExtSwizzleY ) {
-            TXT( "\nExtSwizzleY: " );
-            ENM( src->SrcRegisterExtSwz.ExtSwizzleY, TGSI_EXTSWIZZLES );
-         }
-         if( deflt || fs->SrcRegisterExtSwz.ExtSwizzleZ != src->SrcRegisterExtSwz.ExtSwizzleZ ) {
-            TXT( "\nExtSwizzleZ: " );
-            ENM( src->SrcRegisterExtSwz.ExtSwizzleZ, TGSI_EXTSWIZZLES );
-         }
-         if( deflt || fs->SrcRegisterExtSwz.ExtSwizzleW != src->SrcRegisterExtSwz.ExtSwizzleW ) {
-            TXT( "\nExtSwizzleW: " );
-            ENM( src->SrcRegisterExtSwz.ExtSwizzleW, TGSI_EXTSWIZZLES );
-         }
-         if( deflt || fs->SrcRegisterExtSwz.NegateX != src->SrcRegisterExtSwz.NegateX ) {
-            TXT( "\nNegateX   : " );
-            UID( src->SrcRegisterExtSwz.NegateX );
-         }
-         if( deflt || fs->SrcRegisterExtSwz.NegateY != src->SrcRegisterExtSwz.NegateY ) {
-            TXT( "\nNegateY   : " );
-            UID( src->SrcRegisterExtSwz.NegateY );
-         }
-         if( deflt || fs->SrcRegisterExtSwz.NegateZ != src->SrcRegisterExtSwz.NegateZ ) {
-            TXT( "\nNegateZ   : " );
-            UID( src->SrcRegisterExtSwz.NegateZ );
-         }
-         if( deflt || fs->SrcRegisterExtSwz.NegateW != src->SrcRegisterExtSwz.NegateW ) {
-            TXT( "\nNegateW   : " );
-            UID( src->SrcRegisterExtSwz.NegateW );
-         }
-         if( deflt || fs->SrcRegisterExtSwz.ExtDivide != src->SrcRegisterExtSwz.ExtDivide ) {
-            TXT( "\nExtDivide  : " );
-            ENM( src->SrcRegisterExtSwz.ExtDivide, TGSI_EXTSWIZZLES );
-         }
-         if( ignored ) {
-            TXT( "\nPadding   : " );
-            UIX( src->SrcRegisterExtSwz.Padding );
-            if( deflt || fs->SrcRegisterExtSwz.Extended != src->SrcRegisterExtSwz.Extended ) {
-               TXT( "\nExtended   : " );
-               UID( src->SrcRegisterExtSwz.Extended );
-            }
-         }
-      }
-
-      if( deflt || tgsi_compare_src_register_ext_mod( src->SrcRegisterExtMod, fs->SrcRegisterExtMod ) ) {
-         CHR( '\n' );
-         TXT( "\nType     : " );
-         ENM( src->SrcRegisterExtMod.Type, TGSI_SRC_REGISTER_EXTS );
-         if( deflt || fs->SrcRegisterExtMod.Complement != src->SrcRegisterExtMod.Complement ) {
-            TXT( "\nComplement: " );
-            UID( src->SrcRegisterExtMod.Complement );
-         }
-         if( deflt || fs->SrcRegisterExtMod.Bias != src->SrcRegisterExtMod.Bias ) {
-            TXT( "\nBias     : " );
-            UID( src->SrcRegisterExtMod.Bias );
-         }
-         if( deflt || fs->SrcRegisterExtMod.Scale2X != src->SrcRegisterExtMod.Scale2X ) {
-            TXT( "\nScale2X   : " );
-            UID( src->SrcRegisterExtMod.Scale2X );
-         }
-         if( deflt || fs->SrcRegisterExtMod.Absolute != src->SrcRegisterExtMod.Absolute ) {
-            TXT( "\nAbsolute  : " );
-            UID( src->SrcRegisterExtMod.Absolute );
-         }
-         if( deflt || fs->SrcRegisterExtMod.Negate != src->SrcRegisterExtMod.Negate ) {
-            TXT( "\nNegate   : " );
-            UID( src->SrcRegisterExtMod.Negate );
-         }
-         if( ignored ) {
-            TXT( "\nPadding   : " );
-            UIX( src->SrcRegisterExtMod.Padding );
-            if( deflt || fs->SrcRegisterExtMod.Extended != src->SrcRegisterExtMod.Extended ) {
-               TXT( "\nExtended  : " );
-               UID( src->SrcRegisterExtMod.Extended );
-            }
-         }
-      }
-   }
-}
-
-void
-tgsi_dump(
-   const struct tgsi_token *tokens,
-   unsigned flags )
-{
-   struct text_dump _dump;
-   struct text_dump *dump = &_dump;
-   struct tgsi_parse_context parse;
-   struct tgsi_full_instruction fi;
-   struct tgsi_full_declaration fd;
-   unsigned verbose = flags & TGSI_DUMP_VERBOSE;
-   unsigned ignored = !(flags & TGSI_DUMP_NO_IGNORED);
-   unsigned deflt = !(flags & TGSI_DUMP_NO_DEFAULT);
-   unsigned instno = 0;
-
-   {
-#if 0
-      static unsigned counter = 0;
-      char buffer[64];
-
-      sprintf( buffer, "tgsi-dump-%.4u.txt", counter++ );
-      dump->file = fopen( buffer, "wt" );
-#else
-      dump->file = stderr;
-#endif
-      dump->tabs = 0;
-   }
-
-   /* sanity check */
-   assert(strcmp(TGSI_OPCODES[TGSI_OPCODE_CONT], "OPCODE_CONT") == 0);
-
-   tgsi_parse_init( &parse, tokens );
-
-   TXT( "tgsi-dump begin -----------------" );
-
-   CHR( '\n' );
-   ENM( parse.FullHeader.Processor.Processor, TGSI_PROCESSOR_TYPES_SHORT );
-   CHR( ' ' );
-   UID( parse.FullVersion.Version.MajorVersion );
-   CHR( '.' );
-   UID( parse.FullVersion.Version.MinorVersion );
-
-   if( verbose ) {
-      TXT( "\nMajorVersion: " );
-      UID( parse.FullVersion.Version.MajorVersion );
-      TXT( "\nMinorVersion: " );
-      UID( parse.FullVersion.Version.MinorVersion );
-      CHR( '\n' );
-
-      TXT( "\nHeaderSize: " );
-      UID( parse.FullHeader.Header.HeaderSize );
-      TXT( "\nBodySize  : " );
-      UID( parse.FullHeader.Header.BodySize );
-      TXT( "\nProcessor : " );
-      ENM( parse.FullHeader.Processor.Processor, TGSI_PROCESSOR_TYPES );
-      CHR( '\n' );
-   }
-
-   fi = tgsi_default_full_instruction();
-   fd = tgsi_default_full_declaration();
-
-   while( !tgsi_parse_end_of_tokens( &parse ) ) {
-      tgsi_parse_token( &parse );
-
-      switch( parse.FullToken.Token.Type ) {
-      case TGSI_TOKEN_TYPE_DECLARATION:
-         dump_declaration_short(
-            dump,
-            &parse.FullToken.FullDeclaration );
-         break;
-
-      case TGSI_TOKEN_TYPE_IMMEDIATE:
-         dump_immediate_short(
-            dump,
-            &parse.FullToken.FullImmediate );
-         break;
-
-      case TGSI_TOKEN_TYPE_INSTRUCTION:
-         dump_instruction_short(
-            dump,
-            &parse.FullToken.FullInstruction,
-            instno );
-         instno++;
-         break;
-
-      default:
-         assert( 0 );
-      }
-
-      if( verbose ) {
-         TXT( "\nType       : " );
-         ENM( parse.FullToken.Token.Type, TGSI_TOKEN_TYPES );
-         if( ignored ) {
-            TXT( "\nSize       : " );
-            UID( parse.FullToken.Token.Size );
-            if( deflt || parse.FullToken.Token.Extended ) {
-               TXT( "\nExtended   : " );
-               UID( parse.FullToken.Token.Extended );
-            }
-         }
-
-         switch( parse.FullToken.Token.Type ) {
-         case TGSI_TOKEN_TYPE_DECLARATION:
-            dump_declaration_verbose(
-               dump,
-               &parse.FullToken.FullDeclaration,
-               ignored,
-               deflt,
-               &fd );
-            break;
-
-         case TGSI_TOKEN_TYPE_IMMEDIATE:
-            dump_immediate_verbose(
-               dump,
-               &parse.FullToken.FullImmediate,
-               ignored );
-            break;
-
-         case TGSI_TOKEN_TYPE_INSTRUCTION:
-            dump_instruction_verbose(
-               dump,
-               &parse.FullToken.FullInstruction,
-               ignored,
-               deflt,
-               &fi );
-            break;
-
-         default:
-            assert( 0 );
-         }
-
-         CHR( '\n' );
-      }
-   }
-
-   TXT( "\ntgsi-dump end -------------------\n" );
-
-   tgsi_parse_free( &parse );
-}
-
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_dump.h b/src/mesa/pipe/tgsi/exec/tgsi_dump.h
deleted file mode 100644 (file)
index 70860c0..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#if !defined TGSI_DUMP_H
-#define TGSI_DUMP_H
-
-#if defined __cplusplus
-extern "C" {
-#endif // defined __cplusplus
-
-#define TGSI_DUMP_VERBOSE       1
-#define TGSI_DUMP_NO_IGNORED    2
-#define TGSI_DUMP_NO_DEFAULT    4
-
-void
-tgsi_dump(
-   const struct tgsi_token *tokens,
-   unsigned flags );
-
-#if defined __cplusplus
-} // extern "C"
-#endif // defined __cplusplus
-
-#endif // !defined TGSI_DUMP_H
-
index ea6c5021b32fcecca38d6407f4987e054b13924c..dd11dd58b78b8cc24d572ddfc1777a4b5487f819 100644 (file)
  *
  *
  * Authors:
- *   Michael Krol
+ *   Michal Krol
  *   Brian Paul
  */
 
 #include "pipe/p_compiler.h"
 #include "pipe/p_state.h"
 #include "pipe/p_util.h"
-#include "tgsi_core.h"
+#include "pipe/p_shader_tokens.h"
+#include "pipe/tgsi/util/tgsi_parse.h"
+#include "pipe/tgsi/util/tgsi_util.h"
+#include "tgsi_exec.h"
 
 #define TILE_TOP_LEFT     0
 #define TILE_TOP_RIGHT    1
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_parse.c b/src/mesa/pipe/tgsi/exec/tgsi_parse.c
deleted file mode 100644 (file)
index aee71de..0000000
+++ /dev/null
@@ -1,316 +0,0 @@
-/**************************************************************************
- * 
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- * 
- **************************************************************************/
-
-#include "tgsi_platform.h"
-#include "tgsi_core.h"
-
-void
-tgsi_full_token_init(
-   union tgsi_full_token *full_token )
-{
-   full_token->Token.Type = TGSI_TOKEN_TYPE_DECLARATION;
-}
-
-void
-tgsi_full_token_free(
-   union tgsi_full_token *full_token )
-{
-   if( full_token->Token.Type == TGSI_TOKEN_TYPE_IMMEDIATE ) {
-      FREE( full_token->FullImmediate.u.Pointer );
-   }
-}
-
-unsigned
-tgsi_parse_init(
-   struct tgsi_parse_context *ctx,
-   const struct tgsi_token *tokens )
-{
-   ctx->FullVersion.Version = *(struct tgsi_version *) &tokens[0];
-   if( ctx->FullVersion.Version.MajorVersion > 1 ) {
-      return TGSI_PARSE_ERROR;
-   }
-
-   ctx->FullHeader.Header = *(struct tgsi_header *) &tokens[1];
-   if( ctx->FullHeader.Header.HeaderSize >= 2 ) {
-      ctx->FullHeader.Processor = *(struct tgsi_processor *) &tokens[2];
-   }
-   else {
-      ctx->FullHeader.Processor = tgsi_default_processor();
-   }
-
-   ctx->Tokens = tokens;
-   ctx->Position = 1 + ctx->FullHeader.Header.HeaderSize;
-
-   tgsi_full_token_init( &ctx->FullToken );
-
-   return TGSI_PARSE_OK;
-}
-
-void
-tgsi_parse_free(
-   struct tgsi_parse_context *ctx )
-{
-   tgsi_full_token_free( &ctx->FullToken );
-}
-
-boolean
-tgsi_parse_end_of_tokens(
-   struct tgsi_parse_context *ctx )
-{
-   return ctx->Position >=
-      1 + ctx->FullHeader.Header.HeaderSize + ctx->FullHeader.Header.BodySize;
-}
-
-static void
-next_token(
-   struct tgsi_parse_context *ctx,
-   void *token )
-{
-   assert( !tgsi_parse_end_of_tokens( ctx ) );
-
-   *(struct tgsi_token *) token = ctx->Tokens[ctx->Position++];
-}
-
-void
-tgsi_parse_token(
-   struct tgsi_parse_context *ctx )
-{
-   struct tgsi_token token;
-   unsigned i;
-
-   tgsi_full_token_free( &ctx->FullToken );
-   tgsi_full_token_init( &ctx->FullToken );
-
-   next_token( ctx, &token );
-
-   switch( token.Type ) {
-   case TGSI_TOKEN_TYPE_DECLARATION:
-   {
-      struct tgsi_full_declaration *decl = &ctx->FullToken.FullDeclaration;
-
-      *decl = tgsi_default_full_declaration();
-      decl->Declaration = *(struct tgsi_declaration *) &token;
-
-      switch( decl->Declaration.Type ) {
-      case TGSI_DECLARE_RANGE:
-         next_token( ctx, &decl->u.DeclarationRange );
-         break;
-
-      case TGSI_DECLARE_MASK:
-         next_token( ctx, &decl->u.DeclarationMask );
-         break;
-
-      default:
-         assert (0);
-      }
-
-      if( decl->Declaration.Interpolate ) {
-         next_token( ctx, &decl->Interpolation );
-      }
-
-      if( decl->Declaration.Semantic ) {
-         next_token( ctx, &decl->Semantic );
-      }
-
-      break;
-   }
-
-   case TGSI_TOKEN_TYPE_IMMEDIATE:
-   {
-      struct tgsi_full_immediate *imm = &ctx->FullToken.FullImmediate;
-
-      *imm = tgsi_default_full_immediate();
-      imm->Immediate = *(struct tgsi_immediate *) &token;
-
-      assert( !imm->Immediate.Extended );
-
-      switch (imm->Immediate.DataType) {
-      case TGSI_IMM_FLOAT32:
-         imm->u.Pointer = MALLOC(
-            sizeof( struct tgsi_immediate_float32 ) * (imm->Immediate.Size - 1) );
-         for( i = 0; i < imm->Immediate.Size - 1; i++ ) {
-            next_token( ctx, &imm->u.ImmediateFloat32[i] );
-         }
-         break;
-
-      default:
-         assert( 0 );
-      }
-
-      break;
-   }
-
-   case TGSI_TOKEN_TYPE_INSTRUCTION:
-   {
-      struct tgsi_full_instruction *inst = &ctx->FullToken.FullInstruction;
-      unsigned extended;
-
-      *inst = tgsi_default_full_instruction();
-      inst->Instruction = *(struct tgsi_instruction *) &token;
-
-      extended = inst->Instruction.Extended;
-
-      while( extended ) {
-         struct tgsi_src_register_ext token;
-
-         next_token( ctx, &token );
-
-         switch( token.Type ) {
-         case TGSI_INSTRUCTION_EXT_TYPE_NV:
-            inst->InstructionExtNv =
-               *(struct tgsi_instruction_ext_nv *) &token;
-            break;
-
-         case TGSI_INSTRUCTION_EXT_TYPE_LABEL:
-            inst->InstructionExtLabel =
-               *(struct tgsi_instruction_ext_label *) &token;
-            break;
-
-         case TGSI_INSTRUCTION_EXT_TYPE_TEXTURE:
-            inst->InstructionExtTexture =
-               *(struct tgsi_instruction_ext_texture *) &token;
-            break;
-
-         default:
-            assert( 0 );
-         }
-
-         extended = token.Extended;
-      }
-
-      assert( inst->Instruction.NumDstRegs <= TGSI_FULL_MAX_DST_REGISTERS );
-
-      for(  i = 0; i < inst->Instruction.NumDstRegs; i++ ) {
-         unsigned extended;
-
-         next_token( ctx, &inst->FullDstRegisters[i].DstRegister );
-
-         /*
-          * No support for indirect or multi-dimensional addressing.
-          */
-         assert( !inst->FullDstRegisters[i].DstRegister.Indirect );
-         assert( !inst->FullDstRegisters[i].DstRegister.Dimension );
-
-         extended = inst->FullDstRegisters[i].DstRegister.Extended;
-
-         while( extended ) {
-            struct tgsi_src_register_ext token;
-
-            next_token( ctx, &token );
-
-            switch( token.Type ) {
-            case TGSI_DST_REGISTER_EXT_TYPE_CONDCODE:
-               inst->FullDstRegisters[i].DstRegisterExtConcode =
-                  *(struct tgsi_dst_register_ext_concode *) &token;
-               break;
-
-            case TGSI_DST_REGISTER_EXT_TYPE_MODULATE:
-               inst->FullDstRegisters[i].DstRegisterExtModulate =
-                  *(struct tgsi_dst_register_ext_modulate *) &token;
-               break;
-
-            default:
-               assert( 0 );
-            }
-
-            extended = token.Extended;
-         }
-      }
-
-      assert( inst->Instruction.NumSrcRegs <= TGSI_FULL_MAX_SRC_REGISTERS );
-
-      for( i = 0; i < inst->Instruction.NumSrcRegs; i++ ) {
-         unsigned extended;
-
-         next_token( ctx, &inst->FullSrcRegisters[i].SrcRegister );
-
-         extended = inst->FullSrcRegisters[i].SrcRegister.Extended;
-
-         while( extended ) {
-            struct tgsi_src_register_ext token;
-
-            next_token( ctx, &token );
-
-            switch( token.Type ) {
-            case TGSI_SRC_REGISTER_EXT_TYPE_SWZ:
-               inst->FullSrcRegisters[i].SrcRegisterExtSwz =
-                  *(struct tgsi_src_register_ext_swz *) &token;
-               break;
-
-            case TGSI_SRC_REGISTER_EXT_TYPE_MOD:
-               inst->FullSrcRegisters[i].SrcRegisterExtMod =
-                  *(struct tgsi_src_register_ext_mod *) &token;
-               break;
-
-            default:
-               assert( 0 );
-            }
-
-            extended = token.Extended;
-         }
-
-         if( inst->FullSrcRegisters[i].SrcRegister.Indirect ) {
-            next_token( ctx, &inst->FullSrcRegisters[i].SrcRegisterInd );
-
-            /*
-             * No support for indirect or multi-dimensional addressing.
-             */
-            assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Indirect );
-            assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Dimension );
-            assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Extended );
-         }
-
-         if( inst->FullSrcRegisters[i].SrcRegister.Dimension ) {
-            next_token( ctx, &inst->FullSrcRegisters[i].SrcRegisterDim );
-
-            /*
-             * No support for multi-dimensional addressing.
-             */
-            assert( !inst->FullSrcRegisters[i].SrcRegisterDim.Dimension );
-            assert( !inst->FullSrcRegisters[i].SrcRegisterDim.Extended );
-
-            if( inst->FullSrcRegisters[i].SrcRegisterDim.Indirect ) {
-               next_token( ctx, &inst->FullSrcRegisters[i].SrcRegisterDimInd );
-
-               /*
-               * No support for indirect or multi-dimensional addressing.
-               */
-               assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Indirect );
-               assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Dimension );
-               assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Extended );
-            }
-         }
-      }
-
-      break;
-   }
-
-   default:
-      assert( 0 );
-   }
-}
-
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_parse.h b/src/mesa/pipe/tgsi/exec/tgsi_parse.h
deleted file mode 100644 (file)
index 9372da8..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-#if !defined TGSI_PARSE_H
-#define TGSI_PARSE_H
-
-#if defined __cplusplus
-extern "C" {
-#endif // defined __cplusplus
-
-struct tgsi_full_version
-{
-   struct tgsi_version  Version;
-};
-
-struct tgsi_full_header
-{
-   struct tgsi_header      Header;
-   struct tgsi_processor   Processor;
-};
-
-struct tgsi_full_dst_register
-{
-   struct tgsi_dst_register               DstRegister;
-   struct tgsi_dst_register_ext_concode   DstRegisterExtConcode;
-   struct tgsi_dst_register_ext_modulate  DstRegisterExtModulate;
-};
-
-struct tgsi_full_src_register
-{
-   struct tgsi_src_register         SrcRegister;
-   struct tgsi_src_register_ext_swz SrcRegisterExtSwz;
-   struct tgsi_src_register_ext_mod SrcRegisterExtMod;
-   struct tgsi_src_register         SrcRegisterInd;
-   struct tgsi_dimension            SrcRegisterDim;
-   struct tgsi_src_register         SrcRegisterDimInd;
-};
-
-struct tgsi_full_declaration
-{
-   struct tgsi_declaration Declaration;
-   union
-   {
-      struct tgsi_declaration_range DeclarationRange;
-      struct tgsi_declaration_mask  DeclarationMask;
-   } u;
-   struct tgsi_declaration_interpolation  Interpolation;
-   struct tgsi_declaration_semantic       Semantic;
-};
-
-struct tgsi_full_immediate
-{
-   struct tgsi_immediate   Immediate;
-   union
-   {
-      void                          *Pointer;
-      struct tgsi_immediate_float32 *ImmediateFloat32;
-   } u;
-};
-
-#define TGSI_FULL_MAX_DST_REGISTERS 2
-#define TGSI_FULL_MAX_SRC_REGISTERS 3
-
-struct tgsi_full_instruction
-{
-   struct tgsi_instruction             Instruction;
-   struct tgsi_instruction_ext_nv      InstructionExtNv;
-   struct tgsi_instruction_ext_label   InstructionExtLabel;
-   struct tgsi_instruction_ext_texture InstructionExtTexture;
-   struct tgsi_full_dst_register       FullDstRegisters[TGSI_FULL_MAX_DST_REGISTERS];
-   struct tgsi_full_src_register       FullSrcRegisters[TGSI_FULL_MAX_SRC_REGISTERS];
-};
-
-union tgsi_full_token
-{
-   struct tgsi_token             Token;
-   struct tgsi_full_declaration  FullDeclaration;
-   struct tgsi_full_immediate    FullImmediate;
-   struct tgsi_full_instruction  FullInstruction;
-};
-
-void
-tgsi_full_token_init(
-   union tgsi_full_token *full_token );
-
-void
-tgsi_full_token_free(
-   union tgsi_full_token *full_token );
-
-struct tgsi_parse_context
-{
-   const struct tgsi_token    *Tokens;
-   unsigned                   Position;
-   struct tgsi_full_version   FullVersion;
-   struct tgsi_full_header    FullHeader;
-   union tgsi_full_token      FullToken;
-};
-
-#define TGSI_PARSE_OK      0
-#define TGSI_PARSE_ERROR   1
-
-unsigned
-tgsi_parse_init(
-   struct tgsi_parse_context *ctx,
-   const struct tgsi_token *tokens );
-
-void
-tgsi_parse_free(
-   struct tgsi_parse_context *ctx );
-
-boolean
-tgsi_parse_end_of_tokens(
-   struct tgsi_parse_context *ctx );
-
-void
-tgsi_parse_token(
-   struct tgsi_parse_context *ctx );
-
-#if defined __cplusplus
-} // extern "C"
-#endif // defined __cplusplus
-
-#endif // !defined TGSI_PARSE_H
-
index 3a5c1da1800365dd67e3b848c1e57fea67c25509..e403cfaaf3670af02e281f537ee60afd6331d390 100755 (executable)
  * 
  **************************************************************************/
 
-#include "tgsi_platform.h"
-#include "tgsi_core.h"
+#include "pipe/p_util.h"
+#include "pipe/p_shader_tokens.h"
+#include "pipe/tgsi/util/tgsi_parse.h"
+#include "pipe/tgsi/util/tgsi_util.h"
+#include "tgsi_exec.h"
+#include "tgsi_sse2.h"
+
 #include "x86/rtasm/x86sse.h"
 
 #if defined(__i386__) || defined(__386__)
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_token.h b/src/mesa/pipe/tgsi/exec/tgsi_token.h
deleted file mode 100644 (file)
index 2b922c7..0000000
+++ /dev/null
@@ -1,1494 +0,0 @@
-#if !defined TGSI_TOKEN_H
-#define TGSI_TOKEN_H
-
-#if defined __cplusplus
-extern "C" {
-#endif // defined __cplusplus
-
-struct tgsi_version
-{
-   unsigned MajorVersion  : 8;
-   unsigned MinorVersion  : 8;
-   unsigned Padding       : 16;
-};
-
-struct tgsi_header
-{
-   unsigned HeaderSize : 8;
-   unsigned BodySize   : 24;
-};
-
-#define TGSI_PROCESSOR_FRAGMENT  0
-#define TGSI_PROCESSOR_VERTEX    1
-#define TGSI_PROCESSOR_GEOMETRY  2
-
-struct tgsi_processor
-{
-   unsigned Processor  : 4;  /* TGSI_PROCESSOR_ */
-   unsigned Padding    : 28;
-};
-
-#define TGSI_TOKEN_TYPE_DECLARATION    0
-#define TGSI_TOKEN_TYPE_IMMEDIATE      1
-#define TGSI_TOKEN_TYPE_INSTRUCTION    2
-
-struct tgsi_token
-{
-   unsigned Type       : 4;  /* TGSI_TOKEN_TYPE_ */
-   unsigned Size       : 8;  /* UINT */
-   unsigned Padding    : 19;
-   unsigned Extended   : 1;  /* BOOL */
-};
-
-#define TGSI_FILE_NULL        0
-#define TGSI_FILE_CONSTANT    1
-#define TGSI_FILE_INPUT       2
-#define TGSI_FILE_OUTPUT      3
-#define TGSI_FILE_TEMPORARY   4
-#define TGSI_FILE_SAMPLER     5
-#define TGSI_FILE_ADDRESS     6
-#define TGSI_FILE_IMMEDIATE   7
-
-#define TGSI_DECLARE_RANGE    0
-#define TGSI_DECLARE_MASK     1
-
-#define TGSI_WRITEMASK_NONE     0x00
-#define TGSI_WRITEMASK_X        0x01
-#define TGSI_WRITEMASK_Y        0x02
-#define TGSI_WRITEMASK_XY       0x03
-#define TGSI_WRITEMASK_Z        0x04
-#define TGSI_WRITEMASK_XZ       0x05
-#define TGSI_WRITEMASK_YZ       0x06
-#define TGSI_WRITEMASK_XYZ      0x07
-#define TGSI_WRITEMASK_W        0x08
-#define TGSI_WRITEMASK_XW       0x09
-#define TGSI_WRITEMASK_YW       0x0A
-#define TGSI_WRITEMASK_XYW      0x0B
-#define TGSI_WRITEMASK_ZW       0x0C
-#define TGSI_WRITEMASK_XZW      0x0D
-#define TGSI_WRITEMASK_YZW      0x0E
-#define TGSI_WRITEMASK_XYZW     0x0F
-
-struct tgsi_declaration
-{
-   unsigned Type        : 4;  /* TGSI_TOKEN_TYPE_DECLARATION */
-   unsigned Size        : 8;  /* UINT */
-   unsigned File        : 4;  /* one of TGSI_FILE_x */
-   unsigned Declare     : 4;  /* one of TGSI_DECLARE_x */
-   unsigned UsageMask   : 4;  /* bitmask of TGSI_WRITEMASK_x flags */
-   unsigned Interpolate : 1;  /* BOOL, any interpolation info? */
-   unsigned Semantic    : 1;  /* BOOL, any semantic info? */
-   unsigned Padding     : 5;
-   unsigned Extended    : 1;  /* BOOL */
-};
-
-struct tgsi_declaration_range
-{
-   unsigned First   : 16; /* UINT */
-   unsigned Last    : 16; /* UINT */
-};
-
-struct tgsi_declaration_mask
-{
-   unsigned Mask : 32; /* UINT */
-};
-
-#define TGSI_INTERPOLATE_CONSTANT      0
-#define TGSI_INTERPOLATE_LINEAR        1
-#define TGSI_INTERPOLATE_PERSPECTIVE   2
-
-struct tgsi_declaration_interpolation
-{
-   unsigned Interpolate   : 4;  /* TGSI_INTERPOLATE_ */
-   unsigned Padding       : 28;
-};
-
-#define TGSI_SEMANTIC_POSITION 0
-#define TGSI_SEMANTIC_COLOR    1
-#define TGSI_SEMANTIC_BCOLOR   2 /**< back-face color */
-#define TGSI_SEMANTIC_FOG      3
-#define TGSI_SEMANTIC_PSIZE    4
-#define TGSI_SEMANTIC_GENERIC  5
-#define TGSI_SEMANTIC_COUNT    6 /**< number of semantic values */
-
-struct tgsi_declaration_semantic
-{
-   unsigned SemanticName   : 8;  /* one of TGSI_SEMANTIC_ */
-   unsigned SemanticIndex  : 16; /* UINT */
-   unsigned Padding        : 8;
-};
-
-#define TGSI_IMM_FLOAT32   0
-
-struct tgsi_immediate
-{
-   unsigned Type       : 4;  /* TGSI_TOKEN_TYPE_IMMEDIATE */
-   unsigned Size       : 8;  /* UINT */
-   unsigned DataType   : 4;  /* TGSI_IMM_ */
-   unsigned Padding    : 15;
-   unsigned Extended   : 1;  /* BOOL */
-};
-
-struct tgsi_immediate_float32
-{
-   float Float;
-};
-
-/*
- * GL_NV_vertex_program
- */
-#define TGSI_OPCODE_ARL                 0
-#define TGSI_OPCODE_MOV                 1
-#define TGSI_OPCODE_LIT                 2
-#define TGSI_OPCODE_RCP                 3
-#define TGSI_OPCODE_RSQ                 4
-#define TGSI_OPCODE_EXP                 5
-#define TGSI_OPCODE_LOG                 6
-#define TGSI_OPCODE_MUL                 7
-#define TGSI_OPCODE_ADD                 8
-#define TGSI_OPCODE_DP3                 9
-#define TGSI_OPCODE_DP4                 10
-#define TGSI_OPCODE_DST                 11
-#define TGSI_OPCODE_MIN                 12
-#define TGSI_OPCODE_MAX                 13
-#define TGSI_OPCODE_SLT                 14
-#define TGSI_OPCODE_SGE                 15
-#define TGSI_OPCODE_MAD                 16
-
-/*
- * GL_ATI_fragment_shader
- */
-/* TGSI_OPCODE_MOV */
-/* TGSI_OPCODE_ADD */
-/* TGSI_OPCODE_MUL */
-#define TGSI_OPCODE_SUB                 17
-#define TGSI_OPCODE_DOT3                TGSI_OPCODE_DP3
-#define TGSI_OPCODE_DOT4                TGSI_OPCODE_DP4
-/* TGSI_OPCODE_MAD */
-#define TGSI_OPCODE_LERP                18
-#define TGSI_OPCODE_CND                 19
-#define TGSI_OPCODE_CND0                20
-#define TGSI_OPCODE_DOT2ADD             21
-
-/*
- * GL_EXT_vertex_shader
- */
-#define TGSI_OPCODE_INDEX               22
-#define TGSI_OPCODE_NEGATE              23
-/* TGSI_OPCODE_DOT3 */
-/* TGSI_OPCODE_DOT4 */
-/* TGSI_OPCODE_MUL */
-/* TGSI_OPCODE_ADD */
-#define TGSI_OPCODE_MADD                TGSI_OPCODE_MAD
-#define TGSI_OPCODE_FRAC                24
-/* TGSI_OPCODE_MAX */
-/* TGSI_OPCODE_MIN */
-#define TGSI_OPCODE_SETGE               TGSI_OPCODE_SGE
-#define TGSI_OPCODE_SETLT               TGSI_OPCODE_SLT
-#define TGSI_OPCODE_CLAMP               25
-#define TGSI_OPCODE_FLOOR               26
-#define TGSI_OPCODE_ROUND               27
-#define TGSI_OPCODE_EXPBASE2            28
-#define TGSI_OPCODE_LOGBASE2            29
-#define TGSI_OPCODE_POWER               30
-#define TGSI_OPCODE_RECIP               TGSI_OPCODE_RCP
-#define TGSI_OPCODE_RECIPSQRT           TGSI_OPCODE_RSQ
-/* TGSI_OPCODE_SUB */
-#define TGSI_OPCODE_CROSSPRODUCT        31
-#define TGSI_OPCODE_MULTIPLYMATRIX      32
-/* TGSI_OPCODE_MOV */
-
-/*
- * GL_NV_vertex_program1_1
- */
-/* TGSI_OPCODE_ARL */
-/* TGSI_OPCODE_MOV */
-/* TGSI_OPCODE_LIT */
-#define TGSI_OPCODE_ABS                 33
-/* TGSI_OPCODE_RCP */
-/* TGSI_OPCODE_RSQ */
-/* TGSI_OPCODE_EXP */
-/* TGSI_OPCODE_LOG */
-#define TGSI_OPCODE_RCC                 34
-/* TGSI_OPCODE_MUL */
-/* TGSI_OPCODE_ADD */
-/* TGSI_OPCODE_DP3 */
-/* TGSI_OPCODE_DP4 */
-/* TGSI_OPCODE_DST */
-/* TGSI_OPCODE_MIN */
-/* TGSI_OPCODE_MAX */
-/* TGSI_OPCODE_SLT */
-/* TGSI_OPCODE_SGE */
-#define TGSI_OPCODE_DPH                 35
-/* TGSI_OPCODE_SUB */
-/* TGSI_OPCODE_MAD */
-
-/*
- * GL_NV_fragment_program
- */
-/* TGSI_OPCODE_ADD */
-#define TGSI_OPCODE_COS                 36
-#define TGSI_OPCODE_DDX                 37
-#define TGSI_OPCODE_DDY                 38
-/* TGSI_OPCODE_DP3 */
-/* TGSI_OPCODE_DP4 */
-/* TGSI_OPCODE_DST */
-#define TGSI_OPCODE_EX2                 TGSI_OPCODE_EXPBASE2
-#define TGSI_OPCODE_FLR                 TGSI_OPCODE_FLOOR
-#define TGSI_OPCODE_FRC                 TGSI_OPCODE_FRAC
-#define TGSI_OPCODE_KILP                39  /* predicated kill */
-#define TGSI_OPCODE_LG2                 TGSI_OPCODE_LOGBASE2
-/* TGSI_OPCODE_LIT */
-#define TGSI_OPCODE_LRP                 TGSI_OPCODE_LERP
-/* TGSI_OPCODE_MAD */
-/* TGSI_OPCODE_MAX */
-/* TGSI_OPCODE_MIN */
-/* TGSI_OPCODE_MOV */
-/* TGSI_OPCODE_MUL */
-#define TGSI_OPCODE_PK2H                40
-#define TGSI_OPCODE_PK2US               41
-#define TGSI_OPCODE_PK4B                42
-#define TGSI_OPCODE_PK4UB               43
-#define TGSI_OPCODE_POW                 TGSI_OPCODE_POWER
-/* TGSI_OPCODE_RCP */
-#define TGSI_OPCODE_RFL                 44
-/* TGSI_OPCODE_RSQ */
-#define TGSI_OPCODE_SEQ                 45
-#define TGSI_OPCODE_SFL                 46
-/* TGSI_OPCODE_SGE */
-#define TGSI_OPCODE_SGT                 47
-#define TGSI_OPCODE_SIN                 48
-#define TGSI_OPCODE_SLE                 49
-/* TGSI_OPCODE_SLT */
-#define TGSI_OPCODE_SNE                 50
-#define TGSI_OPCODE_STR                 51
-/* TGSI_OPCODE_SUB */
-#define TGSI_OPCODE_TEX                 52
-#define TGSI_OPCODE_TXD                 53
-/* TGSI_OPCODE_TXP */
-#define TGSI_OPCODE_UP2H                54
-#define TGSI_OPCODE_UP2US               55
-#define TGSI_OPCODE_UP4B                56
-#define TGSI_OPCODE_UP4UB               57
-#define TGSI_OPCODE_X2D                 58
-
-/*
- * GL_NV_vertex_program2
- */
-/* TGSI_OPCODE_ABS */
-/* TGSI_OPCODE_ADD */
-#define TGSI_OPCODE_ARA                 59
-/* TGSI_OPCODE_ARL */
-#define TGSI_OPCODE_ARR                 60
-#define TGSI_OPCODE_BRA                 61
-#define TGSI_OPCODE_CAL                 62
-/* TGSI_OPCODE_COS */
-/* TGSI_OPCODE_DP3 */
-/* TGSI_OPCODE_DP4 */
-/* TGSI_OPCODE_DPH */
-/* TGSI_OPCODE_DST */
-/* TGSI_OPCODE_EX2 */
-/* TGSI_OPCODE_EXP */
-/* TGSI_OPCODE_FLR */
-/* TGSI_OPCODE_FRC */
-/* TGSI_OPCODE_LG2 */
-/* TGSI_OPCODE_LIT */
-/* TGSI_OPCODE_LOG */
-/* TGSI_OPCODE_MAD */
-/* TGSI_OPCODE_MAX */
-/* TGSI_OPCODE_MIN */
-/* TGSI_OPCODE_MOV */
-/* TGSI_OPCODE_MUL */
-/* TGSI_OPCODE_RCC */
-/* TGSI_OPCODE_RCP */
-#define TGSI_OPCODE_RET                 63
-/* TGSI_OPCODE_RSQNV - use TGSI_OPCODE_RSQ */
-/* TGSI_OPCODE_SEQ */
-/* TGSI_OPCODE_SFL */
-/* TGSI_OPCODE_SGE */
-/* TGSI_OPCODE_SGT */
-/* TGSI_OPCODE_SIN */
-/* TGSI_OPCODE_SLE */
-/* TGSI_OPCODE_SLT */
-/* TGSI_OPCODE_SNE */
-#define TGSI_OPCODE_SSG                 64
-/* TGSI_OPCODE_STR */
-/* TGSI_OPCODE_SUB */
-
-/*
- * GL_ARB_vertex_program
- */
-/* TGSI_OPCODE_ABS */
-/* TGSI_OPCODE_ADD */
-/* TGSI_OPCODE_ARL */
-/* TGSI_OPCODE_DP3 */
-/* TGSI_OPCODE_DP4 */
-/* TGSI_OPCODE_DPH */
-/* TGSI_OPCODE_DST */
-/* TGSI_OPCODE_EX2 */
-/* TGSI_OPCODE_EXP */
-/* TGSI_OPCODE_FLR */
-/* TGSI_OPCODE_FRC */
-/* TGSI_OPCODE_LG2 */
-/* TGSI_OPCODE_LIT */
-/* TGSI_OPCODE_LOG */
-/* TGSI_OPCODE_MAD */
-/* TGSI_OPCODE_MAX */
-/* TGSI_OPCODE_MIN */
-/* TGSI_OPCODE_MOV */
-/* TGSI_OPCODE_MUL */
-/* TGSI_OPCODE_POW */
-/* TGSI_OPCODE_RCP */
-/* TGSI_OPCODE_RSQ */
-/* TGSI_OPCODE_SGE */
-/* TGSI_OPCODE_SLT */
-/* TGSI_OPCODE_SUB */
-#define TGSI_OPCODE_SWZ                 TGSI_OPCODE_MOV
-#define TGSI_OPCODE_XPD                 TGSI_OPCODE_CROSSPRODUCT
-
-/*
- * GL_ARB_fragment_program
- */
-/* TGSI_OPCODE_ABS */
-/* TGSI_OPCODE_ADD */
-#define TGSI_OPCODE_CMP                 65
-/* TGSI_OPCODE_COS */
-/* TGSI_OPCODE_DP3 */
-/* TGSI_OPCODE_DP4 */
-/* TGSI_OPCODE_DPH */
-/* TGSI_OPCODE_DST */
-/* TGSI_OPCODE_EX2 */
-/* TGSI_OPCODE_FLR */
-/* TGSI_OPCODE_FRC */
-/* TGSI_OPCODE_LG2 */
-/* TGSI_OPCODE_LIT */
-/* TGSI_OPCODE_LRP */
-/* TGSI_OPCODE_MAD */
-/* TGSI_OPCODE_MAX */
-/* TGSI_OPCODE_MIN */
-/* TGSI_OPCODE_MOV */
-/* TGSI_OPCODE_MUL */
-/* TGSI_OPCODE_POW */
-/* TGSI_OPCODE_RCP */
-/* TGSI_OPCODE_RSQ */
-#define TGSI_OPCODE_SCS                 66
-/* TGSI_OPCODE_SGE */
-/* TGSI_OPCODE_SIN */
-/* TGSI_OPCODE_SLT */
-/* TGSI_OPCODE_SUB */
-/* TGSI_OPCODE_SWZ */
-/* TGSI_OPCODE_XPD */
-/* TGSI_OPCODE_TEX */
-/* TGSI_OPCODE_TXP */
-#define TGSI_OPCODE_TXB                 67
-/* TGSI_OPCODE_KIL */
-
-/*
- * GL_NV_fragment_program_option
- */
-/* TGSI_OPCODE_ABS */
-/* TGSI_OPCODE_FLR */
-/* TGSI_OPCODE_FRC */
-/* TGSI_OPCODE_LIT */
-/* TGSI_OPCODE_MOV */
-/* TGSI_OPCODE_DDX */
-/* TGSI_OPCODE_DDY */
-/* TGSI_OPCODE_PK2H */
-/* TGSI_OPCODE_PK2US */
-/* TGSI_OPCODE_PK4B */
-/* TGSI_OPCODE_PK4UB */
-/* TGSI_OPCODE_COS */
-/* TGSI_OPCODE_EX2 */
-/* TGSI_OPCODE_LG2 */
-/* TGSI_OPCODE_RCP */
-/* TGSI_OPCODE_RSQ */
-/* TGSI_OPCODE_SIN */
-/* TGSI_OPCODE_SCS */
-/* TGSI_OPCODE_UP2H */
-/* TGSI_OPCODE_UP2US */
-/* TGSI_OPCODE_UP4B */
-/* TGSI_OPCODE_UP4UB */
-/* TGSI_OPCODE_POW */
-/* TGSI_OPCODE_ADD */
-/* TGSI_OPCODE_DP3 */
-/* TGSI_OPCODE_DP4 */
-/* TGSI_OPCODE_DPH */
-/* TGSI_OPCODE_DST */
-/* TGSI_OPCODE_MAX */
-/* TGSI_OPCODE_MIN */
-/* TGSI_OPCODE_MUL */
-/* TGSI_OPCODE_SGE */
-/* TGSI_OPCODE_SLT */
-/* TGSI_OPCODE_SUB */
-/* TGSI_OPCODE_XPD */
-/* TGSI_OPCODE_RFL */
-/* TGSI_OPCODE_SEQ */
-/* TGSI_OPCODE_SFL */
-/* TGSI_OPCODE_SGT */
-/* TGSI_OPCODE_SLE */
-/* TGSI_OPCODE_SNE */
-/* TGSI_OPCODE_STR */
-/* TGSI_OPCODE_CMP */
-/* TGSI_OPCODE_LRP */
-/* TGSI_OPCODE_MAD */
-/* TGSI_OPCODE_X2D */
-/* TGSI_OPCODE_SWZ */
-/* TGSI_OPCODE_TEX */
-/* TGSI_OPCODE_TXP */
-/* TGSI_OPCODE_TXB */
-/* TGSI_OPCODE_KIL */
-/* TGSI_OPCODE_TXD */
-
-/*
- * GL_NV_fragment_program2
- */
-/* TGSI_OPCODE_ABS */
-/* TGSI_OPCODE_FLR */
-/* TGSI_OPCODE_FRC */
-/* TGSI_OPCODE_LIT */
-/* TGSI_OPCODE_MOV */
-/* TGSI_OPCODE_DDX */
-/* TGSI_OPCODE_DDY */
-/* TGSI_OPCODE_PK2H */
-/* TGSI_OPCODE_PK2US */
-/* TGSI_OPCODE_PK4B */
-/* TGSI_OPCODE_PK4UB */
-#define TGSI_OPCODE_NRM                 68
-#define TGSI_OPCODE_DIV                 69
-/* TGSI_OPCODE_COS */
-/* TGSI_OPCODE_EX2 */
-/* TGSI_OPCODE_LG2 */
-/* TGSI_OPCODE_RCP */
-/* TGSI_OPCODE_RSQ */
-/* TGSI_OPCODE_SIN */
-/* TGSI_OPCODE_SCS */
-/* TGSI_OPCODE_UP2H */
-/* TGSI_OPCODE_UP2US */
-/* TGSI_OPCODE_UP4B */
-/* TGSI_OPCODE_UP4UB */
-/* TGSI_OPCODE_POW */
-/* TGSI_OPCODE_ADD */
-/* TGSI_OPCODE_DP3 */
-/* TGSI_OPCODE_DP4 */
-/* TGSI_OPCODE_DPH */
-/* TGSI_OPCODE_DST */
-/* TGSI_OPCODE_MAX */
-/* TGSI_OPCODE_MIN */
-/* TGSI_OPCODE_MUL */
-/* TGSI_OPCODE_SGE */
-/* TGSI_OPCODE_SLT */
-/* TGSI_OPCODE_SUB */
-/* TGSI_OPCODE_XPD */
-/* TGSI_OPCODE_RFL */
-/* TGSI_OPCODE_SEQ */
-/* TGSI_OPCODE_SFL */
-/* TGSI_OPCODE_SGT */
-/* TGSI_OPCODE_SLE */
-/* TGSI_OPCODE_SNE */
-/* TGSI_OPCODE_STR */
-#define TGSI_OPCODE_DP2                 70
-/* TGSI_OPCODE_CMP */
-/* TGSI_OPCODE_LRP */
-/* TGSI_OPCODE_MAD */
-/* TGSI_OPCODE_X2D */
-#define TGSI_OPCODE_DP2A                TGSI_OPCODE_DOT2ADD
-/* TGSI_OPCODE_SWZ */
-/* TGSI_OPCODE_TEX */
-/* TGSI_OPCODE_TXP */
-/* TGSI_OPCODE_TXB */
-#define TGSI_OPCODE_TXL                 71
-/* TGSI_OPCODE_KIL */
-/* TGSI_OPCODE_TXD */
-/* TGSI_OPCODE_CAL */
-/* TGSI_OPCODE_RET */
-#define TGSI_OPCODE_BRK                 72
-#define TGSI_OPCODE_IF                  73
-#define TGSI_OPCODE_LOOP                74
-#define TGSI_OPCODE_REP                 75
-#define TGSI_OPCODE_ELSE                76
-#define TGSI_OPCODE_ENDIF               77
-#define TGSI_OPCODE_ENDLOOP             78
-#define TGSI_OPCODE_ENDREP              79
-
-/*
- * GL_NV_vertex_program2_option
- */
-/* TGSI_OPCODE_ARL */
-/* TGSI_OPCODE_ABS */
-/* TGSI_OPCODE_FLR */
-/* TGSI_OPCODE_FRC */
-/* TGSI_OPCODE_LIT */
-/* TGSI_OPCODE_MOV */
-/* TGSI_OPCODE_SSG */
-/* TGSI_OPCODE_EX2 */
-/* TGSI_OPCODE_EXP */
-/* TGSI_OPCODE_LG2 */
-/* TGSI_OPCODE_LOG */
-/* TGSI_OPCODE_RCP */
-/* TGSI_OPCODE_RSQ */
-/* TGSI_OPCODE_COS */
-/* TGSI_OPCODE_RCC */
-/* TGSI_OPCODE_SIN */
-/* TGSI_OPCODE_POW */
-/* TGSI_OPCODE_ADD */
-/* TGSI_OPCODE_DP3 */
-/* TGSI_OPCODE_DP4 */
-/* TGSI_OPCODE_DPH */
-/* TGSI_OPCODE_DST */
-/* TGSI_OPCODE_MAX */
-/* TGSI_OPCODE_MIN */
-/* TGSI_OPCODE_MUL */
-/* TGSI_OPCODE_SGE */
-/* TGSI_OPCODE_SLT */
-/* TGSI_OPCODE_SUB */
-/* TGSI_OPCODE_XPD */
-/* TGSI_OPCODE_SEQ */
-/* TGSI_OPCODE_SFL */
-/* TGSI_OPCODE_SGT */
-/* TGSI_OPCODE_SLE */
-/* TGSI_OPCODE_SNE */
-/* TGSI_OPCODE_STR */
-/* TGSI_OPCODE_MAD */
-/* TGSI_OPCODE_SWZ */
-/* TGSI_OPCODE_ARR */
-/* TGSI_OPCODE_ARA */
-/* TGSI_OPCODE_BRA */
-/* TGSI_OPCODE_CAL */
-/* TGSI_OPCODE_RET */
-
-/*
- * GL_NV_vertex_program3
- */
-/* TGSI_OPCODE_ARL */
-/* TGSI_OPCODE_ABS */
-/* TGSI_OPCODE_FLR */
-/* TGSI_OPCODE_FRC */
-/* TGSI_OPCODE_LIT */
-/* TGSI_OPCODE_MOV */
-/* TGSI_OPCODE_SSG */
-/* TGSI_OPCODE_EX2 */
-/* TGSI_OPCODE_EXP */
-/* TGSI_OPCODE_LG2 */
-/* TGSI_OPCODE_LOG */
-/* TGSI_OPCODE_RCP */
-/* TGSI_OPCODE_RSQ */
-/* TGSI_OPCODE_COS */
-/* TGSI_OPCODE_RCC */
-/* TGSI_OPCODE_SIN */
-/* TGSI_OPCODE_POW */
-/* TGSI_OPCODE_ADD */
-/* TGSI_OPCODE_DP3 */
-/* TGSI_OPCODE_DP4 */
-/* TGSI_OPCODE_DPH */
-/* TGSI_OPCODE_DST */
-/* TGSI_OPCODE_MAX */
-/* TGSI_OPCODE_MIN */
-/* TGSI_OPCODE_MUL */
-/* TGSI_OPCODE_SGE */
-/* TGSI_OPCODE_SLT */
-/* TGSI_OPCODE_SUB */
-/* TGSI_OPCODE_XPD */
-/* TGSI_OPCODE_SEQ */
-/* TGSI_OPCODE_SFL */
-/* TGSI_OPCODE_SGT */
-/* TGSI_OPCODE_SLE */
-/* TGSI_OPCODE_SNE */
-/* TGSI_OPCODE_STR */
-/* TGSI_OPCODE_MAD */
-/* TGSI_OPCODE_SWZ */
-/* TGSI_OPCODE_ARR */
-/* TGSI_OPCODE_ARA */
-/* TGSI_OPCODE_BRA */
-/* TGSI_OPCODE_CAL */
-/* TGSI_OPCODE_RET */
-#define TGSI_OPCODE_PUSHA               80
-#define TGSI_OPCODE_POPA                81
-/* TGSI_OPCODE_TEX */
-/* TGSI_OPCODE_TXP */
-/* TGSI_OPCODE_TXB */
-/* TGSI_OPCODE_TXL */
-
-/*
- * GL_NV_gpu_program4
- */
-/* TGSI_OPCODE_ABS */
-#define TGSI_OPCODE_CEIL                82
-/* TGSI_OPCODE_FLR */
-/* TGSI_OPCODE_FRC */
-#define TGSI_OPCODE_I2F                 83
-/* TGSI_OPCODE_LIT */
-/* TGSI_OPCODE_MOV */
-#define TGSI_OPCODE_NOT                 84
-/* TGSI_OPCODE_NRM */
-/* TGSI_OPCODE_PK2H */
-/* TGSI_OPCODE_PK2US */
-/* TGSI_OPCODE_PK4B */
-/* TGSI_OPCODE_PK4UB */
-/* TGSI_OPCODE_ROUND */
-/* TGSI_OPCODE_SSG */
-#define TGSI_OPCODE_TRUNC               85
-/* TGSI_OPCODE_COS */
-/* TGSI_OPCODE_EX2 */
-/* TGSI_OPCODE_LG2 */
-/* TGSI_OPCODE_RCC */
-/* TGSI_OPCODE_RCP */
-/* TGSI_OPCODE_RSQ */
-/* TGSI_OPCODE_SCS */
-/* TGSI_OPCODE_SIN */
-/* TGSI_OPCODE_UP2H */
-/* TGSI_OPCODE_UP2US */
-/* TGSI_OPCODE_UP4B */
-/* TGSI_OPCODE_UP4UB */
-/* TGSI_OPCODE_POW */
-/* TGSI_OPCODE_DIV */
-#define TGSI_OPCODE_SHL                 86
-#define TGSI_OPCODE_SHR                 87
-/* TGSI_OPCODE_ADD */
-#define TGSI_OPCODE_AND                 88
-/* TGSI_OPCODE_DP3 */
-/* TGSI_OPCODE_DP4 */
-/* TGSI_OPCODE_DPH */
-/* TGSI_OPCODE_DST */
-/* TGSI_OPCODE_MAX */
-/* TGSI_OPCODE_MIN */
-/* TGSI_OPCODE_MUL */
-#define TGSI_OPCODE_OR                  89
-/* TGSI_OPCODE_RFL */
-/* TGSI_OPCODE_SEQ */
-/* TGSI_OPCODE_SFL */
-/* TGSI_OPCODE_SGE */
-/* TGSI_OPCODE_SGT */
-/* TGSI_OPCODE_SLE */
-/* TGSI_OPCODE_SLT */
-/* TGSI_OPCODE_SNE */
-/* TGSI_OPCODE_STR */
-/* TGSI_OPCODE_SUB */
-/* TGSI_OPCODE_XPD */
-/* TGSI_OPCODE_DP2 */
-#define TGSI_OPCODE_MOD                 90
-#define TGSI_OPCODE_XOR                 91
-/* TGSI_OPCODE_CMP */
-/* TGSI_OPCODE_DP2A */
-/* TGSI_OPCODE_LRP */
-/* TGSI_OPCODE_MAD */
-#define TGSI_OPCODE_SAD                 92
-/* TGSI_OPCODE_X2D */
-/* TGSI_OPCODE_SWZ */
-/* TGSI_OPCODE_TEX */
-/* TGSI_OPCODE_TXB */
-#define TGSI_OPCODE_TXF                 93
-/* TGSI_OPCODE_TXL */
-/* TGSI_OPCODE_TXP */
-#define TGSI_OPCODE_TXQ                 94
-/* TGSI_OPCODE_TXD */
-/* TGSI_OPCODE_CAL */
-/* TGSI_OPCODE_RET */
-/* TGSI_OPCODE_BRK */
-#define TGSI_OPCODE_CONT                95
-/* TGSI_OPCODE_IF */
-/* TGSI_OPCODE_REP */
-/* TGSI_OPCODE_ELSE */
-/* TGSI_OPCODE_ENDIF */
-/* TGSI_OPCODE_ENDREP */
-
-/*
- * GL_NV_vertex_program4
- */
-/* Same as GL_NV_gpu_program4 */
-
-/*
- * GL_NV_fragment_program4
- */
-/* Same as GL_NV_gpu_program4 */
-/* TGSI_OPCODE_KIL */
-/* TGSI_OPCODE_DDX */
-/* TGSI_OPCODE_DDY */
-
-/*
- * GL_NV_geometry_program4
- */
-/* Same as GL_NV_gpu_program4 */
-#define TGSI_OPCODE_EMIT                96
-#define TGSI_OPCODE_ENDPRIM             97
-
-/*
- * GLSL
- */
-/* TGSI_OPCODE_ABS */
-/* TGSI_OPCODE_ADD */
-#define TGSI_OPCODE_BGNLOOP2            98
-#define TGSI_OPCODE_BGNSUB              99
-/* TGSI_OPCODE_BRA */
-/* TGSI_OPCODE_BRK */
-/* TGSI_OPCODE_CONT */
-/* TGSI_OPCODE_COS */
-/* TGSI_OPCODE_DDX */
-/* TGSI_OPCODE_DDY */
-/* TGSI_OPCODE_DP3 */
-/* TGSI_OPCODE_DP4 */
-/* TGSI_OPCODE_ELSE */
-/* TGSI_OPCODE_ENDIF */
-#define TGSI_OPCODE_ENDLOOP2            100
-#define TGSI_OPCODE_ENDSUB              101
-/* TGSI_OPCODE_EX2 */
-/* TGSI_OPCODE_EXP */
-/* TGSI_OPCODE_FLR */
-/* TGSI_OPCODE_FRC */
-/* TGSI_OPCODE_IF */
-#define TGSI_OPCODE_INT                 TGSI_OPCODE_TRUNC
-/* TGSI_OPCODE_KIL */
-/* TGSI_OPCODE_LG2 */
-/* TGSI_OPCODE_LOG */
-/* TGSI_OPCODE_MAD */
-/* TGSI_OPCODE_MAX */
-/* TGSI_OPCODE_MIN */
-/* TGSI_OPCODE_MOV */
-/* TGSI_OPCODE_MUL */
-#define TGSI_OPCODE_NOISE1              102
-#define TGSI_OPCODE_NOISE2              103
-#define TGSI_OPCODE_NOISE3              104
-#define TGSI_OPCODE_NOISE4              105
-#define TGSI_OPCODE_NOP                 106
-/* TGSI_OPCODE_POW */
-/* TGSI_OPCODE_RCP */
-/* TGSI_OPCODE_RSQ */
-/* TGSI_OPCODE_SEQ */
-/* TGSI_OPCODE_SGE */
-/* TGSI_OPCODE_SGT */
-/* TGSI_OPCODE_SIN */
-/* TGSI_OPCODE_SLE */
-/* TGSI_OPCODE_SLT */
-/* TGSI_OPCODE_SNE */
-/* TGSI_OPCODE_SUB */
-/* TGSI_OPCODE_TEX */
-/* TGSI_OPCODE_TXB */
-/* TGSI_OPCODE_TXD */
-/* TGSI_OPCODE_TXL */
-/* TGSI_OPCODE_TXP */
-/* TGSI_OPCODE_XPD */
-
-/*
- * ps_1_1
- */
-/* TGSI_OPCODE_NOP */
-/* TGSI_OPCODE_MOV */
-/* TGSI_OPCODE_ADD */
-/* TGSI_OPCODE_SUB */
-/* TGSI_OPCODE_MAD */
-/* TGSI_OPCODE_MUL */
-/* TGSI_OPCODE_DP3 */
-/* TGSI_OPCODE_LRP */
-#define TGSI_OPCODE_TEXCOORD            TGSI_OPCODE_NOP
-#define TGSI_OPCODE_TEXKILL             TGSI_OPCODE_KIL
-/* TGSI_OPCODE_TEX */
-#define TGSI_OPCODE_TEXBEM              107
-#define TGSI_OPCODE_TEXBEML             108
-#define TGSI_OPCODE_TEXREG2AR           109
-#define TGSI_OPCODE_TEXM3X2PAD          110
-#define TGSI_OPCODE_TEXM3X2TEX          111
-#define TGSI_OPCODE_TEXM3X3PAD          112
-#define TGSI_OPCODE_TEXM3X3TEX          113
-#define TGSI_OPCODE_TEXM3X3SPEC         114
-#define TGSI_OPCODE_TEXM3X3VSPEC        115
-/* TGSI_OPCODE_CND */
-
-/*
- * ps_1_2
- */
-/* TGSI_OPCODE_NOP */
-/* TGSI_OPCODE_MOV */
-/* TGSI_OPCODE_ADD */
-/* TGSI_OPCODE_SUB */
-/* TGSI_OPCODE_MAD */
-/* TGSI_OPCODE_MUL */
-/* TGSI_OPCODE_DP3 */
-/* TGSI_OPCODE_DP4 */
-/* TGSI_OPCODE_LRP */
-/* TGSI_OPCODE_TEXCOORD */
-/* TGSI_OPCODE_TEXKILL */
-/* TGSI_OPCODE_TEX */
-/* TGSI_OPCODE_TEXBEM */
-/* TGSI_OPCODE_TEXBEML */
-/* TGSI_OPCODE_TEXREG2AR */
-#define TGSI_OPCODE_TEXREG2GB           116
-/* TGSI_OPCODE_TEXM3X2PAD */
-/* TGSI_OPCODE_TEXM3X2TEX */
-/* TGSI_OPCODE_TEXM3X3PAD */
-/* TGSI_OPCODE_TEXM3X3TEX */
-/* TGSI_OPCODE_TEXM3X3SPEC */
-/* TGSI_OPCODE_TEXM3X3VSPEC */
-/* TGSI_OPCODE_CND */
-#define TGSI_OPCODE_TEXREG2RGB          117
-#define TGSI_OPCODE_TEXDP3TEX           118
-#define TGSI_OPCODE_TEXDP3              119
-#define TGSI_OPCODE_TEXM3X3             120
-/* CMP - use TGSI_OPCODE_CND0 */
-
-/*
- * ps_1_3
- */
-/* TGSI_OPCODE_NOP */
-/* TGSI_OPCODE_MOV */
-/* TGSI_OPCODE_ADD */
-/* TGSI_OPCODE_SUB */
-/* TGSI_OPCODE_MAD */
-/* TGSI_OPCODE_MUL */
-/* TGSI_OPCODE_DP3 */
-/* TGSI_OPCODE_DP4 */
-/* TGSI_OPCODE_LRP */
-/* TGSI_OPCODE_TEXCOORD */
-/* TGSI_OPCODE_TEXKILL */
-/* TGSI_OPCODE_TEX */
-/* TGSI_OPCODE_TEXBEM */
-/* TGSI_OPCODE_TEXBEML */
-/* TGSI_OPCODE_TEXREG2AR */
-/* TGSI_OPCODE_TEXREG2GB */
-/* TGSI_OPCODE_TEXM3X2PAD */
-/* TGSI_OPCODE_TEXM3X2TEX */
-/* TGSI_OPCODE_TEXM3X3PAD */
-/* TGSI_OPCODE_TEXM3X3TEX */
-/* TGSI_OPCODE_TEXM3X3SPEC */
-/* TGSI_OPCODE_TEXM3X3VSPEC */
-/* TGSI_OPCODE_CND */
-/* TGSI_OPCODE_TEXREG2RGB */
-/* TGSI_OPCODE_TEXDP3TEX */
-#define TGSI_OPCODE_TEXM3X2DEPTH        121
-/* TGSI_OPCODE_TEXDP3 */
-/* TGSI_OPCODE_TEXM3X3 */
-/* CMP - use TGSI_OPCODE_CND0 */
-
-/*
- * ps_1_4
- */
-/* TGSI_OPCODE_NOP */
-/* TGSI_OPCODE_MOV */
-/* TGSI_OPCODE_ADD */
-/* TGSI_OPCODE_SUB */
-/* TGSI_OPCODE_MAD */
-/* TGSI_OPCODE_MUL */
-/* TGSI_OPCODE_DP3 */
-/* TGSI_OPCODE_DP4 */
-/* TGSI_OPCODE_LRP */
-#define TGSI_OPCODE_TEXCRD              TGSI_OPCODE_TEXCOORD
-/* TGSI_OPCODE_TEXKILL */
-#define TGSI_OPCODE_TEXLD               TGSI_OPCODE_TEX
-/* TGSI_OPCODE_CND */
-#define TGSI_OPCODE_TEXDEPTH            122
-/* CMP - use TGSI_OPCODE_CND0 */
-#define TGSI_OPCODE_BEM                 123
-
-/*
- * ps_2_0
- */
-/* TGSI_OPCODE_NOP */
-/* TGSI_OPCODE_MOV */
-/* TGSI_OPCODE_ADD */
-/* TGSI_OPCODE_SUB */
-/* TGSI_OPCODE_MAD */
-/* TGSI_OPCODE_MUL */
-/* TGSI_OPCODE_RCP */
-/* TGSI_OPCODE_RSQ */   /* XXX: takes ABS */
-/* TGSI_OPCODE_DP3 */
-/* TGSI_OPCODE_DP4 */
-/* TGSI_OPCODE_MIN */
-/* TGSI_OPCODE_MAX */
-/* EXP - use TGSI_OPCODE_EX2 */
-/* LOG - use TGSI_OPCODE_LG2 */
-/* TGSI_OPCODE_LRP */
-/* TGSI_OPCODE_FRC */
-#define TGSI_OPCODE_M4X4                TGSI_OPCODE_MULTIPLYMATRIX
-#define TGSI_OPCODE_M4X3                124
-#define TGSI_OPCODE_M3X4                125
-#define TGSI_OPCODE_M3X3                126
-#define TGSI_OPCODE_M3X2                127
-/* TGSI_OPCODE_POW */   /* XXX: takes ABS */
-#define TGSI_OPCODE_CRS                 TGSI_OPCODE_XPD
-/* TGSI_OPCODE_ABS */
-#define TGSI_OPCODE_NRM4                128
-#define TGSI_OPCODE_SINCOS              TGSI_OPCODE_SCS
-/* TGSI_OPCODE_TEXKILL */
-/* TGSI_OPCODE_TEXLD */
-#define TGSI_OPCODE_TEXLDB              TGSI_OPCODE_TXB
-/* TGSI_OPCODE_TEXLDP */
-/* CMP - use TGSI_OPCODE_CND0 */
-#define TGSI_OPCODE_DP2ADD              TGSI_OPCODE_DP2A
-
-/*
- * ps_2_x
- */
-/* TGSI_OPCODE_NOP */
-/* TGSI_OPCODE_MOV */
-/* TGSI_OPCODE_ADD */
-/* TGSI_OPCODE_SUB */
-/* TGSI_OPCODE_MAD */
-/* TGSI_OPCODE_MUL */
-/* TGSI_OPCODE_RCP */
-/* TGSI_OPCODE_RSQ */   /* XXX: takes ABS */
-/* TGSI_OPCODE_DP3 */
-/* TGSI_OPCODE_DP4 */
-/* TGSI_OPCODE_MIN */
-/* TGSI_OPCODE_MAX */
-/* TGSI_OPCODE_SLT */
-/* TGSI_OPCODE_SGE */
-/* TGSI_OPCODE_SGT */
-/* TGSI_OPCODE_SLE */
-/* TGSI_OPCODE_SEQ */
-/* TGSI_OPCODE_SNE */
-/* EXP - use TGSI_OPCODE_EX2 */
-/* LOG - use TGSI_OPCODE_LG2 */
-/* TGSI_OPCODE_LRP */
-/* TGSI_OPCODE_FRC */
-/* TGSI_OPCODE_M4X4 */
-/* TGSI_OPCODE_M4X3 */
-/* TGSI_OPCODE_M3X4 */
-/* TGSI_OPCODE_M3X3 */
-/* TGSI_OPCODE_M3X2 */
-#define TGSI_OPCODE_CALL                TGSI_OPCODE_CAL
-#define TGSI_OPCODE_CALLNZ              129
-/* TGSI_OPCODE_RET */
-/* TGSI_OPCODE_POW */   /* XXX: takes ABS */
-/* TGSI_OPCODE_CRS */
-/* TGSI_OPCODE_ABS */
-/* TGSI_OPCODE_NRM4 */
-/* TGSI_OPCODE_SINCOS */
-/* TGSI_OPCODE_REP */
-/* TGSI_OPCODE_ENDREP */
-/* TGSI_OPCODE_IF */
-#define TGSI_OPCODE_IFC                 130
-/* TGSI_OPCODE_ELSE */
-/* TGSI_OPCODE_ENDIF */
-#define TGSI_OPCODE_BREAK               TGSI_OPCODE_BRK
-#define TGSI_OPCODE_BREAKC              131
-/* TGSI_OPCODE_TEXKILL */
-/* TGSI_OPCODE_TEXLD */
-/* TGSI_OPCODE_TEXLDB */
-/* CMP - use TGSI_OPCODE_CND0 */
-/* TGSI_OPCODE_DP2ADD */
-#define TGSI_OPCODE_DSX                 TGSI_OPCODE_DDX
-#define TGSI_OPCODE_DSY                 TGSI_OPCODE_DDY
-#define TGSI_OPCODE_TEXLDD              TGSI_OPCODE_TXD
-/* TGSI_OPCODE_TEXLDP */
-
-/*
- * vs_1_1
- */
-/* TGSI_OPCODE_NOP */
-/* TGSI_OPCODE_MOV */
-/* TGSI_OPCODE_ADD */
-/* TGSI_OPCODE_SUB */
-/* TGSI_OPCODE_MAD */
-/* TGSI_OPCODE_MUL */
-/* TGSI_OPCODE_RCP */
-/* TGSI_OPCODE_RSQ */   /* XXX: takes ABS */
-/* TGSI_OPCODE_DP3 */
-/* TGSI_OPCODE_DP4 */
-/* TGSI_OPCODE_MIN */
-/* TGSI_OPCODE_MAX */
-/* TGSI_OPCODE_SLT */
-/* TGSI_OPCODE_SGE */
-/* EXP - use TGSI_OPCODE_EX2 */
-/* LOG - use TGSI_OPCODE_LG2 */
-/* TGSI_OPCODE_LIT */
-/* TGSI_OPCODE_DST */
-/* TGSI_OPCODE_FRC */
-/* TGSI_OPCODE_M4X4 */
-/* TGSI_OPCODE_M4X3 */
-/* TGSI_OPCODE_M3X4 */
-/* TGSI_OPCODE_M3X3 */
-/* TGSI_OPCODE_M3X2 */
-#define TGSI_OPCODE_EXPP                TGSI_OPCODE_EXP
-#define TGSI_OPCODE_LOGP                TGSI_OPCODE_LG2
-
-/*
- * vs_2_0
- */
-/* TGSI_OPCODE_NOP */
-/* TGSI_OPCODE_MOV */
-/* TGSI_OPCODE_ADD */
-/* TGSI_OPCODE_SUB */
-/* TGSI_OPCODE_MAD */
-/* TGSI_OPCODE_MUL */
-/* TGSI_OPCODE_RCP */
-/* TGSI_OPCODE_RSQ */   /* XXX: takes ABS */
-/* TGSI_OPCODE_DP3 */
-/* TGSI_OPCODE_DP4 */
-/* TGSI_OPCODE_MIN */
-/* TGSI_OPCODE_MAX */
-/* TGSI_OPCODE_SLT */
-/* TGSI_OPCODE_SGE */
-/* EXP - use TGSI_OPCODE_EX2 */
-/* LOG - use TGSI_OPCODE_LG2 */
-/* TGSI_OPCODE_LIT */
-/* TGSI_OPCODE_DST */
-/* TGSI_OPCODE_LRP */
-/* TGSI_OPCODE_FRC */
-/* TGSI_OPCODE_M4X4 */
-/* TGSI_OPCODE_M4X3 */
-/* TGSI_OPCODE_M3X4 */
-/* TGSI_OPCODE_M3X3 */
-/* TGSI_OPCODE_M3X2 */
-/* TGSI_OPCODE_CALL */
-/* TGSI_OPCODE_CALLNZ */
-/* TGSI_OPCODE_LOOP */
-/* TGSI_OPCODE_RET */
-/* TGSI_OPCODE_ENDLOOP */
-/* TGSI_OPCODE_POW */   /* XXX: takes ABS */
-/* TGSI_OPCODE_CRS */
-#define TGSI_OPCODE_SGN                 TGSI_OPCODE_SSG
-/* TGSI_OPCODE_ABS */
-/* TGSI_OPCODE_NRM4 */
-/* TGSI_OPCODE_SINCOS */
-/* TGSI_OPCODE_REP */
-/* TGSI_OPCODE_ENDREP */
-/* TGSI_OPCODE_IF */
-/* TGSI_OPCODE_ELSE */
-/* TGSI_OPCODE_ENDIF */
-#define TGSI_OPCODE_MOVA                TGSI_OPCODE_ARR
-/* TGSI_OPCODE_LOGP */
-
-/*
- * vs_2_x
- */
-/* TGSI_OPCODE_NOP */
-/* TGSI_OPCODE_MOV */
-/* TGSI_OPCODE_ADD */
-/* TGSI_OPCODE_SUB */
-/* TGSI_OPCODE_MAD */
-/* TGSI_OPCODE_MUL */
-/* TGSI_OPCODE_RCP */
-/* TGSI_OPCODE_RSQ */   /* XXX: takes ABS */
-/* TGSI_OPCODE_DP3 */
-/* TGSI_OPCODE_DP4 */
-/* TGSI_OPCODE_MIN */
-/* TGSI_OPCODE_MAX */
-/* TGSI_OPCODE_SLT */
-/* TGSI_OPCODE_SGE */
-/* TGSI_OPCODE_SGT */
-/* TGSI_OPCODE_SLE */
-/* TGSI_OPCODE_SEQ */
-/* TGSI_OPCODE_SNE */
-/* EXP - use TGSI_OPCODE_EX2 */
-/* LOG - use TGSI_OPCODE_LG2 */
-/* TGSI_OPCODE_LIT */
-/* TGSI_OPCODE_DST */
-/* TGSI_OPCODE_LRP */
-/* TGSI_OPCODE_FRC */
-/* TGSI_OPCODE_M4X4 */
-/* TGSI_OPCODE_M4X3 */
-/* TGSI_OPCODE_M3X4 */
-/* TGSI_OPCODE_M3X3 */
-/* TGSI_OPCODE_M3X2 */
-/* TGSI_OPCODE_CALL */
-/* TGSI_OPCODE_CALLNZ */
-/* TGSI_OPCODE_LOOP */
-/* TGSI_OPCODE_RET */
-/* TGSI_OPCODE_ENDLOOP */
-/* TGSI_OPCODE_POW */   /* XXX: takes ABS */
-/* TGSI_OPCODE_CRS */
-/* TGSI_OPCODE_SGN */
-/* TGSI_OPCODE_ABS */
-/* TGSI_OPCODE_NRM4 */
-/* TGSI_OPCODE_SINCOS */
-/* TGSI_OPCODE_REP */
-/* TGSI_OPCODE_ENDREP */
-/* TGSI_OPCODE_IF */
-/* TGSI_OPCODE_IFC */
-/* TGSI_OPCODE_ELSE */
-/* TGSI_OPCODE_ENDIF */
-/* TGSI_OPCODE_BREAK */
-/* TGSI_OPCODE_BREAKC */
-/* TGSI_OPCODE_MOVA */
-/* TGSI_OPCODE_LOGP */
-
-#define TGSI_OPCODE_KIL                 132  /* unpredicated kill */
-#define TGSI_OPCODE_END                 133  /* aka HALT */
-
-#define TGSI_OPCODE_LAST                134
-
-#define TGSI_SAT_NONE            0  /* do not saturate */
-#define TGSI_SAT_ZERO_ONE        1  /* clamp to [0,1] */
-#define TGSI_SAT_MINUS_PLUS_ONE  2  /* clamp to [-1,1] */
-
-/*
- * Opcode is the operation code to execute. A given operation defines the
- * semantics how the source registers (if any) are interpreted and what is
- * written to the destination registers (if any) as a result of execution.
- *
- * NumDstRegs and NumSrcRegs is the number of destination and source registers,
- * respectively. For a given operation code, those numbers are fixed and are
- * present here only for convenience.
- *
- * If Extended is TRUE, it is now executed.
- *
- * Saturate controls how are final results in destination registers modified.
- */
-
-struct tgsi_instruction
-{
-   unsigned Type       : 4;  /* TGSI_TOKEN_TYPE_INSTRUCTION */
-   unsigned Size       : 8;  /* UINT */
-   unsigned Opcode     : 8;  /* TGSI_OPCODE_ */
-   unsigned Saturate   : 2;  /* TGSI_SAT_ */
-   unsigned NumDstRegs : 2;  /* UINT */
-   unsigned NumSrcRegs : 4;  /* UINT */
-   unsigned Padding    : 3;
-   unsigned Extended   : 1;  /* BOOL */
-};
-
-/*
- * If tgsi_instruction::Extended is TRUE, tgsi_instruction_ext follows.
- * 
- * Then, tgsi_instruction::NumDstRegs of tgsi_dst_register follow.
- * 
- * Then, tgsi_instruction::NumSrcRegs of tgsi_src_register follow.
- *
- * tgsi_instruction::Size contains the total number of words that make the
- * instruction, including the instruction word.
- */
-
-#define TGSI_INSTRUCTION_EXT_TYPE_NV        0
-#define TGSI_INSTRUCTION_EXT_TYPE_LABEL     1
-#define TGSI_INSTRUCTION_EXT_TYPE_TEXTURE   2
-#define TGSI_INSTRUCTION_EXT_TYPE_PREDICATE 3
-
-struct tgsi_instruction_ext
-{
-   unsigned Type       : 4;  /* TGSI_INSTRUCTION_EXT_TYPE_ */
-   unsigned Padding    : 27;
-   unsigned Extended   : 1;  /* BOOL */
-};
-
-/*
- * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_NV, it should
- * be cast to tgsi_instruction_ext_nv.
- * 
- * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_LABEL, it
- * should be cast to tgsi_instruction_ext_label.
- * 
- * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_TEXTURE, it
- * should be cast to tgsi_instruction_ext_texture.
- * 
- * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_PREDICATE, it
- * should be cast to tgsi_instruction_ext_predicate.
- * 
- * If tgsi_instruction_ext::Extended is TRUE, another tgsi_instruction_ext
- * follows.
- */
-
-#define TGSI_PRECISION_DEFAULT      0
-#define TGSI_PRECISION_FLOAT32      1
-#define TGSI_PRECISION_FLOAT16      2
-#define TGSI_PRECISION_FIXED12      3
-
-#define TGSI_CC_GT      0
-#define TGSI_CC_EQ      1
-#define TGSI_CC_LT      2
-#define TGSI_CC_UN      3
-#define TGSI_CC_GE      4
-#define TGSI_CC_LE      5
-#define TGSI_CC_NE      6
-#define TGSI_CC_TR      7
-#define TGSI_CC_FL      8
-
-#define TGSI_SWIZZLE_X      0
-#define TGSI_SWIZZLE_Y      1
-#define TGSI_SWIZZLE_Z      2
-#define TGSI_SWIZZLE_W      3
-
-/*
- * Precision controls the precision at which the operation should be executed.
- *
- * CondDstUpdate enables condition code register writes. When this field is
- * TRUE, CondDstIndex specifies the index of the condition code register to
- * update.
- *
- * CondFlowEnable enables conditional execution of the operation. When this
- * field is TRUE, CondFlowIndex specifies the index of the condition code
- * register to test against CondMask with component swizzle controled by
- * CondSwizzleX, CondSwizzleY, CondSwizzleZ and CondSwizzleW. If the test fails,
- * the operation is not executed.
- */
-
-struct tgsi_instruction_ext_nv
-{
-   unsigned Type             : 4;    /* TGSI_INSTRUCTION_EXT_TYPE_NV */
-   unsigned Precision        : 4;    /* TGSI_PRECISION_ */
-   unsigned CondDstIndex     : 4;    /* UINT */
-   unsigned CondFlowIndex    : 4;    /* UINT */
-   unsigned CondMask         : 4;    /* TGSI_CC_ */
-   unsigned CondSwizzleX     : 2;    /* TGSI_SWIZZLE_ */
-   unsigned CondSwizzleY     : 2;    /* TGSI_SWIZZLE_ */
-   unsigned CondSwizzleZ     : 2;    /* TGSI_SWIZZLE_ */
-   unsigned CondSwizzleW     : 2;    /* TGSI_SWIZZLE_ */
-   unsigned CondDstUpdate    : 1;    /* BOOL */
-   unsigned CondFlowEnable   : 1;    /* BOOL */
-   unsigned Padding          : 1;
-   unsigned Extended         : 1;    /* BOOL */
-};
-
-struct tgsi_instruction_ext_label
-{
-   unsigned Type     : 4;    /* TGSI_INSTRUCTION_EXT_TYPE_LABEL */
-   unsigned Label    : 24;   /* UINT */
-   unsigned Padding  : 3;
-   unsigned Extended : 1;    /* BOOL */
-};
-
-#define TGSI_TEXTURE_UNKNOWN        0
-#define TGSI_TEXTURE_1D             1
-#define TGSI_TEXTURE_2D             2
-#define TGSI_TEXTURE_3D             3
-#define TGSI_TEXTURE_CUBE           4
-#define TGSI_TEXTURE_RECT           5
-#define TGSI_TEXTURE_SHADOW1D       6
-#define TGSI_TEXTURE_SHADOW2D       7
-#define TGSI_TEXTURE_SHADOWRECT     8
-
-struct tgsi_instruction_ext_texture
-{
-   unsigned Type     : 4;    /* TGSI_INSTRUCTION_EXT_TYPE_TEXTURE */
-   unsigned Texture  : 8;    /* TGSI_TEXTURE_ */
-   unsigned Padding  : 19;
-   unsigned Extended : 1;    /* BOOL */
-};
-
-struct tgsi_instruction_ext_predicate
-{
-   unsigned Type             : 4;    /* TGSI_INSTRUCTION_EXT_TYPE_PREDICATE */
-   unsigned PredDstIndex     : 4;    /* UINT */
-   unsigned PredWriteMask    : 4;    /* TGSI_WRITEMASK_ */
-   unsigned Padding          : 19;
-   unsigned Extended         : 1;    /* BOOL */
-};
-
-/*
- * File specifies the register array to access.
- *
- * Index specifies the element number of a register in the register file.
- *
- * If Indirect is TRUE, Index should be offset by the X component of a source
- * register that follows. The register can be now fetched into local storage
- * for further processing.
- *
- * If Negate is TRUE, all components of the fetched register are negated.
- *
- * The fetched register components are swizzled according to SwizzleX, SwizzleY,
- * SwizzleZ and SwizzleW.
- *
- * If Extended is TRUE, any further modifications to the source register are
- * made to this temporary storage.
- */
-
-struct tgsi_src_register
-{
-   unsigned File        : 4;  /* TGSI_FILE_ */
-   unsigned SwizzleX    : 2;  /* TGSI_SWIZZLE_ */
-   unsigned SwizzleY    : 2;  /* TGSI_SWIZZLE_ */
-   unsigned SwizzleZ    : 2;  /* TGSI_SWIZZLE_ */
-   unsigned SwizzleW    : 2;  /* TGSI_SWIZZLE_ */
-   unsigned Negate      : 1;  /* BOOL */
-   unsigned Indirect    : 1;  /* BOOL */
-   unsigned Dimension   : 1;  /* BOOL */
-   int      Index       : 16; /* SINT */
-   unsigned Extended    : 1;  /* BOOL */
-};
-
-/*
- * If tgsi_src_register::Extended is TRUE, tgsi_src_register_ext follows.
- * 
- * Then, if tgsi_src_register::Indirect is TRUE, another tgsi_src_register
- * follows.
- *
- * Then, if tgsi_src_register::Dimension is TRUE, tgsi_dimension follows.
- */
-
-#define TGSI_SRC_REGISTER_EXT_TYPE_SWZ      0
-#define TGSI_SRC_REGISTER_EXT_TYPE_MOD      1
-
-struct tgsi_src_register_ext
-{
-   unsigned Type     : 4;    /* TGSI_SRC_REGISTER_EXT_TYPE_ */
-   unsigned Padding  : 27;
-   unsigned Extended : 1;    /* BOOL */
-};
-
-/*
- * If tgsi_src_register_ext::Type is TGSI_SRC_REGISTER_EXT_TYPE_SWZ,
- * it should be cast to tgsi_src_register_ext_extswz.
- * 
- * If tgsi_src_register_ext::Type is TGSI_SRC_REGISTER_EXT_TYPE_MOD,
- * it should be cast to tgsi_src_register_ext_mod.
- * 
- * If tgsi_dst_register_ext::Extended is TRUE, another tgsi_dst_register_ext
- * follows.
- */
-
-#define TGSI_EXTSWIZZLE_X       TGSI_SWIZZLE_X
-#define TGSI_EXTSWIZZLE_Y       TGSI_SWIZZLE_Y
-#define TGSI_EXTSWIZZLE_Z       TGSI_SWIZZLE_Z
-#define TGSI_EXTSWIZZLE_W       TGSI_SWIZZLE_W
-#define TGSI_EXTSWIZZLE_ZERO    4
-#define TGSI_EXTSWIZZLE_ONE     5
-
-/*
- * ExtSwizzleX, ExtSwizzleY, ExtSwizzleZ and ExtSwizzleW swizzle the source
- * register in an extended manner.
- *
- * NegateX, NegateY, NegateZ and NegateW negate individual components of the
- * source register.
- *
- * ExtDivide specifies which component is used to divide all components of the
- * source register.
- */
-
-struct tgsi_src_register_ext_swz
-{
-   unsigned Type         : 4;    /* TGSI_SRC_REGISTER_EXT_TYPE_SWZ */
-   unsigned ExtSwizzleX  : 4;    /* TGSI_EXTSWIZZLE_ */
-   unsigned ExtSwizzleY  : 4;    /* TGSI_EXTSWIZZLE_ */
-   unsigned ExtSwizzleZ  : 4;    /* TGSI_EXTSWIZZLE_ */
-   unsigned ExtSwizzleW  : 4;    /* TGSI_EXTSWIZZLE_ */
-   unsigned NegateX      : 1;    /* BOOL */
-   unsigned NegateY      : 1;    /* BOOL */
-   unsigned NegateZ      : 1;    /* BOOL */
-   unsigned NegateW      : 1;    /* BOOL */
-   unsigned ExtDivide    : 4;    /* TGSI_EXTSWIZZLE_ */
-   unsigned Padding      : 3;
-   unsigned Extended     : 1;    /* BOOL */
-};
-
-/**
- * Extra src register modifiers
- *
- * If Complement is TRUE, the source register is modified by subtracting it
- * from 1.0.
- *
- * If Bias is TRUE, the source register is modified by subtracting 0.5 from it.
- *
- * If Scale2X is TRUE, the source register is modified by multiplying it by 2.0.
- *
- * If Absolute is TRUE, the source register is modified by removing the sign.
- *
- * If Negate is TRUE, the source register is modified by negating it.
- */
-
-struct tgsi_src_register_ext_mod
-{
-   unsigned Type         : 4;    /* TGSI_SRC_REGISTER_EXT_TYPE_MOD */
-   unsigned Complement   : 1;    /* BOOL */
-   unsigned Bias         : 1;    /* BOOL */
-   unsigned Scale2X      : 1;    /* BOOL */
-   unsigned Absolute     : 1;    /* BOOL */
-   unsigned Negate       : 1;    /* BOOL */
-   unsigned Padding      : 22;
-   unsigned Extended     : 1;    /* BOOL */
-};
-
-struct tgsi_dimension
-{
-   unsigned Indirect    : 1;  /* BOOL */
-   unsigned Dimension   : 1;  /* BOOL */
-   unsigned Padding     : 13;
-   int      Index       : 16; /* SINT */
-   unsigned Extended    : 1;  /* BOOL */
-};
-
-struct tgsi_dst_register
-{
-   unsigned File        : 4;  /* TGSI_FILE_ */
-   unsigned WriteMask   : 4;  /* TGSI_WRITEMASK_ */
-   unsigned Indirect    : 1;  /* BOOL */
-   unsigned Dimension   : 1;  /* BOOL */
-   int      Index       : 16; /* SINT */
-   unsigned Padding     : 5;
-   unsigned Extended    : 1;  /* BOOL */
-};
-
-/*
- * If tgsi_dst_register::Extended is TRUE, tgsi_dst_register_ext follows.
- * 
- * Then, if tgsi_dst_register::Indirect is TRUE, tgsi_src_register follows.
- */
-
-#define TGSI_DST_REGISTER_EXT_TYPE_CONDCODE     0
-#define TGSI_DST_REGISTER_EXT_TYPE_MODULATE     1
-#define TGSI_DST_REGISTER_EXT_TYPE_PREDICATE    2
-
-struct tgsi_dst_register_ext
-{
-   unsigned Type     : 4;    /* TGSI_DST_REGISTER_EXT_TYPE_ */
-   unsigned Padding  : 27;
-   unsigned Extended : 1;    /* BOOL */
-};
-
-/**
- * Extra destination register modifiers
- *
- * If tgsi_dst_register_ext::Type is TGSI_DST_REGISTER_EXT_TYPE_CONDCODE,
- * it should be cast to tgsi_dst_register_ext_condcode.
- * 
- * If tgsi_dst_register_ext::Type is TGSI_DST_REGISTER_EXT_TYPE_MODULATE,
- * it should be cast to tgsi_dst_register_ext_modulate.
- * 
- * If tgsi_dst_register_ext::Type is TGSI_DST_REGISTER_EXT_TYPE_PREDICATE,
- * it should be cast to tgsi_dst_register_ext_predicate.
- * 
- * If tgsi_dst_register_ext::Extended is TRUE, another tgsi_dst_register_ext
- * follows.
- */
-struct tgsi_dst_register_ext_concode
-{
-   unsigned Type         : 4;    /* TGSI_DST_REGISTER_EXT_TYPE_CONDCODE */
-   unsigned CondMask     : 4;    /* TGSI_CC_ */
-   unsigned CondSwizzleX : 2;    /* TGSI_SWIZZLE_ */
-   unsigned CondSwizzleY : 2;    /* TGSI_SWIZZLE_ */
-   unsigned CondSwizzleZ : 2;    /* TGSI_SWIZZLE_ */
-   unsigned CondSwizzleW : 2;    /* TGSI_SWIZZLE_ */
-   unsigned CondSrcIndex : 4;    /* UINT */
-   unsigned Padding      : 11;
-   unsigned Extended     : 1;    /* BOOL */
-};
-
-#define TGSI_MODULATE_1X        0
-#define TGSI_MODULATE_2X        1
-#define TGSI_MODULATE_4X        2
-#define TGSI_MODULATE_8X        3
-#define TGSI_MODULATE_HALF      4
-#define TGSI_MODULATE_QUARTER   5
-#define TGSI_MODULATE_EIGHTH    6
-
-struct tgsi_dst_register_ext_modulate
-{
-   unsigned Type     : 4;    /* TGSI_DST_REGISTER_EXT_TYPE_MODULATE */
-   unsigned Modulate : 4;    /* TGSI_MODULATE_ */
-   unsigned Padding  : 23;
-   unsigned Extended : 1;    /* BOOL */
-};
-
-/*
- * Currently, the following constraints apply.
- *
- * - PredSwizzleXYZW is either set to identity or replicate.
- * - PredSrcIndex is 0.
- */
-
-struct tgsi_dst_register_ext_predicate
-{
-   unsigned Type         : 4;    /* TGSI_DST_REGISTER_EXT_TYPE_PREDICATE */
-   unsigned PredSwizzleX : 2;    /* TGSI_SWIZZLE_ */
-   unsigned PredSwizzleY : 2;    /* TGSI_SWIZZLE_ */
-   unsigned PredSwizzleZ : 2;    /* TGSI_SWIZZLE_ */
-   unsigned PredSwizzleW : 2;    /* TGSI_SWIZZLE_ */
-   unsigned PredSrcIndex : 4;    /* UINT */
-   unsigned Negate       : 1;    /* BOOL */
-   unsigned Padding      : 14;
-   unsigned Extended     : 1;    /* BOOL */
-};
-
-
-#if defined __cplusplus
-} // extern "C"
-#endif // defined __cplusplus
-
-#endif // !defined TGSI_TOKEN_H
-
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_util.c b/src/mesa/pipe/tgsi/exec/tgsi_util.c
deleted file mode 100644 (file)
index d1bc935..0000000
+++ /dev/null
@@ -1,270 +0,0 @@
-#include "tgsi_platform.h"
-#include "tgsi_core.h"
-
-union pointer_hack
-{
-   void *pointer;
-   unsigned long long uint64;
-};
-
-void *
-tgsi_align_128bit(
-   void *unaligned )
-{
-   union pointer_hack ph;
-
-   ph.uint64 = 0;
-   ph.pointer = unaligned;
-   ph.uint64 = (ph.uint64 + 15) & ~15;
-   return ph.pointer;
-}
-
-unsigned
-tgsi_util_get_src_register_swizzle(
-   const struct tgsi_src_register *reg,
-   unsigned component )
-{
-   switch( component ) {
-   case 0:
-      return reg->SwizzleX;
-   case 1:
-      return reg->SwizzleY;
-   case 2:
-      return reg->SwizzleZ;
-   case 3:
-      return reg->SwizzleW;
-   default:
-      assert( 0 );
-   }
-   return 0;
-}
-
-unsigned
-tgsi_util_get_src_register_extswizzle(
-   const struct tgsi_src_register_ext_swz *reg,
-   unsigned component )
-{
-   switch( component ) {
-   case 0:
-      return reg->ExtSwizzleX;
-   case 1:
-      return reg->ExtSwizzleY;
-   case 2:
-      return reg->ExtSwizzleZ;
-   case 3:
-      return reg->ExtSwizzleW;
-   default:
-      assert( 0 );
-   }
-   return 0;
-}
-
-unsigned
-tgsi_util_get_full_src_register_extswizzle(
-   const struct tgsi_full_src_register  *reg,
-   unsigned component )
-{
-   unsigned swizzle;
-
-   /*
-    * First, calculate  the   extended swizzle for a given channel. This will give
-    * us either a channel index into the simple swizzle or  a constant 1 or   0.
-    */
-   swizzle = tgsi_util_get_src_register_extswizzle(
-      &reg->SrcRegisterExtSwz,
-      component );
-
-   assert (TGSI_SWIZZLE_X == TGSI_EXTSWIZZLE_X);
-   assert (TGSI_SWIZZLE_Y == TGSI_EXTSWIZZLE_Y);
-   assert (TGSI_SWIZZLE_Z == TGSI_EXTSWIZZLE_Z);
-   assert (TGSI_SWIZZLE_W == TGSI_EXTSWIZZLE_W);
-   assert (TGSI_EXTSWIZZLE_ZERO > TGSI_SWIZZLE_W);
-   assert (TGSI_EXTSWIZZLE_ONE > TGSI_SWIZZLE_W);
-
-   /*
-    * Second, calculate the simple  swizzle  for   the   unswizzled channel index.
-    * Leave the constants intact, they are   not   affected by the   simple swizzle.
-    */
-   if( swizzle <= TGSI_SWIZZLE_W ) {
-      swizzle = tgsi_util_get_src_register_swizzle(
-         &reg->SrcRegister,
-         component );
-   }
-
-   return swizzle;
-}
-
-void
-tgsi_util_set_src_register_swizzle(
-   struct tgsi_src_register *reg,
-   unsigned swizzle,
-   unsigned component )
-{
-   switch( component ) {
-   case 0:
-      reg->SwizzleX = swizzle;
-      break;
-   case 1:
-      reg->SwizzleY = swizzle;
-      break;
-   case 2:
-      reg->SwizzleZ = swizzle;
-      break;
-   case 3:
-      reg->SwizzleW = swizzle;
-      break;
-   default:
-      assert( 0 );
-   }
-}
-
-void
-tgsi_util_set_src_register_extswizzle(
-   struct tgsi_src_register_ext_swz *reg,
-   unsigned swizzle,
-   unsigned component )
-{
-   switch( component ) {
-   case 0:
-      reg->ExtSwizzleX = swizzle;
-      break;
-   case 1:
-      reg->ExtSwizzleY = swizzle;
-      break;
-   case 2:
-      reg->ExtSwizzleZ = swizzle;
-      break;
-   case 3:
-      reg->ExtSwizzleW = swizzle;
-      break;
-   default:
-      assert( 0 );
-   }
-}
-
-unsigned
-tgsi_util_get_src_register_extnegate(
-   const  struct tgsi_src_register_ext_swz *reg,
-   unsigned component )
-{
-   switch( component ) {
-   case 0:
-      return reg->NegateX;
-   case 1:
-      return reg->NegateY;
-   case 2:
-      return reg->NegateZ;
-   case 3:
-      return reg->NegateW;
-   default:
-      assert( 0 );
-   }
-   return 0;
-}
-
-void
-tgsi_util_set_src_register_extnegate(
-   struct tgsi_src_register_ext_swz *reg,
-   unsigned negate,
-   unsigned component )
-{
-   switch( component ) {
-   case 0:
-      reg->NegateX = negate;
-      break;
-   case 1:
-      reg->NegateY = negate;
-      break;
-   case 2:
-      reg->NegateZ = negate;
-      break;
-   case 3:
-      reg->NegateW = negate;
-      break;
-   default:
-      assert( 0 );
-   }
-}
-
-unsigned
-tgsi_util_get_full_src_register_sign_mode(
-   const struct  tgsi_full_src_register *reg,
-   unsigned component )
-{
-   unsigned sign_mode;
-
-   if( reg->SrcRegisterExtMod.Absolute ) {
-      /* Consider only the post-abs negation. */
-
-      if( reg->SrcRegisterExtMod.Negate ) {
-         sign_mode = TGSI_UTIL_SIGN_SET;
-      }
-      else {
-         sign_mode = TGSI_UTIL_SIGN_CLEAR;
-      }
-   }
-   else {
-      /* Accumulate the three negations. */
-
-      unsigned negate;
-
-      negate = reg->SrcRegister.Negate;
-      if( tgsi_util_get_src_register_extnegate( &reg->SrcRegisterExtSwz, component ) ) {
-         negate = !negate;
-      }
-      if( reg->SrcRegisterExtMod.Negate ) {
-         negate = !negate;
-      }
-
-      if( negate ) {
-         sign_mode = TGSI_UTIL_SIGN_TOGGLE;
-      }
-      else {
-         sign_mode = TGSI_UTIL_SIGN_KEEP;
-      }
-   }
-
-   return sign_mode;
-}
-
-void
-tgsi_util_set_full_src_register_sign_mode(
-   struct tgsi_full_src_register *reg,
-   unsigned sign_mode )
-{
-   reg->SrcRegisterExtSwz.NegateX = 0;
-   reg->SrcRegisterExtSwz.NegateY = 0;
-   reg->SrcRegisterExtSwz.NegateZ = 0;
-   reg->SrcRegisterExtSwz.NegateW = 0;
-
-   switch (sign_mode)
-   {
-   case TGSI_UTIL_SIGN_CLEAR:
-      reg->SrcRegister.Negate = 0;
-      reg->SrcRegisterExtMod.Absolute = 1;
-      reg->SrcRegisterExtMod.Negate = 0;
-      break;
-
-   case TGSI_UTIL_SIGN_SET:
-      reg->SrcRegister.Negate = 0;
-      reg->SrcRegisterExtMod.Absolute = 1;
-      reg->SrcRegisterExtMod.Negate = 1;
-      break;
-
-   case TGSI_UTIL_SIGN_TOGGLE:
-      reg->SrcRegister.Negate = 1;
-      reg->SrcRegisterExtMod.Absolute = 0;
-      reg->SrcRegisterExtMod.Negate = 0;
-      break;
-
-   case TGSI_UTIL_SIGN_KEEP:
-      reg->SrcRegister.Negate = 0;
-      reg->SrcRegisterExtMod.Absolute = 0;
-      reg->SrcRegisterExtMod.Negate = 0;
-      break;
-
-   default:
-      assert( 0 );
-   }
-}
-
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_util.h b/src/mesa/pipe/tgsi/exec/tgsi_util.h
deleted file mode 100644 (file)
index ef14446..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-#if !defined TGSI_UTIL_H
-#define TGSI_UTIL_H
-
-#if defined __cplusplus
-extern "C" {
-#endif // defined __cplusplus
-
-void *
-tgsi_align_128bit(
-   void *unaligned );
-
-unsigned
-tgsi_util_get_src_register_swizzle(
-   const struct tgsi_src_register *reg,
-   unsigned component );
-
-unsigned
-tgsi_util_get_src_register_extswizzle(
-   const struct tgsi_src_register_ext_swz *reg,
-   unsigned component);
-
-unsigned
-tgsi_util_get_full_src_register_extswizzle(
-   const struct tgsi_full_src_register *reg,
-   unsigned component );
-
-void
-tgsi_util_set_src_register_swizzle(
-   struct tgsi_src_register *reg,
-   unsigned swizzle,
-   unsigned component );
-
-void
-tgsi_util_set_src_register_extswizzle(
-   struct tgsi_src_register_ext_swz *reg,
-   unsigned swizzle,
-   unsigned component );
-
-unsigned
-tgsi_util_get_src_register_extnegate(
-   const struct tgsi_src_register_ext_swz *reg,
-   unsigned component );
-
-void
-tgsi_util_set_src_register_extnegate(
-   struct tgsi_src_register_ext_swz *reg,
-   unsigned negate,
-   unsigned component );
-
-#define TGSI_UTIL_SIGN_CLEAR    0   /* Force positive */
-#define TGSI_UTIL_SIGN_SET      1   /* Force negative */
-#define TGSI_UTIL_SIGN_TOGGLE   2   /* Negate */
-#define TGSI_UTIL_SIGN_KEEP     3   /* No change */
-
-unsigned
-tgsi_util_get_full_src_register_sign_mode(
-   const struct tgsi_full_src_register *reg,
-   unsigned component );
-
-void
-tgsi_util_set_full_src_register_sign_mode(
-   struct tgsi_full_src_register *reg,
-   unsigned sign_mode );
-
-#if defined __cplusplus
-} // extern "C"
-#endif // defined __cplusplus
-
-#endif // !defined TGSI_UTIL_H
-
diff --git a/src/mesa/pipe/tgsi/tgsi_platform.h b/src/mesa/pipe/tgsi/tgsi_platform.h
deleted file mode 100644 (file)
index e7a381b..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#if !defined TGSI_PLATFORM_H\r
-#define TGSI_PLATFORM_H\r
-\r
-#if defined __cplusplus\r
-extern "C" {\r
-#endif // defined __cplusplus\r
-\r
-#include "pipe/p_compiler.h"\r
-#include "pipe/p_util.h"\r
-\r
-#if defined __cplusplus\r
-} // extern "C"\r
-#endif // defined __cplusplus\r
-\r
-#endif // !defined TGSI_PLATFORM_H\r
-\r
diff --git a/src/mesa/pipe/tgsi/util/tgsi_build.c b/src/mesa/pipe/tgsi/util/tgsi_build.c
new file mode 100644 (file)
index 0000000..19b2aad
--- /dev/null
@@ -0,0 +1,1370 @@
+#include "pipe/p_util.h"
+#include "pipe/p_shader_tokens.h"
+#include "tgsi_build.h"
+#include "tgsi_parse.h"
+
+/*
+ * version
+ */
+
+struct tgsi_version
+tgsi_build_version( void )
+{
+   struct tgsi_version  version;
+
+   version.MajorVersion = 1;
+   version.MinorVersion = 1;
+   version.Padding = 0;
+
+   return version;
+}
+
+/*
+ * header
+ */
+
+struct tgsi_header
+tgsi_build_header( void )
+{
+   struct tgsi_header header;
+
+   header.HeaderSize = 1;
+   header.BodySize = 0;
+
+   return header;
+}
+
+static void
+header_headersize_grow( struct tgsi_header *header )
+{
+   assert( header->HeaderSize < 0xFF );
+   assert( header->BodySize == 0 );
+
+   header->HeaderSize++;
+}
+
+static void
+header_bodysize_grow( struct tgsi_header *header )
+{
+   assert( header->BodySize < 0xFFFFFF );
+
+   header->BodySize++;
+}
+
+struct tgsi_processor
+tgsi_default_processor( void )
+{
+   struct tgsi_processor processor;
+
+   processor.Processor = TGSI_PROCESSOR_FRAGMENT;
+   processor.Padding = 0;
+
+   return processor;
+}
+
+struct tgsi_processor
+tgsi_build_processor(
+   unsigned type,
+   struct tgsi_header *header )
+{
+   struct tgsi_processor processor;
+
+   processor = tgsi_default_processor();
+   processor.Processor = type;
+
+   header_headersize_grow( header );
+
+   return processor;
+}
+
+/*
+ * declaration
+ */
+
+struct tgsi_declaration
+tgsi_default_declaration( void )
+{
+   struct tgsi_declaration declaration;
+
+   declaration.Type = TGSI_TOKEN_TYPE_DECLARATION;
+   declaration.Size = 1;
+   declaration.File = TGSI_FILE_NULL;
+   declaration.Declare = TGSI_DECLARE_RANGE;
+   declaration.UsageMask = TGSI_WRITEMASK_XYZW;
+   declaration.Interpolate = 0;
+   declaration.Semantic = 0;
+   declaration.Padding = 0;
+   declaration.Extended = 0;
+
+   return declaration;
+}
+
+struct tgsi_declaration
+tgsi_build_declaration(
+   unsigned file,
+   unsigned declare,
+   unsigned usage_mask,
+   unsigned interpolate,
+   unsigned semantic,
+   struct tgsi_header *header )
+{
+   struct tgsi_declaration declaration;
+
+   assert( file <= TGSI_FILE_IMMEDIATE );
+   assert( declare <= TGSI_DECLARE_MASK );
+
+   declaration = tgsi_default_declaration();
+   declaration.File = file;
+   declaration.Declare = declare;
+   declaration.UsageMask = usage_mask;
+   declaration.Interpolate = interpolate;
+   declaration.Semantic = semantic;
+
+   header_bodysize_grow( header );
+
+   return declaration;
+}
+
+static void
+declaration_grow(
+   struct tgsi_declaration *declaration,
+   struct tgsi_header *header )
+{
+   assert( declaration->Size < 0xFF );
+
+   declaration->Size++;
+
+   header_bodysize_grow( header );
+}
+
+struct tgsi_full_declaration
+tgsi_default_full_declaration( void )
+{
+   struct tgsi_full_declaration  full_declaration;
+
+   full_declaration.Declaration  = tgsi_default_declaration();
+   full_declaration.Interpolation = tgsi_default_declaration_interpolation();
+   full_declaration.Semantic = tgsi_default_declaration_semantic();
+
+   return full_declaration;
+}
+
+unsigned
+tgsi_build_full_declaration(
+   const struct tgsi_full_declaration *full_decl,
+   struct tgsi_token *tokens,
+   struct tgsi_header *header,
+   unsigned maxsize )
+{
+   unsigned size = 0;
+   struct tgsi_declaration *declaration;
+
+   if( maxsize <= size )
+     return 0;
+   declaration = (struct tgsi_declaration *) &tokens[size];
+   size++;
+
+   *declaration = tgsi_build_declaration(
+      full_decl->Declaration.File,
+      full_decl->Declaration.Declare,
+      full_decl->Declaration.UsageMask,
+      full_decl->Declaration.Interpolate,
+      full_decl->Declaration.Semantic,
+      header );
+
+   switch( full_decl->Declaration.Declare )  {
+   case TGSI_DECLARE_RANGE:
+   {
+      struct tgsi_declaration_range *dr;
+
+      if( maxsize <= size )
+         return 0;
+      dr = (struct tgsi_declaration_range *) &tokens[size];
+      size++;
+
+      *dr = tgsi_build_declaration_range(
+         full_decl->u.DeclarationRange.First,
+         full_decl->u.DeclarationRange.Last,
+         declaration,
+         header );
+      break;
+    }
+
+   case TGSI_DECLARE_MASK:
+   {
+      struct tgsi_declaration_mask *dm;
+
+      if( maxsize <= size )
+         return 0;
+      dm = (struct tgsi_declaration_mask  *) &tokens[size];
+      size++;
+
+      *dm = tgsi_build_declaration_mask(
+         full_decl->u.DeclarationMask.Mask,
+         declaration,
+         header );
+      break;
+   }
+
+   default:
+      assert( 0 );
+   }
+
+   if( full_decl->Declaration.Interpolate ) {
+      struct tgsi_declaration_interpolation *di;
+
+      if( maxsize <= size )
+         return  0;
+      di = (struct tgsi_declaration_interpolation *) &tokens[size];
+      size++;
+
+      *di = tgsi_build_declaration_interpolation(
+         full_decl->Interpolation.Interpolate,
+         declaration,
+         header );
+   }
+
+   if( full_decl->Declaration.Semantic ) {
+      struct tgsi_declaration_semantic *ds;
+
+      if( maxsize <= size )
+         return  0;
+      ds = (struct tgsi_declaration_semantic *) &tokens[size];
+      size++;
+
+      *ds = tgsi_build_declaration_semantic(
+         full_decl->Semantic.SemanticName,
+         full_decl->Semantic.SemanticIndex,
+         declaration,
+         header );
+   }
+
+   return size;
+}
+
+struct tgsi_declaration_range
+tgsi_build_declaration_range(
+   unsigned first,
+   unsigned last,
+   struct tgsi_declaration *declaration,
+   struct tgsi_header *header )
+{
+   struct tgsi_declaration_range declaration_range;
+
+   assert( last >= first );
+   assert( last <= 0xFFFF );
+
+   declaration_range.First = first;
+   declaration_range.Last = last;
+
+   declaration_grow( declaration, header );
+
+   return declaration_range;
+}
+
+struct tgsi_declaration_mask
+tgsi_build_declaration_mask(
+   unsigned mask,
+   struct tgsi_declaration *declaration,
+   struct tgsi_header *header )
+{
+   struct tgsi_declaration_mask  declaration_mask;
+
+   declaration_mask.Mask = mask;
+
+   declaration_grow( declaration, header );
+
+   return declaration_mask;
+}
+
+struct tgsi_declaration_interpolation
+tgsi_default_declaration_interpolation( void )
+{
+   struct tgsi_declaration_interpolation di;
+
+   di.Interpolate = TGSI_INTERPOLATE_CONSTANT;
+   di.Padding = 0;
+
+   return di;
+}
+
+struct tgsi_declaration_interpolation
+tgsi_build_declaration_interpolation(
+   unsigned interpolate,
+   struct tgsi_declaration *declaration,
+   struct tgsi_header *header )
+{
+   struct tgsi_declaration_interpolation di;
+
+   assert( interpolate <= TGSI_INTERPOLATE_PERSPECTIVE );
+
+   di = tgsi_default_declaration_interpolation();
+   di.Interpolate = interpolate;
+
+   declaration_grow( declaration, header );
+
+   return di;
+}
+
+struct tgsi_declaration_semantic
+tgsi_default_declaration_semantic( void )
+{
+   struct tgsi_declaration_semantic ds;
+
+   ds.SemanticName = TGSI_SEMANTIC_POSITION;
+   ds.SemanticIndex = 0;
+   ds.Padding = 0;
+
+   return ds;
+}
+
+struct tgsi_declaration_semantic
+tgsi_build_declaration_semantic(
+   unsigned semantic_name,
+   unsigned semantic_index,
+   struct tgsi_declaration *declaration,
+   struct tgsi_header *header )
+{
+   struct tgsi_declaration_semantic ds;
+
+   assert( semantic_name <= TGSI_SEMANTIC_COUNT );
+   assert( semantic_index <= 0xFFFF );
+
+   ds = tgsi_default_declaration_semantic();
+   ds.SemanticName = semantic_name;
+   ds.SemanticIndex = semantic_index;
+
+   declaration_grow( declaration, header );
+
+   return ds;
+}
+
+/*
+ * immediate
+ */
+
+struct tgsi_immediate
+tgsi_default_immediate( void )
+{
+   struct tgsi_immediate immediate;
+
+   immediate.Type = TGSI_TOKEN_TYPE_IMMEDIATE;
+   immediate.Size = 1;
+   immediate.DataType = TGSI_IMM_FLOAT32;
+   immediate.Padding = 0;
+   immediate.Extended = 0;
+
+   return immediate;
+}
+
+struct tgsi_immediate
+tgsi_build_immediate(
+   struct tgsi_header *header )
+{
+   struct tgsi_immediate immediate;
+
+   immediate = tgsi_default_immediate();
+
+   header_bodysize_grow( header  );
+
+   return immediate;
+}
+
+struct tgsi_full_immediate
+tgsi_default_full_immediate( void )
+{
+   struct tgsi_full_immediate fullimm;
+
+   fullimm.Immediate = tgsi_default_immediate();
+   fullimm.u.Pointer = (void *) 0;
+
+   return fullimm;
+}
+
+static void
+immediate_grow(
+   struct tgsi_immediate *immediate,
+   struct tgsi_header *header )
+{
+   assert( immediate->Size < 0xFF );
+
+   immediate->Size++;
+
+   header_bodysize_grow( header );
+}
+
+struct tgsi_immediate_float32
+tgsi_build_immediate_float32(
+   float value,
+   struct tgsi_immediate *immediate,
+   struct tgsi_header *header )
+{
+   struct tgsi_immediate_float32 immediate_float32;
+
+   immediate_float32.Float = value;
+
+   immediate_grow( immediate, header );
+
+   return immediate_float32;
+}
+
+unsigned
+tgsi_build_full_immediate(
+   const struct tgsi_full_immediate *full_imm,
+   struct tgsi_token *tokens,
+   struct tgsi_header *header,
+   unsigned maxsize )
+{
+   unsigned size = 0,  i;
+   struct tgsi_immediate *immediate;
+
+   if( maxsize <= size )
+      return 0;
+   immediate = (struct tgsi_immediate *) &tokens[size];
+   size++;
+
+   *immediate = tgsi_build_immediate( header );
+
+   for( i = 0; i < full_imm->Immediate.Size - 1; i++ ) {
+      struct tgsi_immediate_float32 *if32;
+
+      if( maxsize <= size )
+         return  0;
+      if32 = (struct tgsi_immediate_float32 *) &tokens[size];
+      size++;
+
+      *if32  = tgsi_build_immediate_float32(
+         full_imm->u.ImmediateFloat32[i].Float,
+         immediate,
+         header );
+   }
+
+   return size;
+}
+
+/*
+ * instruction
+ */
+
+struct tgsi_instruction
+tgsi_default_instruction( void )
+{
+   struct tgsi_instruction instruction;
+
+   instruction.Type = TGSI_TOKEN_TYPE_INSTRUCTION;
+   instruction.Size = 1;
+   instruction.Opcode = TGSI_OPCODE_MOV;
+   instruction.Saturate = TGSI_SAT_NONE;
+   instruction.NumDstRegs = 1;
+   instruction.NumSrcRegs = 1;
+   instruction.Padding  = 0;
+   instruction.Extended = 0;
+
+   return instruction;
+}
+
+struct tgsi_instruction
+tgsi_build_instruction(
+   unsigned opcode,
+   unsigned saturate,
+   unsigned num_dst_regs,
+   unsigned num_src_regs,
+   struct tgsi_header *header )
+{
+   struct tgsi_instruction instruction;
+
+   assert (opcode <= TGSI_OPCODE_LAST);
+   assert (saturate <= TGSI_SAT_MINUS_PLUS_ONE);
+   assert (num_dst_regs <= 3);
+   assert (num_src_regs <= 15);
+
+   instruction = tgsi_default_instruction();
+   instruction.Opcode = opcode;
+   instruction.Saturate = saturate;
+   instruction.NumDstRegs = num_dst_regs;
+   instruction.NumSrcRegs = num_src_regs;
+
+   header_bodysize_grow( header );
+
+   return instruction;
+}
+
+static void
+instruction_grow(
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header )
+{
+   assert (instruction->Size <   0xFF);
+
+   instruction->Size++;
+
+   header_bodysize_grow( header );
+}
+
+struct tgsi_full_instruction
+tgsi_default_full_instruction( void )
+{
+   struct tgsi_full_instruction full_instruction;
+   unsigned i;
+
+   full_instruction.Instruction = tgsi_default_instruction();
+   full_instruction.InstructionExtNv = tgsi_default_instruction_ext_nv();
+   full_instruction.InstructionExtLabel = tgsi_default_instruction_ext_label();
+   full_instruction.InstructionExtTexture = tgsi_default_instruction_ext_texture();
+   for( i = 0;  i < TGSI_FULL_MAX_DST_REGISTERS; i++ ) {
+      full_instruction.FullDstRegisters[i] = tgsi_default_full_dst_register();
+   }
+   for( i = 0;  i < TGSI_FULL_MAX_SRC_REGISTERS; i++ ) {
+      full_instruction.FullSrcRegisters[i] = tgsi_default_full_src_register();
+   }
+
+   return full_instruction;
+}
+
+unsigned
+tgsi_build_full_instruction(
+   const struct tgsi_full_instruction *full_inst,
+   struct  tgsi_token *tokens,
+   struct  tgsi_header *header,
+   unsigned  maxsize )
+{
+   unsigned size = 0;
+   unsigned i;
+   struct tgsi_instruction *instruction;
+   struct tgsi_token *prev_token;
+
+   if( maxsize <= size )
+      return 0;
+   instruction = (struct tgsi_instruction *) &tokens[size];
+   size++;
+
+   *instruction = tgsi_build_instruction(
+      full_inst->Instruction.Opcode,
+      full_inst->Instruction.Saturate,
+      full_inst->Instruction.NumDstRegs,
+      full_inst->Instruction.NumSrcRegs,
+      header );
+   prev_token = (struct tgsi_token  *) instruction;
+
+   if( tgsi_compare_instruction_ext_nv(
+         full_inst->InstructionExtNv,
+         tgsi_default_instruction_ext_nv() ) ) {
+      struct tgsi_instruction_ext_nv *instruction_ext_nv;
+
+      if( maxsize <= size )
+         return 0;
+      instruction_ext_nv =
+         (struct  tgsi_instruction_ext_nv *) &tokens[size];
+      size++;
+
+      *instruction_ext_nv  = tgsi_build_instruction_ext_nv(
+         full_inst->InstructionExtNv.Precision,
+         full_inst->InstructionExtNv.CondDstIndex,
+         full_inst->InstructionExtNv.CondFlowIndex,
+         full_inst->InstructionExtNv.CondMask,
+         full_inst->InstructionExtNv.CondSwizzleX,
+         full_inst->InstructionExtNv.CondSwizzleY,
+         full_inst->InstructionExtNv.CondSwizzleZ,
+         full_inst->InstructionExtNv.CondSwizzleW,
+         full_inst->InstructionExtNv.CondDstUpdate,
+         full_inst->InstructionExtNv.CondFlowEnable,
+         prev_token,
+         instruction,
+         header );
+      prev_token = (struct tgsi_token  *) instruction_ext_nv;
+   }
+
+   if( tgsi_compare_instruction_ext_label(
+         full_inst->InstructionExtLabel,
+         tgsi_default_instruction_ext_label() ) ) {
+      struct tgsi_instruction_ext_label *instruction_ext_label;
+
+      if( maxsize <= size )
+         return 0;
+      instruction_ext_label =
+         (struct  tgsi_instruction_ext_label *) &tokens[size];
+      size++;
+
+      *instruction_ext_label = tgsi_build_instruction_ext_label(
+         full_inst->InstructionExtLabel.Label,
+         prev_token,
+         instruction,
+         header );
+      prev_token = (struct tgsi_token  *) instruction_ext_label;
+   }
+
+   if( tgsi_compare_instruction_ext_texture(
+         full_inst->InstructionExtTexture,
+         tgsi_default_instruction_ext_texture() ) ) {
+      struct tgsi_instruction_ext_texture *instruction_ext_texture;
+
+      if( maxsize <= size )
+         return 0;
+      instruction_ext_texture =
+         (struct  tgsi_instruction_ext_texture *) &tokens[size];
+      size++;
+
+      *instruction_ext_texture = tgsi_build_instruction_ext_texture(
+         full_inst->InstructionExtTexture.Texture,
+         prev_token,
+         instruction,
+         header   );
+      prev_token = (struct tgsi_token  *) instruction_ext_texture;
+   }
+
+   for( i = 0;  i <   full_inst->Instruction.NumDstRegs; i++ ) {
+      const struct tgsi_full_dst_register *reg = &full_inst->FullDstRegisters[i];
+      struct tgsi_dst_register *dst_register;
+      struct tgsi_token *prev_token;
+
+      if( maxsize <= size )
+         return 0;
+      dst_register = (struct tgsi_dst_register *) &tokens[size];
+      size++;
+
+      *dst_register = tgsi_build_dst_register(
+         reg->DstRegister.File,
+         reg->DstRegister.WriteMask,
+         reg->DstRegister.Index,
+         instruction,
+         header );
+      prev_token = (struct tgsi_token  *) dst_register;
+
+      if( tgsi_compare_dst_register_ext_concode(
+            reg->DstRegisterExtConcode,
+            tgsi_default_dst_register_ext_concode() ) ) {
+         struct tgsi_dst_register_ext_concode *dst_register_ext_concode;
+
+         if( maxsize <= size )
+            return 0;
+         dst_register_ext_concode =
+            (struct  tgsi_dst_register_ext_concode *) &tokens[size];
+         size++;
+
+         *dst_register_ext_concode =   tgsi_build_dst_register_ext_concode(
+            reg->DstRegisterExtConcode.CondMask,
+            reg->DstRegisterExtConcode.CondSwizzleX,
+            reg->DstRegisterExtConcode.CondSwizzleY,
+            reg->DstRegisterExtConcode.CondSwizzleZ,
+            reg->DstRegisterExtConcode.CondSwizzleW,
+            reg->DstRegisterExtConcode.CondSrcIndex,
+            prev_token,
+            instruction,
+            header );
+         prev_token = (struct tgsi_token  *) dst_register_ext_concode;
+      }
+
+      if( tgsi_compare_dst_register_ext_modulate(
+            reg->DstRegisterExtModulate,
+            tgsi_default_dst_register_ext_modulate() ) ) {
+         struct tgsi_dst_register_ext_modulate *dst_register_ext_modulate;
+
+         if( maxsize <= size )
+            return 0;
+         dst_register_ext_modulate =
+            (struct  tgsi_dst_register_ext_modulate *) &tokens[size];
+         size++;
+
+         *dst_register_ext_modulate = tgsi_build_dst_register_ext_modulate(
+            reg->DstRegisterExtModulate.Modulate,
+            prev_token,
+            instruction,
+            header );
+         prev_token = (struct tgsi_token  *) dst_register_ext_modulate;
+      }
+   }
+
+   for( i = 0;  i < full_inst->Instruction.NumSrcRegs; i++ ) {
+      const struct tgsi_full_src_register *reg = &full_inst->FullSrcRegisters[i];
+      struct tgsi_src_register *src_register;
+      struct tgsi_token *prev_token;
+
+      if( maxsize <= size )
+         return 0;
+      src_register = (struct tgsi_src_register *)  &tokens[size];
+      size++;
+
+      *src_register = tgsi_build_src_register(
+         reg->SrcRegister.File,
+         reg->SrcRegister.SwizzleX,
+         reg->SrcRegister.SwizzleY,
+         reg->SrcRegister.SwizzleZ,
+         reg->SrcRegister.SwizzleW,
+         reg->SrcRegister.Negate,
+         reg->SrcRegister.Indirect,
+         reg->SrcRegister.Dimension,
+         reg->SrcRegister.Index,
+         instruction,
+         header );
+      prev_token = (struct tgsi_token  *) src_register;
+
+      if( tgsi_compare_src_register_ext_swz(
+            reg->SrcRegisterExtSwz,
+            tgsi_default_src_register_ext_swz() ) ) {
+         struct tgsi_src_register_ext_swz *src_register_ext_swz;
+
+         if( maxsize <= size )
+            return 0;
+         src_register_ext_swz =
+            (struct  tgsi_src_register_ext_swz *) &tokens[size];
+         size++;
+
+         *src_register_ext_swz = tgsi_build_src_register_ext_swz(
+            reg->SrcRegisterExtSwz.ExtSwizzleX,
+            reg->SrcRegisterExtSwz.ExtSwizzleY,
+            reg->SrcRegisterExtSwz.ExtSwizzleZ,
+            reg->SrcRegisterExtSwz.ExtSwizzleW,
+            reg->SrcRegisterExtSwz.NegateX,
+            reg->SrcRegisterExtSwz.NegateY,
+            reg->SrcRegisterExtSwz.NegateZ,
+            reg->SrcRegisterExtSwz.NegateW,
+            reg->SrcRegisterExtSwz.ExtDivide,
+            prev_token,
+            instruction,
+            header );
+         prev_token = (struct tgsi_token  *) src_register_ext_swz;
+      }
+
+      if( tgsi_compare_src_register_ext_mod(
+            reg->SrcRegisterExtMod,
+            tgsi_default_src_register_ext_mod() ) ) {
+         struct tgsi_src_register_ext_mod *src_register_ext_mod;
+
+         if( maxsize <= size )
+            return 0;
+         src_register_ext_mod =
+            (struct  tgsi_src_register_ext_mod *) &tokens[size];
+         size++;
+
+         *src_register_ext_mod = tgsi_build_src_register_ext_mod(
+            reg->SrcRegisterExtMod.Complement,
+            reg->SrcRegisterExtMod.Bias,
+            reg->SrcRegisterExtMod.Scale2X,
+            reg->SrcRegisterExtMod.Absolute,
+            reg->SrcRegisterExtMod.Negate,
+            prev_token,
+            instruction,
+            header );
+         prev_token = (struct tgsi_token  *) src_register_ext_mod;
+      }
+
+      if( reg->SrcRegister.Indirect ) {
+         struct  tgsi_src_register *ind;
+
+         if( maxsize <= size )
+            return 0;
+         ind = (struct tgsi_src_register *) &tokens[size];
+         size++;
+
+         *ind = tgsi_build_src_register(
+            reg->SrcRegisterInd.File,
+            reg->SrcRegisterInd.SwizzleX,
+            reg->SrcRegisterInd.SwizzleY,
+            reg->SrcRegisterInd.SwizzleZ,
+            reg->SrcRegisterInd.SwizzleW,
+            reg->SrcRegisterInd.Negate,
+            reg->SrcRegisterInd.Indirect,
+            reg->SrcRegisterInd.Dimension,
+            reg->SrcRegisterInd.Index,
+            instruction,
+            header );
+      }
+
+      if( reg->SrcRegister.Dimension ) {
+         struct  tgsi_dimension *dim;
+
+         assert( !reg->SrcRegisterDim.Dimension );
+
+         if( maxsize <= size )
+            return 0;
+         dim = (struct tgsi_dimension *) &tokens[size];
+         size++;
+
+         *dim = tgsi_build_dimension(
+            reg->SrcRegisterDim.Indirect,
+            reg->SrcRegisterDim.Index,
+            instruction,
+            header );
+
+         if( reg->SrcRegisterDim.Indirect ) {
+            struct tgsi_src_register *ind;
+
+            if( maxsize <= size )
+               return 0;
+            ind = (struct tgsi_src_register *) &tokens[size];
+            size++;
+
+            *ind = tgsi_build_src_register(
+               reg->SrcRegisterDimInd.File,
+               reg->SrcRegisterDimInd.SwizzleX,
+               reg->SrcRegisterDimInd.SwizzleY,
+               reg->SrcRegisterDimInd.SwizzleZ,
+               reg->SrcRegisterDimInd.SwizzleW,
+               reg->SrcRegisterDimInd.Negate,
+               reg->SrcRegisterDimInd.Indirect,
+               reg->SrcRegisterDimInd.Dimension,
+               reg->SrcRegisterDimInd.Index,
+               instruction,
+               header );
+         }
+      }
+   }
+
+   return size;
+}
+
+struct tgsi_instruction_ext_nv
+tgsi_default_instruction_ext_nv( void )
+{
+   struct tgsi_instruction_ext_nv instruction_ext_nv;
+
+   instruction_ext_nv.Type = TGSI_INSTRUCTION_EXT_TYPE_NV;
+   instruction_ext_nv.Precision = TGSI_PRECISION_DEFAULT;
+   instruction_ext_nv.CondDstIndex = 0;
+   instruction_ext_nv.CondFlowIndex = 0;
+   instruction_ext_nv.CondMask = TGSI_CC_TR;
+   instruction_ext_nv.CondSwizzleX = TGSI_SWIZZLE_X;
+   instruction_ext_nv.CondSwizzleY = TGSI_SWIZZLE_Y;
+   instruction_ext_nv.CondSwizzleZ = TGSI_SWIZZLE_Z;
+   instruction_ext_nv.CondSwizzleW = TGSI_SWIZZLE_W;
+   instruction_ext_nv.CondDstUpdate = 0;
+   instruction_ext_nv.CondFlowEnable = 0;
+   instruction_ext_nv.Padding = 0;
+   instruction_ext_nv.Extended = 0;
+
+   return instruction_ext_nv;
+}
+
+union token_u32
+{
+   unsigned u32;
+};
+
+unsigned
+tgsi_compare_instruction_ext_nv(
+   struct tgsi_instruction_ext_nv a,
+   struct tgsi_instruction_ext_nv b )
+{
+   a.Padding = b.Padding = 0;
+   a.Extended = b.Extended = 0;
+   return ((union token_u32 *) &a)->u32 != ((union token_u32 *) &b)->u32;
+}
+
+struct tgsi_instruction_ext_nv
+tgsi_build_instruction_ext_nv(
+   unsigned precision,
+   unsigned cond_dst_index,
+   unsigned cond_flow_index,
+   unsigned cond_mask,
+   unsigned cond_swizzle_x,
+   unsigned cond_swizzle_y,
+   unsigned cond_swizzle_z,
+   unsigned cond_swizzle_w,
+   unsigned cond_dst_update,
+   unsigned cond_flow_update,
+   struct tgsi_token *prev_token,
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header )
+{
+   struct tgsi_instruction_ext_nv instruction_ext_nv;
+
+   instruction_ext_nv = tgsi_default_instruction_ext_nv();
+   instruction_ext_nv.Precision = precision;
+   instruction_ext_nv.CondDstIndex = cond_dst_index;
+   instruction_ext_nv.CondFlowIndex = cond_flow_index;
+   instruction_ext_nv.CondMask = cond_mask;
+   instruction_ext_nv.CondSwizzleX = cond_swizzle_x;
+   instruction_ext_nv.CondSwizzleY = cond_swizzle_y;
+   instruction_ext_nv.CondSwizzleZ = cond_swizzle_z;
+   instruction_ext_nv.CondSwizzleW = cond_swizzle_w;
+   instruction_ext_nv.CondDstUpdate = cond_dst_update;
+   instruction_ext_nv.CondFlowEnable = cond_flow_update;
+
+   prev_token->Extended = 1;
+   instruction_grow( instruction, header );
+
+   return instruction_ext_nv;
+}
+
+struct tgsi_instruction_ext_label
+tgsi_default_instruction_ext_label( void )
+{
+   struct tgsi_instruction_ext_label instruction_ext_label;
+
+   instruction_ext_label.Type = TGSI_INSTRUCTION_EXT_TYPE_LABEL;
+   instruction_ext_label.Label = 0;
+   instruction_ext_label.Padding = 0;
+   instruction_ext_label.Extended = 0;
+
+   return instruction_ext_label;
+}
+
+unsigned
+tgsi_compare_instruction_ext_label(
+   struct tgsi_instruction_ext_label a,
+   struct tgsi_instruction_ext_label b )
+{
+   a.Padding = b.Padding = 0;
+   a.Extended = b.Extended = 0;
+   return ((union token_u32 *) &a)->u32 != ((union token_u32 *) &b)->u32;
+}
+
+struct tgsi_instruction_ext_label
+tgsi_build_instruction_ext_label(
+   unsigned label,
+   struct tgsi_token  *prev_token,
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header )
+{
+   struct tgsi_instruction_ext_label instruction_ext_label;
+
+   instruction_ext_label = tgsi_default_instruction_ext_label();
+   instruction_ext_label.Label = label;
+
+   prev_token->Extended = 1;
+   instruction_grow( instruction, header );
+
+   return instruction_ext_label;
+}
+
+struct tgsi_instruction_ext_texture
+tgsi_default_instruction_ext_texture( void )
+{
+   struct tgsi_instruction_ext_texture instruction_ext_texture;
+
+   instruction_ext_texture.Type = TGSI_INSTRUCTION_EXT_TYPE_TEXTURE;
+   instruction_ext_texture.Texture = TGSI_TEXTURE_UNKNOWN;
+   instruction_ext_texture.Padding = 0;
+   instruction_ext_texture.Extended = 0;
+
+   return instruction_ext_texture;
+}
+
+unsigned
+tgsi_compare_instruction_ext_texture(
+   struct tgsi_instruction_ext_texture a,
+   struct tgsi_instruction_ext_texture b )
+{
+   a.Padding = b.Padding = 0;
+   a.Extended = b.Extended = 0;
+   return ((union token_u32 *) &a)->u32 != ((union token_u32 *) &b)->u32;
+}
+
+struct tgsi_instruction_ext_texture
+tgsi_build_instruction_ext_texture(
+   unsigned texture,
+   struct tgsi_token *prev_token,
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header )
+{
+   struct tgsi_instruction_ext_texture instruction_ext_texture;
+
+   instruction_ext_texture = tgsi_default_instruction_ext_texture();
+   instruction_ext_texture.Texture = texture;
+
+   prev_token->Extended = 1;
+   instruction_grow( instruction, header );
+
+   return instruction_ext_texture;
+}
+
+struct tgsi_src_register
+tgsi_default_src_register( void )
+{
+   struct tgsi_src_register src_register;
+
+   src_register.File = TGSI_FILE_NULL;
+   src_register.SwizzleX = TGSI_SWIZZLE_X;
+   src_register.SwizzleY = TGSI_SWIZZLE_Y;
+   src_register.SwizzleZ = TGSI_SWIZZLE_Z;
+   src_register.SwizzleW = TGSI_SWIZZLE_W;
+   src_register.Negate = 0;
+   src_register.Indirect = 0;
+   src_register.Dimension = 0;
+   src_register.Index = 0;
+   src_register.Extended = 0;
+
+   return src_register;
+}
+
+struct tgsi_src_register
+tgsi_build_src_register(
+   unsigned file,
+   unsigned swizzle_x,
+   unsigned swizzle_y,
+   unsigned swizzle_z,
+   unsigned swizzle_w,
+   unsigned negate,
+   unsigned indirect,
+   unsigned dimension,
+   int index,
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header )
+{
+   struct tgsi_src_register   src_register;
+
+   assert( file <= TGSI_FILE_IMMEDIATE );
+   assert( swizzle_x <= TGSI_SWIZZLE_W );
+   assert( swizzle_y <= TGSI_SWIZZLE_W );
+   assert( swizzle_z <= TGSI_SWIZZLE_W );
+   assert( swizzle_w <= TGSI_SWIZZLE_W );
+   assert( negate <= 1 );
+   assert( index >= -0x8000 && index <= 0x7FFF );
+
+   src_register = tgsi_default_src_register();
+   src_register.File = file;
+   src_register.SwizzleX = swizzle_x;
+   src_register.SwizzleY = swizzle_y;
+   src_register.SwizzleZ = swizzle_z;
+   src_register.SwizzleW = swizzle_w;
+   src_register.Negate = negate;
+   src_register.Indirect = indirect;
+   src_register.Dimension = dimension;
+   src_register.Index = index;
+
+   instruction_grow( instruction, header );
+
+   return src_register;
+}
+
+struct tgsi_full_src_register
+tgsi_default_full_src_register( void )
+{
+   struct tgsi_full_src_register full_src_register;
+
+   full_src_register.SrcRegister = tgsi_default_src_register();
+   full_src_register.SrcRegisterExtSwz = tgsi_default_src_register_ext_swz();
+   full_src_register.SrcRegisterExtMod = tgsi_default_src_register_ext_mod();
+   full_src_register.SrcRegisterInd = tgsi_default_src_register();
+   full_src_register.SrcRegisterDim = tgsi_default_dimension();
+   full_src_register.SrcRegisterDimInd = tgsi_default_src_register();
+
+   return full_src_register;
+}
+
+struct tgsi_src_register_ext_swz
+tgsi_default_src_register_ext_swz( void )
+{
+   struct tgsi_src_register_ext_swz src_register_ext_swz;
+
+   src_register_ext_swz.Type = TGSI_SRC_REGISTER_EXT_TYPE_SWZ;
+   src_register_ext_swz.ExtSwizzleX = TGSI_EXTSWIZZLE_X;
+   src_register_ext_swz.ExtSwizzleY = TGSI_EXTSWIZZLE_Y;
+   src_register_ext_swz.ExtSwizzleZ = TGSI_EXTSWIZZLE_Z;
+   src_register_ext_swz.ExtSwizzleW = TGSI_EXTSWIZZLE_W;
+   src_register_ext_swz.NegateX = 0;
+   src_register_ext_swz.NegateY = 0;
+   src_register_ext_swz.NegateZ = 0;
+   src_register_ext_swz.NegateW = 0;
+   src_register_ext_swz.ExtDivide = TGSI_EXTSWIZZLE_ONE;
+   src_register_ext_swz.Padding = 0;
+   src_register_ext_swz.Extended = 0;
+
+   return src_register_ext_swz;
+}
+
+unsigned
+tgsi_compare_src_register_ext_swz(
+   struct tgsi_src_register_ext_swz a,
+   struct tgsi_src_register_ext_swz b )
+{
+   a.Padding = b.Padding = 0;
+   a.Extended = b.Extended = 0;
+   return ((union token_u32 *) &a)->u32 != ((union token_u32 *) &b)->u32;
+}
+
+struct tgsi_src_register_ext_swz
+tgsi_build_src_register_ext_swz(
+   unsigned ext_swizzle_x,
+   unsigned ext_swizzle_y,
+   unsigned ext_swizzle_z,
+   unsigned ext_swizzle_w,
+   unsigned negate_x,
+   unsigned negate_y,
+   unsigned negate_z,
+   unsigned negate_w,
+   unsigned ext_divide,
+   struct tgsi_token *prev_token,
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header )
+{
+   struct tgsi_src_register_ext_swz src_register_ext_swz;
+
+   assert( ext_swizzle_x <= TGSI_EXTSWIZZLE_ONE );
+   assert( ext_swizzle_y <= TGSI_EXTSWIZZLE_ONE );
+   assert( ext_swizzle_z <= TGSI_EXTSWIZZLE_ONE );
+   assert( ext_swizzle_w <= TGSI_EXTSWIZZLE_ONE );
+   assert( negate_x <= 1 );
+   assert( negate_y <= 1 );
+   assert( negate_z <= 1 );
+   assert( negate_w <= 1 );
+   assert( ext_divide <= TGSI_EXTSWIZZLE_ONE );
+
+   src_register_ext_swz = tgsi_default_src_register_ext_swz();
+   src_register_ext_swz.ExtSwizzleX = ext_swizzle_x;
+   src_register_ext_swz.ExtSwizzleY = ext_swizzle_y;
+   src_register_ext_swz.ExtSwizzleZ = ext_swizzle_z;
+   src_register_ext_swz.ExtSwizzleW = ext_swizzle_w;
+   src_register_ext_swz.NegateX = negate_x;
+   src_register_ext_swz.NegateY = negate_y;
+   src_register_ext_swz.NegateZ = negate_z;
+   src_register_ext_swz.NegateW = negate_w;
+   src_register_ext_swz.ExtDivide = ext_divide;
+
+   prev_token->Extended = 1;
+   instruction_grow( instruction, header );
+
+   return src_register_ext_swz;
+}
+
+struct tgsi_src_register_ext_mod
+tgsi_default_src_register_ext_mod( void )
+{
+   struct tgsi_src_register_ext_mod src_register_ext_mod;
+
+   src_register_ext_mod.Type = TGSI_SRC_REGISTER_EXT_TYPE_MOD;
+   src_register_ext_mod.Complement = 0;
+   src_register_ext_mod.Bias = 0;
+   src_register_ext_mod.Scale2X = 0;
+   src_register_ext_mod.Absolute = 0;
+   src_register_ext_mod.Negate = 0;
+   src_register_ext_mod.Padding = 0;
+   src_register_ext_mod.Extended = 0;
+
+   return src_register_ext_mod;
+}
+
+unsigned
+tgsi_compare_src_register_ext_mod(
+   struct tgsi_src_register_ext_mod a,
+   struct tgsi_src_register_ext_mod b )
+{
+   a.Padding = b.Padding = 0;
+   a.Extended = b.Extended = 0;
+   return ((union token_u32 *) &a)->u32 != ((union token_u32 *) &b)->u32;
+}
+
+struct tgsi_src_register_ext_mod
+tgsi_build_src_register_ext_mod(
+   unsigned complement,
+   unsigned bias,
+   unsigned scale_2x,
+   unsigned absolute,
+   unsigned negate,
+   struct tgsi_token *prev_token,
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header )
+{
+   struct tgsi_src_register_ext_mod src_register_ext_mod;
+
+   assert( complement <= 1 );
+   assert( bias <= 1 );
+   assert( scale_2x <= 1 );
+   assert( absolute <= 1 );
+   assert( negate <= 1 );
+
+   src_register_ext_mod = tgsi_default_src_register_ext_mod();
+   src_register_ext_mod.Complement = complement;
+   src_register_ext_mod.Bias = bias;
+   src_register_ext_mod.Scale2X = scale_2x;
+   src_register_ext_mod.Absolute = absolute;
+   src_register_ext_mod.Negate = negate;
+
+   prev_token->Extended = 1;
+   instruction_grow( instruction, header );
+
+   return src_register_ext_mod;
+}
+
+struct tgsi_dimension
+tgsi_default_dimension( void )
+{
+   struct tgsi_dimension dimension;
+
+   dimension.Indirect = 0;
+   dimension.Dimension = 0;
+   dimension.Padding = 0;
+   dimension.Index = 0;
+   dimension.Extended = 0;
+
+   return dimension;
+}
+
+struct tgsi_dimension
+tgsi_build_dimension(
+   unsigned indirect,
+   unsigned index,
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header )
+{
+   struct tgsi_dimension dimension;
+
+   dimension = tgsi_default_dimension();
+   dimension.Indirect = indirect;
+   dimension.Index = index;
+
+   instruction_grow( instruction, header );
+
+   return dimension;
+}
+
+struct tgsi_dst_register
+tgsi_default_dst_register( void )
+{
+   struct tgsi_dst_register dst_register;
+
+   dst_register.File = TGSI_FILE_NULL;
+   dst_register.WriteMask = TGSI_WRITEMASK_XYZW;
+   dst_register.Indirect = 0;
+   dst_register.Dimension = 0;
+   dst_register.Index = 0;
+   dst_register.Padding = 0;
+   dst_register.Extended = 0;
+
+   return dst_register;
+}
+
+struct tgsi_dst_register
+tgsi_build_dst_register(
+   unsigned file,
+   unsigned mask,
+   int index,
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header )
+{
+   struct tgsi_dst_register dst_register;
+
+   assert( file <= TGSI_FILE_IMMEDIATE );
+   assert( mask <= TGSI_WRITEMASK_XYZW );
+   assert( index >= -32768 && index <= 32767 );
+
+   dst_register = tgsi_default_dst_register();
+   dst_register.File = file;
+   dst_register.WriteMask = mask;
+   dst_register.Index = index;
+
+   instruction_grow( instruction, header );
+
+   return dst_register;
+}
+
+struct tgsi_full_dst_register
+tgsi_default_full_dst_register( void )
+{
+   struct tgsi_full_dst_register full_dst_register;
+
+   full_dst_register.DstRegister = tgsi_default_dst_register();
+   full_dst_register.DstRegisterExtConcode =
+      tgsi_default_dst_register_ext_concode();
+   full_dst_register.DstRegisterExtModulate =
+      tgsi_default_dst_register_ext_modulate();
+
+   return full_dst_register;
+}
+
+struct tgsi_dst_register_ext_concode
+tgsi_default_dst_register_ext_concode( void )
+{
+   struct tgsi_dst_register_ext_concode dst_register_ext_concode;
+
+   dst_register_ext_concode.Type = TGSI_DST_REGISTER_EXT_TYPE_CONDCODE;
+   dst_register_ext_concode.CondMask = TGSI_CC_TR;
+   dst_register_ext_concode.CondSwizzleX = TGSI_SWIZZLE_X;
+   dst_register_ext_concode.CondSwizzleY = TGSI_SWIZZLE_Y;
+   dst_register_ext_concode.CondSwizzleZ = TGSI_SWIZZLE_Z;
+   dst_register_ext_concode.CondSwizzleW = TGSI_SWIZZLE_W;
+   dst_register_ext_concode.CondSrcIndex = 0;
+   dst_register_ext_concode.Padding = 0;
+   dst_register_ext_concode.Extended = 0;
+
+   return dst_register_ext_concode;
+}
+
+unsigned
+tgsi_compare_dst_register_ext_concode(
+   struct tgsi_dst_register_ext_concode a,
+   struct tgsi_dst_register_ext_concode b )
+{
+   a.Padding = b.Padding = 0;
+   a.Extended = b.Extended = 0;
+   return ((union token_u32 *) &a)->u32 != ((union token_u32 *) &b)->u32;
+}
+
+struct tgsi_dst_register_ext_concode
+tgsi_build_dst_register_ext_concode(
+   unsigned cc,
+   unsigned swizzle_x,
+   unsigned swizzle_y,
+   unsigned swizzle_z,
+   unsigned swizzle_w,
+   int index,
+   struct tgsi_token *prev_token,
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header )
+{
+   struct tgsi_dst_register_ext_concode dst_register_ext_concode;
+
+   assert( cc <= TGSI_CC_FL );
+   assert( swizzle_x <= TGSI_SWIZZLE_W );
+   assert( swizzle_y <= TGSI_SWIZZLE_W );
+   assert( swizzle_z <= TGSI_SWIZZLE_W );
+   assert( swizzle_w <= TGSI_SWIZZLE_W );
+   assert( index >= -32768 && index <= 32767 );
+
+   dst_register_ext_concode = tgsi_default_dst_register_ext_concode();
+   dst_register_ext_concode.CondMask = cc;
+   dst_register_ext_concode.CondSwizzleX = swizzle_x;
+   dst_register_ext_concode.CondSwizzleY = swizzle_y;
+   dst_register_ext_concode.CondSwizzleZ = swizzle_z;
+   dst_register_ext_concode.CondSwizzleW = swizzle_w;
+   dst_register_ext_concode.CondSrcIndex = index;
+
+   prev_token->Extended = 1;
+   instruction_grow( instruction, header );
+
+   return dst_register_ext_concode;
+}
+
+struct tgsi_dst_register_ext_modulate
+tgsi_default_dst_register_ext_modulate( void )
+{
+   struct tgsi_dst_register_ext_modulate dst_register_ext_modulate;
+
+   dst_register_ext_modulate.Type = TGSI_DST_REGISTER_EXT_TYPE_MODULATE;
+   dst_register_ext_modulate.Modulate = TGSI_MODULATE_1X;
+   dst_register_ext_modulate.Padding = 0;
+   dst_register_ext_modulate.Extended = 0;
+
+   return dst_register_ext_modulate;
+}
+
+unsigned
+tgsi_compare_dst_register_ext_modulate(
+   struct tgsi_dst_register_ext_modulate a,
+   struct tgsi_dst_register_ext_modulate b )
+{
+   a.Padding = b.Padding = 0;
+   a.Extended = b.Extended = 0;
+   return ((union token_u32 *) &a)->u32 != ((union token_u32 *) &b)->u32;
+}
+
+struct tgsi_dst_register_ext_modulate
+tgsi_build_dst_register_ext_modulate(
+   unsigned modulate,
+   struct tgsi_token *prev_token,
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header )
+{
+   struct tgsi_dst_register_ext_modulate dst_register_ext_modulate;
+
+   assert( modulate <= TGSI_MODULATE_EIGHTH );
+
+   dst_register_ext_modulate = tgsi_default_dst_register_ext_modulate();
+   dst_register_ext_modulate.Modulate = modulate;
+
+   prev_token->Extended = 1;
+   instruction_grow( instruction, header );
+
+   return dst_register_ext_modulate;
+}
+
diff --git a/src/mesa/pipe/tgsi/util/tgsi_build.h b/src/mesa/pipe/tgsi/util/tgsi_build.h
new file mode 100644 (file)
index 0000000..116c78a
--- /dev/null
@@ -0,0 +1,320 @@
+#if !defined TGSI_BUILD_H
+#define TGSI_BUILD_H
+
+#if defined __cplusplus
+extern "C" {
+#endif // defined __cplusplus
+
+/*
+ * version
+ */
+
+struct tgsi_version
+tgsi_build_version( void );
+
+/*
+ * header
+ */
+
+struct tgsi_header
+tgsi_build_header( void );
+
+struct tgsi_processor
+tgsi_default_processor( void );
+
+struct tgsi_processor
+tgsi_build_processor(
+   unsigned processor,
+   struct tgsi_header *header );
+
+/*
+ * declaration
+ */
+
+struct tgsi_declaration
+tgsi_default_declaration( void );
+
+struct tgsi_declaration
+tgsi_build_declaration(
+   unsigned file,
+   unsigned declare,
+   unsigned usage_mask,
+   unsigned interpolate,
+   unsigned semantic,
+   struct tgsi_header *header );
+
+struct tgsi_full_declaration
+tgsi_default_full_declaration( void );
+
+unsigned
+tgsi_build_full_declaration(
+   const struct tgsi_full_declaration *full_decl,
+   struct tgsi_token *tokens,
+   struct tgsi_header *header,
+   unsigned maxsize );
+
+struct tgsi_declaration_range
+tgsi_build_declaration_range(
+   unsigned first,
+   unsigned last,
+   struct tgsi_declaration *declaration,
+   struct tgsi_header *header );
+
+struct tgsi_declaration_mask
+tgsi_build_declaration_mask(
+   unsigned mask,
+   struct tgsi_declaration *declaration,
+   struct tgsi_header *header );
+
+struct tgsi_declaration_interpolation
+tgsi_default_declaration_interpolation( void );
+
+struct tgsi_declaration_interpolation
+tgsi_build_declaration_interpolation(
+   unsigned interpolate,
+   struct tgsi_declaration *declaration,
+   struct tgsi_header *header );
+
+struct tgsi_declaration_semantic
+tgsi_default_declaration_semantic( void );
+
+struct tgsi_declaration_semantic
+tgsi_build_declaration_semantic(
+   unsigned semantic_name,
+   unsigned semantic_index,
+   struct tgsi_declaration *declaration,
+   struct tgsi_header *header );
+
+/*
+ * immediate
+ */
+
+struct tgsi_immediate
+tgsi_default_immediate( void );
+
+struct tgsi_immediate
+tgsi_build_immediate(
+   struct tgsi_header *header );
+
+struct tgsi_full_immediate
+tgsi_default_full_immediate( void );
+
+struct tgsi_immediate_float32
+tgsi_build_immediate_float32(
+   float value,
+   struct tgsi_immediate *immediate,
+   struct tgsi_header *header );
+
+unsigned
+tgsi_build_full_immediate(
+   const struct tgsi_full_immediate *full_imm,
+   struct tgsi_token *tokens,
+   struct tgsi_header *header,
+   unsigned maxsize );
+
+/*
+ * instruction
+ */
+
+struct tgsi_instruction
+tgsi_default_instruction( void );
+
+struct tgsi_instruction
+tgsi_build_instruction(
+   unsigned opcode,
+   unsigned saturate,
+   unsigned num_dst_regs,
+   unsigned num_src_regs,
+   struct tgsi_header *header );
+
+struct tgsi_full_instruction
+tgsi_default_full_instruction( void );
+
+unsigned
+tgsi_build_full_instruction(
+   const struct tgsi_full_instruction *full_inst,
+   struct tgsi_token *tokens,
+   struct tgsi_header *header,
+   unsigned maxsize );
+
+struct tgsi_instruction_ext_nv
+tgsi_default_instruction_ext_nv( void );
+
+unsigned
+tgsi_compare_instruction_ext_nv(
+   struct tgsi_instruction_ext_nv a,
+   struct tgsi_instruction_ext_nv b );
+
+struct tgsi_instruction_ext_nv
+tgsi_build_instruction_ext_nv(
+   unsigned precision,
+   unsigned cond_dst_index,
+   unsigned cond_flow_index,
+   unsigned cond_mask,
+   unsigned cond_swizzle_x,
+   unsigned cond_swizzle_y,
+   unsigned cond_swizzle_z,
+   unsigned cond_swizzle_w,
+   unsigned cond_dst_update,
+   unsigned cond_flow_update,
+   struct tgsi_token *prev_token,
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header );
+
+struct tgsi_instruction_ext_label
+tgsi_default_instruction_ext_label( void );
+
+unsigned
+tgsi_compare_instruction_ext_label(
+   struct tgsi_instruction_ext_label a,
+   struct tgsi_instruction_ext_label b );
+
+struct tgsi_instruction_ext_label
+tgsi_build_instruction_ext_label(
+   unsigned label,
+   struct tgsi_token *prev_token,
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header );
+
+struct tgsi_instruction_ext_texture
+tgsi_default_instruction_ext_texture( void );
+
+unsigned
+tgsi_compare_instruction_ext_texture(
+   struct tgsi_instruction_ext_texture a,
+   struct tgsi_instruction_ext_texture b );
+
+struct tgsi_instruction_ext_texture
+tgsi_build_instruction_ext_texture(
+   unsigned texture,
+   struct tgsi_token *prev_token,
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header );
+
+struct tgsi_src_register
+tgsi_default_src_register( void );
+
+struct tgsi_src_register
+tgsi_build_src_register(
+   unsigned file,
+   unsigned swizzle_x,
+   unsigned swizzle_y,
+   unsigned swizzle_z,
+   unsigned swizzle_w,
+   unsigned negate,
+   unsigned indirect,
+   unsigned dimension,
+   int index,
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header );
+
+struct tgsi_full_src_register
+tgsi_default_full_src_register( void );
+
+struct tgsi_src_register_ext_swz
+tgsi_default_src_register_ext_swz( void );
+
+unsigned
+tgsi_compare_src_register_ext_swz(
+   struct tgsi_src_register_ext_swz a,
+   struct tgsi_src_register_ext_swz b );
+
+struct tgsi_src_register_ext_swz
+tgsi_build_src_register_ext_swz(
+   unsigned ext_swizzle_x,
+   unsigned ext_swizzle_y,
+   unsigned ext_swizzle_z,
+   unsigned ext_swizzle_w,
+   unsigned negate_x,
+   unsigned negate_y,
+   unsigned negate_z,
+   unsigned negate_w,
+   unsigned ext_divide,
+   struct tgsi_token *prev_token,
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header );
+
+struct tgsi_src_register_ext_mod
+tgsi_default_src_register_ext_mod( void );
+
+unsigned
+tgsi_compare_src_register_ext_mod(
+   struct tgsi_src_register_ext_mod a,
+   struct tgsi_src_register_ext_mod b );
+
+struct tgsi_src_register_ext_mod
+tgsi_build_src_register_ext_mod(
+   unsigned complement,
+   unsigned bias,
+   unsigned scale_2x,
+   unsigned absolute,
+   unsigned negate,
+   struct tgsi_token *prev_token,
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header );
+
+struct tgsi_dimension
+tgsi_default_dimension( void );
+
+struct tgsi_dimension
+tgsi_build_dimension(
+   unsigned indirect,
+   unsigned index,
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header );
+
+struct tgsi_dst_register
+tgsi_default_dst_register( void );
+
+struct tgsi_dst_register
+tgsi_build_dst_register(
+   unsigned file,
+   unsigned mask,
+   int index,
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header );
+
+struct tgsi_full_dst_register
+tgsi_default_full_dst_register( void );
+
+struct tgsi_dst_register_ext_concode
+tgsi_default_dst_register_ext_concode( void );
+
+unsigned
+tgsi_compare_dst_register_ext_concode(
+   struct tgsi_dst_register_ext_concode a,
+   struct tgsi_dst_register_ext_concode b );
+
+struct tgsi_dst_register_ext_concode
+tgsi_build_dst_register_ext_concode(
+   unsigned cc,
+   unsigned swizzle_x,
+   unsigned swizzle_y,
+   unsigned swizzle_z,
+   unsigned swizzle_w,
+   int index,
+   struct tgsi_token *prev_token,
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header );
+
+struct tgsi_dst_register_ext_modulate
+tgsi_default_dst_register_ext_modulate( void );
+
+unsigned
+tgsi_compare_dst_register_ext_modulate(
+   struct tgsi_dst_register_ext_modulate a,
+   struct tgsi_dst_register_ext_modulate b );
+
+struct tgsi_dst_register_ext_modulate
+tgsi_build_dst_register_ext_modulate(
+   unsigned modulate,
+   struct tgsi_token *prev_token,
+   struct tgsi_instruction *instruction,
+   struct tgsi_header *header );
+
+#if defined __cplusplus
+} // extern "C"
+#endif // defined __cplusplus
+
+#endif // !defined TGSI_BUILD_H
+
diff --git a/src/mesa/pipe/tgsi/util/tgsi_dump.c b/src/mesa/pipe/tgsi/util/tgsi_dump.c
new file mode 100644 (file)
index 0000000..982d5ce
--- /dev/null
@@ -0,0 +1,1459 @@
+/**************************************************************************
+ * 
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+#include "pipe/p_util.h"
+#include "pipe/p_shader_tokens.h"
+#include "tgsi_dump.h"
+#include "tgsi_parse.h"
+#include "tgsi_build.h"
+
+struct text_dump
+{
+   FILE     *file;
+   unsigned tabs;
+};
+
+static void
+text_dump_str(
+   struct text_dump *dump,
+   const char *str )
+{
+   unsigned i;
+   size_t len = strlen( str );
+
+   for( i = 0; i < len; i++ ) {
+      fprintf( dump->file, "%c", str[i] );
+
+      if( str[i] == '\n' ) {
+         unsigned i;
+
+         for( i = 0; i < dump->tabs; i++ ) {
+            fprintf( dump->file, "    " );
+         }
+      }
+   }
+}
+
+static void
+text_dump_chr(
+   struct text_dump *dump,
+   const char chr )
+{
+   char str[2];
+
+   str[0] = chr;
+   str[1] = '\0';
+   text_dump_str( dump, str );
+}
+
+static void
+text_dump_uix(
+   struct text_dump *dump,
+   const unsigned ui )
+{
+   char str[36];
+
+   sprintf( str, "0x%x", ui );
+   text_dump_str( dump, str );
+}
+
+static void
+text_dump_uid(
+   struct text_dump *dump,
+   const unsigned ui )
+{
+   char str[16];
+
+   sprintf( str, "%u", ui );
+   text_dump_str( dump, str );
+}
+
+static void
+text_dump_sid(
+   struct text_dump *dump,
+   const int si )
+{
+   char str[16];
+
+   sprintf( str, "%d", si );
+   text_dump_str( dump, str );
+}
+
+static void
+text_dump_flt(
+   struct text_dump *dump,
+   const float f )
+{
+   char str[48];
+
+   sprintf( str, "%10.4f", f );
+   text_dump_str( dump, str );
+}
+
+static void
+text_dump_enum(
+   struct text_dump *dump,
+   const unsigned e,
+   const char **enums,
+   const unsigned enums_count )
+{
+   if( e >= enums_count ) {
+      text_dump_uid( dump, e );
+   }
+   else {
+      text_dump_str( dump, enums[e] );
+   }
+}
+
+static void
+text_dump_tab(
+   struct text_dump *dump )
+{
+   dump->tabs++;
+}
+
+static void
+text_dump_untab(
+   struct text_dump *dump )
+{
+   assert( dump->tabs > 0 );
+
+   --dump->tabs;
+}
+
+#define TXT(S)          text_dump_str( dump, S )
+#define CHR(C)          text_dump_chr( dump, C )
+#define UIX(I)          text_dump_uix( dump, I )
+#define UID(I)          text_dump_uid( dump, I )
+#define SID(I)          text_dump_sid( dump, I )
+#define FLT(F)          text_dump_flt( dump, F )
+#define TAB()           text_dump_tab( dump )
+#define UNT()           text_dump_untab( dump )
+#define ENM(E,ENUMS)    text_dump_enum( dump, E, ENUMS, sizeof( ENUMS ) / sizeof( *ENUMS ) )
+
+static const char *TGSI_PROCESSOR_TYPES[] =
+{
+   "PROCESSOR_FRAGMENT",
+   "PROCESSOR_VERTEX",
+   "PROCESSOR_GEOMETRY"
+};
+
+static const char *TGSI_PROCESSOR_TYPES_SHORT[] =
+{
+   "FRAG",
+   "VERT",
+   "GEOM"
+};
+
+static const char *TGSI_TOKEN_TYPES[] =
+{
+   "TOKEN_TYPE_DECLARATION",
+   "TOKEN_TYPE_IMMEDIATE",
+   "TOKEN_TYPE_INSTRUCTION"
+};
+
+static const char *TGSI_FILES[] =
+{
+   "FILE_NULL",
+   "FILE_CONSTANT",
+   "FILE_INPUT",
+   "FILE_OUTPUT",
+   "FILE_TEMPORARY",
+   "FILE_SAMPLER",
+   "FILE_ADDRESS",
+   "FILE_IMMEDIATE"
+};
+
+static const char *TGSI_FILES_SHORT[] =
+{
+   "NULL",
+   "CONST",
+   "IN",
+   "OUT",
+   "TEMP",
+   "SAMP",
+   "ADDR",
+   "IMM"
+};
+
+static const char *TGSI_DECLARES[] =
+{
+   "DECLARE_RANGE",
+   "DECLARE_MASK"
+};
+
+static const char *TGSI_INTERPOLATES[] =
+{
+   "INTERPOLATE_CONSTANT",
+   "INTERPOLATE_LINEAR",
+   "INTERPOLATE_PERSPECTIVE",
+   "INTERPOLATE_ATTRIB"
+};
+
+static const char *TGSI_INTERPOLATES_SHORT[] =
+{
+   "CONSTANT",
+   "LINEAR",
+   "PERSPECTIVE",
+   "ATTRIB"
+};
+
+static const char *TGSI_SEMANTICS[] =
+{
+   "SEMANTIC_POSITION",
+   "SEMANTIC_COLOR",
+   "SEMANTIC_BCOLOR",
+   "SEMANTIC_FOG",
+   "SEMANTIC_PSIZE",
+   "SEMANTIC_GENERIC,"
+};
+
+static const char *TGSI_SEMANTICS_SHORT[] =
+{
+   "POSITION",
+   "COLOR",
+   "BCOLOR",
+   "FOG",
+   "PSIZE",
+   "GENERIC",
+};
+
+static const char *TGSI_IMMS[] =
+{
+   "IMM_FLOAT32"
+};
+
+static const char *TGSI_IMMS_SHORT[] =
+{
+   "FLT32"
+};
+
+static const char *TGSI_OPCODES[] =
+{
+   "OPCODE_ARL",
+   "OPCODE_MOV",
+   "OPCODE_LIT",
+   "OPCODE_RCP",
+   "OPCODE_RSQ",
+   "OPCODE_EXP",
+   "OPCODE_LOG",
+   "OPCODE_MUL",
+   "OPCODE_ADD",
+   "OPCODE_DP3",
+   "OPCODE_DP4",
+   "OPCODE_DST",
+   "OPCODE_MIN",
+   "OPCODE_MAX",
+   "OPCODE_SLT",
+   "OPCODE_SGE",
+   "OPCODE_MAD",
+   "OPCODE_SUB",
+   "OPCODE_LERP",
+   "OPCODE_CND",
+   "OPCODE_CND0",
+   "OPCODE_DOT2ADD",
+   "OPCODE_INDEX",
+   "OPCODE_NEGATE",
+   "OPCODE_FRAC",
+   "OPCODE_CLAMP",
+   "OPCODE_FLOOR",
+   "OPCODE_ROUND",
+   "OPCODE_EXPBASE2",
+   "OPCODE_LOGBASE2",
+   "OPCODE_POWER",
+   "OPCODE_CROSSPRODUCT",
+   "OPCODE_MULTIPLYMATRIX",
+   "OPCODE_ABS",
+   "OPCODE_RCC",
+   "OPCODE_DPH",
+   "OPCODE_COS",
+   "OPCODE_DDX",
+   "OPCODE_DDY",
+   "OPCODE_KILP",
+   "OPCODE_PK2H",
+   "OPCODE_PK2US",
+   "OPCODE_PK4B",
+   "OPCODE_PK4UB",
+   "OPCODE_RFL",
+   "OPCODE_SEQ",
+   "OPCODE_SFL",
+   "OPCODE_SGT",
+   "OPCODE_SIN",
+   "OPCODE_SLE",
+   "OPCODE_SNE",
+   "OPCODE_STR",
+   "OPCODE_TEX",
+   "OPCODE_TXD",
+   "OPCODE_UP2H",
+   "OPCODE_UP2US",
+   "OPCODE_UP4B",
+   "OPCODE_UP4UB",
+   "OPCODE_X2D",
+   "OPCODE_ARA",
+   "OPCODE_ARR",
+   "OPCODE_BRA",
+   "OPCODE_CAL",
+   "OPCODE_RET",
+   "OPCODE_SSG",
+   "OPCODE_CMP",
+   "OPCODE_SCS",
+   "OPCODE_TXB",
+   "OPCODE_NRM",
+   "OPCODE_DIV",
+   "OPCODE_DP2",
+   "OPCODE_TXL",
+   "OPCODE_BRK",
+   "OPCODE_IF",
+   "OPCODE_LOOP",
+   "OPCODE_REP",
+   "OPCODE_ELSE",
+   "OPCODE_ENDIF",
+   "OPCODE_ENDLOOP",
+   "OPCODE_ENDREP",
+   "OPCODE_PUSHA",
+   "OPCODE_POPA",
+   "OPCODE_CEIL",
+   "OPCODE_I2F",
+   "OPCODE_NOT",
+   "OPCODE_TRUNC",
+   "OPCODE_SHL",
+   "OPCODE_SHR",
+   "OPCODE_AND",
+   "OPCODE_OR",
+   "OPCODE_MOD",
+   "OPCODE_XOR",
+   "OPCODE_SAD",
+   "OPCODE_TXF",
+   "OPCODE_TXQ",
+   "OPCODE_CONT",
+   "OPCODE_EMIT",
+   "OPCODE_ENDPRIM",
+   "OPCODE_BGNLOOP2",
+   "OPCODE_BGNSUB",
+   "OPCODE_ENDLOOP2",
+   "OPCODE_ENDSUB",
+   "OPCODE_NOISE1",
+   "OPCODE_NOISE2",
+   "OPCODE_NOISE3",
+   "OPCODE_NOISE4",
+   "OPCODE_NOP",
+   "OPCODE_TEXBEM",
+   "OPCODE_TEXBEML",
+   "OPCODE_TEXREG2AR",
+   "OPCODE_TEXM3X2PAD",
+   "OPCODE_TEXM3X2TEX",
+   "OPCODE_TEXM3X3PAD",
+   "OPCODE_TEXM3X3TEX",
+   "OPCODE_TEXM3X3SPEC",
+   "OPCODE_TEXM3X3VSPEC",
+   "OPCODE_TEXREG2GB",
+   "OPCODE_TEXREG2RGB",
+   "OPCODE_TEXDP3TEX",
+   "OPCODE_TEXDP3",
+   "OPCODE_TEXM3X3",
+   "OPCODE_TEXM3X2DEPTH",
+   "OPCODE_TEXDEPTH",
+   "OPCODE_BEM",
+   "OPCODE_M4X3",
+   "OPCODE_M3X4",
+   "OPCODE_M3X3",
+   "OPCODE_M3X2",
+   "OPCODE_NRM4",
+   "OPCODE_CALLNZ",
+   "OPCODE_IFC",
+   "OPCODE_BREAKC",
+   "OPCODE_TXP",
+   "OPCODE_KIL",
+   "OPCODE_END"
+};
+
+static const char *TGSI_OPCODES_SHORT[] =
+{
+   "ARL",
+   "MOV",
+   "LIT",
+   "RCP",
+   "RSQ",
+   "EXP",
+   "LOG",
+   "MUL",
+   "ADD",
+   "DP3",
+   "DP4",
+   "DST",
+   "MIN",
+   "MAX",
+   "SLT",
+   "SGE",
+   "MAD",
+   "SUB",
+   "LERP",
+   "CND",
+   "CND0",
+   "DOT2ADD",
+   "INDEX",
+   "NEGATE",
+   "FRAC",
+   "CLAMP",
+   "FLOOR",
+   "ROUND",
+   "EXPBASE2",
+   "LOGBASE2",
+   "POWER",
+   "CROSSPRODUCT",
+   "MULTIPLYMATRIX",
+   "ABS",
+   "RCC",
+   "DPH",
+   "COS",
+   "DDX",
+   "DDY",
+   "KILP",
+   "PK2H",
+   "PK2US",
+   "PK4B",
+   "PK4UB",
+   "RFL",
+   "SEQ",
+   "SFL",
+   "SGT",
+   "SIN",
+   "SLE",
+   "SNE",
+   "STR",
+   "TEX",
+   "TXD",
+   "UP2H",
+   "UP2US",
+   "UP4B",
+   "UP4UB",
+   "X2D",
+   "ARA",
+   "ARR",
+   "BRA",
+   "CAL",
+   "RET",
+   "SSG",
+   "CMP",
+   "SCS",
+   "TXB",
+   "NRM",
+   "DIV",
+   "DP2",
+   "TXL",
+   "BRK",
+   "IF",
+   "LOOP",
+   "REP",
+   "ELSE",
+   "ENDIF",
+   "ENDLOOP",
+   "ENDREP",
+   "PUSHA",
+   "POPA",
+   "CEIL",
+   "I2F",
+   "NOT",
+   "TRUNC",
+   "SHL",
+   "SHR",
+   "AND",
+   "OR",
+   "MOD",
+   "XOR",
+   "SAD",
+   "TXF",
+   "TXQ",
+   "CONT",
+   "EMIT",
+   "ENDPRIM",
+   "BGNLOOP2",
+   "BGNSUB",
+   "ENDLOOP2",
+   "ENDSUB",
+   "NOISE1",
+   "NOISE2",
+   "NOISE3",
+   "NOISE4",
+   "NOP",
+   "TEXBEM",
+   "TEXBEML",
+   "TEXREG2AR",
+   "TEXM3X2PAD",
+   "TEXM3X2TEX",
+   "TEXM3X3PAD",
+   "TEXM3X3TEX",
+   "TEXM3X3SPEC",
+   "TEXM3X3VSPEC",
+   "TEXREG2GB",
+   "TEXREG2RGB",
+   "TEXDP3TEX",
+   "TEXDP3",
+   "TEXM3X3",
+   "TEXM3X2DEPTH",
+   "TEXDEPTH",
+   "BEM",
+   "M4X3",
+   "M3X4",
+   "M3X3",
+   "M3X2",
+   "NRM4",
+   "CALLNZ",
+   "IFC",
+   "BREAKC",
+   "TXP",
+   "KIL",
+   "END"
+};
+
+static const char *TGSI_SATS[] =
+{
+   "SAT_NONE",
+   "SAT_ZERO_ONE",
+   "SAT_MINUS_PLUS_ONE"
+};
+
+static const char *TGSI_INSTRUCTION_EXTS[] =
+{
+   "INSTRUCTION_EXT_TYPE_NV",
+   "INSTRUCTION_EXT_TYPE_LABEL",
+   "INSTRUCTION_EXT_TYPE_TEXTURE"
+};
+
+static const char *TGSI_PRECISIONS[] =
+{
+   "PRECISION_DEFAULT",
+   "TGSI_PRECISION_FLOAT32",
+   "TGSI_PRECISION_FLOAT16",
+   "TGSI_PRECISION_FIXED12"
+};
+
+static const char *TGSI_CCS[] =
+{
+   "CC_GT",
+   "CC_EQ",
+   "CC_LT",
+   "CC_UN",
+   "CC_GE",
+   "CC_LE",
+   "CC_NE",
+   "CC_TR",
+   "CC_FL"
+};
+
+static const char *TGSI_SWIZZLES[] =
+{
+   "SWIZZLE_X",
+   "SWIZZLE_Y",
+   "SWIZZLE_Z",
+   "SWIZZLE_W"
+};
+
+static const char *TGSI_SWIZZLES_SHORT[] =
+{
+   "x",
+   "y",
+   "z",
+   "w"
+};
+
+static const char *TGSI_TEXTURES[] =
+{
+   "TEXTURE_UNKNOWN",
+   "TEXTURE_1D",
+   "TEXTURE_2D",
+   "TEXTURE_3D",
+   "TEXTURE_CUBE",
+   "TEXTURE_RECT",
+   "TEXTURE_SHADOW1D",
+   "TEXTURE_SHADOW2D",
+   "TEXTURE_SHADOWRECT"
+};
+
+static const char *TGSI_SRC_REGISTER_EXTS[] =
+{
+   "SRC_REGISTER_EXT_TYPE_SWZ",
+   "SRC_REGISTER_EXT_TYPE_MOD"
+};
+
+static const char *TGSI_EXTSWIZZLES[] =
+{
+   "EXTSWIZZLE_X",
+   "EXTSWIZZLE_Y",
+   "EXTSWIZZLE_Z",
+   "EXTSWIZZLE_W",
+   "EXTSWIZZLE_ZERO",
+   "EXTSWIZZLE_ONE"
+};
+
+static const char *TGSI_EXTSWIZZLES_SHORT[] =
+{
+   "x",
+   "y",
+   "z",
+   "w",
+   "0",
+   "1"
+};
+
+static const char *TGSI_WRITEMASKS[] =
+{
+   "0",
+   "WRITEMASK_X",
+   "WRITEMASK_Y",
+   "WRITEMASK_XY",
+   "WRITEMASK_Z",
+   "WRITEMASK_XZ",
+   "WRITEMASK_YZ",
+   "WRITEMASK_XYZ",
+   "WRITEMASK_W",
+   "WRITEMASK_XW",
+   "WRITEMASK_YW",
+   "WRITEMASK_XYW",
+   "WRITEMASK_ZW",
+   "WRITEMASK_XZW",
+   "WRITEMASK_YZW",
+   "WRITEMASK_XYZW"
+};
+
+static const char *TGSI_DST_REGISTER_EXTS[] =
+{
+   "DST_REGISTER_EXT_TYPE_CONDCODE",
+   "DST_REGISTER_EXT_TYPE_MODULATE"
+};
+
+static const char *TGSI_MODULATES[] =
+{
+   "MODULATE_1X",
+   "MODULATE_2X",
+   "MODULATE_4X",
+   "MODULATE_8X",
+   "MODULATE_HALF",
+   "MODULATE_QUARTER",
+   "MODULATE_EIGHTH"
+};
+
+static void
+dump_declaration_short(
+   struct text_dump *dump,
+   struct tgsi_full_declaration *decl )
+{
+   TXT( "\nDCL " );
+   ENM( decl->Declaration.File, TGSI_FILES_SHORT );
+
+   switch( decl->Declaration.Declare ) {
+   case TGSI_DECLARE_RANGE:
+      CHR( '[' );
+      UID( decl->u.DeclarationRange.First );
+      if( decl->u.DeclarationRange.First != decl->u.DeclarationRange.Last ) {
+         TXT( ".." );
+         UID( decl->u.DeclarationRange.Last );
+      }
+      CHR( ']' );
+      break;
+   default:
+      assert( 0 );
+   }
+
+   if( decl->Declaration.UsageMask != TGSI_WRITEMASK_XYZW ) {
+      CHR( '.' );
+      if( decl->Declaration.UsageMask & TGSI_WRITEMASK_X ) {
+         CHR( 'x' );
+      }
+      if( decl->Declaration.UsageMask & TGSI_WRITEMASK_Y ) {
+         CHR( 'y' );
+      }
+      if( decl->Declaration.UsageMask & TGSI_WRITEMASK_Z ) {
+         CHR( 'z' );
+      }
+      if( decl->Declaration.UsageMask & TGSI_WRITEMASK_W ) {
+         CHR( 'w' );
+      }
+   }
+
+   if( decl->Declaration.Interpolate ) {
+      TXT( ", " );
+      ENM( decl->Interpolation.Interpolate, TGSI_INTERPOLATES_SHORT );
+   }
+
+   if( decl->Declaration.Semantic ) {
+      TXT( ", " );
+      ENM( decl->Semantic.SemanticName, TGSI_SEMANTICS_SHORT );
+      CHR( '[' );
+      UID( decl->Semantic.SemanticIndex );
+      CHR( ']' );
+   }
+}
+
+static void
+dump_declaration_verbose(
+   struct text_dump *dump,
+   struct tgsi_full_declaration *decl,
+   unsigned ignored,
+   unsigned deflt,
+   struct tgsi_full_declaration *fd )
+{
+   TXT( "\nFile       : " );
+   ENM( decl->Declaration.File, TGSI_FILES );
+   TXT( "\nDeclare    : " );
+   ENM( decl->Declaration.Declare, TGSI_DECLARES );
+   if( deflt || fd->Declaration.UsageMask != decl->Declaration.UsageMask ) {
+      TXT( "\nUsageMask  : " );
+      if( decl->Declaration.UsageMask & TGSI_WRITEMASK_X ) {
+         CHR( 'X' );
+      }
+      if( decl->Declaration.UsageMask & TGSI_WRITEMASK_Y ) {
+         CHR( 'Y' );
+      }
+      if( decl->Declaration.UsageMask & TGSI_WRITEMASK_Z ) {
+         CHR( 'Z' );
+      }
+      if( decl->Declaration.UsageMask & TGSI_WRITEMASK_W ) {
+         CHR( 'W' );
+      }
+   }
+   if( deflt || fd->Declaration.Interpolate != decl->Declaration.Interpolate ) {
+      TXT( "\nInterpolate: " );
+      UID( decl->Declaration.Interpolate );
+   }
+   if( deflt || fd->Declaration.Semantic != decl->Declaration.Semantic ) {
+      TXT( "\nSemantic   : " );
+      UID( decl->Declaration.Semantic );
+   }
+   if( ignored ) {
+      TXT( "\nPadding    : " );
+      UIX( decl->Declaration.Padding );
+   }
+
+   CHR( '\n' );
+   switch( decl->Declaration.Declare ) {
+   case TGSI_DECLARE_RANGE:
+      TXT( "\nFirst: " );
+      UID( decl->u.DeclarationRange.First );
+      TXT( "\nLast : " );
+      UID( decl->u.DeclarationRange.Last );
+      break;
+
+   case TGSI_DECLARE_MASK:
+      TXT( "\nMask: " );
+      UIX( decl->u.DeclarationMask.Mask );
+      break;
+
+   default:
+      assert( 0 );
+   }
+
+   if( decl->Declaration.Interpolate ) {
+      CHR( '\n' );
+      TXT( "\nInterpolate: " );
+      ENM( decl->Interpolation.Interpolate, TGSI_INTERPOLATES );
+      if( ignored ) {
+         TXT( "\nPadding    : " );
+         UIX( decl->Interpolation.Padding );
+      }
+   }
+
+   if( decl->Declaration.Semantic ) {
+      CHR( '\n' );
+      TXT( "\nSemanticName : " );
+      ENM( decl->Semantic.SemanticName, TGSI_SEMANTICS );
+      TXT( "\nSemanticIndex: " );
+      UID( decl->Semantic.SemanticIndex );
+      if( ignored ) {
+         TXT( "\nPadding      : " );
+         UIX( decl->Semantic.Padding );
+      }
+   }
+}
+
+static void
+dump_immediate_short(
+   struct text_dump *dump,
+   struct tgsi_full_immediate *imm )
+{
+   unsigned i;
+
+   TXT( "\nIMM " );
+   ENM( imm->Immediate.DataType, TGSI_IMMS_SHORT );
+
+   TXT( " { " );
+   for( i = 0; i < imm->Immediate.Size - 1; i++ ) {
+      switch( imm->Immediate.DataType ) {
+      case TGSI_IMM_FLOAT32:
+         FLT( imm->u.ImmediateFloat32[i].Float );
+         break;
+
+      default:
+         assert( 0 );
+      }
+
+      if( i < imm->Immediate.Size - 2 ) {
+         TXT( ", " );
+      }
+   }
+   TXT( " }" );
+}
+
+static void
+dump_immediate_verbose(
+   struct text_dump *dump,
+   struct tgsi_full_immediate *imm,
+   unsigned ignored )
+{
+   unsigned i;
+
+   TXT( "\nDataType   : " );
+   ENM( imm->Immediate.DataType, TGSI_IMMS );
+   if( ignored ) {
+      TXT( "\nPadding    : " );
+      UIX( imm->Immediate.Padding );
+   }
+
+   for( i = 0; i < imm->Immediate.Size - 1; i++ ) {
+      CHR( '\n' );
+      switch( imm->Immediate.DataType ) {
+      case TGSI_IMM_FLOAT32:
+         TXT( "\nFloat: " );
+         FLT( imm->u.ImmediateFloat32[i].Float );
+         break;
+
+      default:
+         assert( 0 );
+      }
+   }
+}
+
+static void
+dump_instruction_short(
+   struct text_dump *dump,
+   struct tgsi_full_instruction *inst,
+   unsigned instno )
+{
+   unsigned i;
+   boolean first_reg = TRUE;
+
+   CHR( '\n' );
+   UID( instno );
+   CHR( ':' );
+   ENM( inst->Instruction.Opcode, TGSI_OPCODES_SHORT );
+
+   switch( inst->Instruction.Saturate ) {
+   case TGSI_SAT_NONE:
+      break;
+   case TGSI_SAT_ZERO_ONE:
+      TXT( "_SAT" );
+      break;
+   case TGSI_SAT_MINUS_PLUS_ONE:
+      TXT( "_SAT[-1,1]" );
+      break;
+   default:
+      assert( 0 );
+   }
+
+   for( i = 0; i < inst->Instruction.NumDstRegs; i++ ) {
+      struct tgsi_full_dst_register *dst = &inst->FullDstRegisters[i];
+
+      if( !first_reg ) {
+         CHR( ',' );
+      }
+      CHR( ' ' );
+
+      ENM( dst->DstRegister.File, TGSI_FILES_SHORT );
+
+      CHR( '[' );
+      SID( dst->DstRegister.Index );
+      CHR( ']' );
+
+      if( dst->DstRegister.WriteMask != TGSI_WRITEMASK_XYZW ) {
+         CHR( '.' );
+         if( dst->DstRegister.WriteMask & TGSI_WRITEMASK_X ) {
+            CHR( 'x' );
+         }
+         if( dst->DstRegister.WriteMask & TGSI_WRITEMASK_Y ) {
+            CHR( 'y' );
+         }
+         if( dst->DstRegister.WriteMask & TGSI_WRITEMASK_Z ) {
+            CHR( 'z' );
+         }
+         if( dst->DstRegister.WriteMask & TGSI_WRITEMASK_W ) {
+            CHR( 'w' );
+         }
+      }
+
+      first_reg = FALSE;
+   }
+
+   for( i = 0; i < inst->Instruction.NumSrcRegs; i++ ) {
+      struct tgsi_full_src_register *src = &inst->FullSrcRegisters[i];
+
+      if( !first_reg ) {
+         CHR( ',' );
+      }
+      CHR( ' ' );
+
+      if( src->SrcRegisterExtMod.Negate  ) {
+         CHR( '-' );
+      }
+      if( src->SrcRegisterExtMod.Absolute ) {
+         CHR( '|' );
+      }
+      if( src->SrcRegister.Negate ) {
+         CHR( '-' );
+      }
+
+      ENM( src->SrcRegister.File, TGSI_FILES_SHORT );
+
+      CHR( '[' );
+      SID( src->SrcRegister.Index );
+      CHR( ']' );
+
+      if (src->SrcRegister.Extended) {
+         if (src->SrcRegisterExtSwz.ExtSwizzleX != TGSI_EXTSWIZZLE_X ||
+             src->SrcRegisterExtSwz.ExtSwizzleY != TGSI_EXTSWIZZLE_Y ||
+             src->SrcRegisterExtSwz.ExtSwizzleZ != TGSI_EXTSWIZZLE_Z ||
+             src->SrcRegisterExtSwz.ExtSwizzleW != TGSI_EXTSWIZZLE_W) {
+            CHR( '.' );
+            ENM( src->SrcRegisterExtSwz.ExtSwizzleX, TGSI_EXTSWIZZLES_SHORT );
+            ENM( src->SrcRegisterExtSwz.ExtSwizzleY, TGSI_EXTSWIZZLES_SHORT );
+            ENM( src->SrcRegisterExtSwz.ExtSwizzleZ, TGSI_EXTSWIZZLES_SHORT );
+            ENM( src->SrcRegisterExtSwz.ExtSwizzleW, TGSI_EXTSWIZZLES_SHORT );
+         }
+      }
+      else if( src->SrcRegister.SwizzleX != TGSI_SWIZZLE_X ||
+               src->SrcRegister.SwizzleY != TGSI_SWIZZLE_Y ||
+               src->SrcRegister.SwizzleZ != TGSI_SWIZZLE_Z ||
+               src->SrcRegister.SwizzleW != TGSI_SWIZZLE_W ) {
+         CHR( '.' );
+         ENM( src->SrcRegister.SwizzleX, TGSI_SWIZZLES_SHORT );
+         ENM( src->SrcRegister.SwizzleY, TGSI_SWIZZLES_SHORT );
+         ENM( src->SrcRegister.SwizzleZ, TGSI_SWIZZLES_SHORT );
+         ENM( src->SrcRegister.SwizzleW, TGSI_SWIZZLES_SHORT );
+      }
+
+      if( src->SrcRegisterExtMod.Absolute ) {
+         CHR( '|' );
+      }
+
+      first_reg = FALSE;
+   }
+
+   switch( inst->Instruction.Opcode ) {
+   case TGSI_OPCODE_IF:
+   case TGSI_OPCODE_ELSE:
+   case TGSI_OPCODE_BGNLOOP2:
+   case TGSI_OPCODE_ENDLOOP2:
+   case TGSI_OPCODE_CAL:
+      TXT( " :" );
+      UID( inst->InstructionExtLabel.Label );
+      break;
+   }
+}
+
+static void
+dump_instruction_verbose(
+   struct text_dump *dump,
+   struct tgsi_full_instruction *inst,
+   unsigned ignored,
+   unsigned deflt,
+   struct tgsi_full_instruction *fi )
+{
+   unsigned i;
+
+   TXT( "\nOpcode     : " );
+   ENM( inst->Instruction.Opcode, TGSI_OPCODES );
+   if( deflt || fi->Instruction.Saturate != inst->Instruction.Saturate ) {
+      TXT( "\nSaturate   : " );
+      ENM( inst->Instruction.Saturate, TGSI_SATS );
+   }
+   if( deflt || fi->Instruction.NumDstRegs != inst->Instruction.NumDstRegs ) {
+      TXT( "\nNumDstRegs : " );
+      UID( inst->Instruction.NumDstRegs );
+   }
+   if( deflt || fi->Instruction.NumSrcRegs != inst->Instruction.NumSrcRegs ) {
+      TXT( "\nNumSrcRegs : " );
+      UID( inst->Instruction.NumSrcRegs );
+   }
+   if( ignored ) {
+      TXT( "\nPadding    : " );
+      UIX( inst->Instruction.Padding );
+   }
+
+   if( deflt || tgsi_compare_instruction_ext_nv( inst->InstructionExtNv, fi->InstructionExtNv ) ) {
+      CHR( '\n' );
+      TXT( "\nType          : " );
+      ENM( inst->InstructionExtNv.Type, TGSI_INSTRUCTION_EXTS );
+      if( deflt || fi->InstructionExtNv.Precision != inst->InstructionExtNv.Precision ) {
+         TXT( "\nPrecision     : " );
+         ENM( inst->InstructionExtNv.Precision, TGSI_PRECISIONS );
+      }
+      if( deflt || fi->InstructionExtNv.CondDstIndex != inst->InstructionExtNv.CondDstIndex ) {
+         TXT( "\nCondDstIndex  : " );
+         UID( inst->InstructionExtNv.CondDstIndex );
+      }
+      if( deflt || fi->InstructionExtNv.CondFlowIndex != inst->InstructionExtNv.CondFlowIndex ) {
+         TXT( "\nCondFlowIndex : " );
+         UID( inst->InstructionExtNv.CondFlowIndex );
+      }
+      if( deflt || fi->InstructionExtNv.CondMask != inst->InstructionExtNv.CondMask ) {
+         TXT( "\nCondMask      : " );
+         ENM( inst->InstructionExtNv.CondMask, TGSI_CCS );
+      }
+      if( deflt || fi->InstructionExtNv.CondSwizzleX != inst->InstructionExtNv.CondSwizzleX ) {
+         TXT( "\nCondSwizzleX  : " );
+         ENM( inst->InstructionExtNv.CondSwizzleX, TGSI_SWIZZLES );
+      }
+      if( deflt || fi->InstructionExtNv.CondSwizzleY != inst->InstructionExtNv.CondSwizzleY ) {
+         TXT( "\nCondSwizzleY  : " );
+         ENM( inst->InstructionExtNv.CondSwizzleY, TGSI_SWIZZLES );
+      }
+      if( deflt || fi->InstructionExtNv.CondSwizzleZ != inst->InstructionExtNv.CondSwizzleZ ) {
+         TXT( "\nCondSwizzleZ  : " );
+         ENM( inst->InstructionExtNv.CondSwizzleZ, TGSI_SWIZZLES );
+      }
+      if( deflt || fi->InstructionExtNv.CondSwizzleW != inst->InstructionExtNv.CondSwizzleW ) {
+         TXT( "\nCondSwizzleW  : " );
+         ENM( inst->InstructionExtNv.CondSwizzleW, TGSI_SWIZZLES );
+      }
+      if( deflt || fi->InstructionExtNv.CondDstUpdate != inst->InstructionExtNv.CondDstUpdate ) {
+         TXT( "\nCondDstUpdate : " );
+         UID( inst->InstructionExtNv.CondDstUpdate );
+      }
+      if( deflt || fi->InstructionExtNv.CondFlowEnable != inst->InstructionExtNv.CondFlowEnable ) {
+         TXT( "\nCondFlowEnable: " );
+         UID( inst->InstructionExtNv.CondFlowEnable );
+      }
+      if( ignored ) {
+         TXT( "\nPadding       : " );
+         UIX( inst->InstructionExtNv.Padding );
+         if( deflt || fi->InstructionExtNv.Extended != inst->InstructionExtNv.Extended ) {
+            TXT( "\nExtended      : " );
+            UID( inst->InstructionExtNv.Extended );
+         }
+      }
+   }
+
+   if( deflt || tgsi_compare_instruction_ext_label( inst->InstructionExtLabel, fi->InstructionExtLabel ) ) {
+      CHR( '\n' );
+      TXT( "\nType    : " );
+      ENM( inst->InstructionExtLabel.Type, TGSI_INSTRUCTION_EXTS );
+      if( deflt || fi->InstructionExtLabel.Label != inst->InstructionExtLabel.Label ) {
+         TXT( "\nLabel   : " );
+         UID( inst->InstructionExtLabel.Label );
+      }
+      if( ignored ) {
+         TXT( "\nPadding : " );
+         UIX( inst->InstructionExtLabel.Padding );
+         if( deflt || fi->InstructionExtLabel.Extended != inst->InstructionExtLabel.Extended ) {
+            TXT( "\nExtended: " );
+            UID( inst->InstructionExtLabel.Extended );
+         }
+      }
+   }
+
+   if( deflt || tgsi_compare_instruction_ext_texture( inst->InstructionExtTexture, fi->InstructionExtTexture ) ) {
+      CHR( '\n' );
+      TXT( "\nType    : " );
+      ENM( inst->InstructionExtTexture.Type, TGSI_INSTRUCTION_EXTS );
+      if( deflt || fi->InstructionExtTexture.Texture != inst->InstructionExtTexture.Texture ) {
+         TXT( "\nTexture : " );
+         ENM( inst->InstructionExtTexture.Texture, TGSI_TEXTURES );
+      }
+      if( ignored ) {
+         TXT( "\nPadding : " );
+         UIX( inst->InstructionExtTexture.Padding );
+         if( deflt || fi->InstructionExtTexture.Extended != inst->InstructionExtTexture.Extended ) {
+            TXT( "\nExtended: " );
+            UID( inst->InstructionExtTexture.Extended );
+         }
+      }
+   }
+
+   for( i = 0; i < inst->Instruction.NumDstRegs; i++ ) {
+      struct tgsi_full_dst_register *dst = &inst->FullDstRegisters[i];
+      struct tgsi_full_dst_register *fd = &fi->FullDstRegisters[i];
+
+      CHR( '\n' );
+      TXT( "\nFile     : " );
+      ENM( dst->DstRegister.File, TGSI_FILES );
+      if( deflt || fd->DstRegister.WriteMask != dst->DstRegister.WriteMask ) {
+         TXT( "\nWriteMask: " );
+         ENM( dst->DstRegister.WriteMask, TGSI_WRITEMASKS );
+      }
+      if( ignored ) {
+         if( deflt || fd->DstRegister.Indirect != dst->DstRegister.Indirect ) {
+            TXT( "\nIndirect : " );
+            UID( dst->DstRegister.Indirect );
+         }
+         if( deflt || fd->DstRegister.Dimension != dst->DstRegister.Dimension ) {
+            TXT( "\nDimension: " );
+            UID( dst->DstRegister.Dimension );
+         }
+      }
+      if( deflt || fd->DstRegister.Index != dst->DstRegister.Index ) {
+         TXT( "\nIndex    : " );
+         SID( dst->DstRegister.Index );
+      }
+      if( ignored ) {
+         TXT( "\nPadding  : " );
+         UIX( dst->DstRegister.Padding );
+         if( deflt || fd->DstRegister.Extended != dst->DstRegister.Extended ) {
+            TXT( "\nExtended : " );
+            UID( dst->DstRegister.Extended );
+         }
+      }
+
+      if( deflt || tgsi_compare_dst_register_ext_concode( dst->DstRegisterExtConcode, fd->DstRegisterExtConcode ) ) {
+         CHR( '\n' );
+         TXT( "\nType        : " );
+         ENM( dst->DstRegisterExtConcode.Type, TGSI_DST_REGISTER_EXTS );
+         if( deflt || fd->DstRegisterExtConcode.CondMask != dst->DstRegisterExtConcode.CondMask ) {
+            TXT( "\nCondMask    : " );
+            ENM( dst->DstRegisterExtConcode.CondMask, TGSI_CCS );
+         }
+         if( deflt || fd->DstRegisterExtConcode.CondSwizzleX != dst->DstRegisterExtConcode.CondSwizzleX ) {
+            TXT( "\nCondSwizzleX: " );
+            ENM( dst->DstRegisterExtConcode.CondSwizzleX, TGSI_SWIZZLES );
+         }
+         if( deflt || fd->DstRegisterExtConcode.CondSwizzleY != dst->DstRegisterExtConcode.CondSwizzleY ) {
+            TXT( "\nCondSwizzleY: " );
+            ENM( dst->DstRegisterExtConcode.CondSwizzleY, TGSI_SWIZZLES );
+         }
+         if( deflt || fd->DstRegisterExtConcode.CondSwizzleZ != dst->DstRegisterExtConcode.CondSwizzleZ ) {
+            TXT( "\nCondSwizzleZ: " );
+            ENM( dst->DstRegisterExtConcode.CondSwizzleZ, TGSI_SWIZZLES );
+         }
+         if( deflt || fd->DstRegisterExtConcode.CondSwizzleW != dst->DstRegisterExtConcode.CondSwizzleW ) {
+            TXT( "\nCondSwizzleW: " );
+            ENM( dst->DstRegisterExtConcode.CondSwizzleW, TGSI_SWIZZLES );
+         }
+         if( deflt || fd->DstRegisterExtConcode.CondSrcIndex != dst->DstRegisterExtConcode.CondSrcIndex ) {
+            TXT( "\nCondSrcIndex: " );
+            UID( dst->DstRegisterExtConcode.CondSrcIndex );
+         }
+         if( ignored ) {
+            TXT( "\nPadding     : " );
+            UIX( dst->DstRegisterExtConcode.Padding );
+            if( deflt || fd->DstRegisterExtConcode.Extended != dst->DstRegisterExtConcode.Extended ) {
+               TXT( "\nExtended    : " );
+               UID( dst->DstRegisterExtConcode.Extended );
+            }
+         }
+      }
+
+      if( deflt || tgsi_compare_dst_register_ext_modulate( dst->DstRegisterExtModulate, fd->DstRegisterExtModulate ) ) {
+         CHR( '\n' );
+         TXT( "\nType    : " );
+         ENM( dst->DstRegisterExtModulate.Type, TGSI_DST_REGISTER_EXTS );
+         if( deflt || fd->DstRegisterExtModulate.Modulate != dst->DstRegisterExtModulate.Modulate ) {
+            TXT( "\nModulate: " );
+            ENM( dst->DstRegisterExtModulate.Modulate, TGSI_MODULATES );
+         }
+         if( ignored ) {
+            TXT( "\nPadding : " );
+            UIX( dst->DstRegisterExtModulate.Padding );
+            if( deflt || fd->DstRegisterExtModulate.Extended != dst->DstRegisterExtModulate.Extended ) {
+               TXT( "\nExtended: " );
+               UID( dst->DstRegisterExtModulate.Extended );
+            }
+         }
+      }
+   }
+
+   for( i = 0; i < inst->Instruction.NumSrcRegs; i++ ) {
+      struct tgsi_full_src_register *src = &inst->FullSrcRegisters[i];
+      struct tgsi_full_src_register *fs = &fi->FullSrcRegisters[i];
+
+      CHR( '\n' );
+      TXT( "\nFile     : ");
+      ENM( src->SrcRegister.File, TGSI_FILES );
+      if( deflt || fs->SrcRegister.SwizzleX != src->SrcRegister.SwizzleX ) {
+         TXT( "\nSwizzleX : " );
+         ENM( src->SrcRegister.SwizzleX, TGSI_SWIZZLES );
+      }
+      if( deflt || fs->SrcRegister.SwizzleY != src->SrcRegister.SwizzleY ) {
+         TXT( "\nSwizzleY : " );
+         ENM( src->SrcRegister.SwizzleY, TGSI_SWIZZLES );
+      }
+      if( deflt || fs->SrcRegister.SwizzleZ != src->SrcRegister.SwizzleZ ) {
+         TXT( "\nSwizzleZ : " );
+         ENM( src->SrcRegister.SwizzleZ, TGSI_SWIZZLES );
+      }
+      if( deflt || fs->SrcRegister.SwizzleW != src->SrcRegister.SwizzleW ) {
+         TXT( "\nSwizzleW : " );
+         ENM( src->SrcRegister.SwizzleW, TGSI_SWIZZLES );
+      }
+      if( deflt || fs->SrcRegister.Negate != src->SrcRegister.Negate ) {
+         TXT( "\nNegate   : " );
+         UID( src->SrcRegister.Negate );
+      }
+      if( ignored ) {
+         if( deflt || fs->SrcRegister.Indirect != src->SrcRegister.Indirect ) {
+            TXT( "\nIndirect : " );
+            UID( src->SrcRegister.Indirect );
+         }
+         if( deflt || fs->SrcRegister.Dimension != src->SrcRegister.Dimension ) {
+            TXT( "\nDimension: " );
+            UID( src->SrcRegister.Dimension );
+         }
+      }
+      if( deflt || fs->SrcRegister.Index != src->SrcRegister.Index ) {
+         TXT( "\nIndex    : " );
+         SID( src->SrcRegister.Index );
+      }
+      if( ignored ) {
+         if( deflt || fs->SrcRegister.Extended != src->SrcRegister.Extended ) {
+            TXT( "\nExtended : " );
+            UID( src->SrcRegister.Extended );
+         }
+      }
+
+      if( deflt || tgsi_compare_src_register_ext_swz( src->SrcRegisterExtSwz, fs->SrcRegisterExtSwz ) ) {
+         CHR( '\n' );
+         TXT( "\nType       : " );
+         ENM( src->SrcRegisterExtSwz.Type, TGSI_SRC_REGISTER_EXTS );
+         if( deflt || fs->SrcRegisterExtSwz.ExtSwizzleX != src->SrcRegisterExtSwz.ExtSwizzleX ) {
+            TXT( "\nExtSwizzleX: " );
+            ENM( src->SrcRegisterExtSwz.ExtSwizzleX, TGSI_EXTSWIZZLES );
+         }
+         if( deflt || fs->SrcRegisterExtSwz.ExtSwizzleY != src->SrcRegisterExtSwz.ExtSwizzleY ) {
+            TXT( "\nExtSwizzleY: " );
+            ENM( src->SrcRegisterExtSwz.ExtSwizzleY, TGSI_EXTSWIZZLES );
+         }
+         if( deflt || fs->SrcRegisterExtSwz.ExtSwizzleZ != src->SrcRegisterExtSwz.ExtSwizzleZ ) {
+            TXT( "\nExtSwizzleZ: " );
+            ENM( src->SrcRegisterExtSwz.ExtSwizzleZ, TGSI_EXTSWIZZLES );
+         }
+         if( deflt || fs->SrcRegisterExtSwz.ExtSwizzleW != src->SrcRegisterExtSwz.ExtSwizzleW ) {
+            TXT( "\nExtSwizzleW: " );
+            ENM( src->SrcRegisterExtSwz.ExtSwizzleW, TGSI_EXTSWIZZLES );
+         }
+         if( deflt || fs->SrcRegisterExtSwz.NegateX != src->SrcRegisterExtSwz.NegateX ) {
+            TXT( "\nNegateX   : " );
+            UID( src->SrcRegisterExtSwz.NegateX );
+         }
+         if( deflt || fs->SrcRegisterExtSwz.NegateY != src->SrcRegisterExtSwz.NegateY ) {
+            TXT( "\nNegateY   : " );
+            UID( src->SrcRegisterExtSwz.NegateY );
+         }
+         if( deflt || fs->SrcRegisterExtSwz.NegateZ != src->SrcRegisterExtSwz.NegateZ ) {
+            TXT( "\nNegateZ   : " );
+            UID( src->SrcRegisterExtSwz.NegateZ );
+         }
+         if( deflt || fs->SrcRegisterExtSwz.NegateW != src->SrcRegisterExtSwz.NegateW ) {
+            TXT( "\nNegateW   : " );
+            UID( src->SrcRegisterExtSwz.NegateW );
+         }
+         if( deflt || fs->SrcRegisterExtSwz.ExtDivide != src->SrcRegisterExtSwz.ExtDivide ) {
+            TXT( "\nExtDivide  : " );
+            ENM( src->SrcRegisterExtSwz.ExtDivide, TGSI_EXTSWIZZLES );
+         }
+         if( ignored ) {
+            TXT( "\nPadding   : " );
+            UIX( src->SrcRegisterExtSwz.Padding );
+            if( deflt || fs->SrcRegisterExtSwz.Extended != src->SrcRegisterExtSwz.Extended ) {
+               TXT( "\nExtended   : " );
+               UID( src->SrcRegisterExtSwz.Extended );
+            }
+         }
+      }
+
+      if( deflt || tgsi_compare_src_register_ext_mod( src->SrcRegisterExtMod, fs->SrcRegisterExtMod ) ) {
+         CHR( '\n' );
+         TXT( "\nType     : " );
+         ENM( src->SrcRegisterExtMod.Type, TGSI_SRC_REGISTER_EXTS );
+         if( deflt || fs->SrcRegisterExtMod.Complement != src->SrcRegisterExtMod.Complement ) {
+            TXT( "\nComplement: " );
+            UID( src->SrcRegisterExtMod.Complement );
+         }
+         if( deflt || fs->SrcRegisterExtMod.Bias != src->SrcRegisterExtMod.Bias ) {
+            TXT( "\nBias     : " );
+            UID( src->SrcRegisterExtMod.Bias );
+         }
+         if( deflt || fs->SrcRegisterExtMod.Scale2X != src->SrcRegisterExtMod.Scale2X ) {
+            TXT( "\nScale2X   : " );
+            UID( src->SrcRegisterExtMod.Scale2X );
+         }
+         if( deflt || fs->SrcRegisterExtMod.Absolute != src->SrcRegisterExtMod.Absolute ) {
+            TXT( "\nAbsolute  : " );
+            UID( src->SrcRegisterExtMod.Absolute );
+         }
+         if( deflt || fs->SrcRegisterExtMod.Negate != src->SrcRegisterExtMod.Negate ) {
+            TXT( "\nNegate   : " );
+            UID( src->SrcRegisterExtMod.Negate );
+         }
+         if( ignored ) {
+            TXT( "\nPadding   : " );
+            UIX( src->SrcRegisterExtMod.Padding );
+            if( deflt || fs->SrcRegisterExtMod.Extended != src->SrcRegisterExtMod.Extended ) {
+               TXT( "\nExtended  : " );
+               UID( src->SrcRegisterExtMod.Extended );
+            }
+         }
+      }
+   }
+}
+
+void
+tgsi_dump(
+   const struct tgsi_token *tokens,
+   unsigned flags )
+{
+   struct text_dump _dump;
+   struct text_dump *dump = &_dump;
+   struct tgsi_parse_context parse;
+   struct tgsi_full_instruction fi;
+   struct tgsi_full_declaration fd;
+   unsigned verbose = flags & TGSI_DUMP_VERBOSE;
+   unsigned ignored = !(flags & TGSI_DUMP_NO_IGNORED);
+   unsigned deflt = !(flags & TGSI_DUMP_NO_DEFAULT);
+   unsigned instno = 0;
+
+   {
+#if 0
+      static unsigned counter = 0;
+      char buffer[64];
+
+      sprintf( buffer, "tgsi-dump-%.4u.txt", counter++ );
+      dump->file = fopen( buffer, "wt" );
+#else
+      dump->file = stderr;
+#endif
+      dump->tabs = 0;
+   }
+
+   /* sanity check */
+   assert(strcmp(TGSI_OPCODES[TGSI_OPCODE_CONT], "OPCODE_CONT") == 0);
+
+   tgsi_parse_init( &parse, tokens );
+
+   TXT( "tgsi-dump begin -----------------" );
+
+   CHR( '\n' );
+   ENM( parse.FullHeader.Processor.Processor, TGSI_PROCESSOR_TYPES_SHORT );
+   CHR( ' ' );
+   UID( parse.FullVersion.Version.MajorVersion );
+   CHR( '.' );
+   UID( parse.FullVersion.Version.MinorVersion );
+
+   if( verbose ) {
+      TXT( "\nMajorVersion: " );
+      UID( parse.FullVersion.Version.MajorVersion );
+      TXT( "\nMinorVersion: " );
+      UID( parse.FullVersion.Version.MinorVersion );
+      CHR( '\n' );
+
+      TXT( "\nHeaderSize: " );
+      UID( parse.FullHeader.Header.HeaderSize );
+      TXT( "\nBodySize  : " );
+      UID( parse.FullHeader.Header.BodySize );
+      TXT( "\nProcessor : " );
+      ENM( parse.FullHeader.Processor.Processor, TGSI_PROCESSOR_TYPES );
+      CHR( '\n' );
+   }
+
+   fi = tgsi_default_full_instruction();
+   fd = tgsi_default_full_declaration();
+
+   while( !tgsi_parse_end_of_tokens( &parse ) ) {
+      tgsi_parse_token( &parse );
+
+      switch( parse.FullToken.Token.Type ) {
+      case TGSI_TOKEN_TYPE_DECLARATION:
+         dump_declaration_short(
+            dump,
+            &parse.FullToken.FullDeclaration );
+         break;
+
+      case TGSI_TOKEN_TYPE_IMMEDIATE:
+         dump_immediate_short(
+            dump,
+            &parse.FullToken.FullImmediate );
+         break;
+
+      case TGSI_TOKEN_TYPE_INSTRUCTION:
+         dump_instruction_short(
+            dump,
+            &parse.FullToken.FullInstruction,
+            instno );
+         instno++;
+         break;
+
+      default:
+         assert( 0 );
+      }
+
+      if( verbose ) {
+         TXT( "\nType       : " );
+         ENM( parse.FullToken.Token.Type, TGSI_TOKEN_TYPES );
+         if( ignored ) {
+            TXT( "\nSize       : " );
+            UID( parse.FullToken.Token.Size );
+            if( deflt || parse.FullToken.Token.Extended ) {
+               TXT( "\nExtended   : " );
+               UID( parse.FullToken.Token.Extended );
+            }
+         }
+
+         switch( parse.FullToken.Token.Type ) {
+         case TGSI_TOKEN_TYPE_DECLARATION:
+            dump_declaration_verbose(
+               dump,
+               &parse.FullToken.FullDeclaration,
+               ignored,
+               deflt,
+               &fd );
+            break;
+
+         case TGSI_TOKEN_TYPE_IMMEDIATE:
+            dump_immediate_verbose(
+               dump,
+               &parse.FullToken.FullImmediate,
+               ignored );
+            break;
+
+         case TGSI_TOKEN_TYPE_INSTRUCTION:
+            dump_instruction_verbose(
+               dump,
+               &parse.FullToken.FullInstruction,
+               ignored,
+               deflt,
+               &fi );
+            break;
+
+         default:
+            assert( 0 );
+         }
+
+         CHR( '\n' );
+      }
+   }
+
+   TXT( "\ntgsi-dump end -------------------\n" );
+
+   tgsi_parse_free( &parse );
+}
+
diff --git a/src/mesa/pipe/tgsi/util/tgsi_dump.h b/src/mesa/pipe/tgsi/util/tgsi_dump.h
new file mode 100644 (file)
index 0000000..70860c0
--- /dev/null
@@ -0,0 +1,22 @@
+#if !defined TGSI_DUMP_H
+#define TGSI_DUMP_H
+
+#if defined __cplusplus
+extern "C" {
+#endif // defined __cplusplus
+
+#define TGSI_DUMP_VERBOSE       1
+#define TGSI_DUMP_NO_IGNORED    2
+#define TGSI_DUMP_NO_DEFAULT    4
+
+void
+tgsi_dump(
+   const struct tgsi_token *tokens,
+   unsigned flags );
+
+#if defined __cplusplus
+} // extern "C"
+#endif // defined __cplusplus
+
+#endif // !defined TGSI_DUMP_H
+
diff --git a/src/mesa/pipe/tgsi/util/tgsi_parse.c b/src/mesa/pipe/tgsi/util/tgsi_parse.c
new file mode 100644 (file)
index 0000000..f0f8d44
--- /dev/null
@@ -0,0 +1,318 @@
+/**************************************************************************
+ * 
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+#include "pipe/p_util.h"
+#include "pipe/p_shader_tokens.h"
+#include "tgsi_parse.h"
+#include "tgsi_build.h"
+
+void
+tgsi_full_token_init(
+   union tgsi_full_token *full_token )
+{
+   full_token->Token.Type = TGSI_TOKEN_TYPE_DECLARATION;
+}
+
+void
+tgsi_full_token_free(
+   union tgsi_full_token *full_token )
+{
+   if( full_token->Token.Type == TGSI_TOKEN_TYPE_IMMEDIATE ) {
+      FREE( full_token->FullImmediate.u.Pointer );
+   }
+}
+
+unsigned
+tgsi_parse_init(
+   struct tgsi_parse_context *ctx,
+   const struct tgsi_token *tokens )
+{
+   ctx->FullVersion.Version = *(struct tgsi_version *) &tokens[0];
+   if( ctx->FullVersion.Version.MajorVersion > 1 ) {
+      return TGSI_PARSE_ERROR;
+   }
+
+   ctx->FullHeader.Header = *(struct tgsi_header *) &tokens[1];
+   if( ctx->FullHeader.Header.HeaderSize >= 2 ) {
+      ctx->FullHeader.Processor = *(struct tgsi_processor *) &tokens[2];
+   }
+   else {
+      ctx->FullHeader.Processor = tgsi_default_processor();
+   }
+
+   ctx->Tokens = tokens;
+   ctx->Position = 1 + ctx->FullHeader.Header.HeaderSize;
+
+   tgsi_full_token_init( &ctx->FullToken );
+
+   return TGSI_PARSE_OK;
+}
+
+void
+tgsi_parse_free(
+   struct tgsi_parse_context *ctx )
+{
+   tgsi_full_token_free( &ctx->FullToken );
+}
+
+boolean
+tgsi_parse_end_of_tokens(
+   struct tgsi_parse_context *ctx )
+{
+   return ctx->Position >=
+      1 + ctx->FullHeader.Header.HeaderSize + ctx->FullHeader.Header.BodySize;
+}
+
+static void
+next_token(
+   struct tgsi_parse_context *ctx,
+   void *token )
+{
+   assert( !tgsi_parse_end_of_tokens( ctx ) );
+
+   *(struct tgsi_token *) token = ctx->Tokens[ctx->Position++];
+}
+
+void
+tgsi_parse_token(
+   struct tgsi_parse_context *ctx )
+{
+   struct tgsi_token token;
+   unsigned i;
+
+   tgsi_full_token_free( &ctx->FullToken );
+   tgsi_full_token_init( &ctx->FullToken );
+
+   next_token( ctx, &token );
+
+   switch( token.Type ) {
+   case TGSI_TOKEN_TYPE_DECLARATION:
+   {
+      struct tgsi_full_declaration *decl = &ctx->FullToken.FullDeclaration;
+
+      *decl = tgsi_default_full_declaration();
+      decl->Declaration = *(struct tgsi_declaration *) &token;
+
+      switch( decl->Declaration.Type ) {
+      case TGSI_DECLARE_RANGE:
+         next_token( ctx, &decl->u.DeclarationRange );
+         break;
+
+      case TGSI_DECLARE_MASK:
+         next_token( ctx, &decl->u.DeclarationMask );
+         break;
+
+      default:
+         assert (0);
+      }
+
+      if( decl->Declaration.Interpolate ) {
+         next_token( ctx, &decl->Interpolation );
+      }
+
+      if( decl->Declaration.Semantic ) {
+         next_token( ctx, &decl->Semantic );
+      }
+
+      break;
+   }
+
+   case TGSI_TOKEN_TYPE_IMMEDIATE:
+   {
+      struct tgsi_full_immediate *imm = &ctx->FullToken.FullImmediate;
+
+      *imm = tgsi_default_full_immediate();
+      imm->Immediate = *(struct tgsi_immediate *) &token;
+
+      assert( !imm->Immediate.Extended );
+
+      switch (imm->Immediate.DataType) {
+      case TGSI_IMM_FLOAT32:
+         imm->u.Pointer = MALLOC(
+            sizeof( struct tgsi_immediate_float32 ) * (imm->Immediate.Size - 1) );
+         for( i = 0; i < imm->Immediate.Size - 1; i++ ) {
+            next_token( ctx, &imm->u.ImmediateFloat32[i] );
+         }
+         break;
+
+      default:
+         assert( 0 );
+      }
+
+      break;
+   }
+
+   case TGSI_TOKEN_TYPE_INSTRUCTION:
+   {
+      struct tgsi_full_instruction *inst = &ctx->FullToken.FullInstruction;
+      unsigned extended;
+
+      *inst = tgsi_default_full_instruction();
+      inst->Instruction = *(struct tgsi_instruction *) &token;
+
+      extended = inst->Instruction.Extended;
+
+      while( extended ) {
+         struct tgsi_src_register_ext token;
+
+         next_token( ctx, &token );
+
+         switch( token.Type ) {
+         case TGSI_INSTRUCTION_EXT_TYPE_NV:
+            inst->InstructionExtNv =
+               *(struct tgsi_instruction_ext_nv *) &token;
+            break;
+
+         case TGSI_INSTRUCTION_EXT_TYPE_LABEL:
+            inst->InstructionExtLabel =
+               *(struct tgsi_instruction_ext_label *) &token;
+            break;
+
+         case TGSI_INSTRUCTION_EXT_TYPE_TEXTURE:
+            inst->InstructionExtTexture =
+               *(struct tgsi_instruction_ext_texture *) &token;
+            break;
+
+         default:
+            assert( 0 );
+         }
+
+         extended = token.Extended;
+      }
+
+      assert( inst->Instruction.NumDstRegs <= TGSI_FULL_MAX_DST_REGISTERS );
+
+      for(  i = 0; i < inst->Instruction.NumDstRegs; i++ ) {
+         unsigned extended;
+
+         next_token( ctx, &inst->FullDstRegisters[i].DstRegister );
+
+         /*
+          * No support for indirect or multi-dimensional addressing.
+          */
+         assert( !inst->FullDstRegisters[i].DstRegister.Indirect );
+         assert( !inst->FullDstRegisters[i].DstRegister.Dimension );
+
+         extended = inst->FullDstRegisters[i].DstRegister.Extended;
+
+         while( extended ) {
+            struct tgsi_src_register_ext token;
+
+            next_token( ctx, &token );
+
+            switch( token.Type ) {
+            case TGSI_DST_REGISTER_EXT_TYPE_CONDCODE:
+               inst->FullDstRegisters[i].DstRegisterExtConcode =
+                  *(struct tgsi_dst_register_ext_concode *) &token;
+               break;
+
+            case TGSI_DST_REGISTER_EXT_TYPE_MODULATE:
+               inst->FullDstRegisters[i].DstRegisterExtModulate =
+                  *(struct tgsi_dst_register_ext_modulate *) &token;
+               break;
+
+            default:
+               assert( 0 );
+            }
+
+            extended = token.Extended;
+         }
+      }
+
+      assert( inst->Instruction.NumSrcRegs <= TGSI_FULL_MAX_SRC_REGISTERS );
+
+      for( i = 0; i < inst->Instruction.NumSrcRegs; i++ ) {
+         unsigned extended;
+
+         next_token( ctx, &inst->FullSrcRegisters[i].SrcRegister );
+
+         extended = inst->FullSrcRegisters[i].SrcRegister.Extended;
+
+         while( extended ) {
+            struct tgsi_src_register_ext token;
+
+            next_token( ctx, &token );
+
+            switch( token.Type ) {
+            case TGSI_SRC_REGISTER_EXT_TYPE_SWZ:
+               inst->FullSrcRegisters[i].SrcRegisterExtSwz =
+                  *(struct tgsi_src_register_ext_swz *) &token;
+               break;
+
+            case TGSI_SRC_REGISTER_EXT_TYPE_MOD:
+               inst->FullSrcRegisters[i].SrcRegisterExtMod =
+                  *(struct tgsi_src_register_ext_mod *) &token;
+               break;
+
+            default:
+               assert( 0 );
+            }
+
+            extended = token.Extended;
+         }
+
+         if( inst->FullSrcRegisters[i].SrcRegister.Indirect ) {
+            next_token( ctx, &inst->FullSrcRegisters[i].SrcRegisterInd );
+
+            /*
+             * No support for indirect or multi-dimensional addressing.
+             */
+            assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Indirect );
+            assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Dimension );
+            assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Extended );
+         }
+
+         if( inst->FullSrcRegisters[i].SrcRegister.Dimension ) {
+            next_token( ctx, &inst->FullSrcRegisters[i].SrcRegisterDim );
+
+            /*
+             * No support for multi-dimensional addressing.
+             */
+            assert( !inst->FullSrcRegisters[i].SrcRegisterDim.Dimension );
+            assert( !inst->FullSrcRegisters[i].SrcRegisterDim.Extended );
+
+            if( inst->FullSrcRegisters[i].SrcRegisterDim.Indirect ) {
+               next_token( ctx, &inst->FullSrcRegisters[i].SrcRegisterDimInd );
+
+               /*
+               * No support for indirect or multi-dimensional addressing.
+               */
+               assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Indirect );
+               assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Dimension );
+               assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Extended );
+            }
+         }
+      }
+
+      break;
+   }
+
+   default:
+      assert( 0 );
+   }
+}
+
diff --git a/src/mesa/pipe/tgsi/util/tgsi_parse.h b/src/mesa/pipe/tgsi/util/tgsi_parse.h
new file mode 100644 (file)
index 0000000..9372da8
--- /dev/null
@@ -0,0 +1,121 @@
+#if !defined TGSI_PARSE_H
+#define TGSI_PARSE_H
+
+#if defined __cplusplus
+extern "C" {
+#endif // defined __cplusplus
+
+struct tgsi_full_version
+{
+   struct tgsi_version  Version;
+};
+
+struct tgsi_full_header
+{
+   struct tgsi_header      Header;
+   struct tgsi_processor   Processor;
+};
+
+struct tgsi_full_dst_register
+{
+   struct tgsi_dst_register               DstRegister;
+   struct tgsi_dst_register_ext_concode   DstRegisterExtConcode;
+   struct tgsi_dst_register_ext_modulate  DstRegisterExtModulate;
+};
+
+struct tgsi_full_src_register
+{
+   struct tgsi_src_register         SrcRegister;
+   struct tgsi_src_register_ext_swz SrcRegisterExtSwz;
+   struct tgsi_src_register_ext_mod SrcRegisterExtMod;
+   struct tgsi_src_register         SrcRegisterInd;
+   struct tgsi_dimension            SrcRegisterDim;
+   struct tgsi_src_register         SrcRegisterDimInd;
+};
+
+struct tgsi_full_declaration
+{
+   struct tgsi_declaration Declaration;
+   union
+   {
+      struct tgsi_declaration_range DeclarationRange;
+      struct tgsi_declaration_mask  DeclarationMask;
+   } u;
+   struct tgsi_declaration_interpolation  Interpolation;
+   struct tgsi_declaration_semantic       Semantic;
+};
+
+struct tgsi_full_immediate
+{
+   struct tgsi_immediate   Immediate;
+   union
+   {
+      void                          *Pointer;
+      struct tgsi_immediate_float32 *ImmediateFloat32;
+   } u;
+};
+
+#define TGSI_FULL_MAX_DST_REGISTERS 2
+#define TGSI_FULL_MAX_SRC_REGISTERS 3
+
+struct tgsi_full_instruction
+{
+   struct tgsi_instruction             Instruction;
+   struct tgsi_instruction_ext_nv      InstructionExtNv;
+   struct tgsi_instruction_ext_label   InstructionExtLabel;
+   struct tgsi_instruction_ext_texture InstructionExtTexture;
+   struct tgsi_full_dst_register       FullDstRegisters[TGSI_FULL_MAX_DST_REGISTERS];
+   struct tgsi_full_src_register       FullSrcRegisters[TGSI_FULL_MAX_SRC_REGISTERS];
+};
+
+union tgsi_full_token
+{
+   struct tgsi_token             Token;
+   struct tgsi_full_declaration  FullDeclaration;
+   struct tgsi_full_immediate    FullImmediate;
+   struct tgsi_full_instruction  FullInstruction;
+};
+
+void
+tgsi_full_token_init(
+   union tgsi_full_token *full_token );
+
+void
+tgsi_full_token_free(
+   union tgsi_full_token *full_token );
+
+struct tgsi_parse_context
+{
+   const struct tgsi_token    *Tokens;
+   unsigned                   Position;
+   struct tgsi_full_version   FullVersion;
+   struct tgsi_full_header    FullHeader;
+   union tgsi_full_token      FullToken;
+};
+
+#define TGSI_PARSE_OK      0
+#define TGSI_PARSE_ERROR   1
+
+unsigned
+tgsi_parse_init(
+   struct tgsi_parse_context *ctx,
+   const struct tgsi_token *tokens );
+
+void
+tgsi_parse_free(
+   struct tgsi_parse_context *ctx );
+
+boolean
+tgsi_parse_end_of_tokens(
+   struct tgsi_parse_context *ctx );
+
+void
+tgsi_parse_token(
+   struct tgsi_parse_context *ctx );
+
+#if defined __cplusplus
+} // extern "C"
+#endif // defined __cplusplus
+
+#endif // !defined TGSI_PARSE_H
+
diff --git a/src/mesa/pipe/tgsi/util/tgsi_util.c b/src/mesa/pipe/tgsi/util/tgsi_util.c
new file mode 100644 (file)
index 0000000..1e76b0f
--- /dev/null
@@ -0,0 +1,273 @@
+#include "pipe/p_util.h"
+#include "pipe/p_shader_tokens.h"
+#include "tgsi_parse.h"
+#include "tgsi_build.h"
+#include "tgsi_util.h"
+
+union pointer_hack
+{
+   void *pointer;
+   unsigned long long uint64;
+};
+
+void *
+tgsi_align_128bit(
+   void *unaligned )
+{
+   union pointer_hack ph;
+
+   ph.uint64 = 0;
+   ph.pointer = unaligned;
+   ph.uint64 = (ph.uint64 + 15) & ~15;
+   return ph.pointer;
+}
+
+unsigned
+tgsi_util_get_src_register_swizzle(
+   const struct tgsi_src_register *reg,
+   unsigned component )
+{
+   switch( component ) {
+   case 0:
+      return reg->SwizzleX;
+   case 1:
+      return reg->SwizzleY;
+   case 2:
+      return reg->SwizzleZ;
+   case 3:
+      return reg->SwizzleW;
+   default:
+      assert( 0 );
+   }
+   return 0;
+}
+
+unsigned
+tgsi_util_get_src_register_extswizzle(
+   const struct tgsi_src_register_ext_swz *reg,
+   unsigned component )
+{
+   switch( component ) {
+   case 0:
+      return reg->ExtSwizzleX;
+   case 1:
+      return reg->ExtSwizzleY;
+   case 2:
+      return reg->ExtSwizzleZ;
+   case 3:
+      return reg->ExtSwizzleW;
+   default:
+      assert( 0 );
+   }
+   return 0;
+}
+
+unsigned
+tgsi_util_get_full_src_register_extswizzle(
+   const struct tgsi_full_src_register  *reg,
+   unsigned component )
+{
+   unsigned swizzle;
+
+   /*
+    * First, calculate  the   extended swizzle for a given channel. This will give
+    * us either a channel index into the simple swizzle or  a constant 1 or   0.
+    */
+   swizzle = tgsi_util_get_src_register_extswizzle(
+      &reg->SrcRegisterExtSwz,
+      component );
+
+   assert (TGSI_SWIZZLE_X == TGSI_EXTSWIZZLE_X);
+   assert (TGSI_SWIZZLE_Y == TGSI_EXTSWIZZLE_Y);
+   assert (TGSI_SWIZZLE_Z == TGSI_EXTSWIZZLE_Z);
+   assert (TGSI_SWIZZLE_W == TGSI_EXTSWIZZLE_W);
+   assert (TGSI_EXTSWIZZLE_ZERO > TGSI_SWIZZLE_W);
+   assert (TGSI_EXTSWIZZLE_ONE > TGSI_SWIZZLE_W);
+
+   /*
+    * Second, calculate the simple  swizzle  for   the   unswizzled channel index.
+    * Leave the constants intact, they are   not   affected by the   simple swizzle.
+    */
+   if( swizzle <= TGSI_SWIZZLE_W ) {
+      swizzle = tgsi_util_get_src_register_swizzle(
+         &reg->SrcRegister,
+         component );
+   }
+
+   return swizzle;
+}
+
+void
+tgsi_util_set_src_register_swizzle(
+   struct tgsi_src_register *reg,
+   unsigned swizzle,
+   unsigned component )
+{
+   switch( component ) {
+   case 0:
+      reg->SwizzleX = swizzle;
+      break;
+   case 1:
+      reg->SwizzleY = swizzle;
+      break;
+   case 2:
+      reg->SwizzleZ = swizzle;
+      break;
+   case 3:
+      reg->SwizzleW = swizzle;
+      break;
+   default:
+      assert( 0 );
+   }
+}
+
+void
+tgsi_util_set_src_register_extswizzle(
+   struct tgsi_src_register_ext_swz *reg,
+   unsigned swizzle,
+   unsigned component )
+{
+   switch( component ) {
+   case 0:
+      reg->ExtSwizzleX = swizzle;
+      break;
+   case 1:
+      reg->ExtSwizzleY = swizzle;
+      break;
+   case 2:
+      reg->ExtSwizzleZ = swizzle;
+      break;
+   case 3:
+      reg->ExtSwizzleW = swizzle;
+      break;
+   default:
+      assert( 0 );
+   }
+}
+
+unsigned
+tgsi_util_get_src_register_extnegate(
+   const  struct tgsi_src_register_ext_swz *reg,
+   unsigned component )
+{
+   switch( component ) {
+   case 0:
+      return reg->NegateX;
+   case 1:
+      return reg->NegateY;
+   case 2:
+      return reg->NegateZ;
+   case 3:
+      return reg->NegateW;
+   default:
+      assert( 0 );
+   }
+   return 0;
+}
+
+void
+tgsi_util_set_src_register_extnegate(
+   struct tgsi_src_register_ext_swz *reg,
+   unsigned negate,
+   unsigned component )
+{
+   switch( component ) {
+   case 0:
+      reg->NegateX = negate;
+      break;
+   case 1:
+      reg->NegateY = negate;
+      break;
+   case 2:
+      reg->NegateZ = negate;
+      break;
+   case 3:
+      reg->NegateW = negate;
+      break;
+   default:
+      assert( 0 );
+   }
+}
+
+unsigned
+tgsi_util_get_full_src_register_sign_mode(
+   const struct  tgsi_full_src_register *reg,
+   unsigned component )
+{
+   unsigned sign_mode;
+
+   if( reg->SrcRegisterExtMod.Absolute ) {
+      /* Consider only the post-abs negation. */
+
+      if( reg->SrcRegisterExtMod.Negate ) {
+         sign_mode = TGSI_UTIL_SIGN_SET;
+      }
+      else {
+         sign_mode = TGSI_UTIL_SIGN_CLEAR;
+      }
+   }
+   else {
+      /* Accumulate the three negations. */
+
+      unsigned negate;
+
+      negate = reg->SrcRegister.Negate;
+      if( tgsi_util_get_src_register_extnegate( &reg->SrcRegisterExtSwz, component ) ) {
+         negate = !negate;
+      }
+      if( reg->SrcRegisterExtMod.Negate ) {
+         negate = !negate;
+      }
+
+      if( negate ) {
+         sign_mode = TGSI_UTIL_SIGN_TOGGLE;
+      }
+      else {
+         sign_mode = TGSI_UTIL_SIGN_KEEP;
+      }
+   }
+
+   return sign_mode;
+}
+
+void
+tgsi_util_set_full_src_register_sign_mode(
+   struct tgsi_full_src_register *reg,
+   unsigned sign_mode )
+{
+   reg->SrcRegisterExtSwz.NegateX = 0;
+   reg->SrcRegisterExtSwz.NegateY = 0;
+   reg->SrcRegisterExtSwz.NegateZ = 0;
+   reg->SrcRegisterExtSwz.NegateW = 0;
+
+   switch (sign_mode)
+   {
+   case TGSI_UTIL_SIGN_CLEAR:
+      reg->SrcRegister.Negate = 0;
+      reg->SrcRegisterExtMod.Absolute = 1;
+      reg->SrcRegisterExtMod.Negate = 0;
+      break;
+
+   case TGSI_UTIL_SIGN_SET:
+      reg->SrcRegister.Negate = 0;
+      reg->SrcRegisterExtMod.Absolute = 1;
+      reg->SrcRegisterExtMod.Negate = 1;
+      break;
+
+   case TGSI_UTIL_SIGN_TOGGLE:
+      reg->SrcRegister.Negate = 1;
+      reg->SrcRegisterExtMod.Absolute = 0;
+      reg->SrcRegisterExtMod.Negate = 0;
+      break;
+
+   case TGSI_UTIL_SIGN_KEEP:
+      reg->SrcRegister.Negate = 0;
+      reg->SrcRegisterExtMod.Absolute = 0;
+      reg->SrcRegisterExtMod.Negate = 0;
+      break;
+
+   default:
+      assert( 0 );
+   }
+}
+
diff --git a/src/mesa/pipe/tgsi/util/tgsi_util.h b/src/mesa/pipe/tgsi/util/tgsi_util.h
new file mode 100644 (file)
index 0000000..ef14446
--- /dev/null
@@ -0,0 +1,70 @@
+#if !defined TGSI_UTIL_H
+#define TGSI_UTIL_H
+
+#if defined __cplusplus
+extern "C" {
+#endif // defined __cplusplus
+
+void *
+tgsi_align_128bit(
+   void *unaligned );
+
+unsigned
+tgsi_util_get_src_register_swizzle(
+   const struct tgsi_src_register *reg,
+   unsigned component );
+
+unsigned
+tgsi_util_get_src_register_extswizzle(
+   const struct tgsi_src_register_ext_swz *reg,
+   unsigned component);
+
+unsigned
+tgsi_util_get_full_src_register_extswizzle(
+   const struct tgsi_full_src_register *reg,
+   unsigned component );
+
+void
+tgsi_util_set_src_register_swizzle(
+   struct tgsi_src_register *reg,
+   unsigned swizzle,
+   unsigned component );
+
+void
+tgsi_util_set_src_register_extswizzle(
+   struct tgsi_src_register_ext_swz *reg,
+   unsigned swizzle,
+   unsigned component );
+
+unsigned
+tgsi_util_get_src_register_extnegate(
+   const struct tgsi_src_register_ext_swz *reg,
+   unsigned component );
+
+void
+tgsi_util_set_src_register_extnegate(
+   struct tgsi_src_register_ext_swz *reg,
+   unsigned negate,
+   unsigned component );
+
+#define TGSI_UTIL_SIGN_CLEAR    0   /* Force positive */
+#define TGSI_UTIL_SIGN_SET      1   /* Force negative */
+#define TGSI_UTIL_SIGN_TOGGLE   2   /* Negate */
+#define TGSI_UTIL_SIGN_KEEP     3   /* No change */
+
+unsigned
+tgsi_util_get_full_src_register_sign_mode(
+   const struct tgsi_full_src_register *reg,
+   unsigned component );
+
+void
+tgsi_util_set_full_src_register_sign_mode(
+   struct tgsi_full_src_register *reg,
+   unsigned sign_mode );
+
+#if defined __cplusplus
+} // extern "C"
+#endif // defined __cplusplus
+
+#endif // !defined TGSI_UTIL_H
+
index ea6840f3d95689fb8b7f9c7f39f71c459e6a424d..2df60d1996c430093e227c4c13aba63b672c6ad8 100644 (file)
@@ -178,15 +178,14 @@ DRAW_SOURCES = \
        pipe/draw/draw_wide_prims.c
 
 TGSIEXEC_SOURCES = \
-       pipe/tgsi/exec/tgsi_build.c \
-       pipe/tgsi/exec/tgsi_dump.c \
        pipe/tgsi/exec/tgsi_exec.c \
-       pipe/tgsi/exec/tgsi_parse.c \
-       pipe/tgsi/exec/tgsi_sse2.c \
-       pipe/tgsi/exec/tgsi_util.c
+       pipe/tgsi/exec/tgsi_sse2.c
 
-TGSIDECO_SOURCES = \
-       pipe/tgsi/deco/deco_caps.c
+TGSIUTIL_SOURCES = \
+       pipe/tgsi/util/tgsi_build.c \
+       pipe/tgsi/util/tgsi_dump.c \
+       pipe/tgsi/util/tgsi_parse.c \
+       pipe/tgsi/util/tgsi_util.c
 
 
 LLVMTGSI_SOURCES = \
@@ -385,7 +384,7 @@ SOLO_SOURCES = \
        $(VF_SOURCES)           \
        $(DRAW_SOURCES)         \
        $(TGSIEXEC_SOURCES)     \
-       $(TGSIDECO_SOURCES)     \
+       $(TGSIUTIL_SOURCES)     \
        $(STATECACHE_SOURCES)   \
        $(STATETRACKER_SOURCES) \
        $(TNL_SOURCES)          \
index d4976941f9ad44106c0ddb7d04111cccd46a70b8..4ec10badad32f9dda14d44a9525d2216a26be7d2 100644 (file)
@@ -41,7 +41,7 @@
 #include "main/mtypes.h"
 
 #include "pipe/p_context.h"
-#include "pipe/tgsi/exec/tgsi_core.h"
+#include "pipe/p_shader_tokens.h"
 
 #include "st_context.h"
 #include "st_cache.h"
index e00684ac0360ec9b75fe388fffee6058ed3d0c73..cffd66751def92ace91edea98a8abb1d7f3d42d0 100644 (file)
@@ -30,7 +30,8 @@
 #include "shader/prog_print.h"
 
 #include "pipe/p_state.h"
-#include "pipe/tgsi/exec/tgsi_core.h"
+#include "pipe/p_shader_tokens.h"
+#include "pipe/tgsi/util/tgsi_dump.h"
 
 #include "pipe/cso_cache/cso_cache.h"
 
index bc57868af28b87b7573b43b86f65f4d72f933930..b392edf16d28bdbf87ea0f9f23846ceba29fa5eb 100644 (file)
  * Michal Krol
  */
 
-
-#include "tgsi_platform.h"
-#include "pipe/tgsi/exec/tgsi_core.h"
+#include "pipe/p_compiler.h"
+#include "pipe/p_shader_tokens.h"
+#include "pipe/tgsi/util/tgsi_parse.h"
+#include "pipe/tgsi/util/tgsi_build.h"
+#include "pipe/tgsi/util/tgsi_util.h"
 #include "st_mesa_to_tgsi.h"
 #include "shader/prog_instruction.h"
 #include "shader/prog_parameter.h"
index ce5384671cd75b056af93fce46df340a8be962c8..4e8bdc820e96d0422d6829c0a8d6b01327f262a4 100644 (file)
@@ -36,8 +36,8 @@
 
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
+#include "pipe/p_shader_tokens.h"
 #include "pipe/draw/draw_context.h"
-#include "pipe/tgsi/exec/tgsi_core.h"
 
 #include "st_context.h"
 #include "st_cache.h"
index 51877af8da95f926bd26a44c5aefa0dbaf244240..049f9f659fa61d39367d75a708a5ebadc937f976 100644 (file)
@@ -35,7 +35,7 @@
 #define ST_PROGRAM_H
 
 #include "mtypes.h"
-#include "pipe/tgsi/exec/tgsi_token.h"
+#include "pipe/p_shader_tokens.h"
 #include "x86/rtasm/x86sse.h"