diff options
author | Iago Toral Quiroga <[email protected]> | 2017-10-19 16:33:49 +0200 |
---|---|---|
committer | Iago Toral Quiroga <[email protected]> | 2017-10-26 08:40:14 +0200 |
commit | ab40acb45341d8cea011ba7330626ffc6e3238ad (patch) | |
tree | edd9de6ead3198d667f3a2a8308f628fa59a0af5 /src/compiler/glsl/link_varyings.cpp | |
parent | 0b565f715d24d74d844f0708e3ed17ad1ee14faf (diff) |
glsl/linker: outputs in the same location must share auxiliary storage
From ARB_enhanced_layouts:
"[...]when location aliasing, the aliases sharing the location
must have the same underlying numerical type (floating-point or
integer) and the same auxiliary storage and
interpolation qualification.[...]"
Add code to the linker to validate that aliased locations do
have the same aux storage.
Fixes:
KHR-GL45.enhanced_layouts.varying_location_aliasing_with_mixed_auxiliary_storage
Reviewed-by: Timothy Arceri <[email protected]>
Reviewed-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/compiler/glsl/link_varyings.cpp')
-rw-r--r-- | src/compiler/glsl/link_varyings.cpp | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp index 95427546007..7766d824643 100644 --- a/src/compiler/glsl/link_varyings.cpp +++ b/src/compiler/glsl/link_varyings.cpp @@ -407,6 +407,9 @@ struct explicit_location_info { ir_variable *var; unsigned base_type; unsigned interpolation; + bool centroid; + bool sample; + bool patch; }; static bool @@ -417,6 +420,9 @@ check_location_aliasing(struct explicit_location_info explicit_locations[][4], unsigned location_limit, const glsl_type *type, unsigned interpolation, + bool centroid, + bool sample, + bool patch, gl_shader_program *prog, gl_shader_stage stage) { @@ -459,6 +465,16 @@ check_location_aliasing(struct explicit_location_info explicit_locations[][4], _mesa_shader_stage_to_string(stage), location); return false; } + + if (info->centroid != centroid || + info->sample != sample || + info->patch != patch) { + linker_error(prog, + "%s shader has multiple outputs at explicit " + "location %u with different aux storage\n", + _mesa_shader_stage_to_string(stage), location); + return false; + } } comp++; @@ -493,6 +509,9 @@ check_location_aliasing(struct explicit_location_info explicit_locations[][4], explicit_locations[location][i].base_type = type->without_array()->base_type; explicit_locations[location][i].interpolation = interpolation; + explicit_locations[location][i].centroid = centroid; + explicit_locations[location][i].sample = sample; + explicit_locations[location][i].patch = patch; i++; /* We need to do some special handling for doubles as dvec3 and @@ -557,15 +576,17 @@ cross_validate_outputs_to_inputs(struct gl_context *ctx, if (type->without_array()->is_interface()) { for (unsigned i = 0; i < type->without_array()->length; i++) { - const glsl_type *field_type = type->fields.structure[i].type; - unsigned field_location = type->fields.structure[i].location - - (type->fields.structure[i].patch ? VARYING_SLOT_PATCH0 : - VARYING_SLOT_VAR0); - unsigned interpolation = type->fields.structure[i].interpolation; + glsl_struct_field *field = &type->fields.structure[i]; + unsigned field_location = field->location - + (field->patch ? VARYING_SLOT_PATCH0 : VARYING_SLOT_VAR0); if (!check_location_aliasing(explicit_locations, var, field_location, 0, field_location + 1, - field_type, interpolation, + field->type, + field->interpolation, + field->centroid, + field->sample, + field->patch, prog, producer->Stage)) { return; } @@ -574,6 +595,9 @@ cross_validate_outputs_to_inputs(struct gl_context *ctx, idx, var->data.location_frac, slot_limit, type, var->data.interpolation, + var->data.centroid, + var->data.sample, + var->data.patch, prog, producer->Stage)) { return; } |