1 /**************************************************************************
3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
35 #include "p_compiler.h"
39 unsigned MajorVersion : 8;
40 unsigned MinorVersion : 8;
41 unsigned Padding : 16;
46 unsigned HeaderSize : 8;
47 unsigned BodySize : 24;
50 #define TGSI_PROCESSOR_FRAGMENT 0
51 #define TGSI_PROCESSOR_VERTEX 1
52 #define TGSI_PROCESSOR_GEOMETRY 2
56 unsigned Processor : 4; /* TGSI_PROCESSOR_ */
57 unsigned Padding : 28;
60 #define TGSI_TOKEN_TYPE_DECLARATION 0
61 #define TGSI_TOKEN_TYPE_IMMEDIATE 1
62 #define TGSI_TOKEN_TYPE_INSTRUCTION 2
66 unsigned Type : 4; /**< TGSI_TOKEN_TYPE_x */
67 unsigned NrTokens : 8; /**< UINT */
68 unsigned Padding : 19;
69 unsigned Extended : 1; /**< BOOL */
74 TGSI_FILE_CONSTANT =1,
77 TGSI_FILE_TEMPORARY =4,
80 TGSI_FILE_IMMEDIATE =7,
82 TGSI_FILE_COUNT /**< how many TGSI_FILE_ types */
86 #define TGSI_WRITEMASK_NONE 0x00
87 #define TGSI_WRITEMASK_X 0x01
88 #define TGSI_WRITEMASK_Y 0x02
89 #define TGSI_WRITEMASK_XY 0x03
90 #define TGSI_WRITEMASK_Z 0x04
91 #define TGSI_WRITEMASK_XZ 0x05
92 #define TGSI_WRITEMASK_YZ 0x06
93 #define TGSI_WRITEMASK_XYZ 0x07
94 #define TGSI_WRITEMASK_W 0x08
95 #define TGSI_WRITEMASK_XW 0x09
96 #define TGSI_WRITEMASK_YW 0x0A
97 #define TGSI_WRITEMASK_XYW 0x0B
98 #define TGSI_WRITEMASK_ZW 0x0C
99 #define TGSI_WRITEMASK_XZW 0x0D
100 #define TGSI_WRITEMASK_YZW 0x0E
101 #define TGSI_WRITEMASK_XYZW 0x0F
103 #define TGSI_INTERPOLATE_CONSTANT 0
104 #define TGSI_INTERPOLATE_LINEAR 1
105 #define TGSI_INTERPOLATE_PERSPECTIVE 2
106 #define TGSI_INTERPOLATE_COUNT 3
108 struct tgsi_declaration
110 unsigned Type : 4; /**< TGSI_TOKEN_TYPE_DECLARATION */
111 unsigned NrTokens : 8; /**< UINT */
112 unsigned File : 4; /**< one of TGSI_FILE_x */
113 unsigned UsageMask : 4; /**< bitmask of TGSI_WRITEMASK_x flags */
114 unsigned Interpolate : 4; /**< one of TGSI_INTERPOLATE_x */
115 unsigned Semantic : 1; /**< BOOL, any semantic info? */
116 unsigned Centroid : 1; /**< centroid sampling? */
117 unsigned Invariant : 1; /**< invariant optimization? */
118 unsigned Padding : 4;
119 unsigned Extended : 1; /**< BOOL */
122 struct tgsi_declaration_range
124 unsigned First : 16; /**< UINT */
125 unsigned Last : 16; /**< UINT */
128 #define TGSI_SEMANTIC_POSITION 0
129 #define TGSI_SEMANTIC_COLOR 1
130 #define TGSI_SEMANTIC_BCOLOR 2 /**< back-face color */
131 #define TGSI_SEMANTIC_FOG 3
132 #define TGSI_SEMANTIC_PSIZE 4
133 #define TGSI_SEMANTIC_GENERIC 5
134 #define TGSI_SEMANTIC_NORMAL 6
135 #define TGSI_SEMANTIC_FACE 7
136 #define TGSI_SEMANTIC_COUNT 8 /**< number of semantic values */
138 struct tgsi_declaration_semantic
140 unsigned SemanticName : 8; /**< one of TGSI_SEMANTIC_x */
141 unsigned SemanticIndex : 16; /**< UINT */
142 unsigned Padding : 8;
145 #define TGSI_IMM_FLOAT32 0
147 struct tgsi_immediate
149 unsigned Type : 4; /**< TGSI_TOKEN_TYPE_IMMEDIATE */
150 unsigned NrTokens : 8; /**< UINT */
151 unsigned DataType : 4; /**< one of TGSI_IMM_x */
152 unsigned Padding : 15;
153 unsigned Extended : 1; /**< BOOL */
156 union tgsi_immediate_data
163 * For more information on semantics of opcodes and
164 * which APIs are known to use which opcodes, see
165 * auxiliary/tgsi/tgsi-instruction-set.txt
167 #define TGSI_OPCODE_ARL 0
168 #define TGSI_OPCODE_MOV 1
169 #define TGSI_OPCODE_LIT 2
170 #define TGSI_OPCODE_RCP 3
171 #define TGSI_OPCODE_RSQ 4
172 #define TGSI_OPCODE_EXP 5
173 #define TGSI_OPCODE_LOG 6
174 #define TGSI_OPCODE_MUL 7
175 #define TGSI_OPCODE_ADD 8
176 #define TGSI_OPCODE_DP3 9
177 #define TGSI_OPCODE_DP4 10
178 #define TGSI_OPCODE_DST 11
179 #define TGSI_OPCODE_MIN 12
180 #define TGSI_OPCODE_MAX 13
181 #define TGSI_OPCODE_SLT 14
182 #define TGSI_OPCODE_SGE 15
183 #define TGSI_OPCODE_MAD 16
184 #define TGSI_OPCODE_SUB 17
185 #define TGSI_OPCODE_LRP 18
186 #define TGSI_OPCODE_CND 19
188 #define TGSI_OPCODE_DP2A 21
190 #define TGSI_OPCODE_FRC 24
191 #define TGSI_OPCODE_CLAMP 25
192 #define TGSI_OPCODE_FLR 26
193 #define TGSI_OPCODE_ROUND 27
194 #define TGSI_OPCODE_EX2 28
195 #define TGSI_OPCODE_LG2 29
196 #define TGSI_OPCODE_POW 30
197 #define TGSI_OPCODE_XPD 31
199 #define TGSI_OPCODE_ABS 33
200 #define TGSI_OPCODE_RCC 34
201 #define TGSI_OPCODE_DPH 35
202 #define TGSI_OPCODE_COS 36
203 #define TGSI_OPCODE_DDX 37
204 #define TGSI_OPCODE_DDY 38
205 #define TGSI_OPCODE_KILP 39 /* predicated kill */
206 #define TGSI_OPCODE_PK2H 40
207 #define TGSI_OPCODE_PK2US 41
208 #define TGSI_OPCODE_PK4B 42
209 #define TGSI_OPCODE_PK4UB 43
210 #define TGSI_OPCODE_RFL 44
211 #define TGSI_OPCODE_SEQ 45
212 #define TGSI_OPCODE_SFL 46
213 #define TGSI_OPCODE_SGT 47
214 #define TGSI_OPCODE_SIN 48
215 #define TGSI_OPCODE_SLE 49
216 #define TGSI_OPCODE_SNE 50
217 #define TGSI_OPCODE_STR 51
218 #define TGSI_OPCODE_TEX 52
219 #define TGSI_OPCODE_TXD 53
220 #define TGSI_OPCODE_TXP 54
221 #define TGSI_OPCODE_UP2H 55
222 #define TGSI_OPCODE_UP2US 56
223 #define TGSI_OPCODE_UP4B 57
224 #define TGSI_OPCODE_UP4UB 58
225 #define TGSI_OPCODE_X2D 59
226 #define TGSI_OPCODE_ARA 60
227 #define TGSI_OPCODE_ARR 61
228 #define TGSI_OPCODE_BRA 62
229 #define TGSI_OPCODE_CAL 63
230 #define TGSI_OPCODE_RET 64
231 #define TGSI_OPCODE_SSG 65 /* SGN */
232 #define TGSI_OPCODE_CMP 66
233 #define TGSI_OPCODE_SCS 67
234 #define TGSI_OPCODE_TXB 68
235 #define TGSI_OPCODE_NRM 69
236 #define TGSI_OPCODE_DIV 70
237 #define TGSI_OPCODE_DP2 71
238 #define TGSI_OPCODE_TXL 72
239 #define TGSI_OPCODE_BRK 73
240 #define TGSI_OPCODE_IF 74
241 #define TGSI_OPCODE_BGNFOR 75
242 #define TGSI_OPCODE_REP 76
243 #define TGSI_OPCODE_ELSE 77
244 #define TGSI_OPCODE_ENDIF 78
245 #define TGSI_OPCODE_ENDFOR 79
246 #define TGSI_OPCODE_ENDREP 80
247 #define TGSI_OPCODE_PUSHA 81
248 #define TGSI_OPCODE_POPA 82
249 #define TGSI_OPCODE_CEIL 83
250 #define TGSI_OPCODE_I2F 84
251 #define TGSI_OPCODE_NOT 85
252 #define TGSI_OPCODE_TRUNC 86
253 #define TGSI_OPCODE_SHL 87
254 #define TGSI_OPCODE_SHR 88
255 #define TGSI_OPCODE_AND 89
256 #define TGSI_OPCODE_OR 90
257 #define TGSI_OPCODE_MOD 91
258 #define TGSI_OPCODE_XOR 92
259 #define TGSI_OPCODE_SAD 93
260 #define TGSI_OPCODE_TXF 94
261 #define TGSI_OPCODE_TXQ 95
262 #define TGSI_OPCODE_CONT 96
263 #define TGSI_OPCODE_EMIT 97
264 #define TGSI_OPCODE_ENDPRIM 98
265 #define TGSI_OPCODE_BGNLOOP 99
266 #define TGSI_OPCODE_BGNSUB 100
267 #define TGSI_OPCODE_ENDLOOP 101
268 #define TGSI_OPCODE_ENDSUB 102
269 #define TGSI_OPCODE_NOISE1 103
270 #define TGSI_OPCODE_NOISE2 104
271 #define TGSI_OPCODE_NOISE3 105
272 #define TGSI_OPCODE_NOISE4 106
273 #define TGSI_OPCODE_NOP 107
275 #define TGSI_OPCODE_NRM4 112
276 #define TGSI_OPCODE_CALLNZ 113
277 #define TGSI_OPCODE_IFC 114
278 #define TGSI_OPCODE_BREAKC 115
279 #define TGSI_OPCODE_KIL 116 /* conditional kill */
280 #define TGSI_OPCODE_END 117 /* aka HALT */
281 #define TGSI_OPCODE_SWZ 118
282 #define TGSI_OPCODE_LAST 119
284 #define TGSI_SAT_NONE 0 /* do not saturate */
285 #define TGSI_SAT_ZERO_ONE 1 /* clamp to [0,1] */
286 #define TGSI_SAT_MINUS_PLUS_ONE 2 /* clamp to [-1,1] */
289 * Opcode is the operation code to execute. A given operation defines the
290 * semantics how the source registers (if any) are interpreted and what is
291 * written to the destination registers (if any) as a result of execution.
293 * NumDstRegs and NumSrcRegs is the number of destination and source registers,
294 * respectively. For a given operation code, those numbers are fixed and are
295 * present here only for convenience.
297 * If Extended is TRUE, it is now executed.
299 * Saturate controls how are final results in destination registers modified.
302 struct tgsi_instruction
304 unsigned Type : 4; /* TGSI_TOKEN_TYPE_INSTRUCTION */
305 unsigned NrTokens : 8; /* UINT */
306 unsigned Opcode : 8; /* TGSI_OPCODE_ */
307 unsigned Saturate : 2; /* TGSI_SAT_ */
308 unsigned NumDstRegs : 2; /* UINT */
309 unsigned NumSrcRegs : 4; /* UINT */
310 unsigned Padding : 3;
311 unsigned Extended : 1; /* BOOL */
315 * If tgsi_instruction::Extended is TRUE, tgsi_instruction_ext follows.
317 * Then, tgsi_instruction::NumDstRegs of tgsi_dst_register follow.
319 * Then, tgsi_instruction::NumSrcRegs of tgsi_src_register follow.
321 * tgsi_instruction::NrTokens contains the total number of words that make the
322 * instruction, including the instruction word.
325 #define TGSI_INSTRUCTION_EXT_TYPE_NV 0
326 #define TGSI_INSTRUCTION_EXT_TYPE_LABEL 1
327 #define TGSI_INSTRUCTION_EXT_TYPE_TEXTURE 2
328 #define TGSI_INSTRUCTION_EXT_TYPE_PREDICATE 3
330 struct tgsi_instruction_ext
332 unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_ */
333 unsigned Padding : 27;
334 unsigned Extended : 1; /* BOOL */
338 * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_NV, it should
339 * be cast to tgsi_instruction_ext_nv.
341 * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_LABEL, it
342 * should be cast to tgsi_instruction_ext_label.
344 * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_TEXTURE, it
345 * should be cast to tgsi_instruction_ext_texture.
347 * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_PREDICATE, it
348 * should be cast to tgsi_instruction_ext_predicate.
350 * If tgsi_instruction_ext::Extended is TRUE, another tgsi_instruction_ext
354 #define TGSI_PRECISION_DEFAULT 0
355 #define TGSI_PRECISION_FLOAT32 1
356 #define TGSI_PRECISION_FLOAT16 2
357 #define TGSI_PRECISION_FIXED12 3
368 #define TGSI_SWIZZLE_X 0
369 #define TGSI_SWIZZLE_Y 1
370 #define TGSI_SWIZZLE_Z 2
371 #define TGSI_SWIZZLE_W 3
374 * Precision controls the precision at which the operation should be executed.
376 * CondDstUpdate enables condition code register writes. When this field is
377 * TRUE, CondDstIndex specifies the index of the condition code register to
380 * CondFlowEnable enables conditional execution of the operation. When this
381 * field is TRUE, CondFlowIndex specifies the index of the condition code
382 * register to test against CondMask with component swizzle controled by
383 * CondSwizzleX, CondSwizzleY, CondSwizzleZ and CondSwizzleW. If the test fails,
384 * the operation is not executed.
387 struct tgsi_instruction_ext_nv
389 unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_NV */
390 unsigned Precision : 4; /* TGSI_PRECISION_ */
391 unsigned CondDstIndex : 4; /* UINT */
392 unsigned CondFlowIndex : 4; /* UINT */
393 unsigned CondMask : 4; /* TGSI_CC_ */
394 unsigned CondSwizzleX : 2; /* TGSI_SWIZZLE_ */
395 unsigned CondSwizzleY : 2; /* TGSI_SWIZZLE_ */
396 unsigned CondSwizzleZ : 2; /* TGSI_SWIZZLE_ */
397 unsigned CondSwizzleW : 2; /* TGSI_SWIZZLE_ */
398 unsigned CondDstUpdate : 1; /* BOOL */
399 unsigned CondFlowEnable : 1; /* BOOL */
400 unsigned Padding : 1;
401 unsigned Extended : 1; /* BOOL */
404 struct tgsi_instruction_ext_label
406 unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_LABEL */
407 unsigned Label : 24; /* UINT */
408 unsigned Padding : 3;
409 unsigned Extended : 1; /* BOOL */
412 #define TGSI_TEXTURE_UNKNOWN 0
413 #define TGSI_TEXTURE_1D 1
414 #define TGSI_TEXTURE_2D 2
415 #define TGSI_TEXTURE_3D 3
416 #define TGSI_TEXTURE_CUBE 4
417 #define TGSI_TEXTURE_RECT 5
418 #define TGSI_TEXTURE_SHADOW1D 6
419 #define TGSI_TEXTURE_SHADOW2D 7
420 #define TGSI_TEXTURE_SHADOWRECT 8
421 #define TGSI_TEXTURE_COUNT 9
423 struct tgsi_instruction_ext_texture
425 unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_TEXTURE */
426 unsigned Texture : 8; /* TGSI_TEXTURE_ */
427 unsigned Padding : 19;
428 unsigned Extended : 1; /* BOOL */
431 struct tgsi_instruction_ext_predicate
433 unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_PREDICATE */
434 unsigned PredDstIndex : 4; /* UINT */
435 unsigned PredWriteMask : 4; /* TGSI_WRITEMASK_ */
436 unsigned Padding : 19;
437 unsigned Extended : 1; /* BOOL */
441 * File specifies the register array to access.
443 * Index specifies the element number of a register in the register file.
445 * If Indirect is TRUE, Index should be offset by the X component of a source
446 * register that follows. The register can be now fetched into local storage
447 * for further processing.
449 * If Negate is TRUE, all components of the fetched register are negated.
451 * The fetched register components are swizzled according to SwizzleX, SwizzleY,
452 * SwizzleZ and SwizzleW.
454 * If Extended is TRUE, any further modifications to the source register are
455 * made to this temporary storage.
458 struct tgsi_src_register
460 unsigned File : 4; /* TGSI_FILE_ */
461 unsigned SwizzleX : 2; /* TGSI_SWIZZLE_ */
462 unsigned SwizzleY : 2; /* TGSI_SWIZZLE_ */
463 unsigned SwizzleZ : 2; /* TGSI_SWIZZLE_ */
464 unsigned SwizzleW : 2; /* TGSI_SWIZZLE_ */
465 unsigned Negate : 1; /* BOOL */
466 unsigned Indirect : 1; /* BOOL */
467 unsigned Dimension : 1; /* BOOL */
468 int Index : 16; /* SINT */
469 unsigned Extended : 1; /* BOOL */
473 * If tgsi_src_register::Extended is TRUE, tgsi_src_register_ext follows.
475 * Then, if tgsi_src_register::Indirect is TRUE, another tgsi_src_register
478 * Then, if tgsi_src_register::Dimension is TRUE, tgsi_dimension follows.
481 #define TGSI_SRC_REGISTER_EXT_TYPE_SWZ 0
482 #define TGSI_SRC_REGISTER_EXT_TYPE_MOD 1
484 struct tgsi_src_register_ext
486 unsigned Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_ */
487 unsigned Padding : 27;
488 unsigned Extended : 1; /* BOOL */
492 * If tgsi_src_register_ext::Type is TGSI_SRC_REGISTER_EXT_TYPE_SWZ,
493 * it should be cast to tgsi_src_register_ext_swz.
495 * If tgsi_src_register_ext::Type is TGSI_SRC_REGISTER_EXT_TYPE_MOD,
496 * it should be cast to tgsi_src_register_ext_mod.
498 * If tgsi_dst_register_ext::Extended is TRUE, another tgsi_dst_register_ext
502 #define TGSI_EXTSWIZZLE_X TGSI_SWIZZLE_X
503 #define TGSI_EXTSWIZZLE_Y TGSI_SWIZZLE_Y
504 #define TGSI_EXTSWIZZLE_Z TGSI_SWIZZLE_Z
505 #define TGSI_EXTSWIZZLE_W TGSI_SWIZZLE_W
506 #define TGSI_EXTSWIZZLE_ZERO 4
507 #define TGSI_EXTSWIZZLE_ONE 5
510 * ExtSwizzleX, ExtSwizzleY, ExtSwizzleZ and ExtSwizzleW swizzle the source
511 * register in an extended manner.
513 * NegateX, NegateY, NegateZ and NegateW negate individual components of the
516 * NOTE: To simplify matter, if this token is present, the corresponding Swizzle
517 * and Negate fields in tgsi_src_register should be set to X,Y,Z,W
518 * and FALSE, respectively.
521 struct tgsi_src_register_ext_swz
523 unsigned Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_SWZ */
524 unsigned ExtSwizzleX : 4; /* TGSI_EXTSWIZZLE_ */
525 unsigned ExtSwizzleY : 4; /* TGSI_EXTSWIZZLE_ */
526 unsigned ExtSwizzleZ : 4; /* TGSI_EXTSWIZZLE_ */
527 unsigned ExtSwizzleW : 4; /* TGSI_EXTSWIZZLE_ */
528 unsigned NegateX : 1; /* BOOL */
529 unsigned NegateY : 1; /* BOOL */
530 unsigned NegateZ : 1; /* BOOL */
531 unsigned NegateW : 1; /* BOOL */
532 unsigned Padding : 7;
533 unsigned Extended : 1; /* BOOL */
537 * Extra src register modifiers
539 * If Complement is TRUE, the source register is modified by subtracting it
542 * If Bias is TRUE, the source register is modified by subtracting 0.5 from it.
544 * If Scale2X is TRUE, the source register is modified by multiplying it by 2.0.
546 * If Absolute is TRUE, the source register is modified by removing the sign.
548 * If Negate is TRUE, the source register is modified by negating it.
551 struct tgsi_src_register_ext_mod
553 unsigned Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_MOD */
554 unsigned Complement : 1; /* BOOL */
555 unsigned Bias : 1; /* BOOL */
556 unsigned Scale2X : 1; /* BOOL */
557 unsigned Absolute : 1; /* BOOL */
558 unsigned Negate : 1; /* BOOL */
559 unsigned Padding : 22;
560 unsigned Extended : 1; /* BOOL */
563 struct tgsi_dimension
565 unsigned Indirect : 1; /* BOOL */
566 unsigned Dimension : 1; /* BOOL */
567 unsigned Padding : 13;
568 int Index : 16; /* SINT */
569 unsigned Extended : 1; /* BOOL */
572 struct tgsi_dst_register
574 unsigned File : 4; /* TGSI_FILE_ */
575 unsigned WriteMask : 4; /* TGSI_WRITEMASK_ */
576 unsigned Indirect : 1; /* BOOL */
577 unsigned Dimension : 1; /* BOOL */
578 int Index : 16; /* SINT */
579 unsigned Padding : 5;
580 unsigned Extended : 1; /* BOOL */
584 * If tgsi_dst_register::Extended is TRUE, tgsi_dst_register_ext follows.
586 * Then, if tgsi_dst_register::Indirect is TRUE, tgsi_src_register follows.
589 #define TGSI_DST_REGISTER_EXT_TYPE_CONDCODE 0
590 #define TGSI_DST_REGISTER_EXT_TYPE_MODULATE 1
591 #define TGSI_DST_REGISTER_EXT_TYPE_PREDICATE 2
593 struct tgsi_dst_register_ext
595 unsigned Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_ */
596 unsigned Padding : 27;
597 unsigned Extended : 1; /* BOOL */
601 * Extra destination register modifiers
603 * If tgsi_dst_register_ext::Type is TGSI_DST_REGISTER_EXT_TYPE_CONDCODE,
604 * it should be cast to tgsi_dst_register_ext_condcode.
606 * If tgsi_dst_register_ext::Type is TGSI_DST_REGISTER_EXT_TYPE_MODULATE,
607 * it should be cast to tgsi_dst_register_ext_modulate.
609 * If tgsi_dst_register_ext::Type is TGSI_DST_REGISTER_EXT_TYPE_PREDICATE,
610 * it should be cast to tgsi_dst_register_ext_predicate.
612 * If tgsi_dst_register_ext::Extended is TRUE, another tgsi_dst_register_ext
615 struct tgsi_dst_register_ext_concode
617 unsigned Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_CONDCODE */
618 unsigned CondMask : 4; /* TGSI_CC_ */
619 unsigned CondSwizzleX : 2; /* TGSI_SWIZZLE_ */
620 unsigned CondSwizzleY : 2; /* TGSI_SWIZZLE_ */
621 unsigned CondSwizzleZ : 2; /* TGSI_SWIZZLE_ */
622 unsigned CondSwizzleW : 2; /* TGSI_SWIZZLE_ */
623 unsigned CondSrcIndex : 4; /* UINT */
624 unsigned Padding : 11;
625 unsigned Extended : 1; /* BOOL */
628 #define TGSI_MODULATE_1X 0
629 #define TGSI_MODULATE_2X 1
630 #define TGSI_MODULATE_4X 2
631 #define TGSI_MODULATE_8X 3
632 #define TGSI_MODULATE_HALF 4
633 #define TGSI_MODULATE_QUARTER 5
634 #define TGSI_MODULATE_EIGHTH 6
635 #define TGSI_MODULATE_COUNT 7
637 struct tgsi_dst_register_ext_modulate
639 unsigned Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_MODULATE */
640 unsigned Modulate : 4; /* TGSI_MODULATE_ */
641 unsigned Padding : 23;
642 unsigned Extended : 1; /* BOOL */
646 * Currently, the following constraints apply.
648 * - PredSwizzleXYZW is either set to identity or replicate.
649 * - PredSrcIndex is 0.
652 struct tgsi_dst_register_ext_predicate
654 unsigned Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_PREDICATE */
655 unsigned PredSwizzleX : 2; /* TGSI_SWIZZLE_ */
656 unsigned PredSwizzleY : 2; /* TGSI_SWIZZLE_ */
657 unsigned PredSwizzleZ : 2; /* TGSI_SWIZZLE_ */
658 unsigned PredSwizzleW : 2; /* TGSI_SWIZZLE_ */
659 unsigned PredSrcIndex : 4; /* UINT */
660 unsigned Negate : 1; /* BOOL */
661 unsigned Padding : 14;
662 unsigned Extended : 1; /* BOOL */
670 #endif /* TGSI_TOKEN_H */