[Piglit] [PATCH] arb_texture_query_lod: add tolerance for some comparisons
Nicolai Hähnle
nhaehnle at gmail.com
Tue Sep 19 10:58:55 UTC 2017
Seems reasonable.
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
On 15.09.2017 00:59, Roland Scheidegger wrote:
> ping?
>
> Am 09.09.2017 um 07:31 schrieb sroland at vmware.com:
>> From: Roland Scheidegger <sroland at vmware.com>
>>
>> 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.
>> ---
>> .../execution/fs-textureQueryLOD-linear.shader_test | 2 +-
>> .../execution/fs-textureQueryLOD-nearest-biased.shader_test | 6 +++++-
>> 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 6afef71..bb2d8ba 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 1e0c557..4487930 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)) {
>>
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
>
--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
More information about the Piglit
mailing list