[Mesa-dev] [PATCH 2/2] gallivm: add support for dynamic indexed texture size queries. (v2)
Dave Airlie
airlied at gmail.com
Thu Apr 21 02:35:04 UTC 2016
From: Dave Airlie <airlied at redhat.com>
This adds support for indirect samplers to the texture size query.
v2: use first active sampler unit.
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 | 11 +++++++++++
3 files changed, 16 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 3ef278f..e6002f5 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -3465,6 +3465,9 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
unsigned target = params->target;
LLVMValueRef texture_unit = lp_build_const_int32(gallivm, params->texture_unit);
+ if (params->sampler_is_indirect)
+ texture_unit = 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 fdba47f..eac66ea 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -2741,6 +2741,17 @@ 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) {
+ LLVMValueRef tmp = lp_exec_mask_get_first_active(&bld->exec_mask);
+
+ 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(bld->bld_base.base.gallivm->builder,
+ params.indirect_index,
+ tmp, "");
+ }
bld->sampler->emit_size_query(bld->sampler,
bld->bld_base.base.gallivm,
--
2.5.5
More information about the mesa-dev
mailing list