[Mesa-dev] [PATCH 04/11] glsl: add `unsigned int` type for EXT_GPU_shader4
Marek Olšák
maraeo at gmail.com
Wed Aug 8 05:42:01 UTC 2018
From: Marek Olšák <marek.olsak at amd.com>
---
src/compiler/glsl/glsl_lexer.ll | 2 +-
src/compiler/glsl/glsl_parser.yy | 11 ++++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/compiler/glsl/glsl_lexer.ll b/src/compiler/glsl/glsl_lexer.ll
index e24bb133bc2..65c5b414a2d 100644
--- a/src/compiler/glsl/glsl_lexer.ll
+++ b/src/compiler/glsl/glsl_lexer.ll
@@ -596,21 +596,21 @@ noinline KEYWORD(110, 100, 0, 0, NOINLINE);
public KEYWORD(110, 100, 0, 0, PUBLIC_TOK);
static KEYWORD(110, 100, 0, 0, STATIC);
extern KEYWORD(110, 100, 0, 0, EXTERN);
external KEYWORD(110, 100, 0, 0, EXTERNAL);
interface KEYWORD(110, 100, 0, 0, INTERFACE);
long KEYWORD(110, 100, 0, 0, LONG_TOK);
short KEYWORD(110, 100, 0, 0, SHORT_TOK);
double TYPE_WITH_ALT(130, 100, 130, 300, yyextra->ARB_gpu_shader_fp64_enable, glsl_type::double_type);
half KEYWORD(110, 100, 0, 0, HALF);
fixed KEYWORD(110, 100, 0, 0, FIXED_TOK);
-unsigned KEYWORD(110, 100, 0, 0, UNSIGNED);
+unsigned KEYWORD_WITH_ALT(110, 100, 0, 0, yyextra->EXT_gpu_shader4_enable, UNSIGNED);
input KEYWORD(110, 100, 0, 0, INPUT_TOK);
output KEYWORD(110, 100, 0, 0, OUTPUT);
hvec2 KEYWORD(110, 100, 0, 0, HVEC2);
hvec3 KEYWORD(110, 100, 0, 0, HVEC3);
hvec4 KEYWORD(110, 100, 0, 0, HVEC4);
dvec2 TYPE_WITH_ALT(110, 100, 400, 0, yyextra->ARB_gpu_shader_fp64_enable, glsl_type::dvec2_type);
dvec3 TYPE_WITH_ALT(110, 100, 400, 0, yyextra->ARB_gpu_shader_fp64_enable, glsl_type::dvec3_type);
dvec4 TYPE_WITH_ALT(110, 100, 400, 0, yyextra->ARB_gpu_shader_fp64_enable, glsl_type::dvec4_type);
dmat2 TYPE_WITH_ALT(110, 100, 400, 0, yyextra->ARB_gpu_shader_fp64_enable, glsl_type::dmat2_type);
dmat3 TYPE_WITH_ALT(110, 100, 400, 0, yyextra->ARB_gpu_shader_fp64_enable, glsl_type::dmat3_type);
diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
index cb7376995d2..053cf942858 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -2237,21 +2237,30 @@ type_specifier_nonarray:
| TYPE_IDENTIFIER
{
void *ctx = state->linalloc;
$$ = new(ctx) ast_type_specifier($1);
$$->set_location(@1);
}
;
basic_type_specifier_nonarray:
VOID_TOK { $$ = glsl_type::void_type; }
- | BASIC_TYPE_TOK { $$ = $1; };
+ | BASIC_TYPE_TOK { $$ = $1; }
+ | UNSIGNED BASIC_TYPE_TOK
+ {
+ if ($2 == glsl_type::int_type) {
+ $$ = glsl_type::uint_type;
+ } else {
+ _mesa_glsl_error(&@1, state,
+ "\"unsigned\" is only allowed before \"int\"");
+ }
+ }
;
precision_qualifier:
HIGHP
{
state->check_precision_qualifiers_allowed(&@1);
$$ = ast_precision_high;
}
| MEDIUMP
{
--
2.17.1
More information about the mesa-dev
mailing list