From: Ian Romanick <[email protected]> There are several variations of
void foo(inout int i, inout float f); ... foo(i, f[i]); that Mesa's GLSL compiler gets wrong. NVIDIA's closed-source driver (version 304.64) fails vs-inout-index-inout-mat2-col.shader_test and vs-inout-index-inout-mat2-row.shader_test, but passes the others. v2: Use 'proble all rgb' and make vs-inout-index-inout-mat2-col use u=1 like the other tests. Both items were suggested by Eric Anholt. I use 'probe all rgb' because the tests actually write 0 for alpha, but shader_runner doesn't always get an RGBA visual (so alpha will be 0 or 1). Also, add two simpler tests vs-out-vec4 and vs-inout-vec4. This currently pass, but a patch series I have in progress had broken them. Signed-off-by: Ian Romanick <[email protected]> --- .../vs-inout-index-inout-float-array.shader_test | 35 ++++++++++++++++++++++ .../vs-inout-index-inout-mat2-col.shader_test | 34 +++++++++++++++++++++ .../vs-inout-index-inout-mat2-row.shader_test | 34 +++++++++++++++++++++ ...nout-index-inout-vec4-array-element.shader_test | 35 ++++++++++++++++++++++ .../vs-inout-index-inout-vec4-array.shader_test | 35 ++++++++++++++++++++++ .../vs-inout-index-inout-vec4.shader_test | 35 ++++++++++++++++++++++ .../vs-inout-vec4.shader_test | 33 ++++++++++++++++++++ .../out-parameter-indexing/vs-out-vec4.shader_test | 33 ++++++++++++++++++++ 8 files changed, 274 insertions(+) create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-index-inout-float-array.shader_test create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-col.shader_test create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-row.shader_test create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array-element.shader_test create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array.shader_test create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4.shader_test create mode 100644 tests/shaders/out-parameter-indexing/vs-inout-vec4.shader_test create mode 100644 tests/shaders/out-parameter-indexing/vs-out-vec4.shader_test diff --git a/tests/shaders/out-parameter-indexing/vs-inout-index-inout-float-array.shader_test b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-float-array.shader_test new file mode 100644 index 0000000..95fee24 --- /dev/null +++ b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-float-array.shader_test @@ -0,0 +1,35 @@ +[require] +GLSL >= 1.20 + +[vertex shader] + +uniform int u = 1; +varying vec4 color; + +void func(inout int i, inout float f) +{ + i = 0; + f = 1.; +} + +void main() +{ + float fa[] = float[](0., 0., 0., 0.); + int i = u; + + func(i, fa[i]); + color = vec4(fa[0], fa[1], fa[2], fa[3]); + gl_Position = gl_Vertex; +} + +[fragment shader] +varying vec4 color; + +void main() +{ + gl_FragColor = color; +} + +[test] +draw rect -1 -1 2 2 +probe all rgb 0. 1. 0. diff --git a/tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-col.shader_test b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-col.shader_test new file mode 100644 index 0000000..853d1bc --- /dev/null +++ b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-col.shader_test @@ -0,0 +1,34 @@ +[require] +GLSL >= 1.20 + +[vertex shader] +uniform int u = 1; +varying vec4 color; + +void func(inout int i, inout float f) +{ + i = 0; + f = 1.; +} + +void main() +{ + mat2 m = mat2(0.); + int i = u; + + func(i, m[i][1]); + color = vec4(m[1].x, m[1].y, m[0].x, m[0].y); + gl_Position = gl_Vertex; +} + +[fragment shader] +varying vec4 color; + +void main() +{ + gl_FragColor = color; +} + +[test] +draw rect -1 -1 2 2 +probe all rgb 0. 1. diff --git a/tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-row.shader_test b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-row.shader_test new file mode 100644 index 0000000..1c1c39c --- /dev/null +++ b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-mat2-row.shader_test @@ -0,0 +1,34 @@ +[require] +GLSL >= 1.20 + +[vertex shader] +uniform int u = 1; +varying vec4 color; + +void func(inout int i, inout float f) +{ + i = 0; + f = 1.; +} + +void main() +{ + mat2 m = mat2(0.); + int i = u; + + func(i, m[0][i]); + color = vec4(m[0].x, m[0].y, m[1].x, m[1].y); + gl_Position = gl_Vertex; +} + +[fragment shader] +varying vec4 color; + +void main() +{ + gl_FragColor = color; +} + +[test] +draw rect -1 -1 2 2 +probe all rgb 0. 1. 0. diff --git a/tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array-element.shader_test b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array-element.shader_test new file mode 100644 index 0000000..a13d409 --- /dev/null +++ b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array-element.shader_test @@ -0,0 +1,35 @@ +[require] +GLSL >= 1.20 + +[vertex shader] + +uniform int u = 1; +varying vec4 color; + +void func(inout int i, inout float f) +{ + i = 0; + f = 1.; +} + +void main() +{ + vec4 v[] = vec4[](vec4(0.), vec4(0.)); + int i = u; + + func(i, v[1][i]); + color = v[1]; + gl_Position = gl_Vertex; +} + +[fragment shader] +varying vec4 color; + +void main() +{ + gl_FragColor = color; +} + +[test] +draw rect -1 -1 2 2 +probe all rgb 0. 1. 0. diff --git a/tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array.shader_test b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array.shader_test new file mode 100644 index 0000000..a334020 --- /dev/null +++ b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4-array.shader_test @@ -0,0 +1,35 @@ +[require] +GLSL >= 1.20 + +[vertex shader] + +uniform int u = 1; +varying vec4 color; + +void func(inout int i, inout float f) +{ + i = 0; + f = 1.; +} + +void main() +{ + vec4 v[] = vec4[](vec4(0.), vec4(0.)); + int i = u; + + func(i, v[i].y); + color = v[1]; + gl_Position = gl_Vertex; +} + +[fragment shader] +varying vec4 color; + +void main() +{ + gl_FragColor = color; +} + +[test] +draw rect -1 -1 2 2 +probe all rgb 0. 1. 0. diff --git a/tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4.shader_test b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4.shader_test new file mode 100644 index 0000000..13259d5 --- /dev/null +++ b/tests/shaders/out-parameter-indexing/vs-inout-index-inout-vec4.shader_test @@ -0,0 +1,35 @@ +[require] +GLSL >= 1.20 + +[vertex shader] + +uniform int u = 1; +varying vec4 color; + +void func(inout int i, inout float f) +{ + i = 0; + f = 1.; +} + +void main() +{ + vec4 v = vec4(0.); + int i = u; + + func(i, v[i]); + color = v; + gl_Position = gl_Vertex; +} + +[fragment shader] +varying vec4 color; + +void main() +{ + gl_FragColor = color; +} + +[test] +draw rect -1 -1 2 2 +probe all rgb 0. 1. 0. diff --git a/tests/shaders/out-parameter-indexing/vs-inout-vec4.shader_test b/tests/shaders/out-parameter-indexing/vs-inout-vec4.shader_test new file mode 100644 index 0000000..d3fe9bc --- /dev/null +++ b/tests/shaders/out-parameter-indexing/vs-inout-vec4.shader_test @@ -0,0 +1,33 @@ +[require] +GLSL >= 1.20 + +[vertex shader] + +uniform int u = 1; +varying vec4 color; + +void func(inout float f) +{ + f = 1.; +} + +void main() +{ + vec4 v = vec4(0.); + + func(v[u]); + color = v; + gl_Position = gl_Vertex; +} + +[fragment shader] +varying vec4 color; + +void main() +{ + gl_FragColor = color; +} + +[test] +draw rect -1 -1 2 2 +probe all rgb 0. 1. 0. diff --git a/tests/shaders/out-parameter-indexing/vs-out-vec4.shader_test b/tests/shaders/out-parameter-indexing/vs-out-vec4.shader_test new file mode 100644 index 0000000..3958e38 --- /dev/null +++ b/tests/shaders/out-parameter-indexing/vs-out-vec4.shader_test @@ -0,0 +1,33 @@ +[require] +GLSL >= 1.20 + +[vertex shader] + +uniform int u = 1; +varying vec4 color; + +void func(out float f) +{ + f = 1.; +} + +void main() +{ + vec4 v = vec4(0.); + + func(v[u]); + color = v; + gl_Position = gl_Vertex; +} + +[fragment shader] +varying vec4 color; + +void main() +{ + gl_FragColor = color; +} + +[test] +draw rect -1 -1 2 2 +probe all rgb 0. 1. 0. -- 1.8.1.4 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
