aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2020-05-19 12:18:20 +1000
committerMarge Bot <[email protected]>2020-07-02 04:12:17 +0000
commit6dc904f600089014f5ed37ada4f200d71fbff714 (patch)
tree21fa16303f501f8ebe14b14565bd3586b118b010 /src/gallium
parent28f906ad913f7dbd2fff2d4226191d9e1a15273d (diff)
draw: add support for indirect texture access
This hooks up the switch statement generator to the draw code. Reviewed-by: Roland Scheidegger <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3778>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm_sample.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm_sample.c b/src/gallium/auxiliary/draw/draw_llvm_sample.c
index eee0c6319e5..26aa7fe1e31 100644
--- a/src/gallium/auxiliary/draw/draw_llvm_sample.c
+++ b/src/gallium/auxiliary/draw/draw_llvm_sample.c
@@ -318,10 +318,27 @@ draw_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base,
assert(texture_index < PIPE_MAX_SHADER_SAMPLER_VIEWS);
assert(sampler_index < PIPE_MAX_SAMPLERS);
- lp_build_sample_soa(&sampler->dynamic_state.static_state[texture_index].texture_state,
- &sampler->dynamic_state.static_state[sampler_index].sampler_state,
- &sampler->dynamic_state.base,
- gallivm, params);
+ if (params->texture_index_offset) {
+ struct lp_build_sample_array_switch switch_info;
+ memset(&switch_info, 0, sizeof(switch_info));
+ LLVMValueRef unit = LLVMBuildAdd(gallivm->builder, params->texture_index_offset,
+ lp_build_const_int32(gallivm, texture_index), "");
+ lp_build_sample_array_init_soa(&switch_info, gallivm, params, unit,
+ 0, sampler->nr_samplers);
+
+ for (unsigned i = 0; i < sampler->nr_samplers; i++) {
+ lp_build_sample_array_case_soa(&switch_info, i,
+ &sampler->dynamic_state.static_state[i].texture_state,
+ &sampler->dynamic_state.static_state[i].sampler_state,
+ &sampler->dynamic_state.base);
+ }
+ lp_build_sample_array_fini_soa(&switch_info);
+ } else {
+ lp_build_sample_soa(&sampler->dynamic_state.static_state[texture_index].texture_state,
+ &sampler->dynamic_state.static_state[sampler_index].sampler_state,
+ &sampler->dynamic_state.base,
+ gallivm, params);
+ }
}