diff options
author | Paul Berry <stereotype441@gmail.com> | 2013-10-22 11:36:41 -0700 |
---|---|---|
committer | Paul Berry <stereotype441@gmail.com> | 2013-11-11 15:09:27 -0800 |
commit | 62f2edcaa23d7a8e8d39c20985acf4bea56cfad0 (patch) | |
tree | 5ea37d0be746e057b1fa4cf52c507a52b349e66e /tests | |
parent | 835e95d4cf8ca92516fafba2da7ecfd82392e9b5 (diff) |
Test interpolation qualifiers inside of interface blocks.
Validated using the NVIDIA proprietary driver for Linux (version
313.18).
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'tests')
3 files changed, 247 insertions, 0 deletions
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 000000000..079cda5ed --- /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 000000000..a74b2af08 --- /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 000000000..b5e3ae022 --- /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 |