summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2016-06-09 06:38:57 +1000
committerIan Romanick <[email protected]>2017-01-20 15:41:23 -0800
commit8ce53d4a2f3f44b8fa00a6a04ec0816f38d788db (patch)
treef3a9e5801ddaad1c85a304f90a282d2e93ab41ab /src/compiler/glsl
parente90830bb8eb6b143551152916ad9eafbee7731b5 (diff)
glsl: Add basic ARB_gpu_shader_int64 types
This adds the builtins and the lexer support. To avoid too many warnings, it adds basic support to the type in a few other places in mesa, mostly in the trivial places. It also adds a query to be used later for if a type is an integer 32 or 64. Signed-off-by: Dave Airlie <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r--src/compiler/glsl/ast_to_hir.cpp2
-rw-r--r--src/compiler/glsl/builtin_types.cpp12
-rw-r--r--src/compiler/glsl/glsl_lexer.ll10
-rw-r--r--src/compiler/glsl/glsl_parser.yy9
-rw-r--r--src/compiler/glsl/ir_clone.cpp2
-rw-r--r--src/compiler/glsl/link_uniform_initializers.cpp2
6 files changed, 37 insertions, 0 deletions
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index ce620fab827..5cd094d7c55 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -1093,6 +1093,8 @@ do_comparison(void *mem_ctx, int operation, ir_rvalue *op0, ir_rvalue *op1)
case GLSL_TYPE_INT:
case GLSL_TYPE_BOOL:
case GLSL_TYPE_DOUBLE:
+ case GLSL_TYPE_UINT64:
+ case GLSL_TYPE_INT64:
return new(mem_ctx) ir_expression(operation, op0, op1);
case GLSL_TYPE_ARRAY: {
diff --git a/src/compiler/glsl/builtin_types.cpp b/src/compiler/glsl/builtin_types.cpp
index 000f8112920..a63d736ea16 100644
--- a/src/compiler/glsl/builtin_types.cpp
+++ b/src/compiler/glsl/builtin_types.cpp
@@ -409,5 +409,17 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
add_type(symbols, glsl_type::dmat4x2_type);
add_type(symbols, glsl_type::dmat4x3_type);
}
+
+ if (state->ARB_gpu_shader_int64_enable) {
+ add_type(symbols, glsl_type::int64_t_type);
+ add_type(symbols, glsl_type::i64vec2_type);
+ add_type(symbols, glsl_type::i64vec3_type);
+ add_type(symbols, glsl_type::i64vec4_type);
+
+ add_type(symbols, glsl_type::uint64_t_type);
+ add_type(symbols, glsl_type::u64vec2_type);
+ add_type(symbols, glsl_type::u64vec3_type);
+ add_type(symbols, glsl_type::u64vec4_type);
+ }
}
/** @} */
diff --git a/src/compiler/glsl/glsl_lexer.ll b/src/compiler/glsl/glsl_lexer.ll
index 0e722cbfba3..4c0980fc248 100644
--- a/src/compiler/glsl/glsl_lexer.ll
+++ b/src/compiler/glsl/glsl_lexer.ll
@@ -591,6 +591,16 @@ resource KEYWORD(420, 300, 0, 0, RESOURCE);
sample KEYWORD_WITH_ALT(400, 300, 400, 320, yyextra->ARB_gpu_shader5_enable || yyextra->OES_shader_multisample_interpolation_enable, SAMPLE);
subroutine KEYWORD_WITH_ALT(400, 300, 400, 0, yyextra->ARB_shader_subroutine_enable, SUBROUTINE);
+ /* Additional words for ARB_gpu_shader_int64 */
+int64_t KEYWORD_WITH_ALT(0, 0, 0, 0, yyextra->ARB_gpu_shader_int64_enable, INT64);
+i64vec2 KEYWORD_WITH_ALT(0, 0, 0, 0, yyextra->ARB_gpu_shader_int64_enable, I64VEC2);
+i64vec3 KEYWORD_WITH_ALT(0, 0, 0, 0, yyextra->ARB_gpu_shader_int64_enable, I64VEC3);
+i64vec4 KEYWORD_WITH_ALT(0, 0, 0, 0, yyextra->ARB_gpu_shader_int64_enable, I64VEC4);
+
+uint64_t KEYWORD_WITH_ALT(0, 0, 0, 0, yyextra->ARB_gpu_shader_int64_enable, UINT64);
+u64vec2 KEYWORD_WITH_ALT(0, 0, 0, 0, yyextra->ARB_gpu_shader_int64_enable, U64VEC2);
+u64vec3 KEYWORD_WITH_ALT(0, 0, 0, 0, yyextra->ARB_gpu_shader_int64_enable, U64VEC3);
+u64vec4 KEYWORD_WITH_ALT(0, 0, 0, 0, yyextra->ARB_gpu_shader_int64_enable, U64VEC4);
[_a-zA-Z][_a-zA-Z0-9]* {
struct _mesa_glsl_parse_state *state = yyextra;
diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
index 519e35b6d53..734dc499cca 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -136,6 +136,7 @@ static bool match_layout_qualifier(const char *s1, const char *s2,
%token ATTRIBUTE CONST_TOK BOOL_TOK FLOAT_TOK INT_TOK UINT_TOK DOUBLE_TOK
%token BREAK BUFFER CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
%token BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 UVEC2 UVEC3 UVEC4 VEC2 VEC3 VEC4 DVEC2 DVEC3 DVEC4
+%token INT64 UINT64 I64VEC2 I64VEC3 I64VEC4 U64VEC2 U64VEC3 U64VEC4
%token CENTROID IN_TOK OUT_TOK INOUT_TOK UNIFORM VARYING SAMPLE
%token NOPERSPECTIVE FLAT SMOOTH
%token MAT2X2 MAT2X3 MAT2X4
@@ -2304,6 +2305,14 @@ basic_type_specifier_nonarray:
| UIMAGE2DMS { $$ = "uimage2DMS"; }
| UIMAGE2DMSARRAY { $$ = "uimage2DMSArray"; }
| ATOMIC_UINT { $$ = "atomic_uint"; }
+ | INT64 { $$ = "int64_t"; }
+ | I64VEC2 { $$ = "i64vec2"; }
+ | I64VEC3 { $$ = "i64vec3"; }
+ | I64VEC4 { $$ = "i64vec4"; }
+ | UINT64 { $$ = "uint64_t"; }
+ | U64VEC2 { $$ = "u64vec2"; }
+ | U64VEC3 { $$ = "u64vec3"; }
+ | U64VEC4 { $$ = "u64vec4"; }
;
precision_qualifier:
diff --git a/src/compiler/glsl/ir_clone.cpp b/src/compiler/glsl/ir_clone.cpp
index 062ea23a830..bfe2573c071 100644
--- a/src/compiler/glsl/ir_clone.cpp
+++ b/src/compiler/glsl/ir_clone.cpp
@@ -337,6 +337,8 @@ ir_constant::clone(void *mem_ctx, struct hash_table *ht) const
case GLSL_TYPE_FLOAT:
case GLSL_TYPE_DOUBLE:
case GLSL_TYPE_BOOL:
+ case GLSL_TYPE_UINT64:
+ case GLSL_TYPE_INT64:
return new(mem_ctx) ir_constant(this->type, &this->value);
case GLSL_TYPE_STRUCT: {
diff --git a/src/compiler/glsl/link_uniform_initializers.cpp b/src/compiler/glsl/link_uniform_initializers.cpp
index 7439fd3789a..994c2f4ed21 100644
--- a/src/compiler/glsl/link_uniform_initializers.cpp
+++ b/src/compiler/glsl/link_uniform_initializers.cpp
@@ -70,6 +70,8 @@ copy_constant_to_storage(union gl_constant_value *storage,
case GLSL_TYPE_BOOL:
storage[i].b = val->value.b[i] ? boolean_true : 0;
break;
+ case GLSL_TYPE_INT64:
+ case GLSL_TYPE_UINT64:
case GLSL_TYPE_ARRAY:
case GLSL_TYPE_STRUCT:
case GLSL_TYPE_IMAGE: