summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2017-09-20 04:11:54 +0200
committerRoland Scheidegger <sroland@vmware.com>2017-09-20 04:13:31 +0200
commit7f1f0f40dca636301d740ab08b1de3df6c6206a5 (patch)
tree2df69d8cffec946331ba56d3db2b193625a1a363
parent2753955998d7deb90f681cf4cb1253c4519dfd1d (diff)
arb_texture_query_lod: add tolerance for some comparisons
Tolerance was added for the tests a while ago, but it looks like it was forgotten for the nearest_biased test (the nearest one has it). Also, for the linear test, add tolerance too when comparing x and y lodq results - the values should probably be the same mostly, however it's possible (due to interpolation inaccuracies) to get values just below 0 or above 3, in which case they will get clamped. (Could just do a clamp instead of allowing tolerance I suppose, but some tolerance might be allowed in any case there too.) This is required for llvmpipe (with a in-progress change) to pass. Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
-rw-r--r--tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-linear.shader_test2
-rw-r--r--tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest-biased.shader_test6
2 files changed, 6 insertions, 2 deletions
diff --git a/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-linear.shader_test b/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-linear.shader_test
index 6afef71f5..bb2d8ba9d 100644
--- a/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-linear.shader_test
+++ b/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-linear.shader_test
@@ -60,7 +60,7 @@ void main()
}
vec2 queried_lod = textureQueryLOD(tex, gl_TexCoord[0].st);
- if (queried_lod.x != queried_lod.y) {
+ if (!equal(queried_lod.x, queried_lod.y)) {
discard;
}
if (!equal(queried_lod.x, lod)) {
diff --git a/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest-biased.shader_test b/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest-biased.shader_test
index 1e0c5575e..448793061 100644
--- a/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest-biased.shader_test
+++ b/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest-biased.shader_test
@@ -51,6 +51,10 @@ GL_ARB_texture_query_lod
#define MAX_MIPMAP_LEVEL 3
uniform sampler2D tex;
uniform float lod;
+
+#define tolerance (1.0/255.0)
+#define equal(x,y) (abs((x) - (y)) <= tolerance)
+
void main()
{
/* The ARB_texture_query_lod spec says that if TEXTURE_MIN_FILTER is set
@@ -69,7 +73,7 @@ void main()
}
vec2 queried_lod = textureQueryLOD(tex, gl_TexCoord[0].st);
- if (queried_lod.x != min(queried_lod.y, MAX_MIPMAP_LEVEL)) {
+ if (!equal(queried_lod.x, min(queried_lod.y, MAX_MIPMAP_LEVEL))) {
discard;
}
if (queried_lod.x != min(nearest_lod + 1, MAX_MIPMAP_LEVEL)) {