[Mesa-dev] [PATCH 2/2] gallivm: propagate scalar_lod to emit_size_query too

sroland at vmware.com sroland at vmware.com
Wed Aug 7 08:10:46 PDT 2013


From: Roland Scheidegger <sroland at vmware.com>

Clearly the returned values need to be per-element if the lod is per element.
Does not actually change behavior yet.
---
 src/gallium/auxiliary/draw/draw_llvm_sample.c     |    2 ++
 src/gallium/auxiliary/gallivm/lp_bld_sample.h     |    1 +
 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |    1 +
 src/gallium/auxiliary/gallivm/lp_bld_tgsi.h       |    1 +
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c   |    5 +++++
 src/gallium/drivers/llvmpipe/lp_tex_sample.c      |    2 ++
 6 files changed, 12 insertions(+)

diff --git a/src/gallium/auxiliary/draw/draw_llvm_sample.c b/src/gallium/auxiliary/draw/draw_llvm_sample.c
index 0cb5c21..3016d7c 100644
--- a/src/gallium/auxiliary/draw/draw_llvm_sample.c
+++ b/src/gallium/auxiliary/draw/draw_llvm_sample.c
@@ -271,6 +271,7 @@ draw_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base,
                                       struct lp_type type,
                                       unsigned texture_unit,
                                       boolean need_nr_mips,
+                                      boolean scalar_lod,
                                       LLVMValueRef explicit_lod, /* optional */
                                       LLVMValueRef *sizes_out)
 {
@@ -284,6 +285,7 @@ draw_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base,
                            type,
                            texture_unit,
                            need_nr_mips,
+                           scalar_lod,
                            explicit_lod,
                            sizes_out);
 }
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
index f9a2b3f..dff8be2 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
@@ -498,6 +498,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
                         struct lp_type int_type,
                         unsigned texture_unit,
                         boolean need_nr_mips,
+                        boolean scalar_lod,
                         LLVMValueRef explicit_lod,
                         LLVMValueRef *sizes_out);
 
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 122ec4f..6780d3e 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -1917,6 +1917,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
                         struct lp_type int_type,
                         unsigned texture_unit,
                         boolean need_nr_mips,
+                        boolean scalar_lod,
                         LLVMValueRef explicit_lod,
                         LLVMValueRef *sizes_out)
 {
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
index 0b48450..aec019a 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
@@ -193,6 +193,7 @@ struct lp_build_sampler_soa
                        struct lp_type type,
                        unsigned unit,
                        boolean need_nr_mips,
+                       boolean scalar_lod,
                        LLVMValueRef explicit_lod, /* optional */
                        LLVMValueRef *sizes_out);
 };
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index c199385..02d804a 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -1990,6 +1990,7 @@ emit_size_query( struct lp_build_tgsi_soa_context *bld,
                  boolean is_sviewinfo)
 {
    LLVMValueRef explicit_lod;
+   boolean scalar_lod;
    unsigned has_lod;
    unsigned i;
    unsigned unit = inst->Src[1].Register.Index;
@@ -2024,11 +2025,15 @@ emit_size_query( struct lp_build_tgsi_soa_context *bld,
    else
       explicit_lod = NULL;
 
+   /* TODO: use scalar lod if explicit_lod is broadcasted scalar */
+   scalar_lod = bld->bld_base.info->processor == TGSI_PROCESSOR_FRAGMENT;
+
    bld->sampler->emit_size_query(bld->sampler,
                                  bld->bld_base.base.gallivm,
                                  bld->bld_base.int_bld.type,
                                  unit,
                                  is_sviewinfo,
+                                 scalar_lod,
                                  explicit_lod,
                                  sizes_out);
 }
diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample.c b/src/gallium/drivers/llvmpipe/lp_tex_sample.c
index 2fb6f5b..2aec6ea 100644
--- a/src/gallium/drivers/llvmpipe/lp_tex_sample.c
+++ b/src/gallium/drivers/llvmpipe/lp_tex_sample.c
@@ -281,6 +281,7 @@ lp_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base,
                                     struct lp_type type,
                                     unsigned texture_unit,
                                     boolean need_nr_mips,
+                                    boolean scalar_lod,
                                     LLVMValueRef explicit_lod, /* optional */
                                     LLVMValueRef *sizes_out)
 {
@@ -294,6 +295,7 @@ lp_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base,
                            type,
                            texture_unit,
                            need_nr_mips,
+                           scalar_lod,
                            explicit_lod,
                            sizes_out);
 }
-- 
1.7.9.5


More information about the mesa-dev mailing list