diff options
author | Marek Olšák <[email protected]> | 2019-04-05 17:01:55 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-04-24 20:45:15 -0400 |
commit | 825c35999c0f0c0872123e528c93e9de5d2e7f0d (patch) | |
tree | 50fead19aab7bd518eb768383c2256e718b95881 /src/compiler | |
parent | 4ff3b8e18a968f557be1529ecb03a7df5da1890f (diff) |
glsl: allow "varying out" for fragment shader outputs with EXT_gpu_shader4
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/glsl/ast_to_hir.cpp | 7 | ||||
-rw-r--r-- | src/compiler/glsl/ast_type.cpp | 7 | ||||
-rw-r--r-- | src/compiler/glsl/glsl_parser.yy | 7 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index 79e14cc6c9b..a3a24810012 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -5132,7 +5132,12 @@ ast_declarator_list::hir(exec_list *instructions, && !state->has_explicit_attrib_location() && !state->has_separate_shader_objects() && !state->ARB_fragment_coord_conventions_enable) { - if (this->type->qualifier.flags.q.out) { + /* GL_EXT_gpu_shader4 only allows "varying out" on fragment shader + * outputs. (the varying flag is not set by the parser) + */ + if (this->type->qualifier.flags.q.out && + (!state->EXT_gpu_shader4_enable || + state->stage != MESA_SHADER_FRAGMENT)) { _mesa_glsl_error(& loc, state, "`out' qualifier in declaration of `%s' " "only valid for function parameters in %s", diff --git a/src/compiler/glsl/ast_type.cpp b/src/compiler/glsl/ast_type.cpp index b499ee913e7..c7f74e7aa08 100644 --- a/src/compiler/glsl/ast_type.cpp +++ b/src/compiler/glsl/ast_type.cpp @@ -489,6 +489,13 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc, q.flags.q.bound_image) merge_bindless_qualifier(state); + if (state->EXT_gpu_shader4_enable && + state->stage == MESA_SHADER_FRAGMENT && + this->flags.q.varying && q.flags.q.out) { + this->flags.q.varying = 0; + this->flags.q.out = 1; + } + return r; } diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy index 80634144084..6426f890b9e 100644 --- a/src/compiler/glsl/glsl_parser.yy +++ b/src/compiler/glsl/glsl_parser.yy @@ -2086,8 +2086,13 @@ type_qualifier: /* Section 4.3 of the GLSL 1.20 specification states: * "Variable declarations may have a storage qualifier specified..." * 1.30 clarifies this to "may have one storage qualifier". + * + * GL_EXT_gpu_shader4 allows "varying out" in fragment shaders. */ - if ($2.has_storage()) + if ($2.has_storage() && + (!state->EXT_gpu_shader4_enable || + state->stage != MESA_SHADER_FRAGMENT || + !$1.flags.q.varying || !$2.flags.q.out)) _mesa_glsl_error(&@1, state, "duplicate storage qualifier"); if (!state->has_420pack_or_es31() && |