diff options
author | Eric Anholt <eric@anholt.net> | 2012-07-26 12:06:22 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2012-08-09 09:09:35 -0700 |
commit | 048a8ea33d365c279035ba9b0a518312bba06707 (patch) | |
tree | 343837e7d2213eb15eaff475294c18b632c2e9fc /tests/spec/glsl-1.40/uniform_buffer | |
parent | dcb671ff1500aeb52b970685376ce2677ee54c9f (diff) |
GLSL 1.40: Add tests for UBO structure padding bug in link_uniforms.cpp.
Diffstat (limited to 'tests/spec/glsl-1.40/uniform_buffer')
-rw-r--r-- | tests/spec/glsl-1.40/uniform_buffer/fs-struct-pad.shader_test | 49 | ||||
-rw-r--r-- | tests/spec/glsl-1.40/uniform_buffer/vs-struct-pad.shader_test | 53 |
2 files changed, 102 insertions, 0 deletions
diff --git a/tests/spec/glsl-1.40/uniform_buffer/fs-struct-pad.shader_test b/tests/spec/glsl-1.40/uniform_buffer/fs-struct-pad.shader_test new file mode 100644 index 00000000..a2202ff9 --- /dev/null +++ b/tests/spec/glsl-1.40/uniform_buffer/fs-struct-pad.shader_test @@ -0,0 +1,49 @@ +[require] +GLSL >= 1.40 + +[vertex shader] +#version 140 + +in vec4 vertex; + +void main() +{ + gl_Position = vertex; +} + +[fragment shader] +#version 140 + +uniform ubo1 { + struct S { + struct S1 { + float r; + } s1; + + struct S2 { + float g; + float b; + float a; + } s2; + } s; +}; + +void main() +{ + gl_FragColor = vec4(s.s1.r, s.s2.g, s.s2.b, s.s2.a); +} + +[vertex data] +vertex/float/2 +-1.0 -1.0 + 1.0 -1.0 + 1.0 1.0 +-1.0 1.0 + +[test] +uniform float s.s1.r 0.0 +uniform float s.s2.g 1.0 +uniform float s.s2.b 0.0 +uniform float s.s2.a 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-pad.shader_test b/tests/spec/glsl-1.40/uniform_buffer/vs-struct-pad.shader_test new file mode 100644 index 00000000..7390ea84 --- /dev/null +++ b/tests/spec/glsl-1.40/uniform_buffer/vs-struct-pad.shader_test @@ -0,0 +1,53 @@ +[require] +GLSL >= 1.40 + +[vertex shader] +#version 140 + +uniform ubo1 { + struct S { + struct S1 { + float r; + } s1; + + struct S2 { + float g; + float b; + float a; + } s2; + } s; +}; + +in vec4 vertex; +out vec4 v; + +void main() +{ + gl_Position = vertex; + v = vec4(s.s1.r, s.s2.g, s.s2.b, s.s2.a); +} + +[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 float s.s1.r 0.0 +uniform float s.s2.g 1.0 +uniform float s.s2.b 0.0 +uniform float s.s2.a 0.0 +draw arrays GL_TRIANGLE_FAN 0 4 +probe all rgba 0.0 1.0 0.0 0.0 |