From: Dave Airlie Date: Tue, 16 Jun 2020 02:51:10 +0000 (+1000) Subject: llvmpipe: handle indirect images properly X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0ecae0ac0b5804552f5503e847ab042947dde43f;p=mesa.git llvmpipe: handle indirect images properly Reviewed-by: Roland Scheidegger Part-of: --- diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample.c b/src/gallium/drivers/llvmpipe/lp_tex_sample.c index 6197275b761..72a8b45dda2 100644 --- a/src/gallium/drivers/llvmpipe/lp_tex_sample.c +++ b/src/gallium/drivers/llvmpipe/lp_tex_sample.c @@ -472,9 +472,26 @@ lp_llvm_image_soa_emit_op(const struct lp_build_image_soa *base, unsigned image_index = params->image_index; assert(image_index < PIPE_MAX_SHADER_IMAGES); - lp_build_img_op_soa(&image->dynamic_state.static_state[image_index].image_state, - &image->dynamic_state.base, - gallivm, params, params->outdata); + if (params->image_index_offset) { + struct lp_build_img_op_array_switch switch_info; + memset(&switch_info, 0, sizeof(switch_info)); + LLVMValueRef unit = LLVMBuildAdd(gallivm->builder, params->image_index_offset, + lp_build_const_int32(gallivm, image_index), ""); + + lp_build_image_op_switch_soa(&switch_info, gallivm, params, + unit, 0, image->nr_images); + + for (unsigned i = 0; i < image->nr_images; i++) { + lp_build_image_op_array_case(&switch_info, i, + &image->dynamic_state.static_state[i].image_state, + &image->dynamic_state.base); + } + lp_build_image_op_array_fini_soa(&switch_info); + } else { + lp_build_img_op_soa(&image->dynamic_state.static_state[image_index].image_state, + &image->dynamic_state.base, + gallivm, params, params->outdata); + } } /**