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 <tarceri@itsqueeze.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
This commit is contained in:
parent
0b565f715d
commit
ab40acb453
|
@ -407,6 +407,9 @@ struct explicit_location_info {
|
||||||
ir_variable *var;
|
ir_variable *var;
|
||||||
unsigned base_type;
|
unsigned base_type;
|
||||||
unsigned interpolation;
|
unsigned interpolation;
|
||||||
|
bool centroid;
|
||||||
|
bool sample;
|
||||||
|
bool patch;
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
@ -417,6 +420,9 @@ check_location_aliasing(struct explicit_location_info explicit_locations[][4],
|
||||||
unsigned location_limit,
|
unsigned location_limit,
|
||||||
const glsl_type *type,
|
const glsl_type *type,
|
||||||
unsigned interpolation,
|
unsigned interpolation,
|
||||||
|
bool centroid,
|
||||||
|
bool sample,
|
||||||
|
bool patch,
|
||||||
gl_shader_program *prog,
|
gl_shader_program *prog,
|
||||||
gl_shader_stage stage)
|
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);
|
_mesa_shader_stage_to_string(stage), location);
|
||||||
return false;
|
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++;
|
comp++;
|
||||||
|
@ -493,6 +509,9 @@ check_location_aliasing(struct explicit_location_info explicit_locations[][4],
|
||||||
explicit_locations[location][i].base_type =
|
explicit_locations[location][i].base_type =
|
||||||
type->without_array()->base_type;
|
type->without_array()->base_type;
|
||||||
explicit_locations[location][i].interpolation = interpolation;
|
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++;
|
i++;
|
||||||
|
|
||||||
/* We need to do some special handling for doubles as dvec3 and
|
/* 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()) {
|
if (type->without_array()->is_interface()) {
|
||||||
for (unsigned i = 0; i < type->without_array()->length; i++) {
|
for (unsigned i = 0; i < type->without_array()->length; i++) {
|
||||||
const glsl_type *field_type = type->fields.structure[i].type;
|
glsl_struct_field *field = &type->fields.structure[i];
|
||||||
unsigned field_location = type->fields.structure[i].location -
|
unsigned field_location = field->location -
|
||||||
(type->fields.structure[i].patch ? VARYING_SLOT_PATCH0 :
|
(field->patch ? VARYING_SLOT_PATCH0 : VARYING_SLOT_VAR0);
|
||||||
VARYING_SLOT_VAR0);
|
|
||||||
unsigned interpolation = type->fields.structure[i].interpolation;
|
|
||||||
if (!check_location_aliasing(explicit_locations, var,
|
if (!check_location_aliasing(explicit_locations, var,
|
||||||
field_location,
|
field_location,
|
||||||
0, field_location + 1,
|
0, field_location + 1,
|
||||||
field_type, interpolation,
|
field->type,
|
||||||
|
field->interpolation,
|
||||||
|
field->centroid,
|
||||||
|
field->sample,
|
||||||
|
field->patch,
|
||||||
prog, producer->Stage)) {
|
prog, producer->Stage)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -574,6 +595,9 @@ cross_validate_outputs_to_inputs(struct gl_context *ctx,
|
||||||
idx, var->data.location_frac,
|
idx, var->data.location_frac,
|
||||||
slot_limit, type,
|
slot_limit, type,
|
||||||
var->data.interpolation,
|
var->data.interpolation,
|
||||||
|
var->data.centroid,
|
||||||
|
var->data.sample,
|
||||||
|
var->data.patch,
|
||||||
prog, producer->Stage)) {
|
prog, producer->Stage)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue