[Piglit] [PATCH] Add a test to check whether the LODs are independant in parallel texture lookups.

Olivier Galibert galibert at pobox.com
Fri Jun 15 08:58:03 PDT 2012


Theorically, we should also test that as the fragment shader level,
but the code would be way more complex and the code paths are shared
in mesa.
    
That was designed to fix the issue in llvmpipe (which also exists in
textureSize).  NVidia passes.  Surprisingly enough, softpipe fails.
    
Signed-off-by: Olivier Galibert <galibert at pobox.com>

diff --git a/tests/spec/glsl-1.30/execution/vs-textureLod-miplevels-2.shader_test b/tests/spec/glsl-1.30/execution/vs-textureLod-miplevels-2.shader_test
new file mode 100644
index 0000000..aed1fef
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/vs-textureLod-miplevels-2.shader_test
@@ -0,0 +1,58 @@
+#
+# A slightly more convoluted mipmap test.
+#
+# Create an 8x8 texture with four miplevels, colored red, green, blue, and
+# white, respectively.  Draw a quad with each vertex looking up the color
+# in a different lod.
+#
+# This verifies that textureLod() selects the proper miplevel for integer
+# LODs when all vertices are given a different LOD.  Or on other words the
+# test verifies that LODs are not improperly shared.
+
+[require]
+GLSL >= 1.30
+
+[fragment shader]
+#version 130
+void main()
+{
+    gl_FragColor = gl_Color;
+}
+
+[vertex shader]
+#version 130
+uniform sampler2D tex;
+in vec4 vertex;
+in float lod;
+void main()
+{
+    gl_Position = gl_ModelViewProjectionMatrix * vertex;
+    gl_FrontColor = textureLod(tex, vec2(0.5, 0.5), lod);
+}
+
+[vertex data]
+vertex/float/2  lod/float/1
+-1.0 -1.0       0
+ 1.0 -1.0       1
+ 1.0  1.0       2
+-1.0  1.0       3
+
+[test]
+clear color 0.4 0.4 0.4 0.4
+clear
+
+uniform int tex 0
+texture miptree 0
+
+# Draw the miptree: basic integer LODs.
+
+texparameter 2D min nearest_mipmap_nearest
+texparameter 2D mag nearest
+
+draw arrays GL_QUADS 0 4
+
+# Probes: integer LODs
+relative probe rgba (0.0, 0.0) (1.0, 0.0, 0.0, 1.0)
+relative probe rgba (1.0, 0.0) (0.0, 1.0, 0.0, 1.0)
+relative probe rgba (1.0, 1.0) (0.0, 0.0, 1.0, 1.0)
+relative probe rgba (0.0, 1.0) (1.0, 1.0, 1.0, 1.0)


More information about the Piglit mailing list