diff options
author | Eric Anholt <eric@anholt.net> | 2010-07-02 15:00:24 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-07-02 15:39:06 -0700 |
commit | c4ac6fe6d155e06cb1d3532b9059c574f205a382 (patch) | |
tree | 4d8d7dc89d03b0fc304fe40be0df9bf4726dc36e | |
parent | 2283c9d56c28c1f699866601e7a979daee3c675b (diff) |
glsl-fs-texture2d*-bias*: Tests for texture2D behavior with an LOD bias.
These simple tests don't make sure that the biasing came out right
(the sample texture has the same image at all levels), but it is
useful in terms of making sure the rest of the texture handling
worked. The focus here is on the different function signatures of
texture2D with bias, as opposed to glsl-lod-bias which tests the
actual biasing.
-rw-r--r-- | tests/all.tests | 3 | ||||
-rw-r--r-- | tests/shaders/glsl-fs-texture2d-bias.shader_test | 30 | ||||
-rw-r--r-- | tests/shaders/glsl-fs-texture2dproj-bias-2.shader_test | 30 | ||||
-rw-r--r-- | tests/shaders/glsl-fs-texture2dproj-bias.shader_test | 30 |
4 files changed, 93 insertions, 0 deletions
diff --git a/tests/all.tests b/tests/all.tests index 1423ef293..c2a8b953d 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -236,9 +236,12 @@ add_plain_test(shaders, 'glsl-fs-sqrt-zero') add_shader_generic(shaders, 'glsl-fs-sign') add_shader_generic(shaders, 'glsl-fs-step') add_shader_generic(shaders, 'glsl-fs-texture2d') +add_shader_generic(shaders, 'glsl-fs-texture2d-bias') add_shader_generic(shaders, 'glsl-fs-texture2d-masked') add_shader_generic(shaders, 'glsl-fs-texture2dproj') add_shader_generic(shaders, 'glsl-fs-texture2dproj-2') +add_shader_generic(shaders, 'glsl-fs-texture2dproj-bias') +add_shader_generic(shaders, 'glsl-fs-texture2dproj-bias-2') add_shader_generic(shaders, 'glsl-if-assign-call') add_plain_test(shaders, 'glsl-orangebook-ch06-bump') add_plain_test(shaders, 'glsl-routing') diff --git a/tests/shaders/glsl-fs-texture2d-bias.shader_test b/tests/shaders/glsl-fs-texture2d-bias.shader_test new file mode 100644 index 000000000..b635a21cc --- /dev/null +++ b/tests/shaders/glsl-fs-texture2d-bias.shader_test @@ -0,0 +1,30 @@ +[require] +GL >= 2.0 +GLSL >= 1.10 + +[vertex shader] +varying vec4 texcoords; + +void main() +{ + gl_Position = gl_Vertex; + texcoords = (gl_Vertex + 1.0) / 2.0; +} + +[fragment shader] +varying vec4 texcoords; +uniform sampler2D tex; + +void main() +{ + gl_FragColor = texture2D(tex, texcoords.xy, 1.0); +} + +[test] +uniform int tex 0 +texture rgbw 0 (8, 8) +draw rect -1 -1 2 2 +relative probe rgb (0.25, 0.25) (1.0, 0.0, 0.0) +relative probe rgb (0.75, 0.25) (0.0, 1.0, 0.0) +relative probe rgb (0.25, 0.75) (0.0, 0.0, 1.0) +relative probe rgb (0.75, 0.75) (1.0, 1.0, 1.0) diff --git a/tests/shaders/glsl-fs-texture2dproj-bias-2.shader_test b/tests/shaders/glsl-fs-texture2dproj-bias-2.shader_test new file mode 100644 index 000000000..37f43c87a --- /dev/null +++ b/tests/shaders/glsl-fs-texture2dproj-bias-2.shader_test @@ -0,0 +1,30 @@ +[require] +GL >= 2.0 +GLSL >= 1.10 + +[vertex shader] +varying vec4 texcoords; + +void main() +{ + gl_Position = gl_Vertex; + texcoords = (gl_Vertex + 1.0); +} + +[fragment shader] +varying vec4 texcoords; +uniform sampler2D tex; + +void main() +{ + gl_FragColor = texture2DProj(tex, vec4(texcoords.xy, 0.0, 2.0), 1.0); +} + +[test] +uniform int tex 0 +texture rgbw 0 (8, 8) +draw rect -1 -1 2 2 +relative probe rgb (0.25, 0.25) (1.0, 0.0, 0.0) +relative probe rgb (0.75, 0.25) (0.0, 1.0, 0.0) +relative probe rgb (0.25, 0.75) (0.0, 0.0, 1.0) +relative probe rgb (0.75, 0.75) (1.0, 1.0, 1.0) diff --git a/tests/shaders/glsl-fs-texture2dproj-bias.shader_test b/tests/shaders/glsl-fs-texture2dproj-bias.shader_test new file mode 100644 index 000000000..d0d7dea51 --- /dev/null +++ b/tests/shaders/glsl-fs-texture2dproj-bias.shader_test @@ -0,0 +1,30 @@ +[require] +GL >= 2.0 +GLSL >= 1.10 + +[vertex shader] +varying vec4 texcoords; + +void main() +{ + gl_Position = gl_Vertex; + texcoords = (gl_Vertex + 1.0); +} + +[fragment shader] +varying vec4 texcoords; +uniform sampler2D tex; + +void main() +{ + gl_FragColor = texture2DProj(tex, vec3(texcoords.xy, 2.0), 1.0); +} + +[test] +uniform int tex 0 +texture rgbw 0 (8, 8) +draw rect -1 -1 2 2 +relative probe rgb (0.25, 0.25) (1.0, 0.0, 0.0) +relative probe rgb (0.75, 0.25) (0.0, 1.0, 0.0) +relative probe rgb (0.25, 0.75) (0.0, 0.0, 1.0) +relative probe rgb (0.75, 0.75) (1.0, 1.0, 1.0) |