[Piglit] [PATCH] Add a biased variants of a textureLod() miplevel tests

2015-09-09 Thread Krzesimir Nowak
These tests have the same purpose as the
{vs,fs}-textureLod-miplevels.shader_test ones. These are actually a
slightly modified copies of those. The modifications are setting the
lod_bias parameter to 1.0 and updating the expected colors in probes.

This exposes a bug in softpipe, where it does not take lod_bias into
account, so the colors returned in these tests are the same as in
unbiased versions.
---
 .../fs-textureLod-miplevels-biased.shader_test | 196 +
 .../vs-textureLod-miplevels-biased.shader_test | 196 +
 2 files changed, 392 insertions(+)
 create mode 100644 
tests/spec/glsl-1.30/execution/fs-textureLod-miplevels-biased.shader_test
 create mode 100644 
tests/spec/glsl-1.30/execution/vs-textureLod-miplevels-biased.shader_test

diff --git 
a/tests/spec/glsl-1.30/execution/fs-textureLod-miplevels-biased.shader_test 
b/tests/spec/glsl-1.30/execution/fs-textureLod-miplevels-biased.shader_test
new file mode 100644
index 000..87b38e2
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/fs-textureLod-miplevels-biased.shader_test
@@ -0,0 +1,196 @@
+#
+# A basic mipmap test:
+#
+# Create an 8x8 texture with four miplevels, colored red, green, blue, and
+# white, respectively.  Draw the following:
+#
+#
+# (integer LODs) (fractional w/ linear)   (fractional w/ nearest)
+#
+# miplevel 3 +
+#[2.2] [2.4] [2.6] [2.8]  [2.2] [2.4] [2.6] [2.8]
+# miplevel 2 +-+
+#+-+
+#[1.2] [1.4] [1.6] [1.8]  [1.2] [1.4] [1.6] [1.8]
+# miplevel 1 +---+
+#|   |
+#+---+
+#[0.2] [0.4] [0.6] [0.8]  [0.2] [0.4] [0.6] [0.8]
+#+--+
+# miplevel 0 |  |
+#|  |
+#+--+
+#
+# This verifies that textureLod() takes lod bias into account when
+# selecting the proper miplevel for integer LODs (left boxes) and that
+# both linear and nearest filtering for fractional LODs work
+# correctly.
+#
+# Instead of seeing red, green, blue, and white squares, we should see
+# only green, blue, white, and again white squares.
+#
+# It does not verify anything regarding texture coordinates.
+
+[require]
+GLSL >= 1.30
+
+[fragment shader]
+#version 130
+uniform sampler2D tex;
+uniform float lod;
+void main()
+{
+gl_FragColor = textureLod(tex, vec2(0.5, 0.5), lod);
+}
+
+[vertex shader]
+#version 130
+void main()
+{
+gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+}
+
+[test]
+ortho
+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 lod_bias 1.0
+texparameter 2D min nearest_mipmap_nearest
+texparameter 2D mag nearest
+
+uniform float lod 0
+draw rect 10 10 32 32
+
+uniform float lod 1
+draw rect 10 52 16 16
+
+uniform float lod 2
+draw rect 10 78 8 8
+
+uniform float lod 3
+draw rect 10 96 4 4
+
+# Fractional LODs: nearest filtering between miplevels
+
+uniform float lod 0.2
+draw rect 152 42 10 10
+
+uniform float lod 0.4
+draw rect 167 42 10 10
+
+uniform float lod 0.6
+draw rect 182 42 10 10
+
+uniform float lod 0.8
+draw rect 197 42 10 10
+
+uniform float lod 1.2
+draw rect 152 68 10 10
+
+uniform float lod 1.4
+draw rect 167 68 10 10
+
+uniform float lod 1.6
+draw rect 182 68 10 10
+
+uniform float lod 1.8
+draw rect 197 68 10 10
+
+uniform float lod 2.2
+draw rect 152 86 10 10
+
+uniform float lod 2.4
+draw rect 167 86 10 10
+
+uniform float lod 2.6
+draw rect 182 86 10 10
+
+uniform float lod 2.8
+draw rect 197 86 10 10
+
+
+# Fractional LODs: linear filtering between miplevels
+
+texparameter 2D min nearest_mipmap_linear
+
+uniform float lod 0.2
+draw rect 52 42 10 10
+
+uniform float lod 0.4
+draw rect 67 42 10 10
+
+uniform float lod 0.6
+draw rect 82 42 10 10
+
+uniform float lod 0.8
+draw rect 97 42 10 10
+
+uniform float lod 1.2
+draw rect 52 68 10 10
+
+uniform float lod 1.4
+draw rect 67 68 10 10
+
+uniform float lod 1.6
+draw rect 82 68 10 10
+
+uniform float lod 1.8
+draw rect 97 68 10 10
+
+uniform float lod 2.2
+draw rect 52 86 10 10
+
+uniform float lod 2.4
+draw rect 67 86 10 10
+
+uniform float lod 2.6
+draw rect 82 86 10 10
+
+uniform float lod 2.8
+draw rect 97 86 10 10
+
+# Probes: integer LODs
+probe rgb 26 15 0.0 1.0 0.0
+probe rgb 18 57 0.0 0.0 1.0
+probe rgb 14 83 1.0 1.0 1.0
+probe rgb 12 98 1.0 1.0 1.0
+
+# Probes: nearest filtering
+probe rgb 157 47 0.0 1.0 0.0
+probe rgb 172 47 0.0 1.0 0.0
+probe rgb 189 47 0.0 0.0 1.0
+probe rgb 202 47 0.0 0.0 1.0
+
+probe rgb 157 73 0.0 0.0 1.0
+probe rgb 172 73 0.0 0.0 1.0
+probe rgb 189 73 1.0 1.0 1.0
+probe rgb 202 73 1.0 1.0 1.0
+
+probe rgb 157 91 1.0 1.0 1.0
+probe rgb 172 91 1.0 1.0 1.0
+probe rgb 189 91 1.0 1.0 1.0
+probe rgb 202 91 1.0 1.0 1.0
+
+# Probes: linear filtering (tolerance of 0.05 makes it pass on fglrx)
+tolerance 0.05 0.05 0.05 0.05
+
+probe rgb  57 47 0.0 0.8 0.2
+probe rgb  72 47 0.0 0.6 0.4
+probe rgb  89 47 0.0 0.4 0.6
+probe rgb 102 47 0.0 0.2 0.8
+

Re: [Piglit] [PATCH] Add a biased variants of a textureLod() miplevel tests

2015-09-09 Thread Brian Paul

On 09/09/2015 03:59 AM, Krzesimir Nowak wrote:

These tests have the same purpose as the
{vs,fs}-textureLod-miplevels.shader_test ones. These are actually a
slightly modified copies of those. The modifications are setting the
lod_bias parameter to 1.0 and updating the expected colors in probes.

This exposes a bug in softpipe, where it does not take lod_bias into
account, so the colors returned in these tests are the same as in
unbiased versions.
---
  .../fs-textureLod-miplevels-biased.shader_test | 196 +
  .../vs-textureLod-miplevels-biased.shader_test | 196 +
  2 files changed, 392 insertions(+)
  create mode 100644 
tests/spec/glsl-1.30/execution/fs-textureLod-miplevels-biased.shader_test
  create mode 100644 
tests/spec/glsl-1.30/execution/vs-textureLod-miplevels-biased.shader_test



Reviewed-by: Brian Paul 

I verified that the tests pass on NVIDIA too.

I'll commit this patch for you (AFAIK, you don't have git write ability).

-Brian


___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit