summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/auxiliary
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2022-04-21 04:23:05 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2022-04-21 04:23:05 +0000
commita09152815d99b8a68f7f5ed0e44bab39dd14a1e5 (patch)
tree2d0fdc70c25e62ac40fe0512a56b269564afb8f8 /lib/mesa/src/gallium/auxiliary
parent5141f851e7304b6ee32a98117c378cb814079903 (diff)
Import Mesa 21.3.8
Diffstat (limited to 'lib/mesa/src/gallium/auxiliary')
-rw-r--r--lib/mesa/src/gallium/auxiliary/driver_trace/tr_context.c2
-rw-r--r--lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c24
2 files changed, 21 insertions, 5 deletions
diff --git a/lib/mesa/src/gallium/auxiliary/driver_trace/tr_context.c b/lib/mesa/src/gallium/auxiliary/driver_trace/tr_context.c
index 7e28a4028..b3a367a5e 100644
--- a/lib/mesa/src/gallium/auxiliary/driver_trace/tr_context.c
+++ b/lib/mesa/src/gallium/auxiliary/driver_trace/tr_context.c
@@ -2191,7 +2191,7 @@ trace_context_create(struct trace_screen *tr_scr,
if (!trace_enabled())
goto error1;
- tr_ctx = ralloc(NULL, struct trace_context);
+ tr_ctx = rzalloc(NULL, struct trace_context);
if (!tr_ctx)
goto error1;
diff --git a/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c b/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
index b771b7cc7..daed647ba 100644
--- a/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
+++ b/lib/mesa/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
@@ -1438,6 +1438,7 @@ static void emit_tex(struct lp_build_nir_context *bld_base,
{
struct lp_build_nir_soa_context *bld = (struct lp_build_nir_soa_context *)bld_base;
struct gallivm_state *gallivm = bld_base->base.gallivm;
+ LLVMBuilderRef builder = bld_base->base.gallivm->builder;
params->type = bld_base->base.type;
params->context_ptr = bld->context_ptr;
@@ -1491,10 +1492,25 @@ static void emit_tex(struct lp_build_nir_context *bld_base,
return;
}
- if (params->texture_index_offset)
- params->texture_index_offset = LLVMBuildExtractElement(bld_base->base.gallivm->builder,
- params->texture_index_offset,
- lp_build_const_int32(bld_base->base.gallivm, 0), "");
+ if (params->texture_index_offset) {
+ struct lp_build_loop_state loop_state;
+ LLVMValueRef exec_mask = mask_vec(bld_base);
+ LLVMValueRef outer_cond = LLVMBuildICmp(builder, LLVMIntNE, exec_mask, bld_base->uint_bld.zero, "");
+ LLVMValueRef res_store = lp_build_alloca(gallivm, bld_base->uint_bld.elem_type, "");
+ lp_build_loop_begin(&loop_state, gallivm, lp_build_const_int32(gallivm, 0));
+ LLVMValueRef if_cond = LLVMBuildExtractElement(gallivm->builder, outer_cond, loop_state.counter, "");
+
+ struct lp_build_if_state ifthen;
+ lp_build_if(&ifthen, gallivm, if_cond);
+ LLVMValueRef value_ptr = LLVMBuildExtractElement(gallivm->builder, params->texture_index_offset,
+ loop_state.counter, "");
+ LLVMBuildStore(builder, value_ptr, res_store);
+ lp_build_endif(&ifthen);
+ lp_build_loop_end_cond(&loop_state, lp_build_const_int32(gallivm, bld_base->uint_bld.type.length),
+ NULL, LLVMIntUGE);
+ LLVMValueRef idx_val = LLVMBuildLoad(builder, res_store, "");
+ params->texture_index_offset = idx_val;
+ }
params->type = bld_base->base.type;
bld->sampler->emit_tex_sample(bld->sampler,