Mesa (master): gallivm/sample: add gather component selection to the key.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 11 00:32:40 UTC 2019


Module: Mesa
Branch: master
Commit: 1e65757f4e8283f136924f7594485ea4440c7e78
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1e65757f4e8283f136924f7594485ea4440c7e78

Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Aug 30 10:30:00 2019 +1000

gallivm/sample: add gather component selection to the key.

This allows for component selection to work as per ARB_gpu_shader5/GLES3.1

Reviewed-by: Roland Scheidegger <sroland at vmware.com>

---

 src/gallium/auxiliary/gallivm/lp_bld_sample.h     |  3 +++
 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 14 +++++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
index 8509179d08f..0e4d95623c8 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
@@ -96,6 +96,8 @@ enum lp_sampler_op_type {
 #define LP_SAMPLER_LOD_CONTROL_MASK   (3 << 4)
 #define LP_SAMPLER_LOD_PROPERTY_SHIFT       6
 #define LP_SAMPLER_LOD_PROPERTY_MASK  (3 << 6)
+#define LP_SAMPLER_GATHER_COMP_SHIFT        8
+#define LP_SAMPLER_GATHER_COMP_MASK   (3 << 8)
 
 struct lp_sampler_params
 {
@@ -345,6 +347,7 @@ struct lp_build_sample_context
    /** number of lod values (valid are 1, length/4, length) */
    unsigned num_lods;
 
+   unsigned gather_comp;
    boolean no_quad_lod;
    boolean no_brilinear;
    boolean no_rho_approx;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 48d98bb617a..964818bebed 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -1033,6 +1033,17 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
    boolean seamless_cube_filter, accurate_cube_corners;
    unsigned chan_swiz = bld->static_texture_state->swizzle_r;
 
+   if (is_gather) {
+      switch (bld->gather_comp) {
+      case 0: chan_swiz = bld->static_texture_state->swizzle_r; break;
+      case 1: chan_swiz = bld->static_texture_state->swizzle_g; break;
+      case 2: chan_swiz = bld->static_texture_state->swizzle_b; break;
+      case 3: chan_swiz = bld->static_texture_state->swizzle_a; break;
+      default:
+	 break;
+      }
+   }
+
    seamless_cube_filter = (bld->static_texture_state->target == PIPE_TEXTURE_CUBE ||
                            bld->static_texture_state->target == PIPE_TEXTURE_CUBE_ARRAY) &&
                           bld->static_sampler_state->seamless_cube_map;
@@ -2978,7 +2989,8 @@ lp_build_sample_soa_code(struct gallivm_state *gallivm,
       bld.num_lods = num_quads;
    }
 
-
+   if (op_is_gather)
+      bld.gather_comp = (sample_key & LP_SAMPLER_GATHER_COMP_MASK) >> LP_SAMPLER_GATHER_COMP_SHIFT;
    bld.lodf_type = type;
    /* we want native vector size to be able to use our intrinsics */
    if (bld.num_lods != type.length) {




More information about the mesa-commit mailing list