[Piglit] [PATCH] arb_texture_query_lod: allow some tolerance for comparisons

Matt Turner mattst88 at gmail.com
Tue Jun 17 21:47:47 PDT 2014


I'm sort of skeptical. Firstly, why are you only modifying three of
the four tests?

On Tue, Jun 17, 2014 at 12:49 PM, Marek Olšák <maraeo at gmail.com> wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> This is required for radeonsi to pass.
> ---
>  .../execution/fs-textureQueryLOD-linear.shader_test              | 9 +++++++--
>  .../execution/fs-textureQueryLOD-nearest.shader_test             | 6 +++++-
>  .../execution/fs-textureQueryLOD-no-mipmap.shader_test           | 6 +++++-
>  3 files changed, 17 insertions(+), 4 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 4438951..6afef71 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
> @@ -46,11 +46,16 @@ GL_ARB_texture_query_lod
>  #extension GL_ARB_texture_query_lod : enable
>  uniform sampler2D tex;
>  uniform float lod;
> +
> +#define tolerance (1.0/255.0)
> +#define equal_v4(x,y) all(lessThanEqual(abs((x) - (y)), vec4(tolerance)))
> +#define equal(x,y) (abs((x) - (y)) <= tolerance)
> +
>  void main()
>  {
>      vec4 frag1 = texture(tex, gl_TexCoord[0].st);
>      vec4 frag2 = textureLod(tex, gl_TexCoord[0].st, lod);
> -    if (frag1 != frag2) {

It's been a while since I wrote these, so I might not remember, but
aren't the squares drawn the exact size of the mip-levels? How could
texture() and textureLod not return the same thing?

> +    if (!equal_v4(frag1, frag2)) {
>         discard;
>      }
>
> @@ -58,7 +63,7 @@ void main()
>      if (queried_lod.x != queried_lod.y) {
>         discard;
>      }
> -    if (queried_lod.x != lod) {
> +    if (!equal(queried_lod.x, lod)) {
>         discard;
>      }
>
> diff --git a/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest.shader_test b/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest.shader_test
> index 2c1b62c..a9df764 100644
> --- a/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest.shader_test
> +++ b/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest.shader_test
> @@ -46,6 +46,10 @@ GL_ARB_texture_query_lod
>  #extension GL_ARB_texture_query_lod : enable
>  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
> @@ -64,7 +68,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)) {

What does textureQueryLod actually return for you?

The man page says textureQueryLOD returns

"The mipmap array(s) that would be accessed is returned in the
xcomponent of the return value. The computed level-of-detail relative
to the base level is returned in the y component of the return value."

And this is the nearest test, so we're not even blending between
levels. How could these be different?

>         discard;
>      }
>      if (queried_lod.x != nearest_lod) {
> diff --git a/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-no-mipmap.shader_test b/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-no-mipmap.shader_test
> index 5f67262..035e2d5 100644
> --- a/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-no-mipmap.shader_test
> +++ b/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-no-mipmap.shader_test
> @@ -51,9 +51,13 @@ GL_ARB_texture_query_lod
>  #extension GL_ARB_texture_query_lod : enable
>  uniform sampler2D tex;
>  uniform float lambda_prime;
> +
> +#define tolerance (1.0/255.0)
> +#define equal_v2(x,y) all(lessThanEqual(abs((x) - (y)), vec2(tolerance)))
> +
>  void main()
>  {
> -    if (textureQueryLOD(tex, gl_TexCoord[0].st) != vec2(0.0f, lambda_prime)) {
> +    if (!equal_v2(textureQueryLOD(tex, gl_TexCoord[0].st), vec2(0.0f, lambda_prime))) {
>         discard;
>      }
>
> --


More information about the Piglit mailing list