2 * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE.
28 #include <tgsi/tgsi_parse.h>
29 #include <tgsi/tgsi_scan.h>
30 #include "r600_shader.h"
31 #include "r600_context.h"
34 struct c_vector
**v
[TGSI_FILE_COUNT
];
35 struct tgsi_shader_info info
;
36 struct tgsi_parse_context parser
;
37 const struct tgsi_token
*tokens
;
38 struct c_shader
*shader
;
42 static unsigned tgsi_file_to_c_file(unsigned file
);
43 static unsigned tgsi_sname_to_c_sname(unsigned sname
);
44 static int tgsi_opcode_to_c_opcode(unsigned opcode
, unsigned *copcode
);
46 static int tgsi_shader_init(struct tgsi_shader
*ts
,
47 const struct tgsi_token
*tokens
,
48 struct c_shader
*shader
)
54 tgsi_scan_shader(ts
->tokens
, &ts
->info
);
55 tgsi_parse_init(&ts
->parser
, ts
->tokens
);
56 /* initialize to NULL in case of error */
57 for (i
= 0; i
< C_FILE_COUNT
; i
++) {
60 for (i
= 0; i
< TGSI_FILE_COUNT
; i
++) {
61 if (ts
->info
.file_count
[i
] > 0) {
62 ts
->v
[i
] = calloc(ts
->info
.file_count
[i
], sizeof(void*));
63 if (ts
->v
[i
] == NULL
) {
64 fprintf(stderr
, "%s:%d unsupported %d %d\n", __func__
, __LINE__
, i
, ts
->info
.file_count
[i
]);
72 static void tgsi_shader_destroy(struct tgsi_shader
*ts
)
76 for (i
= 0; i
< TGSI_FILE_COUNT
; i
++) {
79 tgsi_parse_free(&ts
->parser
);
82 static int ntransform_declaration(struct tgsi_shader
*ts
)
84 struct tgsi_full_declaration
*fd
= &ts
->parser
.FullToken
.FullDeclaration
;
91 if (fd
->Declaration
.Dimension
) {
92 fprintf(stderr
, "%s:%d unsupported\n", __func__
, __LINE__
);
95 for (i
= fd
->Range
.First
; i
<= fd
->Range
.Last
; i
++) {
97 name
= C_SEMANTIC_GENERIC
;
98 file
= tgsi_file_to_c_file(fd
->Declaration
.File
);
99 if (file
== TGSI_FILE_NULL
) {
100 fprintf(stderr
, "%s:%d unsupported\n", __func__
, __LINE__
);
103 if (fd
->Declaration
.Semantic
) {
104 name
= tgsi_sname_to_c_sname(fd
->Semantic
.Name
);
105 sid
= fd
->Semantic
.Index
;
107 v
= c_shader_vector_new(ts
->shader
, file
, name
, sid
);
109 fprintf(stderr
, "%s:%d unsupported\n", __func__
, __LINE__
);
112 ts
->v
[fd
->Declaration
.File
][i
] = v
;
117 static int ntransform_immediate(struct tgsi_shader
*ts
)
119 struct tgsi_full_immediate
*fd
= &ts
->parser
.FullToken
.FullImmediate
;
124 if (fd
->Immediate
.DataType
!= TGSI_IMM_FLOAT32
) {
125 fprintf(stderr
, "%s:%d unsupported\n", __func__
, __LINE__
);
128 name
= C_SEMANTIC_GENERIC
;
129 file
= C_FILE_IMMEDIATE
;
130 v
= c_shader_vector_new(ts
->shader
, file
, name
, 0);
132 fprintf(stderr
, "%s:%d unsupported\n", __func__
, __LINE__
);
135 v
->channel
[0]->value
= fd
->u
[0].Uint
;
136 v
->channel
[1]->value
= fd
->u
[1].Uint
;
137 v
->channel
[2]->value
= fd
->u
[2].Uint
;
138 v
->channel
[3]->value
= fd
->u
[3].Uint
;
139 ts
->v
[TGSI_FILE_IMMEDIATE
][0] = v
;
143 static int ntransform_instruction(struct tgsi_shader
*ts
)
145 struct tgsi_full_instruction
*fi
= &ts
->parser
.FullToken
.FullInstruction
;
146 struct c_shader
*shader
= ts
->shader
;
147 struct c_instruction instruction
;
151 if (fi
->Instruction
.NumDstRegs
> 1) {
152 fprintf(stderr
, "%s %d unsupported\n", __func__
, __LINE__
);
155 if (fi
->Instruction
.Saturate
) {
156 fprintf(stderr
, "%s %d unsupported\n", __func__
, __LINE__
);
159 if (fi
->Instruction
.Predicate
) {
160 fprintf(stderr
, "%s %d unsupported\n", __func__
, __LINE__
);
163 if (fi
->Instruction
.Label
) {
164 fprintf(stderr
, "%s %d unsupported\n", __func__
, __LINE__
);
167 if (fi
->Instruction
.Texture
) {
168 fprintf(stderr
, "%s %d unsupported\n", __func__
, __LINE__
);
171 for (i
= 0; i
< fi
->Instruction
.NumSrcRegs
; i
++) {
172 if (fi
->Src
[i
].Register
.Indirect
||
173 fi
->Src
[i
].Register
.Dimension
||
174 fi
->Src
[i
].Register
.Absolute
) {
175 fprintf(stderr
, "%s %d unsupported\n", __func__
, __LINE__
);
179 for (i
= 0; i
< fi
->Instruction
.NumDstRegs
; i
++) {
180 if (fi
->Dst
[i
].Register
.Indirect
|| fi
->Dst
[i
].Register
.Dimension
) {
181 fprintf(stderr
, "%s %d unsupported\n", __func__
, __LINE__
);
185 r
= tgsi_opcode_to_c_opcode(fi
->Instruction
.Opcode
, &opcode
);
187 fprintf(stderr
, "%s:%d unsupported\n", __func__
, __LINE__
);
190 if (opcode
== C_OPCODE_END
) {
191 return c_node_cfg_link(ts
->node
, &shader
->end
);
193 /* FIXME add flow instruction handling */
194 memset(&instruction
, 0, sizeof(struct c_instruction
));
195 instruction
.opcode
= opcode
;
196 instruction
.ninput
= fi
->Instruction
.NumSrcRegs
;
197 instruction
.write_mask
= fi
->Dst
[0].Register
.WriteMask
;
198 for (i
= 0; i
< fi
->Instruction
.NumSrcRegs
; i
++) {
199 instruction
.input
[i
].vector
= ts
->v
[fi
->Src
[i
].Register
.File
][fi
->Src
[i
].Register
.Index
];
200 instruction
.input
[i
].swizzle
[0] = fi
->Src
[i
].Register
.SwizzleX
;
201 instruction
.input
[i
].swizzle
[1] = fi
->Src
[i
].Register
.SwizzleY
;
202 instruction
.input
[i
].swizzle
[2] = fi
->Src
[i
].Register
.SwizzleZ
;
203 instruction
.input
[i
].swizzle
[3] = fi
->Src
[i
].Register
.SwizzleW
;
205 instruction
.output
.vector
= ts
->v
[fi
->Dst
[0].Register
.File
][fi
->Dst
[0].Register
.Index
];
206 instruction
.output
.swizzle
[0] = (fi
->Dst
[0].Register
.WriteMask
& 0x1) ? C_SWIZZLE_X
: C_SWIZZLE_D
;
207 instruction
.output
.swizzle
[1] = (fi
->Dst
[0].Register
.WriteMask
& 0x2) ? C_SWIZZLE_Y
: C_SWIZZLE_D
;
208 instruction
.output
.swizzle
[2] = (fi
->Dst
[0].Register
.WriteMask
& 0x4) ? C_SWIZZLE_Z
: C_SWIZZLE_D
;
209 instruction
.output
.swizzle
[3] = (fi
->Dst
[0].Register
.WriteMask
& 0x8) ? C_SWIZZLE_W
: C_SWIZZLE_D
;
210 return c_node_add_new_instruction(ts
->node
, &instruction
);
213 int c_shader_from_tgsi(struct c_shader
*shader
, unsigned type
,
214 const struct tgsi_token
*tokens
)
216 struct tgsi_shader ts
;
219 c_shader_init(shader
, type
);
220 r
= tgsi_shader_init(&ts
, tokens
, shader
);
224 ts
.node
= &shader
->entry
;
225 while (!tgsi_parse_end_of_tokens(&ts
.parser
)) {
226 tgsi_parse_token(&ts
.parser
);
227 switch (ts
.parser
.FullToken
.Token
.Type
) {
228 case TGSI_TOKEN_TYPE_IMMEDIATE
:
229 r
= ntransform_immediate(&ts
);
233 case TGSI_TOKEN_TYPE_DECLARATION
:
234 r
= ntransform_declaration(&ts
);
238 case TGSI_TOKEN_TYPE_INSTRUCTION
:
239 r
= ntransform_instruction(&ts
);
248 tgsi_shader_destroy(&ts
);
251 c_shader_destroy(shader
);
252 tgsi_shader_destroy(&ts
);
256 static unsigned tgsi_file_to_c_file(unsigned file
)
259 case TGSI_FILE_CONSTANT
:
260 return C_FILE_CONSTANT
;
261 case TGSI_FILE_INPUT
:
263 case TGSI_FILE_OUTPUT
:
264 return C_FILE_OUTPUT
;
265 case TGSI_FILE_TEMPORARY
:
266 return C_FILE_TEMPORARY
;
267 case TGSI_FILE_SAMPLER
:
268 return C_FILE_SAMPLER
;
269 case TGSI_FILE_ADDRESS
:
270 return C_FILE_ADDRESS
;
271 case TGSI_FILE_IMMEDIATE
:
272 return C_FILE_IMMEDIATE
;
275 case TGSI_FILE_PREDICATE
:
276 return C_FILE_PREDICATE
;
277 case TGSI_FILE_SYSTEM_VALUE
:
278 return C_FILE_SYSTEM_VALUE
;
282 fprintf(stderr
, "%s:%d unsupported file %d\n", __func__
, __LINE__
, file
);
287 static unsigned tgsi_sname_to_c_sname(unsigned sname
)
290 case TGSI_SEMANTIC_POSITION
:
291 return C_SEMANTIC_POSITION
;
292 case TGSI_SEMANTIC_COLOR
:
293 return C_SEMANTIC_COLOR
;
294 case TGSI_SEMANTIC_BCOLOR
:
295 return C_SEMANTIC_BCOLOR
;
296 case TGSI_SEMANTIC_FOG
:
297 return C_SEMANTIC_FOG
;
298 case TGSI_SEMANTIC_PSIZE
:
299 return C_SEMANTIC_PSIZE
;
300 case TGSI_SEMANTIC_GENERIC
:
301 return C_SEMANTIC_GENERIC
;
302 case TGSI_SEMANTIC_NORMAL
:
303 return C_SEMANTIC_NORMAL
;
304 case TGSI_SEMANTIC_FACE
:
305 return C_SEMANTIC_FACE
;
306 case TGSI_SEMANTIC_EDGEFLAG
:
307 return C_SEMANTIC_EDGEFLAG
;
308 case TGSI_SEMANTIC_PRIMID
:
309 return C_SEMANTIC_PRIMID
;
310 case TGSI_SEMANTIC_INSTANCEID
:
311 return C_SEMANTIC_INSTANCEID
;
313 return C_SEMANTIC_GENERIC
;
317 static int tgsi_opcode_to_c_opcode(unsigned opcode
, unsigned *copcode
)
320 case TGSI_OPCODE_MOV
:
321 *copcode
= C_OPCODE_MOV
;
323 case TGSI_OPCODE_MUL
:
324 *copcode
= C_OPCODE_MUL
;
326 case TGSI_OPCODE_MAD
:
327 *copcode
= C_OPCODE_MAD
;
329 case TGSI_OPCODE_END
:
330 *copcode
= C_OPCODE_END
;
332 case TGSI_OPCODE_ARL
:
333 *copcode
= C_OPCODE_ARL
;
335 case TGSI_OPCODE_LIT
:
336 *copcode
= C_OPCODE_LIT
;
338 case TGSI_OPCODE_RCP
:
339 *copcode
= C_OPCODE_RCP
;
341 case TGSI_OPCODE_RSQ
:
342 *copcode
= C_OPCODE_RSQ
;
344 case TGSI_OPCODE_EXP
:
345 *copcode
= C_OPCODE_EXP
;
347 case TGSI_OPCODE_LOG
:
348 *copcode
= C_OPCODE_LOG
;
350 case TGSI_OPCODE_ADD
:
351 *copcode
= C_OPCODE_ADD
;
353 case TGSI_OPCODE_DP3
:
354 *copcode
= C_OPCODE_DP3
;
356 case TGSI_OPCODE_DP4
:
357 *copcode
= C_OPCODE_DP4
;
359 case TGSI_OPCODE_DST
:
360 *copcode
= C_OPCODE_DST
;
362 case TGSI_OPCODE_MIN
:
363 *copcode
= C_OPCODE_MIN
;
365 case TGSI_OPCODE_MAX
:
366 *copcode
= C_OPCODE_MAX
;
368 case TGSI_OPCODE_SLT
:
369 *copcode
= C_OPCODE_SLT
;
371 case TGSI_OPCODE_SGE
:
372 *copcode
= C_OPCODE_SGE
;
374 case TGSI_OPCODE_SUB
:
375 *copcode
= C_OPCODE_SUB
;
377 case TGSI_OPCODE_LRP
:
378 *copcode
= C_OPCODE_LRP
;
380 case TGSI_OPCODE_CND
:
381 *copcode
= C_OPCODE_CND
;
383 case TGSI_OPCODE_DP2A
:
384 *copcode
= C_OPCODE_DP2A
;
386 case TGSI_OPCODE_FRC
:
387 *copcode
= C_OPCODE_FRC
;
389 case TGSI_OPCODE_CLAMP
:
390 *copcode
= C_OPCODE_CLAMP
;
392 case TGSI_OPCODE_FLR
:
393 *copcode
= C_OPCODE_FLR
;
395 case TGSI_OPCODE_ROUND
:
396 *copcode
= C_OPCODE_ROUND
;
398 case TGSI_OPCODE_EX2
:
399 *copcode
= C_OPCODE_EX2
;
401 case TGSI_OPCODE_LG2
:
402 *copcode
= C_OPCODE_LG2
;
404 case TGSI_OPCODE_POW
:
405 *copcode
= C_OPCODE_POW
;
407 case TGSI_OPCODE_XPD
:
408 *copcode
= C_OPCODE_XPD
;
410 case TGSI_OPCODE_ABS
:
411 *copcode
= C_OPCODE_ABS
;
413 case TGSI_OPCODE_RCC
:
414 *copcode
= C_OPCODE_RCC
;
416 case TGSI_OPCODE_DPH
:
417 *copcode
= C_OPCODE_DPH
;
419 case TGSI_OPCODE_COS
:
420 *copcode
= C_OPCODE_COS
;
422 case TGSI_OPCODE_DDX
:
423 *copcode
= C_OPCODE_DDX
;
425 case TGSI_OPCODE_DDY
:
426 *copcode
= C_OPCODE_DDY
;
428 case TGSI_OPCODE_KILP
:
429 *copcode
= C_OPCODE_KILP
;
431 case TGSI_OPCODE_PK2H
:
432 *copcode
= C_OPCODE_PK2H
;
434 case TGSI_OPCODE_PK2US
:
435 *copcode
= C_OPCODE_PK2US
;
437 case TGSI_OPCODE_PK4B
:
438 *copcode
= C_OPCODE_PK4B
;
440 case TGSI_OPCODE_PK4UB
:
441 *copcode
= C_OPCODE_PK4UB
;
443 case TGSI_OPCODE_RFL
:
444 *copcode
= C_OPCODE_RFL
;
446 case TGSI_OPCODE_SEQ
:
447 *copcode
= C_OPCODE_SEQ
;
449 case TGSI_OPCODE_SFL
:
450 *copcode
= C_OPCODE_SFL
;
452 case TGSI_OPCODE_SGT
:
453 *copcode
= C_OPCODE_SGT
;
455 case TGSI_OPCODE_SIN
:
456 *copcode
= C_OPCODE_SIN
;
458 case TGSI_OPCODE_SLE
:
459 *copcode
= C_OPCODE_SLE
;
461 case TGSI_OPCODE_SNE
:
462 *copcode
= C_OPCODE_SNE
;
464 case TGSI_OPCODE_STR
:
465 *copcode
= C_OPCODE_STR
;
467 case TGSI_OPCODE_TEX
:
468 *copcode
= C_OPCODE_TEX
;
470 case TGSI_OPCODE_TXD
:
471 *copcode
= C_OPCODE_TXD
;
473 case TGSI_OPCODE_TXP
:
474 *copcode
= C_OPCODE_TXP
;
476 case TGSI_OPCODE_UP2H
:
477 *copcode
= C_OPCODE_UP2H
;
479 case TGSI_OPCODE_UP2US
:
480 *copcode
= C_OPCODE_UP2US
;
482 case TGSI_OPCODE_UP4B
:
483 *copcode
= C_OPCODE_UP4B
;
485 case TGSI_OPCODE_UP4UB
:
486 *copcode
= C_OPCODE_UP4UB
;
488 case TGSI_OPCODE_X2D
:
489 *copcode
= C_OPCODE_X2D
;
491 case TGSI_OPCODE_ARA
:
492 *copcode
= C_OPCODE_ARA
;
494 case TGSI_OPCODE_ARR
:
495 *copcode
= C_OPCODE_ARR
;
497 case TGSI_OPCODE_BRA
:
498 *copcode
= C_OPCODE_BRA
;
500 case TGSI_OPCODE_CAL
:
501 *copcode
= C_OPCODE_CAL
;
503 case TGSI_OPCODE_RET
:
504 *copcode
= C_OPCODE_RET
;
506 case TGSI_OPCODE_SSG
:
507 *copcode
= C_OPCODE_SSG
;
509 case TGSI_OPCODE_CMP
:
510 *copcode
= C_OPCODE_CMP
;
512 case TGSI_OPCODE_SCS
:
513 *copcode
= C_OPCODE_SCS
;
515 case TGSI_OPCODE_TXB
:
516 *copcode
= C_OPCODE_TXB
;
518 case TGSI_OPCODE_NRM
:
519 *copcode
= C_OPCODE_NRM
;
521 case TGSI_OPCODE_DIV
:
522 *copcode
= C_OPCODE_DIV
;
524 case TGSI_OPCODE_DP2
:
525 *copcode
= C_OPCODE_DP2
;
527 case TGSI_OPCODE_TXL
:
528 *copcode
= C_OPCODE_TXL
;
530 case TGSI_OPCODE_BRK
:
531 *copcode
= C_OPCODE_BRK
;
534 *copcode
= C_OPCODE_IF
;
536 case TGSI_OPCODE_BGNFOR
:
537 *copcode
= C_OPCODE_BGNFOR
;
539 case TGSI_OPCODE_REP
:
540 *copcode
= C_OPCODE_REP
;
542 case TGSI_OPCODE_ELSE
:
543 *copcode
= C_OPCODE_ELSE
;
545 case TGSI_OPCODE_ENDIF
:
546 *copcode
= C_OPCODE_ENDIF
;
548 case TGSI_OPCODE_ENDFOR
:
549 *copcode
= C_OPCODE_ENDFOR
;
551 case TGSI_OPCODE_ENDREP
:
552 *copcode
= C_OPCODE_ENDREP
;
554 case TGSI_OPCODE_PUSHA
:
555 *copcode
= C_OPCODE_PUSHA
;
557 case TGSI_OPCODE_POPA
:
558 *copcode
= C_OPCODE_POPA
;
560 case TGSI_OPCODE_CEIL
:
561 *copcode
= C_OPCODE_CEIL
;
563 case TGSI_OPCODE_I2F
:
564 *copcode
= C_OPCODE_I2F
;
566 case TGSI_OPCODE_NOT
:
567 *copcode
= C_OPCODE_NOT
;
569 case TGSI_OPCODE_TRUNC
:
570 *copcode
= C_OPCODE_TRUNC
;
572 case TGSI_OPCODE_SHL
:
573 *copcode
= C_OPCODE_SHL
;
575 case TGSI_OPCODE_AND
:
576 *copcode
= C_OPCODE_AND
;
579 *copcode
= C_OPCODE_OR
;
581 case TGSI_OPCODE_MOD
:
582 *copcode
= C_OPCODE_MOD
;
584 case TGSI_OPCODE_XOR
:
585 *copcode
= C_OPCODE_XOR
;
587 case TGSI_OPCODE_SAD
:
588 *copcode
= C_OPCODE_SAD
;
590 case TGSI_OPCODE_TXF
:
591 *copcode
= C_OPCODE_TXF
;
593 case TGSI_OPCODE_TXQ
:
594 *copcode
= C_OPCODE_TXQ
;
596 case TGSI_OPCODE_CONT
:
597 *copcode
= C_OPCODE_CONT
;
599 case TGSI_OPCODE_EMIT
:
600 *copcode
= C_OPCODE_EMIT
;
602 case TGSI_OPCODE_ENDPRIM
:
603 *copcode
= C_OPCODE_ENDPRIM
;
605 case TGSI_OPCODE_BGNLOOP
:
606 *copcode
= C_OPCODE_BGNLOOP
;
608 case TGSI_OPCODE_BGNSUB
:
609 *copcode
= C_OPCODE_BGNSUB
;
611 case TGSI_OPCODE_ENDLOOP
:
612 *copcode
= C_OPCODE_ENDLOOP
;
614 case TGSI_OPCODE_ENDSUB
:
615 *copcode
= C_OPCODE_ENDSUB
;
617 case TGSI_OPCODE_NOP
:
618 *copcode
= C_OPCODE_NOP
;
620 case TGSI_OPCODE_NRM4
:
621 *copcode
= C_OPCODE_NRM4
;
623 case TGSI_OPCODE_CALLNZ
:
624 *copcode
= C_OPCODE_CALLNZ
;
626 case TGSI_OPCODE_IFC
:
627 *copcode
= C_OPCODE_IFC
;
629 case TGSI_OPCODE_BREAKC
:
630 *copcode
= C_OPCODE_BREAKC
;
632 case TGSI_OPCODE_KIL
:
633 *copcode
= C_OPCODE_KIL
;
635 case TGSI_OPCODE_F2I
:
636 *copcode
= C_OPCODE_F2I
;
638 case TGSI_OPCODE_IDIV
:
639 *copcode
= C_OPCODE_IDIV
;
641 case TGSI_OPCODE_IMAX
:
642 *copcode
= C_OPCODE_IMAX
;
644 case TGSI_OPCODE_IMIN
:
645 *copcode
= C_OPCODE_IMIN
;
647 case TGSI_OPCODE_INEG
:
648 *copcode
= C_OPCODE_INEG
;
650 case TGSI_OPCODE_ISGE
:
651 *copcode
= C_OPCODE_ISGE
;
653 case TGSI_OPCODE_ISHR
:
654 *copcode
= C_OPCODE_ISHR
;
656 case TGSI_OPCODE_ISLT
:
657 *copcode
= C_OPCODE_ISLT
;
659 case TGSI_OPCODE_F2U
:
660 *copcode
= C_OPCODE_F2U
;
662 case TGSI_OPCODE_U2F
:
663 *copcode
= C_OPCODE_U2F
;
665 case TGSI_OPCODE_UADD
:
666 *copcode
= C_OPCODE_UADD
;
668 case TGSI_OPCODE_UDIV
:
669 *copcode
= C_OPCODE_UDIV
;
671 case TGSI_OPCODE_UMAD
:
672 *copcode
= C_OPCODE_UMAD
;
674 case TGSI_OPCODE_UMAX
:
675 *copcode
= C_OPCODE_UMAX
;
677 case TGSI_OPCODE_UMIN
:
678 *copcode
= C_OPCODE_UMIN
;
680 case TGSI_OPCODE_UMOD
:
681 *copcode
= C_OPCODE_UMOD
;
683 case TGSI_OPCODE_UMUL
:
684 *copcode
= C_OPCODE_UMUL
;
686 case TGSI_OPCODE_USEQ
:
687 *copcode
= C_OPCODE_USEQ
;
689 case TGSI_OPCODE_USGE
:
690 *copcode
= C_OPCODE_USGE
;
692 case TGSI_OPCODE_USHR
:
693 *copcode
= C_OPCODE_USHR
;
695 case TGSI_OPCODE_USLT
:
696 *copcode
= C_OPCODE_USLT
;
698 case TGSI_OPCODE_USNE
:
699 *copcode
= C_OPCODE_USNE
;
701 case TGSI_OPCODE_SWITCH
:
702 *copcode
= C_OPCODE_SWITCH
;
704 case TGSI_OPCODE_CASE
:
705 *copcode
= C_OPCODE_CASE
;
707 case TGSI_OPCODE_DEFAULT
:
708 *copcode
= C_OPCODE_DEFAULT
;
710 case TGSI_OPCODE_ENDSWITCH
:
711 *copcode
= C_OPCODE_ENDSWITCH
;
714 fprintf(stderr
, "%s:%d unsupported opcode %d\n", __func__
, __LINE__
, opcode
);