KHR-GL45.enhanced_layouts.varying_block_automatic_member_locations relies on unused outputs to trigger errors
A shader is created with an output declaration like
layout (location = 2) out DBZ {
vec4 goku;
vec4 gohan[4];
vec4 goten;
layout (location = 1) vec4 chichi;
vec4 pan;
} dbz;
And is populated in the shader code. However no downstream shader stage uses this output. Section 4.4.1 of the GLSL 4.50 spec says:
With one exception, location aliasing is allowed only if it does not cause component aliasing; it is a compile-time or link-time error to cause component aliasing.
And Mesa does all of this checking at link-time. By then the output has been eliminated, and thus no longer causes an error. I believe this is permissible with the above wording. As such, this test should either be modified to consumer the outputs in question, or to use separable objects so that each stage is linked separately.
Same thing with KHR-GL45.enhanced_layouts.varying_location_limit, which sets an illegal location on an unused output:
<TestCaseResult Version="0.3.4" CasePath="KHR-GL45.enhanced_layouts.varying_location_limit" CaseType="SelfValidate">
<Text>Unexpected success: </Text>
<Text>Shader source. Stage: vertex</Text>
<KernelSource>#version 430 core
#extension GL_ARB_enhanced_layouts : require
layout (location = 31 + 1) out double goku;
in vec4 in_vs;
out vec4 vs_tcs;
void main()
{
vec4 result = in_vs;
goku = double(0);
if (vec4(0) == result)
{
goku = double(1);
}
vs_tcs += result;
}
</KernelSource>
Thanks for the report. If you are able to develop and contribute a fix we would be glad to review and accept it.