[Piglit] [PATCH v2] gl-3.2-compat: test gl_TexCoord[] built-in with geometry shaders

Marek Olšák maraeo at gmail.com
Wed May 23 21:24:06 UTC 2018


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Mon, May 21, 2018 at 8:59 PM, Timothy Arceri <tarceri at itsqueeze.com>
wrote:

> This tests both setting gl_TexCoord[] in the geometry shader and
> using the gs to passthrough the gl_TexCoord[] values from the
> vertex shader.
> ---
>  .../gs-texcoord-array-2.shader_test           | 57 ++++++++++++++++
>  .../gs-texcoord-array.shader_test             | 51 ++++++++++++++
>  .../vs-gs-texcoord-array-2.shader_test        | 65 ++++++++++++++++++
>  .../vs-gs-texcoord-array.shader_test          | 66 +++++++++++++++++++
>  4 files changed, 239 insertions(+)
>  create mode 100644 tests/spec/glsl-1.50/execution/compatibility/gs-
> texcoord-array-2.shader_test
>  create mode 100644 tests/spec/glsl-1.50/execution/compatibility/gs-
> texcoord-array.shader_test
>  create mode 100644 tests/spec/glsl-1.50/execution/compatibility/vs-gs-
> texcoord-array-2.shader_test
>  create mode 100644 tests/spec/glsl-1.50/execution/compatibility/vs-gs-
> texcoord-array.shader_test
>
> diff --git a/tests/spec/glsl-1.50/execution/compatibility/gs-texcoord-array-2.shader_test
> b/tests/spec/glsl-1.50/execution/compatibility/gs-
> texcoord-array-2.shader_test
> new file mode 100644
> index 000000000..852bc10c0
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/compatibility/gs-
> texcoord-array-2.shader_test
> @@ -0,0 +1,57 @@
> +[require]
> +GL COMPAT >= 3.2
> +GLSL >= 1.50
> +
> +[vertex shader]
> +#version 150 compatibility
> +
> +out gl_PerVertex {
> +       vec4 gl_Position;
> +       vec4 gl_TexCoord[5];
> +};
> +
> +void main()
> +{
> +       gl_Position = gl_Vertex;
> +}
> +
> +[geometry shader]
> +#version 150 compatibility
> +
> +layout(triangles) in;
> +layout(triangle_strip, max_vertices = 3) out;
> +
> +out vec4 gl_TexCoord[5];
> +
> +void main()
> +{
> +       for (int i = 0; i < 3; i++) {
> +               gl_Position = gl_in[i].gl_Position;
> +
> +               /* 0.05, 0.05, 0.10, 0.15, 0.20 */
> +               for (int j = 0; j < 5; j++) {
> +                       gl_TexCoord[j] = vec4(float(j) * 0.05);
> +               }
> +
> +               EmitVertex();
> +       }
> +}
> +
> +[fragment shader]
> +#version 110
> +
> +varying vec4 gl_TexCoord[5];
> +void main()
> +{
> +       vec4 result = vec4(0.0);
> +
> +       for (int i = 0; i < 4; i++)
> +               result += gl_TexCoord[i];
> +
> +       /* 0.00 + 0.05 + 0.10 + 0.15 = 0.30 */
> +       gl_FragColor = result;
> +}
> +
> +[test]
> +draw rect -1 -1 2 2
> +probe rgba 1 1 0.3 0.3 0.3 0.3
> diff --git a/tests/spec/glsl-1.50/execution/compatibility/gs-texcoord-array.shader_test
> b/tests/spec/glsl-1.50/execution/compatibility/gs-
> texcoord-array.shader_test
> new file mode 100644
> index 000000000..0ee316ef1
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/compatibility/gs-
> texcoord-array.shader_test
> @@ -0,0 +1,51 @@
> +[require]
> +GL COMPAT >= 3.2
> +GLSL >= 1.50
> +
> +[vertex shader]
> +#version 150 compatibility
> +
> +void main()
> +{
> +       gl_Position = gl_Vertex;
> +}
> +
> +[geometry shader]
> +#version 150 compatibility
> +
> +layout(triangles) in;
> +layout(triangle_strip, max_vertices = 3) out;
> +
> +uniform int n;
> +
> +out vec4 gl_TexCoord[5];
> +
> +void main()
> +{
> +       for (int i = 0; i < 3; i++) {
> +               gl_Position = gl_in[i].gl_Position;
> +
> +               for (int j = 0; j < n; j++) {
> +                       gl_TexCoord[j] = vec4(0.5, 0.5, 0.5, 0.5) *
> float(j);
> +               }
> +
> +               EmitVertex();
> +       }
> +}
> +
> +[fragment shader]
> +#version 150 compatibility
> +
> +uniform int index;
> +in vec4 gl_TexCoord[5];
> +
> +void main()
> +{
> +       gl_FragColor = gl_TexCoord[index];
> +}
> +
> +[test]
> +uniform int index 1
> +uniform int n 4
> +draw rect -1 -1 2 2
> +probe rgba 1 1 0.5 0.5 0.5 0.5
> diff --git a/tests/spec/glsl-1.50/execution/compatibility/vs-gs-texcoord-array-2.shader_test
> b/tests/spec/glsl-1.50/execution/compatibility/vs-gs-
> texcoord-array-2.shader_test
> new file mode 100644
> index 000000000..ec910524c
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/compatibility/vs-gs-
> texcoord-array-2.shader_test
> @@ -0,0 +1,65 @@
> +[require]
> +GL COMPAT >= 3.2
> +GLSL >= 1.50
> +
> +[vertex shader]
> +#version 150 compatibility
> +
> +out gl_PerVertex {
> +       vec4 gl_Position;
> +       vec4 gl_TexCoord[5];
> +};
> +
> +void main()
> +{
> +       /* 0.05, 0.05, 0.10, 0.15, 0.20 */
> +       for (int i = 0; i < 5; i++)
> +               gl_TexCoord[i] = vec4(float(i) * 0.05);
> +
> +       gl_Position = gl_Vertex;
> +}
> +
> +[geometry shader]
> +#version 150 compatibility
> +
> +layout(triangles) in;
> +layout(triangle_strip, max_vertices = 3) out;
> +
> +in gl_PerVertex {
> +       vec4 gl_Position;
> +       vec4 gl_TexCoord[5];
> +} gl_in[];
> +
> +out vec4 gl_TexCoord[5];
> +
> +void main()
> +{
> +       for (int i = 0; i < 3; i++) {
> +               gl_Position = gl_in[i].gl_Position;
> +
> +               for (int j = 0; j < 5; j++) {
> +                       gl_TexCoord[j] = gl_in[i].gl_TexCoord[j];
> +               }
> +
> +               EmitVertex();
> +       }
> +}
> +
> +[fragment shader]
> +#version 110
> +
> +varying vec4 gl_TexCoord[5];
> +void main()
> +{
> +       vec4 result = vec4(0.0);
> +
> +       for (int i = 0; i < 4; i++)
> +               result += gl_TexCoord[i];
> +
> +       /* 0.00 + 0.05 + 0.10 + 0.15 = 0.30 */
> +       gl_FragColor = result;
> +}
> +
> +[test]
> +draw rect -1 -1 2 2
> +probe rgba 1 1 0.3 0.3 0.3 0.3
> diff --git a/tests/spec/glsl-1.50/execution/compatibility/vs-gs-texcoord-array.shader_test
> b/tests/spec/glsl-1.50/execution/compatibility/vs-gs-
> texcoord-array.shader_test
> new file mode 100644
> index 000000000..fae6cff63
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/compatibility/vs-gs-
> texcoord-array.shader_test
> @@ -0,0 +1,66 @@
> +[require]
> +GL COMPAT >= 3.2
> +GLSL >= 1.50
> +
> +[vertex shader]
> +#version 150 compatibility
> +
> +uniform int n;
> +
> +out gl_PerVertex {
> +       vec4 gl_Position;
> +       vec4 gl_TexCoord[5];
> +};
> +
> +void main()
> +{
> +       for (int i = 0; i < n; i++) {
> +               gl_TexCoord[i] = vec4(0.5, 0.5, 0.5, 0.5) * float(i);
> +       }
> +       gl_Position = gl_Vertex;
> +}
> +
> +[geometry shader]
> +#version 150 compatibility
> +
> +layout(triangles) in;
> +layout(triangle_strip, max_vertices = 3) out;
> +
> +uniform int n;
> +
> +in gl_PerVertex {
> +       vec4 gl_Position;
> +       vec4 gl_TexCoord[5];
> +} gl_in[];
> +
> +out vec4 gl_TexCoord[5];
> +
> +void main()
> +{
> +       for (int i = 0; i < 3; i++) {
> +               gl_Position = gl_in[i].gl_Position;
> +
> +               for (int j = 0; j < n; j++) {
> +                       gl_TexCoord[j] = gl_in[i].gl_TexCoord[j];
> +               }
> +
> +               EmitVertex();
> +       }
> +}
> +
> +[fragment shader]
> +#version 150 compatibility
> +
> +uniform int index;
> +in vec4 gl_TexCoord[5];
> +
> +void main()
> +{
> +       gl_FragColor = gl_TexCoord[index];
> +}
> +
> +[test]
> +uniform int index 1
> +uniform int n 4
> +draw rect -1 -1 2 2
> +probe rgba 1 1 0.5 0.5 0.5 0.5
> --
> 2.17.0
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20180523/d5d50a8e/attachment.html>


More information about the Piglit mailing list