[Mesa-dev] [PATCH 4/4] gallivm: add support for dynamic indexed texture size queries.

Dave Airlie airlied at gmail.com
Mon Apr 18 02:49:19 UTC 2016


From: Dave Airlie <airlied at redhat.com>

This adds support for indirect samplers to the texture size query.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/gallium/auxiliary/gallivm/lp_bld_sample.h     | 2 ++
 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 3 +++
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c   | 9 +++++++++
 3 files changed, 14 insertions(+)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
index 010e985..73a5d6d 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
@@ -122,6 +122,8 @@ struct lp_sampler_size_query_params
    enum lp_sampler_lod_property lod_property;
    LLVMValueRef explicit_lod;
    LLVMValueRef *sizes_out;
+   LLVMValueRef indirect_index;
+   bool sampler_is_indirect;
 };
 /**
  * Texture static state.
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index fead4fd..cf06275 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -3466,6 +3466,9 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
    struct lp_build_context bld_int_vec4;
    LLVMValueRef tunit = lp_build_const_int32(gallivm, params->texture_unit);
 
+   if (params->sampler_is_indirect)
+      tunit = params->indirect_index;
+
    if (static_state->format == PIPE_FORMAT_NONE) {
       /*
        * If there's nothing bound, format is NONE, and we must return
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 2e8cf49..fded38c 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -2714,6 +2714,15 @@ emit_size_query( struct lp_build_tgsi_soa_context *bld,
    params.lod_property = lod_property;
    params.explicit_lod = explicit_lod;
    params.sizes_out = sizes_out;
+   params.sampler_is_indirect = inst->Src[1].Register.Indirect;
+   if (params.sampler_is_indirect) {
+      LLVMBuilderRef builder = bld->bld_base.base.gallivm->builder;
+      LLVMValueRef zero = lp_build_const_int32(bld->bld_base.base.gallivm, 0);
+       params.indirect_index = get_indirect_index(bld, inst->Src[1].Register.File,
+                                                  inst->Src[1].Register.Index,
+                                                  &inst->Src[1].Indirect);
+       params.indirect_index = LLVMBuildExtractElement(builder, params.indirect_index, zero, "");
+   }
 
    bld->sampler->emit_size_query(bld->sampler,
                                  bld->bld_base.base.gallivm,
-- 
2.5.5



More information about the mesa-dev mailing list