glsl: allow "varying out" for fragment shader outputs with EXT_gpu_shader4

Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Marek Olšák 2019-04-05 17:01:55 -04:00
parent 4ff3b8e18a
commit 825c35999c
3 changed files with 19 additions and 2 deletions

View File

@ -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",

View File

@ -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;
}

View File

@ -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() &&