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

Chris Forbes chrisf at ijw.co.nz
Wed Feb 3 09:08:19 CET 2016


This is undefined.

>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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20160203/604de04d/attachment-0001.html>


More information about the Piglit mailing list