On 06/17/2014 12:49 PM, Marek Olšák wrote:
> From: Marek Olšák <[email protected]>
> 
> 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)

I'd be inclined to make these (and the others) functions all named equal
(or within_epsilon or similar).  Either way,

Reviewed-by: Ian Romanick <[email protected]>

> +
>  void main()
>  {
>      vec4 frag1 = texture(tex, gl_TexCoord[0].st);
>      vec4 frag2 = textureLod(tex, gl_TexCoord[0].st, lod);
> -    if (frag1 != frag2) {
> +    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)) {
>       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;
>      }
>  
> 

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to