gallivm: propagate scalar_lod to emit_size_query too
authorRoland Scheidegger <sroland@vmware.com>
Wed, 7 Aug 2013 15:09:45 +0000 (17:09 +0200)
committerRoland Scheidegger <sroland@vmware.com>
Thu, 8 Aug 2013 16:55:57 +0000 (18:55 +0200)
Clearly the returned values need to be per-element if the lod is per element.
Does not actually change behavior yet.

Reviewed-by: Zack Rusin <zackr@vmware.com>
src/gallium/auxiliary/draw/draw_llvm_sample.c
src/gallium/auxiliary/gallivm/lp_bld_sample.h
src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
src/gallium/drivers/llvmpipe/lp_tex_sample.c

index 0cb5c2103510f8de9bcb2f0185431cd3b87f9606..3016d7c49208f2fca8997ab1fe0212713dff20aa 100644 (file)
@@ -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);
 }
index f9a2b3fe5f598855792f4c0e29a2ce6be6c9ec2c..dff8be22f6e646bcb59e3be783ba9e377ee30996 100644 (file)
@@ -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);
 
index 122ec4f271a053643e522766f3cacfd58c879838..6780d3e53c40739399506451ce7d10d462af593d 100644 (file)
@@ -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)
 {
index 0b4845064a0ecdefa7dbcdde0c3f5d2261164350..aec019a1a6b008aa1a3cfbd04522de8174bd0cf7 100644 (file)
@@ -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);
 };
index c199385998cf8d8bd7080f4153a5b2c6fbc1cd4c..02d804abf52b71b60f5b1b231b017a02ca690b59 100644 (file)
@@ -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);
 }
index 2fb6f5b3c27deb3f55408668375acca06dc49fae..2aec6ea86979fdcfb0bf0aa010dccf56b54a1974 100644 (file)
@@ -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);
 }