summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIago Toral Quiroga <itoral@igalia.com>2015-03-11 08:25:24 +0100
committerIago Toral Quiroga <itoral@igalia.com>2015-03-25 07:58:33 +0100
commit181c26495634ba1a5603b4b75c47e2dee7c97c0f (patch)
tree54cedd0dc0c98a9d6abdd6a39ee3c753a9b08e9b
parent42c3df3319fc18eb1899d41396aa58f22e787aaf (diff)
tex-miplevel-selection: Fix textureProj failures due to precision errors
The textureProj tests multiply expected texture coordinates by the projector in advance so that when the driver does the division we obtain the same coordinates. However, the division can lead to small rounding errors that can affect the selected layer and fail the tests. This is currently happening on Intel hardware for all projector tests involving 3D textures. When we test a 3D texture for texture level 0 we have 32 layers, which means that each layer takes 1/32 = 0.03125 space in the [0, 1] texture coordinate space. The test uses 0.5 for the Z coordinate, which is exactly the boundary between layers 15 and 16 (16 * 0.03125 = 0.5). Because we first multiply 0.5 by the projector in CPU and then we divide the coordinate by the driver in the GPU, the result may be subject to rounding/precision errors and if the result of this operation is even slighly smaller than 0.5 the hardware will select layer 15 instead of layer 16, leading to the test failures we currently see, at least on Intel hardware, for all piglit tests that involve textureProj with 3D textures. The patch prevents this rounding from affecting the result of the test by using 0.51 as the target texture coordinates instead of 0.5. Because 0.51 is 0.01 into layer 16, we are giving a small room for rounding/precision errors that won't lead the hardware to select a different layer. This fixes all projector tests on Intel hardware: bin/tex-miplevel-selection *ProjGradARB 3D -fbo -auto bin/tex-miplevel-selection *ProjLod 3D -fbo -auto bin/tex-miplevel-selection textureProj 3D -fbo -auto bin/tex-miplevel-selection textureProjGrad 3D -fbo -auto bin/tex-miplevel-selection textureProjGradOffset 3D -fbo -auto bin/tex-miplevel-selection textureProjOffset 3D -fbo -auto bin/tex-miplevel-selection "textureProj(bias)" 3D -fbo -auto bin/tex-miplevel-selection "textureProjOffset(bias)" 3D -fbo -auto Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81405
-rw-r--r--tests/texturing/tex-miplevel-selection.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/texturing/tex-miplevel-selection.c b/tests/texturing/tex-miplevel-selection.c
index 54592f93d..959bab2ea 100644
--- a/tests/texturing/tex-miplevel-selection.c
+++ b/tests/texturing/tex-miplevel-selection.c
@@ -1252,10 +1252,10 @@ draw_quad(int x, int y, int w, int h, int expected_level, int fetch_level,
SET_VEC(c3, s0, t1, TEST_LAYER, z);
break;
case TEX_3D:
- SET_VEC(c0, s0*p, t0*p, 0.5*p, p);
- SET_VEC(c1, s1*p, t0*p, 0.5*p, p);
- SET_VEC(c2, s1*p, t1*p, 0.5*p, p);
- SET_VEC(c3, s0*p, t1*p, 0.5*p, p);
+ SET_VEC(c0, s0*p, t0*p, 0.51*p, p);
+ SET_VEC(c1, s1*p, t0*p, 0.51*p, p);
+ SET_VEC(c2, s1*p, t1*p, 0.51*p, p);
+ SET_VEC(c3, s0*p, t1*p, 0.51*p, p);
break;
case TEX_1D_ARRAY:
SET_VEC(c0, s0, TEST_LAYER, 0, 1);