From 28afc22179df05d7727a80efd8e51356bc3ad000 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 27 Sep 2022 15:34:56 +1000 Subject: [PATCH] gallivm/llvmpipe: hand sample position type in for loading. Reviewed-by: Mihai Preda Reviewed-by: Brian Paul Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c | 3 ++- src/gallium/auxiliary/gallivm/lp_bld_tgsi.h | 1 + src/gallium/drivers/llvmpipe/lp_state_fs.c | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c index 3c7e418b7af..dafbffb3448 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c @@ -1893,7 +1893,8 @@ static void emit_sysval_intrin(struct lp_build_nir_context *bld_base, for (unsigned i = 0; i < 2; i++) { LLVMValueRef idx = LLVMBuildMul(gallivm->builder, bld->system_values.sample_id, lp_build_const_int32(gallivm, 2), ""); idx = LLVMBuildAdd(gallivm->builder, idx, lp_build_const_int32(gallivm, i), ""); - LLVMValueRef val = lp_build_array_get(gallivm, bld->system_values.sample_pos, idx); + LLVMValueRef val = lp_build_array_get2(gallivm, bld->system_values.sample_pos_type, + bld->system_values.sample_pos, idx); result[i] = lp_build_broadcast_scalar(&bld_base->base, val); } break; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h index 1b27cf9faa4..9a675b306e7 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h @@ -183,6 +183,7 @@ struct lp_bld_tgsi_system_values { LLVMValueRef tess_inner; LLVMValueRef vertices_in; LLVMValueRef sample_id; + LLVMTypeRef sample_pos_type; LLVMValueRef sample_pos; LLVMValueRef sample_mask_in; LLVMValueRef view_index; diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index b65a3a897eb..d1dbd9d787d 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -643,6 +643,7 @@ generate_fs_loop(struct gallivm_state *gallivm, struct lp_type type, LLVMTypeRef context_type, LLVMValueRef context_ptr, + LLVMTypeRef sample_pos_type, LLVMValueRef sample_pos_array, LLVMValueRef num_loop, struct lp_build_interp_soa_context *interp, @@ -1020,6 +1021,7 @@ generate_fs_loop(struct gallivm_state *gallivm, } system_values.sample_pos = sample_pos_array; + system_values.sample_pos_type = sample_pos_type; lp_build_interp_soa_update_inputs_dyn(interp, gallivm, loop_state.counter, mask_type, mask_store, sample_loop_state.counter); @@ -3415,6 +3417,7 @@ generate_fragment(struct llvmpipe_context *lp, fs_type, variant->jit_context_type, context_ptr, + LLVMTypeOf(sample_pos_array), glob_sample_pos, num_loop, &interp,