.syntax translation_unit;
/* revision number - increment after each change affecting emitted output */
-.emtcode REVISION 3
+.emtcode REVISION 4
/* external declaration (or precision or invariant stmt) */
.emtcode EXTERNAL_NULL 0
.emtcode INVARIANT_STMT 4
/* precision */
-.emtcode PRECISION_LOW 0
-.emtcode PRECISION_MEDIUM 1
-.emtcode PRECISION_HIGH 2
+.emtcode PRECISION_DEFAULT 0
+.emtcode PRECISION_LOW 1
+.emtcode PRECISION_MEDIUM 2
+.emtcode PRECISION_HIGH 3
/* declaration */
.emtcode DECLARATION_FUNCTION_PROTOTYPE 1
/*
<fully_specified_type> ::= <type_specifier>
| <type_qualifier> <type_specifier>
+ | <precision> <type_specifier>
+ | <type_qualifier> <precision> <type_specifier>
*/
fully_specified_type_space
- fully_specified_type_1 .and type_specifier_space;
+ fully_specified_type_optqual .and fully_specified_type_optprec .and type_specifier_space;
fully_specified_type_nospace
- fully_specified_type_1 .and type_specifier_nospace;
-fully_specified_type_1
- fully_specified_type_2 .or .true .emit TYPE_QUALIFIER_NONE;
-fully_specified_type_2
+ fully_specified_type_optqual .and fully_specified_type_optprec .and type_specifier_nospace;
+fully_specified_type_optqual
+ fully_specified_type_qual .or .true .emit TYPE_QUALIFIER_NONE;
+fully_specified_type_qual
type_qualifier .and space;
+fully_specified_type_optprec
+ fully_specified_type_prec .or .true .emit PRECISION_DEFAULT;
+fully_specified_type_prec
+ precision .and space;
/*
<type_qualifier> ::= "const"
/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED FROM THE .syn FILE */
".syntax translation_unit;\n"
-".emtcode REVISION 3\n"
+".emtcode REVISION 4\n"
".emtcode EXTERNAL_NULL 0\n"
".emtcode EXTERNAL_FUNCTION_DEFINITION 1\n"
".emtcode EXTERNAL_DECLARATION 2\n"
".emtcode DEFAULT_PRECISION 3\n"
".emtcode INVARIANT_STMT 4\n"
-".emtcode PRECISION_LOW 0\n"
-".emtcode PRECISION_MEDIUM 1\n"
-".emtcode PRECISION_HIGH 2\n"
+".emtcode PRECISION_DEFAULT 0\n"
+".emtcode PRECISION_LOW 1\n"
+".emtcode PRECISION_MEDIUM 2\n"
+".emtcode PRECISION_HIGH 3\n"
".emtcode DECLARATION_FUNCTION_PROTOTYPE 1\n"
".emtcode DECLARATION_INIT_DECLARATOR_LIST 2\n"
".emtcode FUNCTION_ORDINARY 0\n"
"single_declaration_6\n"
" constant_expression .emit VARIABLE_ARRAY_EXPLICIT .or .true .emit VARIABLE_ARRAY_UNKNOWN;\n"
"fully_specified_type_space\n"
-" fully_specified_type_1 .and type_specifier_space;\n"
+" fully_specified_type_optqual .and fully_specified_type_optprec .and type_specifier_space;\n"
"fully_specified_type_nospace\n"
-" fully_specified_type_1 .and type_specifier_nospace;\n"
-"fully_specified_type_1\n"
-" fully_specified_type_2 .or .true .emit TYPE_QUALIFIER_NONE;\n"
-"fully_specified_type_2\n"
+" fully_specified_type_optqual .and fully_specified_type_optprec .and type_specifier_nospace;\n"
+"fully_specified_type_optqual\n"
+" fully_specified_type_qual .or .true .emit TYPE_QUALIFIER_NONE;\n"
+"fully_specified_type_qual\n"
" type_qualifier .and space;\n"
+"fully_specified_type_optprec\n"
+" fully_specified_type_prec .or .true .emit PRECISION_DEFAULT;\n"
+"fully_specified_type_prec\n"
+" precision .and space;\n"
"type_qualifier\n"
" \"const\" .emit TYPE_QUALIFIER_CONST .or\n"
" .if (shader_type == 2) \"attribute\" .emit TYPE_QUALIFIER_ATTRIBUTE .or\n"
}
/* revision number - increment after each change affecting emitted output */
-#define REVISION 3
+#define REVISION 4
static int
check_revision(slang_parse_ctx * C)
return 1;
}
+#define PRECISION_DEFAULT 0
+#define PRECISION_LOW 1
+#define PRECISION_MEDIUM 2
+#define PRECISION_HIGH 3
+
static int
parse_fully_specified_type(slang_parse_ctx * C, slang_output_ctx * O,
slang_fully_specified_type * type)
{
+ GLuint precision;
+
if (!parse_type_qualifier(C, &type->qualifier))
return 0;
+ precision = *C->I++;
if (!parse_type_specifier(C, O, &type->specifier))
return 0;
+ switch (precision) {
+ case PRECISION_DEFAULT:
+ /* TODO: Grab the default precision for the given type specifier.
+ */
+ break;
+ case PRECISION_LOW:
+ case PRECISION_MEDIUM:
+ case PRECISION_HIGH:
+ /* TODO: Translate to mesa representation.
+ */
+ break;
+ default:
+ return 0;
+ }
return 1;
}
return 1;
}
-
-#define PRECISION_LOW 0
-#define PRECISION_MEDIUM 1
-#define PRECISION_HIGH 2
-
static int
parse_default_precision(slang_parse_ctx * C, slang_output_ctx * O)
{