mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 17:30:12 +01:00
llvmpipe/draw: wire up indirect offset
This bounds checks and adds to the llvm index. Reviewed-by: Roland Scheidegger <sroland@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3778>
This commit is contained in:
parent
3b973eab73
commit
d243655d34
2 changed files with 20 additions and 0 deletions
|
|
@ -119,6 +119,11 @@ draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
|
|||
indices[1] = lp_build_const_int32(gallivm, DRAW_JIT_CTX_TEXTURES);
|
||||
/* context[0].textures[unit] */
|
||||
indices[2] = lp_build_const_int32(gallivm, texture_unit);
|
||||
if (texture_unit_offset) {
|
||||
indices[2] = LLVMBuildAdd(gallivm->builder, indices[2], texture_unit_offset, "");
|
||||
LLVMValueRef cond = LLVMBuildICmp(gallivm->builder, LLVMIntULT, indices[2], lp_build_const_int32(gallivm, PIPE_MAX_SHADER_SAMPLER_VIEWS), "");
|
||||
indices[2] = LLVMBuildSelect(gallivm->builder, cond, indices[2], lp_build_const_int32(gallivm, texture_unit), "");
|
||||
}
|
||||
/* context[0].textures[unit].member */
|
||||
indices[3] = lp_build_const_int32(gallivm, member_index);
|
||||
|
||||
|
|
@ -211,6 +216,11 @@ draw_llvm_image_member(const struct lp_sampler_dynamic_state *base,
|
|||
indices[1] = lp_build_const_int32(gallivm, DRAW_JIT_CTX_IMAGES);
|
||||
/* context[0].textures[unit] */
|
||||
indices[2] = lp_build_const_int32(gallivm, image_unit);
|
||||
if (image_unit_offset) {
|
||||
indices[2] = LLVMBuildAdd(gallivm->builder, indices[2], image_unit_offset, "");
|
||||
LLVMValueRef cond = LLVMBuildICmp(gallivm->builder, LLVMIntULT, indices[2], lp_build_const_int32(gallivm, PIPE_MAX_SHADER_IMAGES), "");
|
||||
indices[2] = LLVMBuildSelect(gallivm->builder, cond, indices[2], lp_build_const_int32(gallivm, image_unit), "");
|
||||
}
|
||||
/* context[0].textures[unit].member */
|
||||
indices[3] = lp_build_const_int32(gallivm, member_index);
|
||||
|
||||
|
|
|
|||
|
|
@ -128,6 +128,11 @@ lp_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
|
|||
indices[1] = lp_build_const_int32(gallivm, LP_JIT_CTX_TEXTURES);
|
||||
/* context[0].textures[unit] */
|
||||
indices[2] = lp_build_const_int32(gallivm, texture_unit);
|
||||
if (texture_unit_offset) {
|
||||
indices[2] = LLVMBuildAdd(gallivm->builder, indices[2], texture_unit_offset, "");
|
||||
LLVMValueRef cond = LLVMBuildICmp(gallivm->builder, LLVMIntULT, indices[2], lp_build_const_int32(gallivm, PIPE_MAX_SHADER_SAMPLER_VIEWS), "");
|
||||
indices[2] = LLVMBuildSelect(gallivm->builder, cond, indices[2], lp_build_const_int32(gallivm, texture_unit), "");
|
||||
}
|
||||
/* context[0].textures[unit].member */
|
||||
indices[3] = lp_build_const_int32(gallivm, member_index);
|
||||
|
||||
|
|
@ -275,6 +280,11 @@ lp_llvm_image_member(const struct lp_sampler_dynamic_state *base,
|
|||
indices[1] = lp_build_const_int32(gallivm, LP_JIT_CTX_IMAGES);
|
||||
/* context[0].images[unit] */
|
||||
indices[2] = lp_build_const_int32(gallivm, image_unit);
|
||||
if (image_unit_offset) {
|
||||
indices[2] = LLVMBuildAdd(gallivm->builder, indices[2], image_unit_offset, "");
|
||||
LLVMValueRef cond = LLVMBuildICmp(gallivm->builder, LLVMIntULT, indices[2], lp_build_const_int32(gallivm, PIPE_MAX_SHADER_IMAGES), "");
|
||||
indices[2] = LLVMBuildSelect(gallivm->builder, cond, indices[2], lp_build_const_int32(gallivm, image_unit), "");
|
||||
}
|
||||
/* context[0].images[unit].member */
|
||||
indices[3] = lp_build_const_int32(gallivm, member_index);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue