[Piglit] [PATCH] sso: add test for linking gs without explicit locations

Timothy Arceri t_arceri at yahoo.com.au
Thu Feb 4 04:50:46 CET 2016


On Wed, 2016-02-03 at 21:08 +1300, Chris Forbes wrote:
> This is undefined.

Right. Its undefined but not illegal so what should we do? Leave the
test as is testing for a simliar undefined behaviour as the Nvidia
driver? Or fix the test and just let Mesa do whatever in this scenario?
My feeling is we should leave the test as it, maybe update the comment
if need be.

Although I don't really feel to strongly either way so if you feel it's
wrong to test for this feel free to fix it up :)

> 
> From the OpenGL 4.5 (Core Profile) spec, 7.4.1 Shader Interface
> Matching, p119:
> 
> "At an interface between program objects, the set of inputs and
> outputs are considered to
> match exactly if and only if:
> * Every declared input block or variable must have a matching output,
> as described above.
> * There are no output blocks or user-defined output variables
> declared
> without a matching input block or variable declaration.
> 
> When the set of inputs and outputs on an interface between programs
> matches exactly, all inputs are well-defined except when the
> corresponding
> outputs were not written in the previous shader. However, any
> mismatch
> between inputs and outputs results in all inputs being undefined
> except for
> cases noted below.
> Even if an input has a corresponding output that matches exactly,
> mismatches on other
> inputs or outputs may adversely affect the executable code generated
> to read or write the
> matching variable."
> 
> <Followed by a bunch of cases where mismatches are OK, all involving
> either
> location qualifiers or builtins>
> 
> On Fri, Jan 22, 2016 at 2:45 AM, Ilia Mirkin <imirkin at alum.mit.edu>
> wrote:
> > Mesa treats each GS input as taking up 3 locations instead of 1,
> > because
> > it doesn't de-array the vars. This causes it to take col3 from VS
> > instead of col1.
> > 
> > Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> > ---
> >  .../execution/vs-gs-linking.shader_test            | 57
> > ++++++++++++++++++++++
> >  1 file changed, 57 insertions(+)
> >  create mode 100644
> > tests/spec/arb_separate_shader_objects/execution/vs-gs-
> > linking.shader_test
> > 
> > diff --git a/tests/spec/arb_separate_shader_objects/execution/vs-
> > gs-linking.shader_test
> > b/tests/spec/arb_separate_shader_objects/execution/vs-gs-
> > linking.shader_test
> > new file mode 100644
> > index 0000000..938df13
> > --- /dev/null
> > +++ b/tests/spec/arb_separate_shader_objects/execution/vs-gs-
> > linking.shader_test
> > @@ -0,0 +1,57 @@
> > +[require]
> > +GLSL >= 1.50
> > +SSO ENABLED
> > +
> > +[vertex shader]
> > +#version 150
> > +
> > +in vec4 piglit_vertex;
> > +out vec4 col0;
> > +out vec4 col1;
> > +out vec4 col2;
> > +out vec4 col3;
> > +out vec4 col4;
> > +out vec4 col5;
> > +
> > +void main() {
> > +  gl_Position = piglit_vertex;
> > +  col1 = vec4(0, 1, 0, 1);
> > +  col0 = col2 = col3 = col4 = col5 = vec4(1, 0, 0, 1);
> > +}
> > +
> > +[geometry shader]
> > +#version 150
> > +
> > +layout (triangles) in;
> > +layout (triangle_strip, max_vertices=3) out;
> > +
> > +in vec4 color0[];
> > +in vec4 color1[];
> > +
> > +out vec4 color;
> > +
> > +void main() {
> > +  int i;
> > +  for (i = 0; i < 3; i++) {
> > +    gl_Position = gl_in[i].gl_Position;
> > +    color = color1[i];
> > +    EmitVertex();
> > +  }
> > +}
> > +
> > +[fragment shader]
> > +#version 150
> > +
> > +in vec4 color;
> > +out vec4 col;
> > +
> > +void main() {
> > +  col = color;
> > +}
> > +
> > +[test]
> > +clear color 0.2 0.2 0.2 0.2
> > +clear
> > +
> > +draw rect -1 -1 2 2
> > +probe all rgba 0 1 0 1
> > --
> > 2.4.10
> > 
> > _______________________________________________
> > Piglit mailing list
> > Piglit at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/piglit
> > 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list