diff options
author | Eric Anholt <eric@anholt.net> | 2012-07-23 15:59:32 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2012-08-09 09:09:35 -0700 |
commit | 502c8590151087fdfb886fe26aa82e6c2945ccfb (patch) | |
tree | a36aa6181409a061727ecf62537ebcd5df853956 /tests/spec/glsl-1.40/uniform_buffer | |
parent | e87de376ad0febf5e89e7e82383e77033648b265 (diff) |
GLSL 1.40: New tests for rendering using UBO aggregate assignment.
Diffstat (limited to 'tests/spec/glsl-1.40/uniform_buffer')
4 files changed, 181 insertions, 0 deletions
diff --git a/tests/spec/glsl-1.40/uniform_buffer/fs-array-copy.shader_test b/tests/spec/glsl-1.40/uniform_buffer/fs-array-copy.shader_test new file mode 100644 index 00000000..bf3c9722 --- /dev/null +++ b/tests/spec/glsl-1.40/uniform_buffer/fs-array-copy.shader_test @@ -0,0 +1,43 @@ +[require] +GLSL >= 1.40 + +[vertex shader] +#version 140 + +in vec4 vertex; + +void main() +{ + gl_Position = vertex; +} + +[fragment shader] +#version 140 + +uniform int i; +uniform ubo1 { + vec4 colors[4]; +}; + +void main() +{ + vec4 temp[4] = colors; + temp[0] = vec4(1.0, 0.0, 0.0, 0.0); + gl_FragColor = temp[i]; +} + +[vertex data] +vertex/float/2 +-1.0 -1.0 + 1.0 -1.0 + 1.0 1.0 +-1.0 1.0 + +[test] +uniform int i 1 +uniform vec4 colors[0] 0.0 0.0 0.0 0.0 +uniform vec4 colors[1] 0.0 1.0 0.0 0.0 +uniform vec4 colors[2] 0.0 1.0 1.0 0.0 +uniform vec4 colors[3] 1.0 0.0 1.0 0.0 +draw arrays GL_TRIANGLE_FAN 0 4 +probe all rgba 0.0 1.0 0.0 0.0 diff --git a/tests/spec/glsl-1.40/uniform_buffer/fs-struct-copy.shader_test b/tests/spec/glsl-1.40/uniform_buffer/fs-struct-copy.shader_test new file mode 100644 index 00000000..2ed1d8e5 --- /dev/null +++ b/tests/spec/glsl-1.40/uniform_buffer/fs-struct-copy.shader_test @@ -0,0 +1,43 @@ +[require] +GLSL >= 1.40 + +[vertex shader] +#version 140 + +in vec4 vertex; + +void main() +{ + gl_Position = vertex; +} + +[fragment shader] +#version 140 + +uniform ubo1 { + struct S { + vec4 a, b, c, d; + } colors; +}; + +void main() +{ + S temp = colors; + temp.c = vec4(0.0); /* try, but fail, to prevent copy prop */ + gl_FragColor = temp.a + temp.b + temp.c + temp.d; +} + +[vertex data] +vertex/float/2 +-1.0 -1.0 + 1.0 -1.0 + 1.0 1.0 +-1.0 1.0 + +[test] +uniform vec4 colors.a 0.0 0.0 0.0 0.0 +uniform vec4 colors.b 0.0 1.0 0.0 0.0 +uniform vec4 colors.c 1.0 0.0 0.0 0.0 +uniform vec4 colors.d 0.0 0.0 0.0 0.0 +draw arrays GL_TRIANGLE_FAN 0 4 +probe all rgba 0.0 1.0 0.0 0.0 diff --git a/tests/spec/glsl-1.40/uniform_buffer/vs-array-copy.shader_test b/tests/spec/glsl-1.40/uniform_buffer/vs-array-copy.shader_test new file mode 100644 index 00000000..f7f235d8 --- /dev/null +++ b/tests/spec/glsl-1.40/uniform_buffer/vs-array-copy.shader_test @@ -0,0 +1,47 @@ +[require] +GLSL >= 1.40 + +[vertex shader] +#version 140 + +uniform int i; +uniform ubo1 { + vec4 colors[4]; +}; + +in vec4 vertex; +out vec4 v; + +void main() +{ + gl_Position = vertex; + vec4 temp[4] = colors; + temp[0] = vec4(1.0, 0.0, 0.0, 0.0); + v = temp[i]; +} + +[fragment shader] +#version 140 + +in vec4 v; + +void main() +{ + gl_FragColor = v; +} + +[vertex data] +vertex/float/2 +-1.0 -1.0 + 1.0 -1.0 + 1.0 1.0 +-1.0 1.0 + +[test] +uniform int i 1 +uniform vec4 colors[0] 0.0 0.0 0.0 0.0 +uniform vec4 colors[1] 0.0 1.0 0.0 0.0 +uniform vec4 colors[2] 0.0 1.0 1.0 0.0 +uniform vec4 colors[3] 1.0 0.0 1.0 0.0 +draw arrays GL_TRIANGLE_FAN 0 4 +probe all rgba 0.0 1.0 0.0 0.0 diff --git a/tests/spec/glsl-1.40/uniform_buffer/vs-struct-copy.shader_test b/tests/spec/glsl-1.40/uniform_buffer/vs-struct-copy.shader_test new file mode 100644 index 00000000..8a261abb --- /dev/null +++ b/tests/spec/glsl-1.40/uniform_buffer/vs-struct-copy.shader_test @@ -0,0 +1,48 @@ +[require] +GLSL >= 1.40 + +[vertex shader] +#version 140 + +uniform ubo1 { + struct S { + vec4 a, b, c, d; + } colors; +}; + +in vec4 vertex; +out vec4 v; + +void main() +{ + gl_Position = vertex; + + S temp = colors; + temp.c = vec4(0.0); /* try, but fail, to prevent copy prop */ + v = temp.a + temp.b + temp.c + temp.d; +} + +[fragment shader] +#version 140 + +in vec4 v; + +void main() +{ + gl_FragColor = v; +} + +[vertex data] +vertex/float/2 +-1.0 -1.0 + 1.0 -1.0 + 1.0 1.0 +-1.0 1.0 + +[test] +uniform vec4 colors.a 0.0 0.0 0.0 0.0 +uniform vec4 colors.b 0.0 1.0 0.0 0.0 +uniform vec4 colors.c 1.0 0.0 0.0 0.0 +uniform vec4 colors.d 0.0 0.0 0.0 0.0 +draw arrays GL_TRIANGLE_FAN 0 4 +probe all rgba 0.0 1.0 0.0 0.0 |