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

2016-02-03 Thread Chris Forbes
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."



On Fri, Jan 22, 2016 at 2:45 AM, Ilia Mirkin  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 
> ---
>  .../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 000..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@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


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

2016-01-21 Thread Ilia Mirkin
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 
---
 .../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 000..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@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


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

2016-01-21 Thread Timothy Arceri
On Thu, 2016-01-21 at 08:45 -0500, Ilia Mirkin 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 

As discussed on IRC the desktop spec leaves SSO interface validation up
to the dev so the mismatch between VS and GS should be fine as far as I
understand.

Reviewed-by: Timothy Arceri 


> ---
>  .../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 000..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
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit