diff options
author | Konstantin Seurer <konstantin.seurer@gmail.com> | 2023-07-04 17:48:58 +0200 |
---|---|---|
committer | Eric Engestrom <eric@engestrom.ch> | 2023-07-28 18:48:24 +0100 |
commit | 1d8d9a0f791a265e824eca56ad0fcb9475b279da (patch) | |
tree | aa81525afb8e4d0e7584cb582062d387aa4d6adb | |
parent | 9e6b835b3cdcfa7b497e4bbbad0926f99b168d6f (diff) | |
download | mesa-1d8d9a0f791a265e824eca56ad0fcb9475b279da.tar.gz mesa-1d8d9a0f791a265e824eca56ad0fcb9475b279da.tar.bz2 mesa-1d8d9a0f791a265e824eca56ad0fcb9475b279da.zip |
gallivm: Fix atomic_global types
Passes LLVM validation on the test_mesh_shader_rendering vkd3d-proton
test.
cc: mesa-stable
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23996>
(cherry picked from commit f281290005119ddd2dc82e0b7a4cc22551d7fc71)
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c | 20 |
2 files changed, 5 insertions, 17 deletions
diff --git a/.pick_status.json b/.pick_status.json index c51207a20cd..3f20413e2c4 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -9652,7 +9652,7 @@ "description": "gallivm: Fix atomic_global types", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c index b656891a9af..262643e3234 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c @@ -1034,6 +1034,7 @@ static void emit_atomic_global(struct lp_build_nir_context *bld_base, LLVMValueRef value_ptr = LLVMBuildExtractElement(gallivm->builder, val, loop_state.counter, ""); + value_ptr = LLVMBuildBitCast(gallivm->builder, value_ptr, atom_bld->elem_type, ""); LLVMValueRef addr_ptr = LLVMBuildExtractElement(gallivm->builder, addr, loop_state.counter, ""); @@ -1107,25 +1108,12 @@ static void emit_atomic_global(struct lp_build_nir_context *bld_base, LLVMAtomicOrderingSequentiallyConsistent, false); } - temp_res = LLVMBuildLoad2(builder, LLVMTypeOf(val), atom_res, ""); + temp_res = LLVMBuildLoad2(builder, atom_bld->vec_type, atom_res, ""); temp_res = LLVMBuildInsertElement(builder, temp_res, scalar, loop_state.counter, ""); LLVMBuildStore(builder, temp_res, atom_res); lp_build_else(&ifthen); - temp_res = LLVMBuildLoad2(builder, LLVMTypeOf(val), atom_res, ""); - bool is_float = LLVMTypeOf(val) == bld_base->base.vec_type; - LLVMValueRef zero_val; - if (is_float) { - if (val_bit_size == 64) - zero_val = lp_build_const_double(gallivm, 0); - else - zero_val = lp_build_const_float(gallivm, 0); - } else { - if (val_bit_size == 64) - zero_val = lp_build_const_int64(gallivm, 0); - else - zero_val = lp_build_const_int32(gallivm, 0); - } - + temp_res = LLVMBuildLoad2(builder, atom_bld->vec_type, atom_res, ""); + LLVMValueRef zero_val = lp_build_zero_bits(gallivm, val_bit_size, is_flt); temp_res = LLVMBuildInsertElement(builder, temp_res, zero_val, loop_state.counter, ""); LLVMBuildStore(builder, temp_res, atom_res); lp_build_endif(&ifthen); |