Mesa (master): glsl: add `unsigned int` type for EXT_GPU_shader4

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 25 00:46:26 UTC 2019


Module: Mesa
Branch: master
Commit: a7f38e7fbdb83d938b2dc9dc790be982f9ec7da6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a7f38e7fbdb83d938b2dc9dc790be982f9ec7da6

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Tue Aug  7 17:18:40 2018 -0400

glsl: add `unsigned int` type for EXT_GPU_shader4

Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Tested-by: Dieter Nützel <Dieter at nuetzel-hh.de>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 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 f1426a9c486..d83e700f6fb 100644
--- a/src/compiler/glsl/glsl_lexer.ll
+++ b/src/compiler/glsl/glsl_lexer.ll
@@ -612,7 +612,7 @@ 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);
diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
index b91c24ebe97..9e9b49c8462 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -2308,7 +2308,16 @@ type_specifier_nonarray:
 
 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:




More information about the mesa-commit mailing list