From 2cf959c8ba2705331782abd76b009008a9d765b7 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Mon, 9 Apr 2018 19:44:41 +1000 Subject: glsl-1.10: add a number of new function parameter tests These all have long function call chains, so that some remain intact when Mesas GLSLOptimizeConservatively flag is set. This allows us to exercise the GLSL IR -> NIR path for functions and NIRs function inlining code. --- ...-function-chain16-in-array-indirect.shader_test | 74 ++++++++++++++++++++++ ...function-chain16-in-array-indirect2.shader_test | 74 ++++++++++++++++++++++ .../glsl-function-chain16-in-array.shader_test | 70 ++++++++++++++++++++ .../glsl-function-chain16-in-array2.shader_test | 70 ++++++++++++++++++++ .../glsl-function-chain16-in-swizzle.shader_test | 64 +++++++++++++++++++ .../glsl-function-chain16-in.shader_test | 64 +++++++++++++++++++ ...glsl-function-chain16-inout-swizzle.shader_test | 64 +++++++++++++++++++ .../glsl-function-chain16-out-swizzle.shader_test | 64 +++++++++++++++++++ .../glsl-function-chain16-out.shader_test | 64 +++++++++++++++++++ 9 files changed, 608 insertions(+) create mode 100644 tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in-array-indirect.shader_test create mode 100644 tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in-array-indirect2.shader_test create mode 100644 tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in-array.shader_test create mode 100644 tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in-array2.shader_test create mode 100644 tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in-swizzle.shader_test create mode 100644 tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in.shader_test create mode 100644 tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-inout-swizzle.shader_test create mode 100644 tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-out-swizzle.shader_test create mode 100644 tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-out.shader_test diff --git a/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in-array-indirect.shader_test b/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in-array-indirect.shader_test new file mode 100644 index 000000000..19dac8bd9 --- /dev/null +++ b/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in-array-indirect.shader_test @@ -0,0 +1,74 @@ +# This tests we inline functions correctly. Chaining the functions helps +# us reach the GLSL IR -> NIR code with some functions intact when the +# conservative optimise flag is set in Mesa. This allows us to test the +# GLSL IR -> NIR conversion code for functions and the NIR function inlining +# code. +[require] +GLSL >= 1.10 + +[vertex shader] +void main() +{ + gl_Position = gl_Vertex; +} + +[fragment shader] +float f01(in float f[4]); +float f02(in float f[4]); +float f06(in float f[4]); +float f10(in float f[4]); +float f14(in float f[4]); +void main() +{ + float g[4]; + + g[0] = 0.0; + g[1] = 1.0; + g[2] = 0.0; + g[3] = 0.1; + + f01(g); + gl_FragColor = vec4(f01(g), g[0], g[2], g[1]); +} +float f01(in float f[4]) {return f02(f);} +float f05(in float f[4]) {return f06(f);} +float f09(in float f[4]) {return f10(f);} +float f13(in float f[4]) {return f14(f);} + +[fragment shader] +float f03(in float f[4]); +float f07(in float f[4]); +float f11(in float f[4]); +float f15(in float f[4]); +float f02(in float f[4]) {return f03(f);} +float f06(in float f[4]) {return f07(f);} +float f10(in float f[4]) {return f11(f);} +float f14(in float f[4]) {return f15(f);} + +[fragment shader] +float f04(in float f[4]); +float f08(in float f[4]); +float f12(in float f[4]); +float f16(in float f[4]); +float f03(in float f[4]) {return f04(f);} +float f07(in float f[4]) {return f08(f);} +float f11(in float f[4]) {return f12(f);} +float f15(in float f[4]) {return f16(f);} + +[fragment shader] +uniform int i; + +float f05(in float f[4]); +float f09(in float f[4]); +float f13(in float f[4]); +float f04(in float f[4]) {return f05(f);} +float f08(in float f[4]) {return f09(f);} +float f12(in float f[4]) {return f13(f);} +float f16(in float f[4]) {return f[i] + 0.1;} + + +[test] +uniform int i 3 + +draw rect -1 -1 2 2 +probe all rgba 0.2 0 0 1.0 diff --git a/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in-array-indirect2.shader_test b/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in-array-indirect2.shader_test new file mode 100644 index 000000000..ea3b20efb --- /dev/null +++ b/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in-array-indirect2.shader_test @@ -0,0 +1,74 @@ +# This tests we inline functions correctly. Chaining the functions helps +# us reach the GLSL IR -> NIR code with some functions intact when the +# conservative optimise flag is set in Mesa. This allows us to test the +# GLSL IR -> NIR conversion code for functions and the NIR function inlining +# code. +[require] +GLSL >= 1.10 + +[vertex shader] +void main() +{ + gl_Position = gl_Vertex; +} + +[fragment shader] +float f01(in float f[4]); +float f02(in float f[4]); +float f06(in float f[4]); +float f10(in float f[4]); +float f14(in float f[4]); +void main() +{ + float g[4]; + + g[0] = 0.0; + g[1] = 1.0; + g[2] = 0.0; + g[3] = 0.1; + + f01(g); + gl_FragColor = vec4(f01(g), g[0], g[2], g[1]); +} +float f01(in float f[4]) {return f02(f);} +float f05(in float f[4]) {return f06(f);} +float f09(in float f[4]) {return f10(f);} +float f13(in float f[4]) {return f14(f);} + +[fragment shader] +float f03(in float f[4]); +float f07(in float f[4]); +float f11(in float f[4]); +float f15(in float f[4]); +float f02(in float f[4]) {return f03(f);} +float f06(in float f[4]) {return f07(f);} +float f10(in float f[4]) {return f11(f);} +float f14(in float f[4]) {return f15(f);} + +[fragment shader] +uniform int i; + +float f04(in float f[4]); +float f08(in float f[4]); +float f12(in float f[4]); +float f16(in float f); +float f03(in float f[4]) {return f04(f);} +float f07(in float f[4]) {return f08(f);} +float f11(in float f[4]) {return f12(f);} +float f15(in float f[4]) {return f16(f[i]);} + +[fragment shader] +float f05(in float f[4]); +float f09(in float f[4]); +float f13(in float f[4]); +float f04(in float f[4]) {return f05(f);} +float f08(in float f[4]) {return f09(f);} +float f12(in float f[4]) {return f13(f);} +float f16(in float f) {return f + 0.1;} + + +[test] +uniform int i 3 + +draw rect -1 -1 2 2 +probe all rgba 0.2 0 0 1.0 diff --git a/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in-array.shader_test b/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in-array.shader_test new file mode 100644 index 000000000..f3134c878 --- /dev/null +++ b/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in-array.shader_test @@ -0,0 +1,70 @@ +# This tests we inline functions correctly. Chaining the functions helps +# us reach the GLSL IR -> NIR code with some functions intact when the +# conservative optimise flag is set in Mesa. This allows us to test the +# GLSL IR -> NIR conversion code for functions and the NIR function inlining +# code. +[require] +GLSL >= 1.10 + +[vertex shader] +void main() +{ + gl_Position = gl_Vertex; +} + +[fragment shader] +float f01(in float f[4]); +float f02(in float f[4]); +float f06(in float f[4]); +float f10(in float f[4]); +float f14(in float f[4]); +void main() +{ + float g[4]; + + g[0] = 0.0; + g[1] = 1.0; + g[2] = 0.0; + g[3] = 0.1; + + f01(g); + gl_FragColor = vec4(f01(g), g[0], g[2], g[1]); +} +float f01(in float f[4]) {return f02(f);} +float f05(in float f[4]) {return f06(f);} +float f09(in float f[4]) {return f10(f);} +float f13(in float f[4]) {return f14(f);} + +[fragment shader] +float f03(in float f[4]); +float f07(in float f[4]); +float f11(in float f[4]); +float f15(in float f[4]); +float f02(in float f[4]) {return f03(f);} +float f06(in float f[4]) {return f07(f);} +float f10(in float f[4]) {return f11(f);} +float f14(in float f[4]) {return f15(f);} + +[fragment shader] +float f04(in float f[4]); +float f08(in float f[4]); +float f12(in float f[4]); +float f16(in float f[4]); +float f03(in float f[4]) {return f04(f);} +float f07(in float f[4]) {return f08(f);} +float f11(in float f[4]) {return f12(f);} +float f15(in float f[4]) {return f16(f);} + +[fragment shader] +float f05(in float f[4]); +float f09(in float f[4]); +float f13(in float f[4]); +float f04(in float f[4]) {return f05(f);} +float f08(in float f[4]) {return f09(f);} +float f12(in float f[4]) {return f13(f);} +float f16(in float f[4]) {return f[3] + 0.1;} + + +[test] +draw rect -1 -1 2 2 +probe all rgba 0.2 0 0 1.0 diff --git a/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in-array2.shader_test b/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in-array2.shader_test new file mode 100644 index 000000000..b0d373218 --- /dev/null +++ b/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in-array2.shader_test @@ -0,0 +1,70 @@ +# This tests we inline functions correctly. Chaining the functions helps +# us reach the GLSL IR -> NIR code with some functions intact when the +# conservative optimise flag is set in Mesa. This allows us to test the +# GLSL IR -> NIR conversion code for functions and the NIR function inlining +# code. +[require] +GLSL >= 1.10 + +[vertex shader] +void main() +{ + gl_Position = gl_Vertex; +} + +[fragment shader] +float f01(in float f[4]); +float f02(in float f[4]); +float f06(in float f[4]); +float f10(in float f[4]); +float f14(in float f[4]); +void main() +{ + float g[4]; + + g[0] = 0.0; + g[1] = 1.0; + g[2] = 0.0; + g[3] = 0.1; + + f01(g); + gl_FragColor = vec4(f01(g), g[0], g[2], g[1]); +} +float f01(in float f[4]) {return f02(f);} +float f05(in float f[4]) {return f06(f);} +float f09(in float f[4]) {return f10(f);} +float f13(in float f[4]) {return f14(f);} + +[fragment shader] +float f03(in float f[4]); +float f07(in float f[4]); +float f11(in float f[4]); +float f15(in float f[4]); +float f02(in float f[4]) {return f03(f);} +float f06(in float f[4]) {return f07(f);} +float f10(in float f[4]) {return f11(f);} +float f14(in float f[4]) {return f15(f);} + +[fragment shader] +float f04(in float f[4]); +float f08(in float f[4]); +float f12(in float f[4]); +float f16(in float f); +float f03(in float f[4]) {return f04(f);} +float f07(in float f[4]) {return f08(f);} +float f11(in float f[4]) {return f12(f);} +float f15(in float f[4]) {return f16(f[3]);} + +[fragment shader] +float f05(in float f[4]); +float f09(in float f[4]); +float f13(in float f[4]); +float f04(in float f[4]) {return f05(f);} +float f08(in float f[4]) {return f09(f);} +float f12(in float f[4]) {return f13(f);} +float f16(in float f) {return f + 0.1;} + + +[test] +draw rect -1 -1 2 2 +probe all rgba 0.2 0 0 1.0 diff --git a/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in-swizzle.shader_test b/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in-swizzle.shader_test new file mode 100644 index 000000000..aa80b4300 --- /dev/null +++ b/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in-swizzle.shader_test @@ -0,0 +1,64 @@ +# This tests we inline functions correctly. Chaining the functions helps +# us reach the GLSL IR -> NIR code with some functions intact when the +# conservative optimise flag is set in Mesa. This allows us to test the +# GLSL IR -> NIR conversion code for functions and the NIR function inlining +# code. +[require] +GLSL >= 1.10 + +[vertex shader] +void main() +{ + gl_Position = gl_Vertex; +} + +[fragment shader] +float f01(in vec4 f); +float f02(in vec4 f); +float f06(in vec4 f); +float f10(in vec4 f); +float f14(in vec4 f); +void main() +{ + vec4 g = vec4(0, 0.1, 0, 1.0); + f01(g); + gl_FragColor = vec4(f01(g), g.x, g.z, g.w); +} +float f01(in vec4 f) {return f02(f);} +float f05(in vec4 f) {return f06(f);} +float f09(in vec4 f) {return f10(f);} +float f13(in vec4 f) {return f14(f);} + +[fragment shader] +float f03(in vec4 f); +float f07(in vec4 f); +float f11(in vec4 f); +float f15(in vec4 f); +float f02(in vec4 f) {return f03(f);} +float f06(in vec4 f) {return f07(f);} +float f10(in vec4 f) {return f11(f);} +float f14(in vec4 f) {return f15(f);} + +[fragment shader] +float f04(in vec4 f); +float f08(in vec4 f); +float f12(in vec4 f); +float f16(in float f); +float f03(in vec4 f) {return f04(f);} +float f07(in vec4 f) {return f08(f);} +float f11(in vec4 f) {return f12(f);} +float f15(in vec4 f) {return f16(f.y);} + +[fragment shader] +float f05(in vec4 f); +float f09(in vec4 f); +float f13(in vec4 f); +float f04(in vec4 f) {return f05(f);} +float f08(in vec4 f) {return f09(f);} +float f12(in vec4 f) {return f13(f);} +float f16(in float f) {return f + 0.1;} + + +[test] +draw rect -1 -1 2 2 +probe all rgba 0.2 0 0 1.0 diff --git a/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in.shader_test b/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in.shader_test new file mode 100644 index 000000000..73d45ca17 --- /dev/null +++ b/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-in.shader_test @@ -0,0 +1,64 @@ +# This tests we inline functions correctly. Chaining the functions helps +# us reach the GLSL IR -> NIR code with some functions intact when the +# conservative optimise flag is set in Mesa. This allows us to test the +# GLSL IR -> NIR conversion code for functions and the NIR function inlining +# code. +[require] +GLSL >= 1.10 + +[vertex shader] +void main() +{ + gl_Position = gl_Vertex; +} + +[fragment shader] +float f01(in vec4 f); +float f02(in vec4 f); +float f06(in vec4 f); +float f10(in vec4 f); +float f14(in vec4 f); +void main() +{ + vec4 g = vec4(0, 0.1, 0, 1.0); + f01(g); + gl_FragColor = vec4(f01(g), g.x, g.z, g.w); +} +float f01(in vec4 f) {return f02(f);} +float f05(in vec4 f) {return f06(f);} +float f09(in vec4 f) {return f10(f);} +float f13(in vec4 f) {return f14(f);} + +[fragment shader] +float f03(in vec4 f); +float f07(in vec4 f); +float f11(in vec4 f); +float f15(in vec4 f); +float f02(in vec4 f) {return f03(f);} +float f06(in vec4 f) {return f07(f);} +float f10(in vec4 f) {return f11(f);} +float f14(in vec4 f) {return f15(f);} + +[fragment shader] +float f04(in vec4 f); +float f08(in vec4 f); +float f12(in vec4 f); +float f16(in vec4 f); +float f03(in vec4 f) {return f04(f);} +float f07(in vec4 f) {return f08(f);} +float f11(in vec4 f) {return f12(f);} +float f15(in vec4 f) {return f16(f);} + +[fragment shader] +float f05(in vec4 f); +float f09(in vec4 f); +float f13(in vec4 f); +float f04(in vec4 f) {return f05(f);} +float f08(in vec4 f) {return f09(f);} +float f12(in vec4 f) {return f13(f);} +float f16(in vec4 f) {return f.y + 0.1;} + + +[test] +draw rect -1 -1 2 2 +probe all rgba 0.2 0 0 1.0 diff --git a/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-inout-swizzle.shader_test b/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-inout-swizzle.shader_test new file mode 100644 index 000000000..7bb6fe075 --- /dev/null +++ b/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-inout-swizzle.shader_test @@ -0,0 +1,64 @@ +# This tests we inline functions correctly. Chaining the functions helps +# us reach the GLSL IR -> NIR code with some functions intact when the +# conservative optimise flag is set in Mesa. This allows us to test the +# GLSL IR -> NIR conversion code for functions and the NIR function inlining +# code. +[require] +GLSL >= 1.10 + +[vertex shader] +void main() +{ + gl_Position = gl_Vertex; +} + +[fragment shader] +void f01(inout vec4 f); +void f02(inout vec4 f); +void f06(inout vec4 f); +void f10(inout vec4 f); +void f14(inout vec4 f); +void main() +{ + vec4 g = vec4(0.1, 0, 0, 1.0); + f01(g); + gl_FragColor = g; +} +void f01(inout vec4 f) {f02(f);} +void f05(inout vec4 f) {f06(f);} +void f09(inout vec4 f) {f10(f);} +void f13(inout vec4 f) {f14(f);} + +[fragment shader] +void f03(inout vec4 f); +void f07(inout vec4 f); +void f11(inout vec4 f); +void f15(inout vec4 f); +void f02(inout vec4 f) {f03(f);} +void f06(inout vec4 f) {f07(f);} +void f10(inout vec4 f) {f11(f);} +void f14(inout vec4 f) {f15(f);} + +[fragment shader] +void f04(inout vec4 f); +void f08(inout vec4 f); +void f12(inout vec4 f); +void f16(inout float f); +void f03(inout vec4 f) {f04(f);} +void f07(inout vec4 f) {f08(f);} +void f11(inout vec4 f) {f12(f);} +void f15(inout vec4 f) {f16(f.x);} + +[fragment shader] +void f05(inout vec4 f); +void f09(inout vec4 f); +void f13(inout vec4 f); +void f04(inout vec4 f) {f05(f);} +void f08(inout vec4 f) {f09(f);} +void f12(inout vec4 f) {f13(f);} +void f16(inout float f) {f+=0.1;} + + +[test] +draw rect -1 -1 2 2 +probe all rgba 0.2 0 0 1.0 diff --git a/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-out-swizzle.shader_test b/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-out-swizzle.shader_test new file mode 100644 index 000000000..ef3220f0a --- /dev/null +++ b/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-out-swizzle.shader_test @@ -0,0 +1,64 @@ +# This tests we inline functions correctly. Chaining the functions helps +# us reach the GLSL IR -> NIR code with some functions intact when the +# conservative optimise flag is set in Mesa. This allows us to test the +# GLSL IR -> NIR conversion code for functions and the NIR function inlining +# code. +[require] +GLSL >= 1.10 + +[vertex shader] +void main() +{ + gl_Position = gl_Vertex; +} + +[fragment shader] +void f01(inout vec4 f); +void f02(inout vec4 f); +void f06(inout vec4 f); +void f10(inout vec4 f); +void f14(inout vec4 f); +void main() +{ + vec4 g = vec4(0.0, 0.3, 0, 1.0); + f01(g); + gl_FragColor = g; +} +void f01(inout vec4 f) {f02(f);} +void f05(inout vec4 f) {f06(f);} +void f09(inout vec4 f) {f10(f);} +void f13(inout vec4 f) {f14(f);} + +[fragment shader] +void f03(inout vec4 f); +void f07(inout vec4 f); +void f11(inout vec4 f); +void f15(inout vec4 f); +void f02(inout vec4 f) {f03(f);} +void f06(inout vec4 f) {f07(f);} +void f10(inout vec4 f) {f11(f);} +void f14(inout vec4 f) {f15(f);} + +[fragment shader] +void f04(inout vec4 f); +void f08(inout vec4 f); +void f12(inout vec4 f); +void f16(inout float f); +void f03(inout vec4 f) {f04(f);} +void f07(inout vec4 f) {f08(f);} +void f11(inout vec4 f) {f12(f);} +void f15(inout vec4 f) {f16(f.y);} + +[fragment shader] +void f05(inout vec4 f); +void f09(inout vec4 f); +void f13(inout vec4 f); +void f04(inout vec4 f) {f05(f);} +void f08(inout vec4 f) {f09(f);} +void f12(inout vec4 f) {f13(f);} +void f16(inout float f) {f=0.2;} + + +[test] +draw rect -1 -1 2 2 +probe all rgba 0 0.2 0 1.0 diff --git a/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-out.shader_test b/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-out.shader_test new file mode 100644 index 000000000..f60a1fe09 --- /dev/null +++ b/tests/spec/glsl-1.10/execution/function-calls/glsl-function-chain16-out.shader_test @@ -0,0 +1,64 @@ +# This tests we inline functions correctly. Chaining the functions helps +# us reach the GLSL IR -> NIR code with some functions intact when the +# conservative optimise flag is set in Mesa. This allows us to test the +# GLSL IR -> NIR conversion code for functions and the NIR function inlining +# code. +[require] +GLSL >= 1.10 + +[vertex shader] +void main() +{ + gl_Position = gl_Vertex; +} + +[fragment shader] +void f01(inout float f); +void f02(inout float f); +void f06(inout float f); +void f10(inout float f); +void f14(inout float f); +void main() +{ + float g = 0.3; + f01(g); + gl_FragColor = vec4(0.0, g, 0, 1.0); +} +void f01(inout float f) {f02(f);} +void f05(inout float f) {f06(f);} +void f09(inout float f) {f10(f);} +void f13(inout float f) {f14(f);} + +[fragment shader] +void f03(inout float f); +void f07(inout float f); +void f11(inout float f); +void f15(inout float f); +void f02(inout float f) {f03(f);} +void f06(inout float f) {f07(f);} +void f10(inout float f) {f11(f);} +void f14(inout float f) {f15(f);} + +[fragment shader] +void f04(inout float f); +void f08(inout float f); +void f12(inout float f); +void f16(inout float f); +void f03(inout float f) {f04(f);} +void f07(inout float f) {f08(f);} +void f11(inout float f) {f12(f);} +void f15(inout float f) {f16(f);} + +[fragment shader] +void f05(inout float f); +void f09(inout float f); +void f13(inout float f); +void f04(inout float f) {f05(f);} +void f08(inout float f) {f09(f);} +void f12(inout float f) {f13(f);} +void f16(inout float f) {f=0.2;} + + +[test] +draw rect -1 -1 2 2 +probe all rgba 0 0.2 0 1.0 -- cgit v1.2.3