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 **************************************************************************/
28 #include "util/u_debug.h"
29 #include "util/u_memory.h"
30 #include "pipe/p_defines.h"
31 #include "tgsi_text.h"
32 #include "tgsi_build.h"
33 #include "tgsi_info.h"
34 #include "tgsi_parse.h"
35 #include "tgsi_sanity.h"
36 #include "tgsi_util.h"
38 static boolean
is_alpha_underscore( const char *cur
)
41 (*cur
>= 'a' && *cur
<= 'z') ||
42 (*cur
>= 'A' && *cur
<= 'Z') ||
46 static boolean
is_digit( const char *cur
)
48 return *cur
>= '0' && *cur
<= '9';
51 static boolean
is_digit_alpha_underscore( const char *cur
)
53 return is_digit( cur
) || is_alpha_underscore( cur
);
56 static boolean
uprcase( char c
)
58 if (c
>= 'a' && c
<= 'z')
59 return c
+= 'A' - 'a';
63 static boolean
str_match_no_case( const char **pcur
, const char *str
)
65 const char *cur
= *pcur
;
67 while (*str
!= '\0' && *str
== uprcase( *cur
)) {
78 /* Eat zero or more whitespaces.
80 static void eat_opt_white( const char **pcur
)
82 while (**pcur
== ' ' || **pcur
== '\t' || **pcur
== '\n')
86 /* Eat one or more whitespaces.
87 * Return TRUE if at least one whitespace eaten.
89 static boolean
eat_white( const char **pcur
)
91 const char *cur
= *pcur
;
93 eat_opt_white( pcur
);
97 /* Parse unsigned integer.
98 * No checks for overflow.
100 static boolean
parse_uint( const char **pcur
, uint
*val
)
102 const char *cur
= *pcur
;
104 if (is_digit( cur
)) {
106 while (is_digit( cur
))
107 *val
= *val
* 10 + *cur
++ - '0';
114 static boolean
parse_identifier( const char **pcur
, char *ret
)
116 const char *cur
= *pcur
;
118 if (is_alpha_underscore( cur
)) {
120 while (is_alpha_underscore( cur
))
128 /* Parse floating point.
130 static boolean
parse_float( const char **pcur
, float *val
)
132 const char *cur
= *pcur
;
133 boolean integral_part
= FALSE
;
134 boolean fractional_part
= FALSE
;
136 *val
= (float) atof( cur
);
138 if (*cur
== '-' || *cur
== '+')
140 if (is_digit( cur
)) {
142 integral_part
= TRUE
;
143 while (is_digit( cur
))
148 if (is_digit( cur
)) {
150 fractional_part
= TRUE
;
151 while (is_digit( cur
))
155 if (!integral_part
&& !fractional_part
)
157 if (uprcase( *cur
) == 'E') {
159 if (*cur
== '-' || *cur
== '+')
161 if (is_digit( cur
)) {
163 while (is_digit( cur
))
177 struct tgsi_token
*tokens
;
178 struct tgsi_token
*tokens_cur
;
179 struct tgsi_token
*tokens_end
;
180 struct tgsi_header
*header
;
183 static void report_error( struct translate_ctx
*ctx
, const char *msg
)
185 debug_printf( "\nError: %s", msg
);
188 /* Parse shader header.
189 * Return TRUE for one of the following headers.
194 static boolean
parse_header( struct translate_ctx
*ctx
)
198 if (str_match_no_case( &ctx
->cur
, "FRAG" ))
199 processor
= TGSI_PROCESSOR_FRAGMENT
;
200 else if (str_match_no_case( &ctx
->cur
, "VERT" ))
201 processor
= TGSI_PROCESSOR_VERTEX
;
202 else if (str_match_no_case( &ctx
->cur
, "GEOM" ))
203 processor
= TGSI_PROCESSOR_GEOMETRY
;
205 report_error( ctx
, "Unknown header" );
209 if (ctx
->tokens_cur
>= ctx
->tokens_end
)
211 ctx
->header
= (struct tgsi_header
*) ctx
->tokens_cur
++;
212 *ctx
->header
= tgsi_build_header();
214 if (ctx
->tokens_cur
>= ctx
->tokens_end
)
216 *(struct tgsi_processor
*) ctx
->tokens_cur
++ = tgsi_build_processor( processor
, ctx
->header
);
221 static boolean
parse_label( struct translate_ctx
*ctx
, uint
*val
)
223 const char *cur
= ctx
->cur
;
225 if (parse_uint( &cur
, val
)) {
226 eat_opt_white( &cur
);
236 static const char *file_names
[TGSI_FILE_COUNT
] =
252 parse_file( const char **pcur
, uint
*file
)
256 for (i
= 0; i
< TGSI_FILE_COUNT
; i
++) {
257 const char *cur
= *pcur
;
259 if (str_match_no_case( &cur
, file_names
[i
] )) {
260 if (!is_digit_alpha_underscore( cur
)) {
272 struct translate_ctx
*ctx
,
278 eat_opt_white( &cur
);
281 *writemask
= TGSI_WRITEMASK_NONE
;
282 eat_opt_white( &cur
);
283 if (uprcase( *cur
) == 'X') {
285 *writemask
|= TGSI_WRITEMASK_X
;
287 if (uprcase( *cur
) == 'Y') {
289 *writemask
|= TGSI_WRITEMASK_Y
;
291 if (uprcase( *cur
) == 'Z') {
293 *writemask
|= TGSI_WRITEMASK_Z
;
295 if (uprcase( *cur
) == 'W') {
297 *writemask
|= TGSI_WRITEMASK_W
;
300 if (*writemask
== TGSI_WRITEMASK_NONE
) {
301 report_error( ctx
, "Writemask expected" );
308 *writemask
= TGSI_WRITEMASK_XYZW
;
313 /* <register_file_bracket> ::= <file> `['
316 parse_register_file_bracket(
317 struct translate_ctx
*ctx
,
320 if (!parse_file( &ctx
->cur
, file
)) {
321 report_error( ctx
, "Unknown register file" );
324 eat_opt_white( &ctx
->cur
);
325 if (*ctx
->cur
!= '[') {
326 report_error( ctx
, "Expected `['" );
333 /* <register_file_bracket_index> ::= <register_file_bracket> <uint>
336 parse_register_file_bracket_index(
337 struct translate_ctx
*ctx
,
343 if (!parse_register_file_bracket( ctx
, file
))
345 eat_opt_white( &ctx
->cur
);
346 if (!parse_uint( &ctx
->cur
, &uindex
)) {
347 report_error( ctx
, "Expected literal unsigned integer" );
350 *index
= (int) uindex
;
354 /* Parse destination register operand.
355 * <register_dst> ::= <register_file_bracket_index> `]'
359 struct translate_ctx
*ctx
,
363 if (!parse_register_file_bracket_index( ctx
, file
, index
))
365 eat_opt_white( &ctx
->cur
);
366 if (*ctx
->cur
!= ']') {
367 report_error( ctx
, "Expected `]'" );
374 /* Parse source register operand.
375 * <register_src> ::= <register_file_bracket_index> `]' |
376 * <register_file_bracket> <register_dst> [`.' (`x' | `y' | `z' | `w')] `]' |
377 * <register_file_bracket> <register_dst> [`.' (`x' | `y' | `z' | `w')] `+' <uint> `]' |
378 * <register_file_bracket> <register_dst> [`.' (`x' | `y' | `z' | `w')] `-' <uint> `]'
382 struct translate_ctx
*ctx
,
392 *ind_comp
= TGSI_SWIZZLE_X
;
393 if (!parse_register_file_bracket( ctx
, file
))
395 eat_opt_white( &ctx
->cur
);
397 if (parse_file( &cur
, ind_file
)) {
398 if (!parse_register_dst( ctx
, ind_file
, ind_index
))
400 eat_opt_white( &ctx
->cur
);
402 if (*ctx
->cur
== '.') {
404 eat_opt_white(&ctx
->cur
);
406 switch (uprcase(*ctx
->cur
)) {
408 *ind_comp
= TGSI_SWIZZLE_X
;
411 *ind_comp
= TGSI_SWIZZLE_Y
;
414 *ind_comp
= TGSI_SWIZZLE_Z
;
417 *ind_comp
= TGSI_SWIZZLE_W
;
420 report_error(ctx
, "Expected indirect register swizzle component `x', `y', `z' or `w'");
424 eat_opt_white(&ctx
->cur
);
427 if (*ctx
->cur
== '+' || *ctx
->cur
== '-') {
430 negate
= *ctx
->cur
== '-';
432 eat_opt_white( &ctx
->cur
);
433 if (!parse_uint( &ctx
->cur
, &uindex
)) {
434 report_error( ctx
, "Expected literal unsigned integer" );
438 *index
= -(int) uindex
;
440 *index
= (int) uindex
;
447 if (!parse_uint( &ctx
->cur
, &uindex
)) {
448 report_error( ctx
, "Expected literal unsigned integer" );
451 *index
= (int) uindex
;
452 *ind_file
= TGSI_FILE_NULL
;
455 eat_opt_white( &ctx
->cur
);
456 if (*ctx
->cur
!= ']') {
457 report_error( ctx
, "Expected `]'" );
464 /* Parse register declaration.
465 * <register_dcl> ::= <register_file_bracket_index> `]' |
466 * <register_file_bracket_index> `..' <index> `]'
470 struct translate_ctx
*ctx
,
475 if (!parse_register_file_bracket_index( ctx
, file
, first
))
477 eat_opt_white( &ctx
->cur
);
478 if (ctx
->cur
[0] == '.' && ctx
->cur
[1] == '.') {
482 eat_opt_white( &ctx
->cur
);
483 if (!parse_uint( &ctx
->cur
, &uindex
)) {
484 report_error( ctx
, "Expected literal integer" );
487 *last
= (int) uindex
;
488 eat_opt_white( &ctx
->cur
);
493 if (*ctx
->cur
!= ']') {
494 report_error( ctx
, "Expected `]' or `..'" );
504 struct translate_ctx
*ctx
,
505 struct tgsi_full_dst_register
*dst
)
512 if (!parse_register_dst( ctx
, &file
, &index
))
516 eat_opt_white( &cur
);
518 if (!parse_opt_writemask( ctx
, &writemask
))
521 dst
->Register
.File
= file
;
522 dst
->Register
.Index
= index
;
523 dst
->Register
.WriteMask
= writemask
;
528 parse_optional_swizzle(
529 struct translate_ctx
*ctx
,
531 boolean
*parsed_swizzle
)
533 const char *cur
= ctx
->cur
;
535 *parsed_swizzle
= FALSE
;
537 eat_opt_white( &cur
);
542 eat_opt_white( &cur
);
543 for (i
= 0; i
< 4; i
++) {
544 if (uprcase( *cur
) == 'X')
545 swizzle
[i
] = TGSI_SWIZZLE_X
;
546 else if (uprcase( *cur
) == 'Y')
547 swizzle
[i
] = TGSI_SWIZZLE_Y
;
548 else if (uprcase( *cur
) == 'Z')
549 swizzle
[i
] = TGSI_SWIZZLE_Z
;
550 else if (uprcase( *cur
) == 'W')
551 swizzle
[i
] = TGSI_SWIZZLE_W
;
553 report_error( ctx
, "Expected register swizzle component `x', `y', `z', `w', `0' or `1'" );
558 *parsed_swizzle
= TRUE
;
566 struct translate_ctx
*ctx
,
567 struct tgsi_full_src_register
*src
)
575 boolean parsed_swizzle
;
577 if (*ctx
->cur
== '-') {
579 eat_opt_white( &ctx
->cur
);
580 src
->Register
.Negate
= 1;
583 if (*ctx
->cur
== '|') {
585 eat_opt_white( &ctx
->cur
);
586 src
->Register
.Absolute
= 1;
589 if (!parse_register_src(ctx
, &file
, &index
, &ind_file
, &ind_index
, &ind_comp
))
591 src
->Register
.File
= file
;
592 src
->Register
.Index
= index
;
593 if (ind_file
!= TGSI_FILE_NULL
) {
594 src
->Register
.Indirect
= 1;
595 src
->Indirect
.File
= ind_file
;
596 src
->Indirect
.Index
= ind_index
;
597 src
->Indirect
.SwizzleX
= ind_comp
;
598 src
->Indirect
.SwizzleY
= ind_comp
;
599 src
->Indirect
.SwizzleZ
= ind_comp
;
600 src
->Indirect
.SwizzleW
= ind_comp
;
603 /* Parse optional swizzle.
605 if (parse_optional_swizzle( ctx
, swizzle
, &parsed_swizzle
)) {
606 if (parsed_swizzle
) {
607 src
->Register
.SwizzleX
= swizzle
[0];
608 src
->Register
.SwizzleY
= swizzle
[1];
609 src
->Register
.SwizzleZ
= swizzle
[2];
610 src
->Register
.SwizzleW
= swizzle
[3];
614 if (src
->Register
.Absolute
) {
615 eat_opt_white( &ctx
->cur
);
616 if (*ctx
->cur
!= '|') {
617 report_error( ctx
, "Expected `|'" );
627 static const char *texture_names
[TGSI_TEXTURE_COUNT
] =
641 match_inst_mnemonic(const char **pcur
,
642 const struct tgsi_opcode_info
*info
)
644 if (str_match_no_case(pcur
, info
->mnemonic
)) {
652 struct translate_ctx
*ctx
,
656 uint saturate
= TGSI_SAT_NONE
;
657 const struct tgsi_opcode_info
*info
;
658 struct tgsi_full_instruction inst
;
661 /* Parse instruction name.
663 eat_opt_white( &ctx
->cur
);
664 for (i
= 0; i
< TGSI_OPCODE_LAST
; i
++) {
665 const char *cur
= ctx
->cur
;
667 info
= tgsi_get_opcode_info( i
);
668 if (match_inst_mnemonic(&cur
, info
)) {
669 if (str_match_no_case( &cur
, "_SATNV" ))
670 saturate
= TGSI_SAT_MINUS_PLUS_ONE
;
671 else if (str_match_no_case( &cur
, "_SAT" ))
672 saturate
= TGSI_SAT_ZERO_ONE
;
674 if (info
->num_dst
+ info
->num_src
+ info
->is_tex
== 0) {
675 if (!is_digit_alpha_underscore( cur
)) {
680 else if (*cur
== '\0' || eat_white( &cur
)) {
686 if (i
== TGSI_OPCODE_LAST
) {
688 report_error( ctx
, "Unknown opcode" );
690 report_error( ctx
, "Expected `DCL', `IMM' or a label" );
694 inst
= tgsi_default_full_instruction();
695 inst
.Instruction
.Opcode
= i
;
696 inst
.Instruction
.Saturate
= saturate
;
697 inst
.Instruction
.NumDstRegs
= info
->num_dst
;
698 inst
.Instruction
.NumSrcRegs
= info
->num_src
;
700 /* Parse instruction operands.
702 for (i
= 0; i
< info
->num_dst
+ info
->num_src
+ info
->is_tex
; i
++) {
704 eat_opt_white( &ctx
->cur
);
705 if (*ctx
->cur
!= ',') {
706 report_error( ctx
, "Expected `,'" );
710 eat_opt_white( &ctx
->cur
);
713 if (i
< info
->num_dst
) {
714 if (!parse_dst_operand( ctx
, &inst
.Dst
[i
] ))
717 else if (i
< info
->num_dst
+ info
->num_src
) {
718 if (!parse_src_operand( ctx
, &inst
.Src
[i
- info
->num_dst
] ))
724 for (j
= 0; j
< TGSI_TEXTURE_COUNT
; j
++) {
725 if (str_match_no_case( &ctx
->cur
, texture_names
[j
] )) {
726 if (!is_digit_alpha_underscore( ctx
->cur
)) {
727 inst
.Instruction
.Texture
= 1;
728 inst
.Texture
.Texture
= j
;
733 if (j
== TGSI_TEXTURE_COUNT
) {
734 report_error( ctx
, "Expected texture target" );
740 if (info
->is_branch
) {
743 eat_opt_white( &ctx
->cur
);
744 if (*ctx
->cur
!= ':') {
745 report_error( ctx
, "Expected `:'" );
749 eat_opt_white( &ctx
->cur
);
750 if (!parse_uint( &ctx
->cur
, &target
)) {
751 report_error( ctx
, "Expected a label" );
754 inst
.Instruction
.Label
= 1;
755 inst
.Label
.Label
= target
;
758 advance
= tgsi_build_full_instruction(
762 (uint
) (ctx
->tokens_end
- ctx
->tokens_cur
) );
765 ctx
->tokens_cur
+= advance
;
770 static const char *semantic_names
[TGSI_SEMANTIC_COUNT
] =
782 static const char *interpolate_names
[TGSI_INTERPOLATE_COUNT
] =
789 static boolean
parse_declaration( struct translate_ctx
*ctx
)
791 struct tgsi_full_declaration decl
;
799 assert(Elements(semantic_names
) == TGSI_SEMANTIC_COUNT
);
800 assert(Elements(interpolate_names
) == TGSI_INTERPOLATE_COUNT
);
802 if (!eat_white( &ctx
->cur
)) {
803 report_error( ctx
, "Syntax error" );
806 if (!parse_register_dcl( ctx
, &file
, &first
, &last
))
808 if (!parse_opt_writemask( ctx
, &writemask
))
811 decl
= tgsi_default_full_declaration();
812 decl
.Declaration
.File
= file
;
813 decl
.Declaration
.UsageMask
= writemask
;
814 decl
.Range
.First
= first
;
815 decl
.Range
.Last
= last
;
818 eat_opt_white( &cur
);
823 eat_opt_white( &cur
);
824 for (i
= 0; i
< TGSI_SEMANTIC_COUNT
; i
++) {
825 if (str_match_no_case( &cur
, semantic_names
[i
] )) {
826 const char *cur2
= cur
;
829 if (is_digit_alpha_underscore( cur
))
831 eat_opt_white( &cur2
);
834 eat_opt_white( &cur2
);
835 if (!parse_uint( &cur2
, &index
)) {
836 report_error( ctx
, "Expected literal integer" );
839 eat_opt_white( &cur2
);
841 report_error( ctx
, "Expected `]'" );
846 decl
.Semantic
.Index
= index
;
851 decl
.Declaration
.Semantic
= 1;
852 decl
.Semantic
.Name
= i
;
861 eat_opt_white( &cur
);
866 eat_opt_white( &cur
);
867 for (i
= 0; i
< TGSI_INTERPOLATE_COUNT
; i
++) {
868 if (str_match_no_case( &cur
, interpolate_names
[i
] )) {
869 if (is_digit_alpha_underscore( cur
))
871 decl
.Declaration
.Interpolate
= i
;
877 if (i
== TGSI_INTERPOLATE_COUNT
) {
878 report_error( ctx
, "Expected semantic or interpolate attribute" );
883 advance
= tgsi_build_full_declaration(
887 (uint
) (ctx
->tokens_end
- ctx
->tokens_cur
) );
890 ctx
->tokens_cur
+= advance
;
895 static boolean
parse_immediate( struct translate_ctx
*ctx
)
897 struct tgsi_full_immediate imm
;
902 if (!eat_white( &ctx
->cur
)) {
903 report_error( ctx
, "Syntax error" );
906 if (!str_match_no_case( &ctx
->cur
, "FLT32" ) || is_digit_alpha_underscore( ctx
->cur
)) {
907 report_error( ctx
, "Expected `FLT32'" );
910 eat_opt_white( &ctx
->cur
);
911 if (*ctx
->cur
!= '{') {
912 report_error( ctx
, "Expected `{'" );
916 for (i
= 0; i
< 4; i
++) {
917 eat_opt_white( &ctx
->cur
);
919 if (*ctx
->cur
!= ',') {
920 report_error( ctx
, "Expected `,'" );
924 eat_opt_white( &ctx
->cur
);
926 if (!parse_float( &ctx
->cur
, &values
[i
] )) {
927 report_error( ctx
, "Expected literal floating point" );
931 eat_opt_white( &ctx
->cur
);
932 if (*ctx
->cur
!= '}') {
933 report_error( ctx
, "Expected `}'" );
938 imm
= tgsi_default_full_immediate();
939 imm
.Immediate
.NrTokens
+= 4;
940 imm
.Immediate
.DataType
= TGSI_IMM_FLOAT32
;
941 imm
.u
[0].Float
= values
[0];
942 imm
.u
[1].Float
= values
[1];
943 imm
.u
[2].Float
= values
[2];
944 imm
.u
[3].Float
= values
[3];
946 advance
= tgsi_build_full_immediate(
950 (uint
) (ctx
->tokens_end
- ctx
->tokens_cur
) );
953 ctx
->tokens_cur
+= advance
;
958 static const char *property_names
[] =
960 "GS_INPUT_PRIMITIVE",
961 "GS_OUTPUT_PRIMITIVE",
962 "GS_MAX_OUTPUT_VERTICES"
965 static const char *primitive_names
[] =
980 parse_primitive( const char **pcur
, uint
*primitive
)
984 for (i
= 0; i
< PIPE_PRIM_MAX
; i
++) {
985 const char *cur
= *pcur
;
987 if (str_match_no_case( &cur
, primitive_names
[i
])) {
997 static boolean
parse_property( struct translate_ctx
*ctx
)
999 struct tgsi_full_property prop
;
1005 if (!eat_white( &ctx
->cur
)) {
1006 report_error( ctx
, "Syntax error" );
1009 if (!parse_identifier( &ctx
->cur
, id
)) {
1010 report_error( ctx
, "Syntax error" );
1013 for (property_name
= 0; property_name
< TGSI_PROPERTY_COUNT
;
1015 if (strncasecmp(id
, property_names
[property_name
],
1016 strlen(property_names
[property_name
]))) {
1020 if (property_name
>= TGSI_PROPERTY_COUNT
) {
1021 debug_printf( "\nError: Unknown property : '%s'", id
);
1025 eat_opt_white( &ctx
->cur
);
1026 switch(property_name
) {
1027 case TGSI_PROPERTY_GS_INPUT_PRIM
:
1028 case TGSI_PROPERTY_GS_OUTPUT_PRIM
:
1029 if (!parse_primitive(&ctx
->cur
, &values
[0] )) {
1030 report_error( ctx
, "Unknown primitive name as property!" );
1035 if (!parse_uint(&ctx
->cur
, &values
[0] )) {
1036 report_error( ctx
, "Expected unsigned integer as property!" );
1041 prop
= tgsi_default_full_property();
1042 prop
.Property
.PropertyName
= property_name
;
1043 prop
.Property
.NrTokens
+= 1;
1044 prop
.u
[0].Data
= values
[0];
1046 advance
= tgsi_build_full_property(
1050 (uint
) (ctx
->tokens_end
- ctx
->tokens_cur
) );
1053 ctx
->tokens_cur
+= advance
;
1059 static boolean
translate( struct translate_ctx
*ctx
)
1061 eat_opt_white( &ctx
->cur
);
1062 if (!parse_header( ctx
))
1065 while (*ctx
->cur
!= '\0') {
1067 if (!eat_white( &ctx
->cur
)) {
1068 report_error( ctx
, "Syntax error" );
1072 if (*ctx
->cur
== '\0')
1074 if (parse_label( ctx
, &label_val
)) {
1075 if (!parse_instruction( ctx
, TRUE
))
1078 else if (str_match_no_case( &ctx
->cur
, "DCL" )) {
1079 if (!parse_declaration( ctx
))
1082 else if (str_match_no_case( &ctx
->cur
, "IMM" )) {
1083 if (!parse_immediate( ctx
))
1086 else if (str_match_no_case( &ctx
->cur
, "PROPERTY" )) {
1087 if (!parse_property( ctx
))
1090 else if (!parse_instruction( ctx
, FALSE
)) {
1099 tgsi_text_translate(
1101 struct tgsi_token
*tokens
,
1104 struct translate_ctx ctx
;
1108 ctx
.tokens
= tokens
;
1109 ctx
.tokens_cur
= tokens
;
1110 ctx
.tokens_end
= tokens
+ num_tokens
;
1112 if (!translate( &ctx
))
1115 return tgsi_sanity_check( tokens
);