[Piglit] [PATCH] arb_enhanced_layouts: add test for location aliasing with non-numerical type
Iago Toral
itoral at igalia.com
Thu Nov 9 07:52:41 UTC 2017
This is not so much based on the spec but based on the original code we
had in the linker (which we still have) which assumes that all
locations consumed by a struct variable use up all 4 components (thus
preventing any kind of aliasing to be successful) based on the fact
that the component layout qualifier can't be used on structs (or its
members):
if (type->without_array()->is_record()) {
/* The component qualifier can't be used on structs so just treat
* all component slots as used.
*/
last_comp = 4;
} else {
...
}
However, thinking a bit more about it, it is not 100% clear that this
assumption is correct and maybe we should be doing the same for structs
that I did for interface blocks members and check the actual components
used by each field member and only produce link errors if there is
actual component aliasing.
Let's drop this patch for now.
Iago
On Thu, 2017-11-09 at 12:43 +1100, Timothy Arceri wrote:
> On 06/11/17 23:22, Iago Toral Quiroga wrote:
> > This is not allowed so we check that we produce a linker error.
>
> It's not 100% obvious why this wouldn't be allowed. Can we have a
> spec
> quote added to the
> test header?
>
> > ---
> > .../vs-to-fs-type-not-numerical.shader_test | 52
> > ++++++++++++++++++++++
> > 1 file changed, 52 insertions(+)
> > create mode 100644
> > tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-
> > type-not-numerical.shader_test
> >
> > diff --git a/tests/spec/arb_enhanced_layouts/linker/component-
> > layout/vs-to-fs-type-not-numerical.shader_test
> > b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-
> > type-not-numerical.shader_test
> > new file mode 100644
> > index 000000000..aede6ce8d
> > --- /dev/null
> > +++ b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-
> > to-fs-type-not-numerical.shader_test
> > @@ -0,0 +1,52 @@
> > +# Test for link error between vertex and fragment shaders when
> > +# component qualifiers don't match. This case checks that
> > +# location aliasing is not permitted for non-numerical types
> > +# such as a struct
> > +
> > +[require]
> > +GLSL >= 3.30
> > +GL_ARB_enhanced_layouts
> > +GL_ARB_separate_shader_objects
> > +
> > +[vertex shader]
> > +#version 330
> > +#extension GL_ARB_enhanced_layouts: require
> > +#extension GL_ARB_separate_shader_objects: require
> > +
> > +struct S {
> > + vec3 foo;
> > + vec4 bar;
> > +};
> > +
> > +layout(location = 0, component = 3) out float b;
> > +layout(location = 0) out S a;
> > +
> > +void main()
> > +{
> > + a.foo = vec3(1.0);
> > + a.bar = vec4(1.0);
> > + b = 0.5;
> > +}
> > +
> > +[fragment shader]
> > +#version 330
> > +#extension GL_ARB_enhanced_layouts: require
> > +#extension GL_ARB_separate_shader_objects: require
> > +
> > +struct S {
> > + vec3 foo;
> > + vec4 bar;
> > +};
> > +
> > +layout(location = 0, component = 3) in float b;
> > +layout(location = 0) in S a;
> > +
> > +out vec4 color;
> > +
> > +void main()
> > +{
> > + color = vec4(a.foo + a.bar.xyz, b);
> > +}
> > +
> > +[test]
> > +link error
> >
>
>
More information about the Piglit
mailing list