From eac57bc223dd2bf9d988b9f1ee0e126a27c98bf8 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Wed, 7 Aug 2013 17:09:45 +0200 Subject: [PATCH] gallivm: propagate scalar_lod to emit_size_query too 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 --- 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 0cb5c210351..3016d7c4920 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 f9a2b3fe5f5..dff8be22f6e 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 122ec4f271a..6780d3e53c4 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 0b4845064a0..aec019a1a6b 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 c199385998c..02d804abf52 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 2fb6f5b3c27..2aec6ea8697 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); } -- 2.30.2