1 /**************************************************************************
3 * Copyright 2008 VMware, Inc.
4 * Copyright 2009-2010 VMware, Inc.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sub license, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
15 * The above copyright notice and this permission notice (including the
16 * next paragraph) shall be included in all copies or substantial portions
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
23 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 **************************************************************************/
29 #ifndef P_SHADER_TOKENS_H
30 #define P_SHADER_TOKENS_H
39 unsigned HeaderSize
: 8;
40 unsigned BodySize
: 24;
43 #define TGSI_PROCESSOR_FRAGMENT 0
44 #define TGSI_PROCESSOR_VERTEX 1
45 #define TGSI_PROCESSOR_GEOMETRY 2
46 #define TGSI_PROCESSOR_COMPUTE 3
50 unsigned Processor
: 4; /* TGSI_PROCESSOR_ */
51 unsigned Padding
: 28;
54 #define TGSI_TOKEN_TYPE_DECLARATION 0
55 #define TGSI_TOKEN_TYPE_IMMEDIATE 1
56 #define TGSI_TOKEN_TYPE_INSTRUCTION 2
57 #define TGSI_TOKEN_TYPE_PROPERTY 3
61 unsigned Type
: 4; /**< TGSI_TOKEN_TYPE_x */
62 unsigned NrTokens
: 8; /**< UINT */
63 unsigned Padding
: 20;
68 TGSI_FILE_CONSTANT
=1,
71 TGSI_FILE_TEMPORARY
=4,
74 TGSI_FILE_IMMEDIATE
=7,
75 TGSI_FILE_PREDICATE
=8,
76 TGSI_FILE_SYSTEM_VALUE
=9,
77 TGSI_FILE_RESOURCE
=10,
78 TGSI_FILE_SAMPLER_VIEW
=11,
79 TGSI_FILE_COUNT
/**< how many TGSI_FILE_ types */
83 #define TGSI_WRITEMASK_NONE 0x00
84 #define TGSI_WRITEMASK_X 0x01
85 #define TGSI_WRITEMASK_Y 0x02
86 #define TGSI_WRITEMASK_XY 0x03
87 #define TGSI_WRITEMASK_Z 0x04
88 #define TGSI_WRITEMASK_XZ 0x05
89 #define TGSI_WRITEMASK_YZ 0x06
90 #define TGSI_WRITEMASK_XYZ 0x07
91 #define TGSI_WRITEMASK_W 0x08
92 #define TGSI_WRITEMASK_XW 0x09
93 #define TGSI_WRITEMASK_YW 0x0A
94 #define TGSI_WRITEMASK_XYW 0x0B
95 #define TGSI_WRITEMASK_ZW 0x0C
96 #define TGSI_WRITEMASK_XZW 0x0D
97 #define TGSI_WRITEMASK_YZW 0x0E
98 #define TGSI_WRITEMASK_XYZW 0x0F
100 #define TGSI_INTERPOLATE_CONSTANT 0
101 #define TGSI_INTERPOLATE_LINEAR 1
102 #define TGSI_INTERPOLATE_PERSPECTIVE 2
103 #define TGSI_INTERPOLATE_COLOR 3 /* special color case for smooth/flat */
104 #define TGSI_INTERPOLATE_COUNT 4
106 #define TGSI_INTERPOLATE_LOC_CENTER 0
107 #define TGSI_INTERPOLATE_LOC_CENTROID 1
108 #define TGSI_INTERPOLATE_LOC_SAMPLE 2
109 #define TGSI_INTERPOLATE_LOC_COUNT 3
111 #define TGSI_CYLINDRICAL_WRAP_X (1 << 0)
112 #define TGSI_CYLINDRICAL_WRAP_Y (1 << 1)
113 #define TGSI_CYLINDRICAL_WRAP_Z (1 << 2)
114 #define TGSI_CYLINDRICAL_WRAP_W (1 << 3)
116 struct tgsi_declaration
118 unsigned Type
: 4; /**< TGSI_TOKEN_TYPE_DECLARATION */
119 unsigned NrTokens
: 8; /**< UINT */
120 unsigned File
: 4; /**< one of TGSI_FILE_x */
121 unsigned UsageMask
: 4; /**< bitmask of TGSI_WRITEMASK_x flags */
122 unsigned Dimension
: 1; /**< any extra dimension info? */
123 unsigned Semantic
: 1; /**< BOOL, any semantic info? */
124 unsigned Interpolate
: 1; /**< any interpolation info? */
125 unsigned Invariant
: 1; /**< invariant optimization? */
126 unsigned Local
: 1; /**< optimize as subroutine local variable? */
127 unsigned Array
: 1; /**< extra array info? */
128 unsigned Padding
: 6;
131 struct tgsi_declaration_range
133 unsigned First
: 16; /**< UINT */
134 unsigned Last
: 16; /**< UINT */
137 struct tgsi_declaration_dimension
139 unsigned Index2D
:16; /**< UINT */
143 struct tgsi_declaration_interp
145 unsigned Interpolate
: 4; /**< one of TGSI_INTERPOLATE_x */
146 unsigned Location
: 2; /**< one of TGSI_INTERPOLATE_LOC_x */
147 unsigned CylindricalWrap
:4; /**< TGSI_CYLINDRICAL_WRAP_x flags */
148 unsigned Padding
: 22;
151 #define TGSI_SEMANTIC_POSITION 0
152 #define TGSI_SEMANTIC_COLOR 1
153 #define TGSI_SEMANTIC_BCOLOR 2 /**< back-face color */
154 #define TGSI_SEMANTIC_FOG 3
155 #define TGSI_SEMANTIC_PSIZE 4
156 #define TGSI_SEMANTIC_GENERIC 5
157 #define TGSI_SEMANTIC_NORMAL 6
158 #define TGSI_SEMANTIC_FACE 7
159 #define TGSI_SEMANTIC_EDGEFLAG 8
160 #define TGSI_SEMANTIC_PRIMID 9
161 #define TGSI_SEMANTIC_INSTANCEID 10 /**< doesn't include start_instance */
162 #define TGSI_SEMANTIC_VERTEXID 11
163 #define TGSI_SEMANTIC_STENCIL 12
164 #define TGSI_SEMANTIC_CLIPDIST 13
165 #define TGSI_SEMANTIC_CLIPVERTEX 14
166 #define TGSI_SEMANTIC_GRID_SIZE 15 /**< grid size in blocks */
167 #define TGSI_SEMANTIC_BLOCK_ID 16 /**< id of the current block */
168 #define TGSI_SEMANTIC_BLOCK_SIZE 17 /**< block size in threads */
169 #define TGSI_SEMANTIC_THREAD_ID 18 /**< block-relative id of the current thread */
170 #define TGSI_SEMANTIC_TEXCOORD 19 /**< texture or sprite coordinates */
171 #define TGSI_SEMANTIC_PCOORD 20 /**< point sprite coordinate */
172 #define TGSI_SEMANTIC_VIEWPORT_INDEX 21 /**< viewport index */
173 #define TGSI_SEMANTIC_LAYER 22 /**< layer (rendertarget index) */
174 #define TGSI_SEMANTIC_CULLDIST 23
175 #define TGSI_SEMANTIC_SAMPLEID 24
176 #define TGSI_SEMANTIC_SAMPLEPOS 25
177 #define TGSI_SEMANTIC_SAMPLEMASK 26
178 #define TGSI_SEMANTIC_INVOCATIONID 27
179 #define TGSI_SEMANTIC_VERTEXID_NOBASE 28
180 #define TGSI_SEMANTIC_BASEVERTEX 29
181 #define TGSI_SEMANTIC_COUNT 30 /**< number of semantic values */
183 struct tgsi_declaration_semantic
185 unsigned Name
: 8; /**< one of TGSI_SEMANTIC_x */
186 unsigned Index
: 16; /**< UINT */
187 unsigned Padding
: 8;
190 struct tgsi_declaration_resource
{
191 unsigned Resource
: 8; /**< one of TGSI_TEXTURE_ */
193 unsigned Writable
: 1;
194 unsigned Padding
: 22;
197 enum tgsi_return_type
{
198 TGSI_RETURN_TYPE_UNORM
= 0,
199 TGSI_RETURN_TYPE_SNORM
,
200 TGSI_RETURN_TYPE_SINT
,
201 TGSI_RETURN_TYPE_UINT
,
202 TGSI_RETURN_TYPE_FLOAT
,
203 TGSI_RETURN_TYPE_COUNT
206 struct tgsi_declaration_sampler_view
{
207 unsigned Resource
: 8; /**< one of TGSI_TEXTURE_ */
208 unsigned ReturnTypeX
: 6; /**< one of enum tgsi_return_type */
209 unsigned ReturnTypeY
: 6; /**< one of enum tgsi_return_type */
210 unsigned ReturnTypeZ
: 6; /**< one of enum tgsi_return_type */
211 unsigned ReturnTypeW
: 6; /**< one of enum tgsi_return_type */
214 struct tgsi_declaration_array
{
215 unsigned ArrayID
: 10;
216 unsigned Padding
: 22;
220 * Special resources that don't need to be declared. They map to the
221 * GLOBAL/LOCAL/PRIVATE/INPUT compute memory spaces.
223 #define TGSI_RESOURCE_GLOBAL 0x7fff
224 #define TGSI_RESOURCE_LOCAL 0x7ffe
225 #define TGSI_RESOURCE_PRIVATE 0x7ffd
226 #define TGSI_RESOURCE_INPUT 0x7ffc
228 #define TGSI_IMM_FLOAT32 0
229 #define TGSI_IMM_UINT32 1
230 #define TGSI_IMM_INT32 2
232 struct tgsi_immediate
234 unsigned Type
: 4; /**< TGSI_TOKEN_TYPE_IMMEDIATE */
235 unsigned NrTokens
: 14; /**< UINT */
236 unsigned DataType
: 4; /**< one of TGSI_IMM_x */
237 unsigned Padding
: 10;
240 union tgsi_immediate_data
247 #define TGSI_PROPERTY_GS_INPUT_PRIM 0
248 #define TGSI_PROPERTY_GS_OUTPUT_PRIM 1
249 #define TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES 2
250 #define TGSI_PROPERTY_FS_COORD_ORIGIN 3
251 #define TGSI_PROPERTY_FS_COORD_PIXEL_CENTER 4
252 #define TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS 5
253 #define TGSI_PROPERTY_FS_DEPTH_LAYOUT 6
254 #define TGSI_PROPERTY_VS_PROHIBIT_UCPS 7
255 #define TGSI_PROPERTY_GS_INVOCATIONS 8
256 #define TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION 9
257 #define TGSI_PROPERTY_COUNT 10
259 struct tgsi_property
{
260 unsigned Type
: 4; /**< TGSI_TOKEN_TYPE_PROPERTY */
261 unsigned NrTokens
: 8; /**< UINT */
262 unsigned PropertyName
: 8; /**< one of TGSI_PROPERTY */
263 unsigned Padding
: 12;
266 #define TGSI_FS_COORD_ORIGIN_UPPER_LEFT 0
267 #define TGSI_FS_COORD_ORIGIN_LOWER_LEFT 1
269 #define TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER 0
270 #define TGSI_FS_COORD_PIXEL_CENTER_INTEGER 1
272 #define TGSI_FS_DEPTH_LAYOUT_NONE 0
273 #define TGSI_FS_DEPTH_LAYOUT_ANY 1
274 #define TGSI_FS_DEPTH_LAYOUT_GREATER 2
275 #define TGSI_FS_DEPTH_LAYOUT_LESS 3
276 #define TGSI_FS_DEPTH_LAYOUT_UNCHANGED 4
279 struct tgsi_property_data
{
285 * For more information on semantics of opcodes and
286 * which APIs are known to use which opcodes, see
287 * gallium/docs/source/tgsi.rst
289 #define TGSI_OPCODE_ARL 0
290 #define TGSI_OPCODE_MOV 1
291 #define TGSI_OPCODE_LIT 2
292 #define TGSI_OPCODE_RCP 3
293 #define TGSI_OPCODE_RSQ 4
294 #define TGSI_OPCODE_EXP 5
295 #define TGSI_OPCODE_LOG 6
296 #define TGSI_OPCODE_MUL 7
297 #define TGSI_OPCODE_ADD 8
298 #define TGSI_OPCODE_DP3 9
299 #define TGSI_OPCODE_DP4 10
300 #define TGSI_OPCODE_DST 11
301 #define TGSI_OPCODE_MIN 12
302 #define TGSI_OPCODE_MAX 13
303 #define TGSI_OPCODE_SLT 14
304 #define TGSI_OPCODE_SGE 15
305 #define TGSI_OPCODE_MAD 16
306 #define TGSI_OPCODE_SUB 17
307 #define TGSI_OPCODE_LRP 18
309 #define TGSI_OPCODE_SQRT 20
310 #define TGSI_OPCODE_DP2A 21
312 #define TGSI_OPCODE_FRC 24
313 #define TGSI_OPCODE_CLAMP 25
314 #define TGSI_OPCODE_FLR 26
315 #define TGSI_OPCODE_ROUND 27
316 #define TGSI_OPCODE_EX2 28
317 #define TGSI_OPCODE_LG2 29
318 #define TGSI_OPCODE_POW 30
319 #define TGSI_OPCODE_XPD 31
321 #define TGSI_OPCODE_ABS 33
323 #define TGSI_OPCODE_DPH 35
324 #define TGSI_OPCODE_COS 36
325 #define TGSI_OPCODE_DDX 37
326 #define TGSI_OPCODE_DDY 38
327 #define TGSI_OPCODE_KILL 39 /* unconditional */
328 #define TGSI_OPCODE_PK2H 40
329 #define TGSI_OPCODE_PK2US 41
330 #define TGSI_OPCODE_PK4B 42
331 #define TGSI_OPCODE_PK4UB 43
333 #define TGSI_OPCODE_SEQ 45
335 #define TGSI_OPCODE_SGT 47
336 #define TGSI_OPCODE_SIN 48
337 #define TGSI_OPCODE_SLE 49
338 #define TGSI_OPCODE_SNE 50
340 #define TGSI_OPCODE_TEX 52
341 #define TGSI_OPCODE_TXD 53
342 #define TGSI_OPCODE_TXP 54
343 #define TGSI_OPCODE_UP2H 55
344 #define TGSI_OPCODE_UP2US 56
345 #define TGSI_OPCODE_UP4B 57
346 #define TGSI_OPCODE_UP4UB 58
348 #define TGSI_OPCODE_ARR 61
350 #define TGSI_OPCODE_CAL 63
351 #define TGSI_OPCODE_RET 64
352 #define TGSI_OPCODE_SSG 65 /* SGN */
353 #define TGSI_OPCODE_CMP 66
354 #define TGSI_OPCODE_SCS 67
355 #define TGSI_OPCODE_TXB 68
357 #define TGSI_OPCODE_DIV 70
358 #define TGSI_OPCODE_DP2 71
359 #define TGSI_OPCODE_TXL 72
360 #define TGSI_OPCODE_BRK 73
361 #define TGSI_OPCODE_IF 74
362 #define TGSI_OPCODE_UIF 75
363 #define TGSI_OPCODE_ELSE 77
364 #define TGSI_OPCODE_ENDIF 78
366 #define TGSI_OPCODE_DDX_FINE 79
367 #define TGSI_OPCODE_DDY_FINE 80
369 #define TGSI_OPCODE_PUSHA 81
370 #define TGSI_OPCODE_POPA 82
371 #define TGSI_OPCODE_CEIL 83
372 #define TGSI_OPCODE_I2F 84
373 #define TGSI_OPCODE_NOT 85
374 #define TGSI_OPCODE_TRUNC 86
375 #define TGSI_OPCODE_SHL 87
377 #define TGSI_OPCODE_AND 89
378 #define TGSI_OPCODE_OR 90
379 #define TGSI_OPCODE_MOD 91
380 #define TGSI_OPCODE_XOR 92
381 #define TGSI_OPCODE_SAD 93
382 #define TGSI_OPCODE_TXF 94
383 #define TGSI_OPCODE_TXQ 95
384 #define TGSI_OPCODE_CONT 96
385 #define TGSI_OPCODE_EMIT 97
386 #define TGSI_OPCODE_ENDPRIM 98
387 #define TGSI_OPCODE_BGNLOOP 99
388 #define TGSI_OPCODE_BGNSUB 100
389 #define TGSI_OPCODE_ENDLOOP 101
390 #define TGSI_OPCODE_ENDSUB 102
391 #define TGSI_OPCODE_TXQ_LZ 103 /* TXQ for mipmap level 0 */
393 #define TGSI_OPCODE_NOP 107
395 #define TGSI_OPCODE_FSEQ 108
396 #define TGSI_OPCODE_FSGE 109
397 #define TGSI_OPCODE_FSLT 110
398 #define TGSI_OPCODE_FSNE 111
401 #define TGSI_OPCODE_CALLNZ 113
403 #define TGSI_OPCODE_BREAKC 115
404 #define TGSI_OPCODE_KILL_IF 116 /* conditional kill */
405 #define TGSI_OPCODE_END 117 /* aka HALT */
407 #define TGSI_OPCODE_F2I 119
408 #define TGSI_OPCODE_IDIV 120
409 #define TGSI_OPCODE_IMAX 121
410 #define TGSI_OPCODE_IMIN 122
411 #define TGSI_OPCODE_INEG 123
412 #define TGSI_OPCODE_ISGE 124
413 #define TGSI_OPCODE_ISHR 125
414 #define TGSI_OPCODE_ISLT 126
415 #define TGSI_OPCODE_F2U 127
416 #define TGSI_OPCODE_U2F 128
417 #define TGSI_OPCODE_UADD 129
418 #define TGSI_OPCODE_UDIV 130
419 #define TGSI_OPCODE_UMAD 131
420 #define TGSI_OPCODE_UMAX 132
421 #define TGSI_OPCODE_UMIN 133
422 #define TGSI_OPCODE_UMOD 134
423 #define TGSI_OPCODE_UMUL 135
424 #define TGSI_OPCODE_USEQ 136
425 #define TGSI_OPCODE_USGE 137
426 #define TGSI_OPCODE_USHR 138
427 #define TGSI_OPCODE_USLT 139
428 #define TGSI_OPCODE_USNE 140
429 #define TGSI_OPCODE_SWITCH 141
430 #define TGSI_OPCODE_CASE 142
431 #define TGSI_OPCODE_DEFAULT 143
432 #define TGSI_OPCODE_ENDSWITCH 144
434 /* resource related opcodes */
435 #define TGSI_OPCODE_SAMPLE 145
436 #define TGSI_OPCODE_SAMPLE_I 146
437 #define TGSI_OPCODE_SAMPLE_I_MS 147
438 #define TGSI_OPCODE_SAMPLE_B 148
439 #define TGSI_OPCODE_SAMPLE_C 149
440 #define TGSI_OPCODE_SAMPLE_C_LZ 150
441 #define TGSI_OPCODE_SAMPLE_D 151
442 #define TGSI_OPCODE_SAMPLE_L 152
443 #define TGSI_OPCODE_GATHER4 153
444 #define TGSI_OPCODE_SVIEWINFO 154
445 #define TGSI_OPCODE_SAMPLE_POS 155
446 #define TGSI_OPCODE_SAMPLE_INFO 156
448 #define TGSI_OPCODE_UARL 157
449 #define TGSI_OPCODE_UCMP 158
450 #define TGSI_OPCODE_IABS 159
451 #define TGSI_OPCODE_ISSG 160
453 #define TGSI_OPCODE_LOAD 161
454 #define TGSI_OPCODE_STORE 162
456 #define TGSI_OPCODE_MFENCE 163
457 #define TGSI_OPCODE_LFENCE 164
458 #define TGSI_OPCODE_SFENCE 165
459 #define TGSI_OPCODE_BARRIER 166
461 #define TGSI_OPCODE_ATOMUADD 167
462 #define TGSI_OPCODE_ATOMXCHG 168
463 #define TGSI_OPCODE_ATOMCAS 169
464 #define TGSI_OPCODE_ATOMAND 170
465 #define TGSI_OPCODE_ATOMOR 171
466 #define TGSI_OPCODE_ATOMXOR 172
467 #define TGSI_OPCODE_ATOMUMIN 173
468 #define TGSI_OPCODE_ATOMUMAX 174
469 #define TGSI_OPCODE_ATOMIMIN 175
470 #define TGSI_OPCODE_ATOMIMAX 176
472 /* to be used for shadow cube map compares */
473 #define TGSI_OPCODE_TEX2 177
474 #define TGSI_OPCODE_TXB2 178
475 #define TGSI_OPCODE_TXL2 179
477 #define TGSI_OPCODE_IMUL_HI 180
478 #define TGSI_OPCODE_UMUL_HI 181
480 #define TGSI_OPCODE_TG4 182
482 #define TGSI_OPCODE_LODQ 183
484 #define TGSI_OPCODE_IBFE 184
485 #define TGSI_OPCODE_UBFE 185
486 #define TGSI_OPCODE_BFI 186
487 #define TGSI_OPCODE_BREV 187
488 #define TGSI_OPCODE_POPC 188
489 #define TGSI_OPCODE_LSB 189
490 #define TGSI_OPCODE_IMSB 190
491 #define TGSI_OPCODE_UMSB 191
493 #define TGSI_OPCODE_INTERP_CENTROID 192
494 #define TGSI_OPCODE_INTERP_SAMPLE 193
495 #define TGSI_OPCODE_INTERP_OFFSET 194
497 #define TGSI_OPCODE_LAST 195
499 #define TGSI_SAT_NONE 0 /* do not saturate */
500 #define TGSI_SAT_ZERO_ONE 1 /* clamp to [0,1] */
501 #define TGSI_SAT_MINUS_PLUS_ONE 2 /* clamp to [-1,1] */
504 * Opcode is the operation code to execute. A given operation defines the
505 * semantics how the source registers (if any) are interpreted and what is
506 * written to the destination registers (if any) as a result of execution.
508 * NumDstRegs and NumSrcRegs is the number of destination and source registers,
509 * respectively. For a given operation code, those numbers are fixed and are
510 * present here only for convenience.
512 * If Predicate is TRUE, tgsi_instruction_predicate token immediately follows.
514 * Saturate controls how are final results in destination registers modified.
517 struct tgsi_instruction
519 unsigned Type
: 4; /* TGSI_TOKEN_TYPE_INSTRUCTION */
520 unsigned NrTokens
: 8; /* UINT */
521 unsigned Opcode
: 8; /* TGSI_OPCODE_ */
522 unsigned Saturate
: 2; /* TGSI_SAT_ */
523 unsigned NumDstRegs
: 2; /* UINT */
524 unsigned NumSrcRegs
: 4; /* UINT */
525 unsigned Predicate
: 1; /* BOOL */
527 unsigned Texture
: 1;
528 unsigned Padding
: 1;
532 * If tgsi_instruction::Label is TRUE, tgsi_instruction_label follows.
534 * If tgsi_instruction::Texture is TRUE, tgsi_instruction_texture follows.
535 * if texture instruction has a number of offsets,
536 * then tgsi_instruction::Texture::NumOffset of tgsi_texture_offset follow.
538 * Then, tgsi_instruction::NumDstRegs of tgsi_dst_register follow.
540 * Then, tgsi_instruction::NumSrcRegs of tgsi_src_register follow.
542 * tgsi_instruction::NrTokens contains the total number of words that make the
543 * instruction, including the instruction word.
546 #define TGSI_SWIZZLE_X 0
547 #define TGSI_SWIZZLE_Y 1
548 #define TGSI_SWIZZLE_Z 2
549 #define TGSI_SWIZZLE_W 3
551 struct tgsi_instruction_label
553 unsigned Label
: 24; /* UINT */
554 unsigned Padding
: 8;
557 #define TGSI_TEXTURE_BUFFER 0
558 #define TGSI_TEXTURE_1D 1
559 #define TGSI_TEXTURE_2D 2
560 #define TGSI_TEXTURE_3D 3
561 #define TGSI_TEXTURE_CUBE 4
562 #define TGSI_TEXTURE_RECT 5
563 #define TGSI_TEXTURE_SHADOW1D 6
564 #define TGSI_TEXTURE_SHADOW2D 7
565 #define TGSI_TEXTURE_SHADOWRECT 8
566 #define TGSI_TEXTURE_1D_ARRAY 9
567 #define TGSI_TEXTURE_2D_ARRAY 10
568 #define TGSI_TEXTURE_SHADOW1D_ARRAY 11
569 #define TGSI_TEXTURE_SHADOW2D_ARRAY 12
570 #define TGSI_TEXTURE_SHADOWCUBE 13
571 #define TGSI_TEXTURE_2D_MSAA 14
572 #define TGSI_TEXTURE_2D_ARRAY_MSAA 15
573 #define TGSI_TEXTURE_CUBE_ARRAY 16
574 #define TGSI_TEXTURE_SHADOWCUBE_ARRAY 17
575 #define TGSI_TEXTURE_UNKNOWN 18
576 #define TGSI_TEXTURE_COUNT 19
578 struct tgsi_instruction_texture
580 unsigned Texture
: 8; /* TGSI_TEXTURE_ */
581 unsigned NumOffsets
: 4;
582 unsigned Padding
: 20;
585 /* for texture offsets in GLSL and DirectX.
586 * Generally these always come from TGSI_FILE_IMMEDIATE,
587 * however DX11 appears to have the capability to do
588 * non-constant texture offsets.
590 struct tgsi_texture_offset
593 unsigned File
: 4; /**< one of TGSI_FILE_x */
594 unsigned SwizzleX
: 2; /* TGSI_SWIZZLE_x */
595 unsigned SwizzleY
: 2; /* TGSI_SWIZZLE_x */
596 unsigned SwizzleZ
: 2; /* TGSI_SWIZZLE_x */
597 unsigned Padding
: 6;
601 * For SM3, the following constraint applies.
602 * - Swizzle is either set to identity or replicate.
604 struct tgsi_instruction_predicate
606 int Index
: 16; /* SINT */
607 unsigned SwizzleX
: 2; /* TGSI_SWIZZLE_x */
608 unsigned SwizzleY
: 2; /* TGSI_SWIZZLE_x */
609 unsigned SwizzleZ
: 2; /* TGSI_SWIZZLE_x */
610 unsigned SwizzleW
: 2; /* TGSI_SWIZZLE_x */
611 unsigned Negate
: 1; /* BOOL */
612 unsigned Padding
: 7;
616 * File specifies the register array to access.
618 * Index specifies the element number of a register in the register file.
620 * If Indirect is TRUE, Index should be offset by the X component of the indirect
621 * register that follows. The register can be now fetched into local storage
622 * for further processing.
624 * If Negate is TRUE, all components of the fetched register are negated.
626 * The fetched register components are swizzled according to SwizzleX, SwizzleY,
627 * SwizzleZ and SwizzleW.
631 struct tgsi_src_register
633 unsigned File
: 4; /* TGSI_FILE_ */
634 unsigned Indirect
: 1; /* BOOL */
635 unsigned Dimension
: 1; /* BOOL */
636 int Index
: 16; /* SINT */
637 unsigned SwizzleX
: 2; /* TGSI_SWIZZLE_ */
638 unsigned SwizzleY
: 2; /* TGSI_SWIZZLE_ */
639 unsigned SwizzleZ
: 2; /* TGSI_SWIZZLE_ */
640 unsigned SwizzleW
: 2; /* TGSI_SWIZZLE_ */
641 unsigned Absolute
: 1; /* BOOL */
642 unsigned Negate
: 1; /* BOOL */
646 * If tgsi_src_register::Indirect is TRUE, tgsi_ind_register follows.
648 * File, Index and Swizzle are handled the same as in tgsi_src_register.
650 * If ArrayID is zero the whole register file might be is indirectly addressed,
651 * if not only the Declaration with this ArrayID is accessed by this operand.
655 struct tgsi_ind_register
657 unsigned File
: 4; /* TGSI_FILE_ */
658 int Index
: 16; /* SINT */
659 unsigned Swizzle
: 2; /* TGSI_SWIZZLE_ */
660 unsigned ArrayID
: 10; /* UINT */
664 * If tgsi_src_register::Dimension is TRUE, tgsi_dimension follows.
667 struct tgsi_dimension
669 unsigned Indirect
: 1; /* BOOL */
670 unsigned Dimension
: 1; /* BOOL */
671 unsigned Padding
: 14;
672 int Index
: 16; /* SINT */
675 struct tgsi_dst_register
677 unsigned File
: 4; /* TGSI_FILE_ */
678 unsigned WriteMask
: 4; /* TGSI_WRITEMASK_ */
679 unsigned Indirect
: 1; /* BOOL */
680 unsigned Dimension
: 1; /* BOOL */
681 int Index
: 16; /* SINT */
682 unsigned Padding
: 6;
690 #endif /* P_SHADER_TOKENS_H */