p_shader_tokens.h

Go to the documentation of this file.
00001 #if !defined TGSI_TOKEN_H
00002 #define TGSI_TOKEN_H
00003 
00004 #ifdef __cplusplus
00005 extern "C" {
00006 #endif
00007 
00008 #include "p_compiler.h"
00009 
00010 struct tgsi_version
00011 {
00012    unsigned MajorVersion  : 8;
00013    unsigned MinorVersion  : 8;
00014    unsigned Padding       : 16;
00015 };
00016 
00017 struct tgsi_header
00018 {
00019    unsigned HeaderSize : 8;
00020    unsigned BodySize   : 24;
00021 };
00022 
00023 #define TGSI_PROCESSOR_FRAGMENT  0
00024 #define TGSI_PROCESSOR_VERTEX    1
00025 #define TGSI_PROCESSOR_GEOMETRY  2
00026 
00027 struct tgsi_processor
00028 {
00029    unsigned Processor  : 4;  /* TGSI_PROCESSOR_ */
00030    unsigned Padding    : 28;
00031 };
00032 
00033 #define TGSI_TOKEN_TYPE_DECLARATION    0
00034 #define TGSI_TOKEN_TYPE_IMMEDIATE      1
00035 #define TGSI_TOKEN_TYPE_INSTRUCTION    2
00036 
00037 struct tgsi_token
00038 {
00039    unsigned Type       : 4;  /* TGSI_TOKEN_TYPE_ */
00040    unsigned Size       : 8;  /* UINT */
00041    unsigned Padding    : 19;
00042    unsigned Extended   : 1;  /* BOOL */
00043 };
00044 
00045 enum tgsi_file_type {
00046    TGSI_FILE_NULL        =0,
00047    TGSI_FILE_CONSTANT    =1,
00048    TGSI_FILE_INPUT       =2,
00049    TGSI_FILE_OUTPUT      =3,
00050    TGSI_FILE_TEMPORARY   =4,
00051    TGSI_FILE_SAMPLER     =5,
00052    TGSI_FILE_ADDRESS     =6,
00053    TGSI_FILE_IMMEDIATE   =7,
00054    TGSI_FILE_LOOP        =8,
00055    TGSI_FILE_COUNT      
00056 };
00057 
00058 
00059 #define TGSI_WRITEMASK_NONE     0x00
00060 #define TGSI_WRITEMASK_X        0x01
00061 #define TGSI_WRITEMASK_Y        0x02
00062 #define TGSI_WRITEMASK_XY       0x03
00063 #define TGSI_WRITEMASK_Z        0x04
00064 #define TGSI_WRITEMASK_XZ       0x05
00065 #define TGSI_WRITEMASK_YZ       0x06
00066 #define TGSI_WRITEMASK_XYZ      0x07
00067 #define TGSI_WRITEMASK_W        0x08
00068 #define TGSI_WRITEMASK_XW       0x09
00069 #define TGSI_WRITEMASK_YW       0x0A
00070 #define TGSI_WRITEMASK_XYW      0x0B
00071 #define TGSI_WRITEMASK_ZW       0x0C
00072 #define TGSI_WRITEMASK_XZW      0x0D
00073 #define TGSI_WRITEMASK_YZW      0x0E
00074 #define TGSI_WRITEMASK_XYZW     0x0F
00075 
00076 #define TGSI_INTERPOLATE_CONSTANT      0
00077 #define TGSI_INTERPOLATE_LINEAR        1
00078 #define TGSI_INTERPOLATE_PERSPECTIVE   2
00079 #define TGSI_INTERPOLATE_COUNT         3
00080 
00081 struct tgsi_declaration
00082 {
00083    unsigned Type        : 4;  /* TGSI_TOKEN_TYPE_DECLARATION */
00084    unsigned Size        : 8;  /* UINT */
00085    unsigned File        : 4;  /* one of TGSI_FILE_x */
00086    unsigned UsageMask   : 4;  /* bitmask of TGSI_WRITEMASK_x flags */
00087    unsigned Interpolate : 4;  /* TGSI_INTERPOLATE_ */
00088    unsigned Semantic    : 1;  /* BOOL, any semantic info? */
00089    unsigned Centroid    : 1;  /* centroid sampling */
00090    unsigned Invariant   : 1;  /* invariant optimization */
00091    unsigned Padding     : 4;
00092    unsigned Extended    : 1;  /* BOOL */
00093 };
00094 
00095 struct tgsi_declaration_range
00096 {
00097    unsigned First   : 16; /* UINT */
00098    unsigned Last    : 16; /* UINT */
00099 };
00100 
00101 #define TGSI_SEMANTIC_POSITION 0
00102 #define TGSI_SEMANTIC_COLOR    1
00103 #define TGSI_SEMANTIC_BCOLOR   2 
00104 #define TGSI_SEMANTIC_FOG      3
00105 #define TGSI_SEMANTIC_PSIZE    4
00106 #define TGSI_SEMANTIC_GENERIC  5
00107 #define TGSI_SEMANTIC_NORMAL   6
00108 #define TGSI_SEMANTIC_COUNT    7 
00110 struct tgsi_declaration_semantic
00111 {
00112    unsigned SemanticName   : 8;  /* one of TGSI_SEMANTIC_ */
00113    unsigned SemanticIndex  : 16; /* UINT */
00114    unsigned Padding        : 8;
00115 };
00116 
00117 #define TGSI_IMM_FLOAT32   0
00118 
00119 struct tgsi_immediate
00120 {
00121    unsigned Type       : 4;  /* TGSI_TOKEN_TYPE_IMMEDIATE */
00122    unsigned Size       : 8;  /* UINT */
00123    unsigned DataType   : 4;  /* TGSI_IMM_ */
00124    unsigned Padding    : 15;
00125    unsigned Extended   : 1;  /* BOOL */
00126 };
00127 
00128 struct tgsi_immediate_float32
00129 {
00130    float Float;
00131 };
00132 
00133 /*
00134  * GL_NV_vertex_program
00135  */
00136 #define TGSI_OPCODE_ARL                 0
00137 #define TGSI_OPCODE_MOV                 1
00138 #define TGSI_OPCODE_LIT                 2
00139 #define TGSI_OPCODE_RCP                 3
00140 #define TGSI_OPCODE_RSQ                 4
00141 #define TGSI_OPCODE_EXP                 5
00142 #define TGSI_OPCODE_LOG                 6
00143 #define TGSI_OPCODE_MUL                 7
00144 #define TGSI_OPCODE_ADD                 8
00145 #define TGSI_OPCODE_DP3                 9
00146 #define TGSI_OPCODE_DP4                 10
00147 #define TGSI_OPCODE_DST                 11
00148 #define TGSI_OPCODE_MIN                 12
00149 #define TGSI_OPCODE_MAX                 13
00150 #define TGSI_OPCODE_SLT                 14
00151 #define TGSI_OPCODE_SGE                 15
00152 #define TGSI_OPCODE_MAD                 16
00153 
00154 /*
00155  * GL_ATI_fragment_shader
00156  */
00157 #define TGSI_OPCODE_SUB                 17
00158 #define TGSI_OPCODE_DOT3                TGSI_OPCODE_DP3
00159 #define TGSI_OPCODE_DOT4                TGSI_OPCODE_DP4
00160 #define TGSI_OPCODE_LERP                18
00161 #define TGSI_OPCODE_CND                 19
00162 #define TGSI_OPCODE_CND0                20
00163 #define TGSI_OPCODE_DOT2ADD             21
00164 
00165 /*
00166  * GL_EXT_vertex_shader
00167  */
00168 #define TGSI_OPCODE_INDEX               22
00169 #define TGSI_OPCODE_NEGATE              23
00170 #define TGSI_OPCODE_MADD                TGSI_OPCODE_MAD
00171 #define TGSI_OPCODE_FRAC                24
00172 #define TGSI_OPCODE_SETGE               TGSI_OPCODE_SGE
00173 #define TGSI_OPCODE_SETLT               TGSI_OPCODE_SLT
00174 #define TGSI_OPCODE_CLAMP               25
00175 #define TGSI_OPCODE_FLOOR               26
00176 #define TGSI_OPCODE_ROUND               27
00177 #define TGSI_OPCODE_EXPBASE2            28
00178 #define TGSI_OPCODE_LOGBASE2            29
00179 #define TGSI_OPCODE_POWER               30
00180 #define TGSI_OPCODE_RECIP               TGSI_OPCODE_RCP
00181 #define TGSI_OPCODE_RECIPSQRT           TGSI_OPCODE_RSQ
00182 #define TGSI_OPCODE_CROSSPRODUCT        31
00183 #define TGSI_OPCODE_MULTIPLYMATRIX      32
00184 
00185 /*
00186  * GL_NV_vertex_program1_1
00187  */
00188 #define TGSI_OPCODE_ABS                 33
00189 #define TGSI_OPCODE_RCC                 34
00190 #define TGSI_OPCODE_DPH                 35
00191 
00192 /*
00193  * GL_NV_fragment_program
00194  */
00195 #define TGSI_OPCODE_COS                 36
00196 #define TGSI_OPCODE_DDX                 37
00197 #define TGSI_OPCODE_DDY                 38
00198 #define TGSI_OPCODE_EX2                 TGSI_OPCODE_EXPBASE2
00199 #define TGSI_OPCODE_FLR                 TGSI_OPCODE_FLOOR
00200 #define TGSI_OPCODE_FRC                 TGSI_OPCODE_FRAC
00201 #define TGSI_OPCODE_KILP                39  /* predicated kill */
00202 #define TGSI_OPCODE_LG2                 TGSI_OPCODE_LOGBASE2
00203 #define TGSI_OPCODE_LRP                 TGSI_OPCODE_LERP
00204 #define TGSI_OPCODE_PK2H                40
00205 #define TGSI_OPCODE_PK2US               41
00206 #define TGSI_OPCODE_PK4B                42
00207 #define TGSI_OPCODE_PK4UB               43
00208 #define TGSI_OPCODE_POW                 TGSI_OPCODE_POWER
00209 #define TGSI_OPCODE_RFL                 44
00210 #define TGSI_OPCODE_SEQ                 45
00211 #define TGSI_OPCODE_SFL                 46
00212 #define TGSI_OPCODE_SGT                 47
00213 #define TGSI_OPCODE_SIN                 48
00214 #define TGSI_OPCODE_SLE                 49
00215 #define TGSI_OPCODE_SNE                 50
00216 #define TGSI_OPCODE_STR                 51
00217 #define TGSI_OPCODE_TEX                 52
00218 #define TGSI_OPCODE_TXD                 53
00219 #define TGSI_OPCODE_TXP                 54
00220 #define TGSI_OPCODE_UP2H                55
00221 #define TGSI_OPCODE_UP2US               56
00222 #define TGSI_OPCODE_UP4B                57
00223 #define TGSI_OPCODE_UP4UB               58
00224 #define TGSI_OPCODE_X2D                 59
00225 
00226 /*
00227  * GL_NV_vertex_program2
00228  */
00229 #define TGSI_OPCODE_ARA                 60
00230 #define TGSI_OPCODE_ARR                 61
00231 #define TGSI_OPCODE_BRA                 62
00232 #define TGSI_OPCODE_CAL                 63
00233 #define TGSI_OPCODE_RET                 64
00234 #define TGSI_OPCODE_SSG                 65
00235 
00236 /*
00237  * GL_ARB_vertex_program
00238  */
00239 #define TGSI_OPCODE_SWZ                 118
00240 #define TGSI_OPCODE_XPD                 TGSI_OPCODE_CROSSPRODUCT
00241 
00242 /*
00243  * GL_ARB_fragment_program
00244  */
00245 #define TGSI_OPCODE_CMP                 66
00246 #define TGSI_OPCODE_KIL                 116  /* conditional kill */
00247 #define TGSI_OPCODE_SCS                 67
00248 #define TGSI_OPCODE_TXB                 68
00249 
00250 /*
00251  * GL_NV_fragment_program_option
00252  */
00253 /* No new opcode */
00254 
00255 /*
00256  * GL_NV_fragment_program2
00257  */
00258 #define TGSI_OPCODE_NRM                 69
00259 #define TGSI_OPCODE_DIV                 70
00260 #define TGSI_OPCODE_DP2                 71
00261 #define TGSI_OPCODE_DP2A                TGSI_OPCODE_DOT2ADD
00262 #define TGSI_OPCODE_TXL                 72
00263 #define TGSI_OPCODE_BRK                 73
00264 #define TGSI_OPCODE_IF                  74
00265 #define TGSI_OPCODE_LOOP                75
00266 #define TGSI_OPCODE_REP                 76
00267 #define TGSI_OPCODE_ELSE                77
00268 #define TGSI_OPCODE_ENDIF               78
00269 #define TGSI_OPCODE_ENDLOOP             79
00270 #define TGSI_OPCODE_ENDREP              80
00271 
00272 /*
00273  * GL_NV_vertex_program2_option
00274  */
00275 
00276 /*
00277  * GL_NV_vertex_program3
00278  */
00279 #define TGSI_OPCODE_PUSHA               81
00280 #define TGSI_OPCODE_POPA                82
00281 
00282 /*
00283  * GL_NV_gpu_program4
00284  */
00285 #define TGSI_OPCODE_CEIL                83
00286 #define TGSI_OPCODE_I2F                 84
00287 #define TGSI_OPCODE_NOT                 85
00288 #define TGSI_OPCODE_TRUNC               86
00289 #define TGSI_OPCODE_SHL                 87
00290 #define TGSI_OPCODE_SHR                 88
00291 #define TGSI_OPCODE_AND                 89
00292 #define TGSI_OPCODE_OR                  90
00293 #define TGSI_OPCODE_MOD                 91
00294 #define TGSI_OPCODE_XOR                 92
00295 #define TGSI_OPCODE_SAD                 93
00296 #define TGSI_OPCODE_TXF                 94
00297 #define TGSI_OPCODE_TXQ                 95
00298 #define TGSI_OPCODE_CONT                96
00299 
00300 /*
00301  * GL_NV_vertex_program4
00302  */
00303 /* Same as GL_NV_gpu_program4 */
00304 
00305 /*
00306  * GL_NV_fragment_program4
00307  */
00308 /* Same as GL_NV_gpu_program4 */
00309 
00310 /*
00311  * GL_NV_geometry_program4
00312  */
00313 /* Same as GL_NV_gpu_program4 */
00314 #define TGSI_OPCODE_EMIT                97
00315 #define TGSI_OPCODE_ENDPRIM             98
00316 
00317 /*
00318  * GLSL
00319  */
00320 #define TGSI_OPCODE_BGNLOOP2            99
00321 #define TGSI_OPCODE_BGNSUB              100
00322 #define TGSI_OPCODE_ENDLOOP2            101
00323 #define TGSI_OPCODE_ENDSUB              102
00324 #define TGSI_OPCODE_INT                 TGSI_OPCODE_TRUNC
00325 #define TGSI_OPCODE_NOISE1              103
00326 #define TGSI_OPCODE_NOISE2              104
00327 #define TGSI_OPCODE_NOISE3              105
00328 #define TGSI_OPCODE_NOISE4              106
00329 #define TGSI_OPCODE_NOP                 107
00330 
00331 /*
00332  * ps_1_1
00333  */
00334 #define TGSI_OPCODE_TEXKILL             TGSI_OPCODE_KIL
00335 
00336 /*
00337  * ps_1_2
00338  */
00339 /* CMP - use TGSI_OPCODE_CND0 */
00340 
00341 /*
00342  * ps_1_3
00343  */
00344 /* CMP - use TGSI_OPCODE_CND0 */
00345 
00346 /*
00347  * ps_1_4
00348  */
00349 #define TGSI_OPCODE_TEXLD               TGSI_OPCODE_TEX
00350 
00351 /*
00352  * ps_2_0
00353  */
00354 #define TGSI_OPCODE_M4X4                TGSI_OPCODE_MULTIPLYMATRIX
00355 #define TGSI_OPCODE_M4X3                108
00356 #define TGSI_OPCODE_M3X4                109
00357 #define TGSI_OPCODE_M3X3                110
00358 #define TGSI_OPCODE_M3X2                111
00359 #define TGSI_OPCODE_CRS                 TGSI_OPCODE_XPD
00360 #define TGSI_OPCODE_NRM4                112
00361 #define TGSI_OPCODE_SINCOS              TGSI_OPCODE_SCS
00362 #define TGSI_OPCODE_TEXLDB              TGSI_OPCODE_TXB
00363 #define TGSI_OPCODE_DP2ADD              TGSI_OPCODE_DP2A
00364 
00365 /*
00366  * ps_2_x
00367  */
00368 #define TGSI_OPCODE_CALL                TGSI_OPCODE_CAL
00369 #define TGSI_OPCODE_CALLNZ              113
00370 #define TGSI_OPCODE_IFC                 114
00371 #define TGSI_OPCODE_BREAK               TGSI_OPCODE_BRK
00372 #define TGSI_OPCODE_BREAKC              115
00373 #define TGSI_OPCODE_DSX                 TGSI_OPCODE_DDX
00374 #define TGSI_OPCODE_DSY                 TGSI_OPCODE_DDY
00375 #define TGSI_OPCODE_TEXLDD              TGSI_OPCODE_TXD
00376 
00377 /*
00378  * vs_1_1
00379  */
00380 #define TGSI_OPCODE_EXPP                TGSI_OPCODE_EXP
00381 #define TGSI_OPCODE_LOGP                TGSI_OPCODE_LOG
00382 
00383 /*
00384  * vs_2_0
00385  */
00386 #define TGSI_OPCODE_SGN                 TGSI_OPCODE_SSG
00387 #define TGSI_OPCODE_MOVA                TGSI_OPCODE_ARR
00388 /* EXPP - use TGSI_OPCODE_EX2 */
00389 
00390 /*
00391  * vs_2_x
00392  */
00393 
00394 #define TGSI_OPCODE_END                 117  /* aka HALT */
00395 
00396 #define TGSI_OPCODE_LAST                119
00397 
00398 #define TGSI_SAT_NONE            0  /* do not saturate */
00399 #define TGSI_SAT_ZERO_ONE        1  /* clamp to [0,1] */
00400 #define TGSI_SAT_MINUS_PLUS_ONE  2  /* clamp to [-1,1] */
00401 
00402 /*
00403  * Opcode is the operation code to execute. A given operation defines the
00404  * semantics how the source registers (if any) are interpreted and what is
00405  * written to the destination registers (if any) as a result of execution.
00406  *
00407  * NumDstRegs and NumSrcRegs is the number of destination and source registers,
00408  * respectively. For a given operation code, those numbers are fixed and are
00409  * present here only for convenience.
00410  *
00411  * If Extended is TRUE, it is now executed.
00412  *
00413  * Saturate controls how are final results in destination registers modified.
00414  */
00415 
00416 struct tgsi_instruction
00417 {
00418    unsigned Type       : 4;  /* TGSI_TOKEN_TYPE_INSTRUCTION */
00419    unsigned Size       : 8;  /* UINT */
00420    unsigned Opcode     : 8;  /* TGSI_OPCODE_ */
00421    unsigned Saturate   : 2;  /* TGSI_SAT_ */
00422    unsigned NumDstRegs : 2;  /* UINT */
00423    unsigned NumSrcRegs : 4;  /* UINT */
00424    unsigned Padding    : 3;
00425    unsigned Extended   : 1;  /* BOOL */
00426 };
00427 
00428 /*
00429  * If tgsi_instruction::Extended is TRUE, tgsi_instruction_ext follows.
00430  * 
00431  * Then, tgsi_instruction::NumDstRegs of tgsi_dst_register follow.
00432  * 
00433  * Then, tgsi_instruction::NumSrcRegs of tgsi_src_register follow.
00434  *
00435  * tgsi_instruction::Size contains the total number of words that make the
00436  * instruction, including the instruction word.
00437  */
00438 
00439 #define TGSI_INSTRUCTION_EXT_TYPE_NV        0
00440 #define TGSI_INSTRUCTION_EXT_TYPE_LABEL     1
00441 #define TGSI_INSTRUCTION_EXT_TYPE_TEXTURE   2
00442 #define TGSI_INSTRUCTION_EXT_TYPE_PREDICATE 3
00443 
00444 struct tgsi_instruction_ext
00445 {
00446    unsigned Type       : 4;  /* TGSI_INSTRUCTION_EXT_TYPE_ */
00447    unsigned Padding    : 27;
00448    unsigned Extended   : 1;  /* BOOL */
00449 };
00450 
00451 /*
00452  * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_NV, it should
00453  * be cast to tgsi_instruction_ext_nv.
00454  * 
00455  * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_LABEL, it
00456  * should be cast to tgsi_instruction_ext_label.
00457  * 
00458  * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_TEXTURE, it
00459  * should be cast to tgsi_instruction_ext_texture.
00460  * 
00461  * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_PREDICATE, it
00462  * should be cast to tgsi_instruction_ext_predicate.
00463  * 
00464  * If tgsi_instruction_ext::Extended is TRUE, another tgsi_instruction_ext
00465  * follows.
00466  */
00467 
00468 #define TGSI_PRECISION_DEFAULT      0
00469 #define TGSI_PRECISION_FLOAT32      1
00470 #define TGSI_PRECISION_FLOAT16      2
00471 #define TGSI_PRECISION_FIXED12      3
00472 
00473 #define TGSI_CC_GT      0
00474 #define TGSI_CC_EQ      1
00475 #define TGSI_CC_LT      2
00476 #define TGSI_CC_GE      3
00477 #define TGSI_CC_LE      4
00478 #define TGSI_CC_NE      5
00479 #define TGSI_CC_TR      6
00480 #define TGSI_CC_FL      7
00481 
00482 #define TGSI_SWIZZLE_X      0
00483 #define TGSI_SWIZZLE_Y      1
00484 #define TGSI_SWIZZLE_Z      2
00485 #define TGSI_SWIZZLE_W      3
00486 
00487 /*
00488  * Precision controls the precision at which the operation should be executed.
00489  *
00490  * CondDstUpdate enables condition code register writes. When this field is
00491  * TRUE, CondDstIndex specifies the index of the condition code register to
00492  * update.
00493  *
00494  * CondFlowEnable enables conditional execution of the operation. When this
00495  * field is TRUE, CondFlowIndex specifies the index of the condition code
00496  * register to test against CondMask with component swizzle controled by
00497  * CondSwizzleX, CondSwizzleY, CondSwizzleZ and CondSwizzleW. If the test fails,
00498  * the operation is not executed.
00499  */
00500 
00501 struct tgsi_instruction_ext_nv
00502 {
00503    unsigned Type             : 4;    /* TGSI_INSTRUCTION_EXT_TYPE_NV */
00504    unsigned Precision        : 4;    /* TGSI_PRECISION_ */
00505    unsigned CondDstIndex     : 4;    /* UINT */
00506    unsigned CondFlowIndex    : 4;    /* UINT */
00507    unsigned CondMask         : 4;    /* TGSI_CC_ */
00508    unsigned CondSwizzleX     : 2;    /* TGSI_SWIZZLE_ */
00509    unsigned CondSwizzleY     : 2;    /* TGSI_SWIZZLE_ */
00510    unsigned CondSwizzleZ     : 2;    /* TGSI_SWIZZLE_ */
00511    unsigned CondSwizzleW     : 2;    /* TGSI_SWIZZLE_ */
00512    unsigned CondDstUpdate    : 1;    /* BOOL */
00513    unsigned CondFlowEnable   : 1;    /* BOOL */
00514    unsigned Padding          : 1;
00515    unsigned Extended         : 1;    /* BOOL */
00516 };
00517 
00518 struct tgsi_instruction_ext_label
00519 {
00520    unsigned Type     : 4;    /* TGSI_INSTRUCTION_EXT_TYPE_LABEL */
00521    unsigned Label    : 24;   /* UINT */
00522    unsigned Padding  : 3;
00523    unsigned Extended : 1;    /* BOOL */
00524 };
00525 
00526 #define TGSI_TEXTURE_UNKNOWN        0
00527 #define TGSI_TEXTURE_1D             1
00528 #define TGSI_TEXTURE_2D             2
00529 #define TGSI_TEXTURE_3D             3
00530 #define TGSI_TEXTURE_CUBE           4
00531 #define TGSI_TEXTURE_RECT           5
00532 #define TGSI_TEXTURE_SHADOW1D       6
00533 #define TGSI_TEXTURE_SHADOW2D       7
00534 #define TGSI_TEXTURE_SHADOWRECT     8
00535 #define TGSI_TEXTURE_COUNT          9
00536 
00537 struct tgsi_instruction_ext_texture
00538 {
00539    unsigned Type     : 4;    /* TGSI_INSTRUCTION_EXT_TYPE_TEXTURE */
00540    unsigned Texture  : 8;    /* TGSI_TEXTURE_ */
00541    unsigned Padding  : 19;
00542    unsigned Extended : 1;    /* BOOL */
00543 };
00544 
00545 struct tgsi_instruction_ext_predicate
00546 {
00547    unsigned Type             : 4;    /* TGSI_INSTRUCTION_EXT_TYPE_PREDICATE */
00548    unsigned PredDstIndex     : 4;    /* UINT */
00549    unsigned PredWriteMask    : 4;    /* TGSI_WRITEMASK_ */
00550    unsigned Padding          : 19;
00551    unsigned Extended         : 1;    /* BOOL */
00552 };
00553 
00554 /*
00555  * File specifies the register array to access.
00556  *
00557  * Index specifies the element number of a register in the register file.
00558  *
00559  * If Indirect is TRUE, Index should be offset by the X component of a source
00560  * register that follows. The register can be now fetched into local storage
00561  * for further processing.
00562  *
00563  * If Negate is TRUE, all components of the fetched register are negated.
00564  *
00565  * The fetched register components are swizzled according to SwizzleX, SwizzleY,
00566  * SwizzleZ and SwizzleW.
00567  *
00568  * If Extended is TRUE, any further modifications to the source register are
00569  * made to this temporary storage.
00570  */
00571 
00572 struct tgsi_src_register
00573 {
00574    unsigned File        : 4;  /* TGSI_FILE_ */
00575    unsigned SwizzleX    : 2;  /* TGSI_SWIZZLE_ */
00576    unsigned SwizzleY    : 2;  /* TGSI_SWIZZLE_ */
00577    unsigned SwizzleZ    : 2;  /* TGSI_SWIZZLE_ */
00578    unsigned SwizzleW    : 2;  /* TGSI_SWIZZLE_ */
00579    unsigned Negate      : 1;  /* BOOL */
00580    unsigned Indirect    : 1;  /* BOOL */
00581    unsigned Dimension   : 1;  /* BOOL */
00582    int      Index       : 16; /* SINT */
00583    unsigned Extended    : 1;  /* BOOL */
00584 };
00585 
00586 /*
00587  * If tgsi_src_register::Extended is TRUE, tgsi_src_register_ext follows.
00588  * 
00589  * Then, if tgsi_src_register::Indirect is TRUE, another tgsi_src_register
00590  * follows.
00591  *
00592  * Then, if tgsi_src_register::Dimension is TRUE, tgsi_dimension follows.
00593  */
00594 
00595 #define TGSI_SRC_REGISTER_EXT_TYPE_SWZ      0
00596 #define TGSI_SRC_REGISTER_EXT_TYPE_MOD      1
00597 
00598 struct tgsi_src_register_ext
00599 {
00600    unsigned Type     : 4;    /* TGSI_SRC_REGISTER_EXT_TYPE_ */
00601    unsigned Padding  : 27;
00602    unsigned Extended : 1;    /* BOOL */
00603 };
00604 
00605 /*
00606  * If tgsi_src_register_ext::Type is TGSI_SRC_REGISTER_EXT_TYPE_SWZ,
00607  * it should be cast to tgsi_src_register_ext_swz.
00608  * 
00609  * If tgsi_src_register_ext::Type is TGSI_SRC_REGISTER_EXT_TYPE_MOD,
00610  * it should be cast to tgsi_src_register_ext_mod.
00611  * 
00612  * If tgsi_dst_register_ext::Extended is TRUE, another tgsi_dst_register_ext
00613  * follows.
00614  */
00615 
00616 #define TGSI_EXTSWIZZLE_X       TGSI_SWIZZLE_X
00617 #define TGSI_EXTSWIZZLE_Y       TGSI_SWIZZLE_Y
00618 #define TGSI_EXTSWIZZLE_Z       TGSI_SWIZZLE_Z
00619 #define TGSI_EXTSWIZZLE_W       TGSI_SWIZZLE_W
00620 #define TGSI_EXTSWIZZLE_ZERO    4
00621 #define TGSI_EXTSWIZZLE_ONE     5
00622 
00623 /*
00624  * ExtSwizzleX, ExtSwizzleY, ExtSwizzleZ and ExtSwizzleW swizzle the source
00625  * register in an extended manner.
00626  *
00627  * NegateX, NegateY, NegateZ and NegateW negate individual components of the
00628  * source register.
00629  *
00630  * NOTE: To simplify matter, if this token is present, the corresponding Swizzle
00631  *       and Negate fields in tgsi_src_register should be set to X,Y,Z,W
00632  *       and FALSE, respectively.
00633  */
00634 
00635 struct tgsi_src_register_ext_swz
00636 {
00637    unsigned Type         : 4;    /* TGSI_SRC_REGISTER_EXT_TYPE_SWZ */
00638    unsigned ExtSwizzleX  : 4;    /* TGSI_EXTSWIZZLE_ */
00639    unsigned ExtSwizzleY  : 4;    /* TGSI_EXTSWIZZLE_ */
00640    unsigned ExtSwizzleZ  : 4;    /* TGSI_EXTSWIZZLE_ */
00641    unsigned ExtSwizzleW  : 4;    /* TGSI_EXTSWIZZLE_ */
00642    unsigned NegateX      : 1;    /* BOOL */
00643    unsigned NegateY      : 1;    /* BOOL */
00644    unsigned NegateZ      : 1;    /* BOOL */
00645    unsigned NegateW      : 1;    /* BOOL */
00646    unsigned Padding      : 7;
00647    unsigned Extended     : 1;    /* BOOL */
00648 };
00649 
00665 struct tgsi_src_register_ext_mod
00666 {
00667    unsigned Type         : 4;    /* TGSI_SRC_REGISTER_EXT_TYPE_MOD */
00668    unsigned Complement   : 1;    /* BOOL */
00669    unsigned Bias         : 1;    /* BOOL */
00670    unsigned Scale2X      : 1;    /* BOOL */
00671    unsigned Absolute     : 1;    /* BOOL */
00672    unsigned Negate       : 1;    /* BOOL */
00673    unsigned Padding      : 22;
00674    unsigned Extended     : 1;    /* BOOL */
00675 };
00676 
00677 struct tgsi_dimension
00678 {
00679    unsigned Indirect    : 1;  /* BOOL */
00680    unsigned Dimension   : 1;  /* BOOL */
00681    unsigned Padding     : 13;
00682    int      Index       : 16; /* SINT */
00683    unsigned Extended    : 1;  /* BOOL */
00684 };
00685 
00686 struct tgsi_dst_register
00687 {
00688    unsigned File        : 4;  /* TGSI_FILE_ */
00689    unsigned WriteMask   : 4;  /* TGSI_WRITEMASK_ */
00690    unsigned Indirect    : 1;  /* BOOL */
00691    unsigned Dimension   : 1;  /* BOOL */
00692    int      Index       : 16; /* SINT */
00693    unsigned Padding     : 5;
00694    unsigned Extended    : 1;  /* BOOL */
00695 };
00696 
00697 /*
00698  * If tgsi_dst_register::Extended is TRUE, tgsi_dst_register_ext follows.
00699  * 
00700  * Then, if tgsi_dst_register::Indirect is TRUE, tgsi_src_register follows.
00701  */
00702 
00703 #define TGSI_DST_REGISTER_EXT_TYPE_CONDCODE     0
00704 #define TGSI_DST_REGISTER_EXT_TYPE_MODULATE     1
00705 #define TGSI_DST_REGISTER_EXT_TYPE_PREDICATE    2
00706 
00707 struct tgsi_dst_register_ext
00708 {
00709    unsigned Type     : 4;    /* TGSI_DST_REGISTER_EXT_TYPE_ */
00710    unsigned Padding  : 27;
00711    unsigned Extended : 1;    /* BOOL */
00712 };
00713 
00729 struct tgsi_dst_register_ext_concode
00730 {
00731    unsigned Type         : 4;    /* TGSI_DST_REGISTER_EXT_TYPE_CONDCODE */
00732    unsigned CondMask     : 4;    /* TGSI_CC_ */
00733    unsigned CondSwizzleX : 2;    /* TGSI_SWIZZLE_ */
00734    unsigned CondSwizzleY : 2;    /* TGSI_SWIZZLE_ */
00735    unsigned CondSwizzleZ : 2;    /* TGSI_SWIZZLE_ */
00736    unsigned CondSwizzleW : 2;    /* TGSI_SWIZZLE_ */
00737    unsigned CondSrcIndex : 4;    /* UINT */
00738    unsigned Padding      : 11;
00739    unsigned Extended     : 1;    /* BOOL */
00740 };
00741 
00742 #define TGSI_MODULATE_1X        0
00743 #define TGSI_MODULATE_2X        1
00744 #define TGSI_MODULATE_4X        2
00745 #define TGSI_MODULATE_8X        3
00746 #define TGSI_MODULATE_HALF      4
00747 #define TGSI_MODULATE_QUARTER   5
00748 #define TGSI_MODULATE_EIGHTH    6
00749 #define TGSI_MODULATE_COUNT     7
00750 
00751 struct tgsi_dst_register_ext_modulate
00752 {
00753    unsigned Type     : 4;    /* TGSI_DST_REGISTER_EXT_TYPE_MODULATE */
00754    unsigned Modulate : 4;    /* TGSI_MODULATE_ */
00755    unsigned Padding  : 23;
00756    unsigned Extended : 1;    /* BOOL */
00757 };
00758 
00759 /*
00760  * Currently, the following constraints apply.
00761  *
00762  * - PredSwizzleXYZW is either set to identity or replicate.
00763  * - PredSrcIndex is 0.
00764  */
00765 
00766 struct tgsi_dst_register_ext_predicate
00767 {
00768    unsigned Type         : 4;    /* TGSI_DST_REGISTER_EXT_TYPE_PREDICATE */
00769    unsigned PredSwizzleX : 2;    /* TGSI_SWIZZLE_ */
00770    unsigned PredSwizzleY : 2;    /* TGSI_SWIZZLE_ */
00771    unsigned PredSwizzleZ : 2;    /* TGSI_SWIZZLE_ */
00772    unsigned PredSwizzleW : 2;    /* TGSI_SWIZZLE_ */
00773    unsigned PredSrcIndex : 4;    /* UINT */
00774    unsigned Negate       : 1;    /* BOOL */
00775    unsigned Padding      : 14;
00776    unsigned Extended     : 1;    /* BOOL */
00777 };
00778 
00779 
00780 #ifdef __cplusplus
00781 }
00782 #endif
00783 
00784 #endif /* TGSI_TOKEN_H */
00785 

Generated on Tue Sep 29 06:25:17 2009 for Gallium3D by  doxygen 1.5.4