diff options
author | Dave Airlie <[email protected]> | 2020-06-16 12:53:43 +1000 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-07-02 04:12:17 +0000 |
commit | b7b22b735d14d15739a86406fb376614fd24cffe (patch) | |
tree | 709651a75598614b31a553f4b10a605c2586bc5c | |
parent | e6f7fe33244fd4f537b3055c1b51037825c0a48e (diff) |
draw/sample: add support for indirect images
This uses the array functions to implement indirect image support
for draw shaders
Reviewed-by: Roland Scheidegger <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3778>
-rw-r--r-- | src/gallium/auxiliary/draw/draw_llvm_sample.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm_sample.c b/src/gallium/auxiliary/draw/draw_llvm_sample.c index fa5729e3ef6..a3895c798df 100644 --- a/src/gallium/auxiliary/draw/draw_llvm_sample.c +++ b/src/gallium/auxiliary/draw/draw_llvm_sample.c @@ -420,6 +420,22 @@ draw_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); + 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); + return; + } lp_build_img_op_soa(&image->dynamic_state.static_state[image_index].image_state, &image->dynamic_state.base, gallivm, params, params->outdata); |