Mesa (main): llvmpipe: add support for max aniso query.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 21 00:40:08 UTC 2021


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Feb  8 12:37:07 2021 +1000

llvmpipe: add support for max aniso query.

This just joins the sampler code to the llvmpipe shader stages.

Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8804>

---

 src/gallium/drivers/llvmpipe/lp_jit.c        | 6 +++++-
 src/gallium/drivers/llvmpipe/lp_jit.h        | 2 ++
 src/gallium/drivers/llvmpipe/lp_setup.c      | 1 +
 src/gallium/drivers/llvmpipe/lp_state_cs.c   | 2 ++
 src/gallium/drivers/llvmpipe/lp_state_fs.c   | 1 +
 src/gallium/drivers/llvmpipe/lp_tex_sample.c | 2 ++
 6 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c
index eaeba9419fc..c3bfe3b15b3 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.c
+++ b/src/gallium/drivers/llvmpipe/lp_jit.c
@@ -111,7 +111,8 @@ create_jit_sampler_type(struct gallivm_state *gallivm)
    LLVMTypeRef elem_types[LP_JIT_SAMPLER_NUM_FIELDS];
    elem_types[LP_JIT_SAMPLER_MIN_LOD] =
    elem_types[LP_JIT_SAMPLER_MAX_LOD] =
-   elem_types[LP_JIT_SAMPLER_LOD_BIAS] = LLVMFloatTypeInContext(lc);
+   elem_types[LP_JIT_SAMPLER_LOD_BIAS] =
+   elem_types[LP_JIT_SAMPLER_MAX_ANISO] = LLVMFloatTypeInContext(lc);
    elem_types[LP_JIT_SAMPLER_BORDER_COLOR] =
       LLVMArrayType(LLVMFloatTypeInContext(lc), 4);
 
@@ -130,6 +131,9 @@ create_jit_sampler_type(struct gallivm_state *gallivm)
    LP_CHECK_MEMBER_OFFSET(struct lp_jit_sampler, border_color,
                           gallivm->target, sampler_type,
                           LP_JIT_SAMPLER_BORDER_COLOR);
+   LP_CHECK_MEMBER_OFFSET(struct lp_jit_sampler, max_aniso,
+                          gallivm->target, sampler_type,
+                          LP_JIT_SAMPLER_MAX_ANISO);
    LP_CHECK_STRUCT_SIZE(struct lp_jit_sampler,
                         gallivm->target, sampler_type);
    return sampler_type;
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h b/src/gallium/drivers/llvmpipe/lp_jit.h
index b9a4173022d..4f00d44c800 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.h
+++ b/src/gallium/drivers/llvmpipe/lp_jit.h
@@ -71,6 +71,7 @@ struct lp_jit_sampler
    float max_lod;
    float lod_bias;
    float border_color[4];
+   float max_aniso;
 };
 
 
@@ -114,6 +115,7 @@ enum {
    LP_JIT_SAMPLER_MAX_LOD,
    LP_JIT_SAMPLER_LOD_BIAS,
    LP_JIT_SAMPLER_BORDER_COLOR,
+   LP_JIT_SAMPLER_MAX_ANISO,
    LP_JIT_SAMPLER_NUM_FIELDS  /* number of fields above */
 };
 
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index d9ac8ed2385..8bd0893465c 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -1057,6 +1057,7 @@ lp_setup_set_fragment_sampler_state(struct lp_setup_context *setup,
          jit_sam->min_lod = sampler->min_lod;
          jit_sam->max_lod = sampler->max_lod;
          jit_sam->lod_bias = sampler->lod_bias;
+         jit_sam->max_aniso = sampler->max_anisotropy;
          COPY_4V(jit_sam->border_color, sampler->border_color.f);
       }
    }
diff --git a/src/gallium/drivers/llvmpipe/lp_state_cs.c b/src/gallium/drivers/llvmpipe/lp_state_cs.c
index 392cdf938f0..af590b53811 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_cs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_cs.c
@@ -644,6 +644,7 @@ dump_cs_variant_key(const struct lp_compute_shader_variant_key *key)
       debug_printf("  .lod_bias_non_zero = %u\n", sampler->lod_bias_non_zero);
       debug_printf("  .apply_min_lod = %u\n", sampler->apply_min_lod);
       debug_printf("  .apply_max_lod = %u\n", sampler->apply_max_lod);
+      debug_printf("  .aniso = %u\n", sampler->aniso);
    }
    for (i = 0; i < key->nr_sampler_views; ++i) {
       const struct lp_static_texture_state *texture = &key->samplers[i].texture_state;
@@ -1049,6 +1050,7 @@ lp_csctx_set_sampler_state(struct lp_cs_context *csctx,
          jit_sam->min_lod = sampler->min_lod;
          jit_sam->max_lod = sampler->max_lod;
          jit_sam->lod_bias = sampler->lod_bias;
+         jit_sam->max_aniso = sampler->max_anisotropy;
          COPY_4V(jit_sam->border_color, sampler->border_color.f);
       }
    }
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 69e2ea562e4..d577990c761 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -3408,6 +3408,7 @@ dump_fs_variant_key(struct lp_fragment_shader_variant_key *key)
       debug_printf("  .apply_min_lod = %u\n", sampler->apply_min_lod);
       debug_printf("  .apply_max_lod = %u\n", sampler->apply_max_lod);
       debug_printf("  .reduction_mode = %u\n", sampler->reduction_mode);
+      debug_printf("  .aniso = %u\n", sampler->aniso);
    }
    for (i = 0; i < key->nr_sampler_views; ++i) {
       const struct lp_static_texture_state *texture = &key->samplers[i].texture_state;
diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample.c b/src/gallium/drivers/llvmpipe/lp_tex_sample.c
index 72a8b45dda2..4e9e04fda46 100644
--- a/src/gallium/drivers/llvmpipe/lp_tex_sample.c
+++ b/src/gallium/drivers/llvmpipe/lp_tex_sample.c
@@ -248,6 +248,7 @@ LP_LLVM_SAMPLER_MEMBER(min_lod,    LP_JIT_SAMPLER_MIN_LOD, TRUE)
 LP_LLVM_SAMPLER_MEMBER(max_lod,    LP_JIT_SAMPLER_MAX_LOD, TRUE)
 LP_LLVM_SAMPLER_MEMBER(lod_bias,   LP_JIT_SAMPLER_LOD_BIAS, TRUE)
 LP_LLVM_SAMPLER_MEMBER(border_color, LP_JIT_SAMPLER_BORDER_COLOR, FALSE)
+LP_LLVM_SAMPLER_MEMBER(max_aniso, LP_JIT_SAMPLER_MAX_ANISO, TRUE)
 
 
 /**
@@ -446,6 +447,7 @@ lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
    sampler->dynamic_state.base.max_lod = lp_llvm_sampler_max_lod;
    sampler->dynamic_state.base.lod_bias = lp_llvm_sampler_lod_bias;
    sampler->dynamic_state.base.border_color = lp_llvm_sampler_border_color;
+   sampler->dynamic_state.base.max_aniso = lp_llvm_sampler_max_aniso;
 
 #if LP_USE_TEXTURE_CACHE
    sampler->dynamic_state.base.cache_ptr = lp_llvm_texture_cache_ptr;



More information about the mesa-commit mailing list