[Piglit] [PATCH 1/2] Test interpolation qualifiers inside of interface blocks.

Ian Romanick idr at freedesktop.org
Wed Nov 6 14:15:48 PST 2013


On 10/22/2013 12:37 PM, Paul Berry wrote:

Series is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> Validated using the NVIDIA proprietary driver for Linux (version
> 313.18).
> ---
>  ...interface-block-interpolation-array.shader_test | 85 ++++++++++++++++++++++
>  ...interface-block-interpolation-named.shader_test | 81 +++++++++++++++++++++
>  ...terface-block-interpolation-unnamed.shader_test | 81 +++++++++++++++++++++
>  3 files changed, 247 insertions(+)
>  create mode 100644 tests/spec/glsl-1.50/execution/interface-block-interpolation-array.shader_test
>  create mode 100644 tests/spec/glsl-1.50/execution/interface-block-interpolation-named.shader_test
>  create mode 100644 tests/spec/glsl-1.50/execution/interface-block-interpolation-unnamed.shader_test
> 
> diff --git a/tests/spec/glsl-1.50/execution/interface-block-interpolation-array.shader_test b/tests/spec/glsl-1.50/execution/interface-block-interpolation-array.shader_test
> new file mode 100644
> index 0000000..079cda5
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/interface-block-interpolation-array.shader_test
> @@ -0,0 +1,85 @@
> +# Verify that interpolation qualifiers (flat, smooth, noperspective)
> +# declared inside interface blocks are properly respected.
> +#
> +# This test operates by comparing varyings declared inside an
> +# interface block with varyings declared outside an interface block.
> +# We assume that interpolation qualifiers work properly when declared
> +# outside interface blocks, because that is tested by other piglit
> +# tests.
> +#
> +# In this test, we verify proper functioning of interpolation
> +# qualifiers in an interface block array.
> +
> +[require]
> +GLSL >= 1.50
> +
> +[vertex shader]
> +in vec4 piglit_vertex;
> +
> +flat out float flat_var;
> +smooth out float smooth_var;
> +noperspective out float noperspective_var;
> +out float unqualified_var;
> +
> +out Blk {
> +  flat float flat_var;
> +  smooth float smooth_var;
> +  noperspective float noperspective_var;
> +  float unqualified_var;
> +} ifc[2];
> +
> +void main()
> +{
> +  gl_Position = piglit_vertex;
> +  float var = float(gl_VertexID);
> +  flat_var = var;
> +  smooth_var = var;
> +  noperspective_var = var;
> +  unqualified_var = var;
> +  for (int i = 0; i < 2; i++) {
> +    ifc[i].flat_var = var;
> +    ifc[i].smooth_var = var;
> +    ifc[i].noperspective_var = var;
> +    ifc[i].unqualified_var = var;
> +  }
> +}
> +
> +[fragment shader]
> +flat in float flat_var;
> +smooth in float smooth_var;
> +noperspective in float noperspective_var;
> +in float unqualified_var;
> +
> +in Blk {
> +  flat float flat_var;
> +  smooth float smooth_var;
> +  noperspective float noperspective_var;
> +  float unqualified_var;
> +} ifc[2];
> +
> +void main()
> +{
> +  bool ok = true;
> +  for (int i = 0; i < 2; i++) {
> +    if (flat_var != ifc[i].flat_var) ok = false;
> +    if (smooth_var != ifc[i].smooth_var) ok = false;
> +    if (noperspective_var != ifc[i].noperspective_var) ok = false;
> +    if (unqualified_var != ifc[i].unqualified_var) ok = false;
> +  }
> +  gl_FragColor = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
> +}
> +
> +[vertex data]
> +piglit_vertex/float/4
> +-1.0 -1.0 0.0 1.0
> + 0.0  2.0 0.0 2.0 # Note: different W's to ensure that smooth != noperspective
> + 3.0 -3.0 0.0 3.0
> +
> +[test]
> +
> +# Clear the background to green so that parts of the triangle which
> +# aren't drawn won't cause the test to fail.
> +clear color 0.0 1.0 0.0 1.0
> +clear
> +draw arrays GL_TRIANGLES 0 3
> +probe all rgba 0.0 1.0 0.0 1.0
> diff --git a/tests/spec/glsl-1.50/execution/interface-block-interpolation-named.shader_test b/tests/spec/glsl-1.50/execution/interface-block-interpolation-named.shader_test
> new file mode 100644
> index 0000000..a74b2af
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/interface-block-interpolation-named.shader_test
> @@ -0,0 +1,81 @@
> +# Verify that interpolation qualifiers (flat, smooth, noperspective)
> +# declared inside interface blocks are properly respected.
> +#
> +# This test operates by comparing varyings declared inside an
> +# interface block with varyings declared outside an interface block.
> +# We assume that interpolation qualifiers work properly when declared
> +# outside interface blocks, because that is tested by other piglit
> +# tests.
> +#
> +# In this test, we verify proper functioning of interpolation
> +# qualifiers in a named interface block.
> +
> +[require]
> +GLSL >= 1.50
> +
> +[vertex shader]
> +in vec4 piglit_vertex;
> +
> +flat out float flat_var;
> +smooth out float smooth_var;
> +noperspective out float noperspective_var;
> +out float unqualified_var;
> +
> +out Blk {
> +  flat float flat_var;
> +  smooth float smooth_var;
> +  noperspective float noperspective_var;
> +  float unqualified_var;
> +} ifc;
> +
> +void main()
> +{
> +  gl_Position = piglit_vertex;
> +  float var = float(gl_VertexID);
> +  flat_var = var;
> +  smooth_var = var;
> +  noperspective_var = var;
> +  unqualified_var = var;
> +  ifc.flat_var = var;
> +  ifc.smooth_var = var;
> +  ifc.noperspective_var = var;
> +  ifc.unqualified_var = var;
> +}
> +
> +[fragment shader]
> +flat in float flat_var;
> +smooth in float smooth_var;
> +noperspective in float noperspective_var;
> +in float unqualified_var;
> +
> +in Blk {
> +  flat float flat_var;
> +  smooth float smooth_var;
> +  noperspective float noperspective_var;
> +  float unqualified_var;
> +} ifc;
> +
> +void main()
> +{
> +  bool ok = true;
> +  if (flat_var != ifc.flat_var) ok = false;
> +  if (smooth_var != ifc.smooth_var) ok = false;
> +  if (noperspective_var != ifc.noperspective_var) ok = false;
> +  if (unqualified_var != ifc.unqualified_var) ok = false;
> +  gl_FragColor = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
> +}
> +
> +[vertex data]
> +piglit_vertex/float/4
> +-1.0 -1.0 0.0 1.0
> + 0.0  2.0 0.0 2.0 # Note: different W's to ensure that smooth != noperspective
> + 3.0 -3.0 0.0 3.0
> +
> +[test]
> +
> +# Clear the background to green so that parts of the triangle which
> +# aren't drawn won't cause the test to fail.
> +clear color 0.0 1.0 0.0 1.0
> +clear
> +draw arrays GL_TRIANGLES 0 3
> +probe all rgba 0.0 1.0 0.0 1.0
> diff --git a/tests/spec/glsl-1.50/execution/interface-block-interpolation-unnamed.shader_test b/tests/spec/glsl-1.50/execution/interface-block-interpolation-unnamed.shader_test
> new file mode 100644
> index 0000000..b5e3ae0
> --- /dev/null
> +++ b/tests/spec/glsl-1.50/execution/interface-block-interpolation-unnamed.shader_test
> @@ -0,0 +1,81 @@
> +# Verify that interpolation qualifiers (flat, smooth, noperspective)
> +# declared inside interface blocks are properly respected.
> +#
> +# This test operates by comparing varyings declared inside an
> +# interface block with varyings declared outside an interface block.
> +# We assume that interpolation qualifiers work properly when declared
> +# outside interface blocks, because that is tested by other piglit
> +# tests.
> +#
> +# In this test, we verify proper functioning of interpolation
> +# qualifiers in an unnamed interface block.
> +
> +[require]
> +GLSL >= 1.50
> +
> +[vertex shader]
> +in vec4 piglit_vertex;
> +
> +flat out float flat_var;
> +smooth out float smooth_var;
> +noperspective out float noperspective_var;
> +out float unqualified_var;
> +
> +out Blk {
> +  flat float ifc_flat_var;
> +  smooth float ifc_smooth_var;
> +  noperspective float ifc_noperspective_var;
> +  float ifc_unqualified_var;
> +};
> +
> +void main()
> +{
> +  gl_Position = piglit_vertex;
> +  float var = float(gl_VertexID);
> +  flat_var = var;
> +  smooth_var = var;
> +  noperspective_var = var;
> +  unqualified_var = var;
> +  ifc_flat_var = var;
> +  ifc_smooth_var = var;
> +  ifc_noperspective_var = var;
> +  ifc_unqualified_var = var;
> +}
> +
> +[fragment shader]
> +flat in float flat_var;
> +smooth in float smooth_var;
> +noperspective in float noperspective_var;
> +in float unqualified_var;
> +
> +in Blk {
> +  flat float ifc_flat_var;
> +  smooth float ifc_smooth_var;
> +  noperspective float ifc_noperspective_var;
> +  float ifc_unqualified_var;
> +};
> +
> +void main()
> +{
> +  bool ok = true;
> +  if (flat_var != ifc_flat_var) ok = false;
> +  if (smooth_var != ifc_smooth_var) ok = false;
> +  if (noperspective_var != ifc_noperspective_var) ok = false;
> +  if (unqualified_var != ifc_unqualified_var) ok = false;
> +  gl_FragColor = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
> +}
> +
> +[vertex data]
> +piglit_vertex/float/4
> +-1.0 -1.0 0.0 1.0
> + 0.0  2.0 0.0 2.0 # Note: different W's to ensure that smooth != noperspective
> + 3.0 -3.0 0.0 3.0
> +
> +[test]
> +
> +# Clear the background to green so that parts of the triangle which
> +# aren't drawn won't cause the test to fail.
> +clear color 0.0 1.0 0.0 1.0
> +clear
> +draw arrays GL_TRIANGLES 0 3
> +probe all rgba 0.0 1.0 0.0 1.0
> 



More information about the Piglit mailing list