Mesa (main): gallivm: Always take the per-pixel LOD path for cubemaps.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 28 23:54:53 UTC 2021


Module: Mesa
Branch: main
Commit: d413fd02190d21524eaa543a4f97b203980c6a2b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d413fd02190d21524eaa543a4f97b203980c6a2b

Author: Emma Anholt <emma at anholt.net>
Date:   Mon Jul 19 16:13:36 2021 -0700

gallivm: Always take the per-pixel LOD path for cubemaps.

The VK spec requires that derivatives are mapped to the face, and given
that the face is per pixel that implies that we need per-pixel
derivatives.  This also seems to match hardware behavior.

Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10219>

---

 src/gallium/auxiliary/gallivm/lp_bld_sample.c      | 67 +-----------------
 src/gallium/drivers/virgl/ci/traces-virgl.yml      |  2 +-
 .../frontends/lavapipe/ci/deqp-lvp-fails.txt       | 82 ----------------------
 3 files changed, 3 insertions(+), 148 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
index df8a1ba2192..0c9a41aeb26 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
@@ -1826,7 +1826,7 @@ lp_build_cube_lookup(struct lp_build_sample_context *bld,
    maxasat = lp_build_max(coord_bld, as, at);
    ar_ge_as_at = lp_build_cmp(coord_bld, PIPE_FUNC_GEQUAL, ar, maxasat);
 
-   if (need_derivs && (derivs_in || (bld->no_quad_lod && bld->no_rho_approx))) {
+   if (need_derivs) {
       /*
        * XXX: This is really really complex.
        * It is a bit overkill to use this for implicit derivatives as well,
@@ -1983,70 +1983,7 @@ lp_build_cube_lookup(struct lp_build_sample_context *bld,
       return;
    }
 
-   else if (need_derivs) {
-      LLVMValueRef ddx_ddy[2], tmp[3], rho_vec;
-      static const unsigned char swizzle0[] = { /* no-op swizzle */
-         0, LP_BLD_SWIZZLE_DONTCARE,
-         LP_BLD_SWIZZLE_DONTCARE, LP_BLD_SWIZZLE_DONTCARE
-      };
-      static const unsigned char swizzle1[] = {
-         1, LP_BLD_SWIZZLE_DONTCARE,
-         LP_BLD_SWIZZLE_DONTCARE, LP_BLD_SWIZZLE_DONTCARE
-      };
-      static const unsigned char swizzle01[] = { /* no-op swizzle */
-         0, 1,
-         LP_BLD_SWIZZLE_DONTCARE, LP_BLD_SWIZZLE_DONTCARE
-      };
-      static const unsigned char swizzle23[] = {
-         2, 3,
-         LP_BLD_SWIZZLE_DONTCARE, LP_BLD_SWIZZLE_DONTCARE
-      };
-      static const unsigned char swizzle02[] = {
-         0, 2,
-         LP_BLD_SWIZZLE_DONTCARE, LP_BLD_SWIZZLE_DONTCARE
-      };
-
-      /*
-       * scale the s/t/r coords pre-select/mirror so we can calculate
-       * "reasonable" derivs.
-       */
-      ma = lp_build_select3(coord_bld, as_ge_at, ar_ge_as_at, s, t, r);
-      imahalfpos = lp_build_cube_imapos(coord_bld, ma);
-      s = lp_build_mul(coord_bld, s, imahalfpos);
-      t = lp_build_mul(coord_bld, t, imahalfpos);
-      r = lp_build_mul(coord_bld, r, imahalfpos);
-
-      /*
-       * This isn't quite the same as the "ordinary" (3d deriv) path since we
-       * know the texture is square which simplifies things (we can omit the
-       * size mul which happens very early completely here and do it at the
-       * very end).
-       * Also always do calculations according to GALLIVM_DEBUG_NO_RHO_APPROX
-       * since the error can get quite big otherwise at edges.
-       * (With no_rho_approx max error is sqrt(2) at edges, same as it is
-       * without no_rho_approx for 2d textures, otherwise it would be factor 2.)
-       */
-      ddx_ddy[0] = lp_build_packed_ddx_ddy_twocoord(coord_bld, s, t);
-      ddx_ddy[1] = lp_build_packed_ddx_ddy_onecoord(coord_bld, r);
-
-      ddx_ddy[0] = lp_build_mul(coord_bld, ddx_ddy[0], ddx_ddy[0]);
-      ddx_ddy[1] = lp_build_mul(coord_bld, ddx_ddy[1], ddx_ddy[1]);
-
-      tmp[0] = lp_build_swizzle_aos(coord_bld, ddx_ddy[0], swizzle01);
-      tmp[1] = lp_build_swizzle_aos(coord_bld, ddx_ddy[0], swizzle23);
-      tmp[2] = lp_build_swizzle_aos(coord_bld, ddx_ddy[1], swizzle02);
-
-      rho_vec = lp_build_add(coord_bld, tmp[0], tmp[1]);
-      rho_vec = lp_build_add(coord_bld, rho_vec, tmp[2]);
-
-      tmp[0] = lp_build_swizzle_aos(coord_bld, rho_vec, swizzle0);
-      tmp[1] = lp_build_swizzle_aos(coord_bld, rho_vec, swizzle1);
-      *rho = lp_build_max(coord_bld, tmp[0], tmp[1]);
-   }
-
-   if (!need_derivs) {
-      ma = lp_build_select3(coord_bld, as_ge_at, ar_ge_as_at, s, t, r);
-   }
+   ma = lp_build_select3(coord_bld, as_ge_at, ar_ge_as_at, s, t, r);
    mai = LLVMBuildBitCast(builder, ma, cint_vec_type, "");
    signmabit = LLVMBuildAnd(builder, mai, signmask, "");
 
diff --git a/src/gallium/drivers/virgl/ci/traces-virgl.yml b/src/gallium/drivers/virgl/ci/traces-virgl.yml
index d66ecd446f0..66505f383d0 100644
--- a/src/gallium/drivers/virgl/ci/traces-virgl.yml
+++ b/src/gallium/drivers/virgl/ci/traces-virgl.yml
@@ -238,7 +238,7 @@ traces:
   - path: supertuxkart/supertuxkart-mansion-egl-gles.trace
     expectations:
       - device: gl-virgl
-        checksum: cb918cbe6e2ff6cacdfc09a89e77c8a8
+        checksum: 74e9081b18e48c31f1755fadcb6fc068
 # Sometimes crashes
 #  - path: xonotic/xonotic-keybench-high.trace
 #    expectations:
diff --git a/src/gallium/frontends/lavapipe/ci/deqp-lvp-fails.txt b/src/gallium/frontends/lavapipe/ci/deqp-lvp-fails.txt
index f10ec7a27ef..7aa518a3f08 100644
--- a/src/gallium/frontends/lavapipe/ci/deqp-lvp-fails.txt
+++ b/src/gallium/frontends/lavapipe/ci/deqp-lvp-fails.txt
@@ -33,85 +33,3 @@ dEQP-VK.image.mismatched_formats.image_write.b8g8r8a8_srgb_with_rgba8,Crash
 dEQP-VK.image.mismatched_formats.image_write.r8g8b8a8_srgb_with_rgb10a2,Crash
 dEQP-VK.rasterization.primitives.static_stipple.rectangular_line_strip_wide,Fail
 dEQP-VK.rasterization.primitives_multisample_4_bit.dynamic_stipple.line_strip_wide,Fail
-dEQP-VK.texture.filtering.cube.combinations.linear_mipmap_linear.linear.clamp_to_border.clamp_to_border,Fail
-dEQP-VK.texture.filtering.cube.combinations.linear_mipmap_linear.linear.clamp_to_edge.clamp_to_border,Fail
-dEQP-VK.texture.filtering.cube.combinations.linear_mipmap_linear.linear.clamp_to_edge.clamp_to_edge,Fail
-dEQP-VK.texture.filtering.cube.combinations.linear_mipmap_linear.linear.clamp_to_edge.mirrored_repeat,Fail
-dEQP-VK.texture.filtering.cube.combinations.linear_mipmap_linear.linear.mirror_clamp_to_edge.clamp_to_border,Fail
-dEQP-VK.texture.filtering.cube.combinations.linear_mipmap_linear.linear.mirror_clamp_to_edge.clamp_to_edge,Fail
-dEQP-VK.texture.filtering.cube.combinations.linear_mipmap_linear.linear.mirror_clamp_to_edge.mirrored_repeat,Fail
-dEQP-VK.texture.filtering.cube.combinations.linear_mipmap_linear.linear.mirrored_repeat.clamp_to_border,Fail
-dEQP-VK.texture.filtering.cube.combinations.linear_mipmap_linear.linear.repeat.clamp_to_border,Fail
-dEQP-VK.texture.filtering.cube.combinations.linear_mipmap_linear.linear.repeat.clamp_to_edge,Fail
-dEQP-VK.texture.filtering.cube.combinations.linear_mipmap_linear.linear.repeat.mirrored_repeat,Fail
-dEQP-VK.texture.filtering.cube.combinations.linear_mipmap_linear.nearest.clamp_to_border.clamp_to_border,Fail
-dEQP-VK.texture.filtering.cube.combinations.linear_mipmap_linear.nearest.clamp_to_border.clamp_to_edge,Fail
-dEQP-VK.texture.filtering.cube.combinations.linear_mipmap_linear.nearest.clamp_to_border.mirrored_repeat,Fail
-dEQP-VK.texture.filtering.cube.combinations.linear_mipmap_linear.nearest.clamp_to_edge.clamp_to_border,Fail
-dEQP-VK.texture.filtering.cube.combinations.linear_mipmap_linear.nearest.mirror_clamp_to_edge.clamp_to_border,Fail
-dEQP-VK.texture.filtering.cube.combinations.linear_mipmap_linear.nearest.mirrored_repeat.clamp_to_border,Fail
-dEQP-VK.texture.filtering.cube.combinations.linear_mipmap_linear.nearest.mirrored_repeat.clamp_to_edge,Fail
-dEQP-VK.texture.filtering.cube.combinations.linear_mipmap_linear.nearest.mirrored_repeat.mirrored_repeat,Fail
-dEQP-VK.texture.filtering.cube.combinations.linear_mipmap_linear.nearest.repeat.clamp_to_border,Fail
-dEQP-VK.texture.filtering.cube.combinations.nearest_mipmap_linear.linear.clamp_to_border.clamp_to_border,Fail
-dEQP-VK.texture.filtering.cube.combinations.nearest_mipmap_linear.linear.clamp_to_edge.clamp_to_border,Fail
-dEQP-VK.texture.filtering.cube.combinations.nearest_mipmap_linear.linear.clamp_to_edge.clamp_to_edge,Fail
-dEQP-VK.texture.filtering.cube.combinations.nearest_mipmap_linear.linear.clamp_to_edge.mirrored_repeat,Fail
-dEQP-VK.texture.filtering.cube.combinations.nearest_mipmap_linear.linear.mirror_clamp_to_edge.clamp_to_border,Fail
-dEQP-VK.texture.filtering.cube.combinations.nearest_mipmap_linear.linear.mirror_clamp_to_edge.clamp_to_edge,Fail
-dEQP-VK.texture.filtering.cube.combinations.nearest_mipmap_linear.linear.mirror_clamp_to_edge.mirrored_repeat,Fail
-dEQP-VK.texture.filtering.cube.combinations.nearest_mipmap_linear.linear.mirrored_repeat.clamp_to_border,Fail
-dEQP-VK.texture.filtering.cube.combinations.nearest_mipmap_linear.linear.repeat.clamp_to_border,Fail
-dEQP-VK.texture.filtering.cube.combinations.nearest_mipmap_linear.linear.repeat.clamp_to_edge,Fail
-dEQP-VK.texture.filtering.cube.combinations.nearest_mipmap_linear.linear.repeat.mirrored_repeat,Fail
-dEQP-VK.texture.filtering.cube.combinations.nearest_mipmap_linear.nearest.clamp_to_border.clamp_to_border,Fail
-dEQP-VK.texture.filtering.cube.combinations.nearest_mipmap_linear.nearest.clamp_to_border.clamp_to_edge,Fail
-dEQP-VK.texture.filtering.cube.combinations.nearest_mipmap_linear.nearest.clamp_to_border.mirrored_repeat,Fail
-dEQP-VK.texture.filtering.cube.combinations.nearest_mipmap_linear.nearest.clamp_to_edge.clamp_to_border,Fail
-dEQP-VK.texture.filtering.cube.combinations.nearest_mipmap_linear.nearest.mirror_clamp_to_edge.clamp_to_border,Fail
-dEQP-VK.texture.filtering.cube.combinations.nearest_mipmap_linear.nearest.mirrored_repeat.clamp_to_border,Fail
-dEQP-VK.texture.filtering.cube.combinations.nearest_mipmap_linear.nearest.mirrored_repeat.clamp_to_edge,Fail
-dEQP-VK.texture.filtering.cube.combinations.nearest_mipmap_linear.nearest.mirrored_repeat.mirrored_repeat,Fail
-dEQP-VK.texture.filtering.cube.combinations.nearest_mipmap_linear.nearest.repeat.clamp_to_border,Fail
-dEQP-VK.texture.filtering.cube.formats.a1r5g5b5_unorm.linear_mipmap_linear,Fail
-dEQP-VK.texture.filtering.cube.formats.r8g8b8a8_snorm.linear_mipmap_linear,Fail
-dEQP-VK.texture.filtering.cube.formats.r8g8b8a8_snorm.nearest_mipmap_linear,Fail
-dEQP-VK.texture.filtering.cube.formats.r8g8b8a8_unorm.linear_mipmap_linear,Fail
-dEQP-VK.texture.filtering.cube.formats.r8g8b8a8_unorm.nearest_mipmap_linear,Fail
-dEQP-VK.texture.filtering.cube.sizes.128x128.linear_mipmap_linear,Fail
-dEQP-VK.texture.filtering.cube.sizes.128x128.nearest_mipmap_linear,Fail
-dEQP-VK.texture.filtering.cube.sizes.63x63.nearest_mipmap_linear,Fail
-dEQP-VK.texture.mipmap.cubemap.basic.linear_linear_linear_clamp,Fail
-dEQP-VK.texture.mipmap.cubemap.basic.linear_linear_nearest_clamp,Fail
-dEQP-VK.texture.mipmap.cubemap.basic.linear_nearest_linear_mirror,Fail
-dEQP-VK.texture.mipmap.cubemap.basic.linear_nearest_nearest_clamp,Fail
-dEQP-VK.texture.mipmap.cubemap.basic.linear_nearest_nearest_mirror,Fail
-dEQP-VK.texture.mipmap.cubemap.basic.nearest_linear_linear_clamp,Fail
-dEQP-VK.texture.mipmap.cubemap.basic.nearest_linear_linear_repeat,Fail
-dEQP-VK.texture.mipmap.cubemap.basic.nearest_nearest_linear_mirror,Fail
-dEQP-VK.texture.mipmap.cubemap.basic.nearest_nearest_nearest_repeat,Fail
-dEQP-VK.texture.mipmap.cubemap.bias.linear_linear_linear_mirror,Fail
-dEQP-VK.texture.mipmap.cubemap.bias.linear_linear_nearest_clamp,Fail
-dEQP-VK.texture.mipmap.cubemap.bias.linear_linear_nearest_mirror,Fail
-dEQP-VK.texture.mipmap.cubemap.bias.linear_nearest_linear_repeat,Fail
-dEQP-VK.texture.mipmap.cubemap.bias.linear_nearest_nearest_mirror,Fail
-dEQP-VK.texture.mipmap.cubemap.bias.linear_nearest_nearest_repeat,Fail
-dEQP-VK.texture.mipmap.cubemap.bias.nearest_linear_linear_mirror,Fail
-dEQP-VK.texture.mipmap.cubemap.bias.nearest_linear_nearest_repeat,Fail
-dEQP-VK.texture.mipmap.cubemap.bias.nearest_nearest_linear_clamp,Fail
-dEQP-VK.texture.mipmap.cubemap.bias.nearest_nearest_nearest_clamp,Fail
-dEQP-VK.texture.mipmap.cubemap.max_level.linear_nearest,Fail
-dEQP-VK.texture.mipmap.cubemap.max_level.nearest_linear,Fail
-dEQP-VK.texture.mipmap.cubemap.max_lod.nearest_linear,Fail
-dEQP-VK.texture.mipmap.cubemap.max_lod.nearest_nearest,Fail
-dEQP-VK.texture.mipmap.cubemap.min_lod.linear_linear,Fail
-dEQP-VK.texture.mipmap.cubemap.projected.linear_linear_linear_clamp,Fail
-dEQP-VK.texture.mipmap.cubemap.projected.linear_linear_linear_repeat,Fail
-dEQP-VK.texture.mipmap.cubemap.projected.linear_nearest_linear_mirror,Fail
-dEQP-VK.texture.mipmap.cubemap.projected.linear_nearest_nearest_repeat,Fail
-dEQP-VK.texture.mipmap.cubemap.projected.nearest_linear_linear_mirror,Fail
-dEQP-VK.texture.mipmap.cubemap.projected.nearest_linear_nearest_clamp,Fail
-dEQP-VK.texture.mipmap.cubemap.projected.nearest_linear_nearest_mirror,Fail
-dEQP-VK.texture.mipmap.cubemap.projected.nearest_nearest_linear_repeat,Fail
-dEQP-VK.texture.mipmap.cubemap.projected.nearest_nearest_nearest_mirror,Fail
-dEQP-VK.texture.mipmap.cubemap.projected.nearest_nearest_nearest_repeat,Fail



More information about the mesa-commit mailing list