From 98efdc449d1d0c6794372308ba5d454ea4862b93 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 26 Sep 2022 13:00:11 +1000 Subject: [PATCH] llvmpipe/cs: convert cs thread data to opaque friendly api Reviewed-by: Roland Scheidegger Reviewed-by: Brian Paul Reviewed-by: Mihai Preda Part-of: --- src/gallium/drivers/llvmpipe/lp_jit.c | 1 + src/gallium/drivers/llvmpipe/lp_jit.h | 8 ++++---- src/gallium/drivers/llvmpipe/lp_state_cs.c | 4 +++- src/gallium/drivers/llvmpipe/lp_state_cs.h | 1 + 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c index e0c6f75b111..8588594b6a5 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.c +++ b/src/gallium/drivers/llvmpipe/lp_jit.c @@ -431,6 +431,7 @@ lp_jit_create_cs_types(struct lp_compute_shader_variant *lp) thread_data_type = LLVMStructTypeInContext(lc, elem_types, ARRAY_SIZE(elem_types), 0); + lp->jit_cs_thread_data_type = thread_data_type; lp->jit_cs_thread_data_ptr_type = LLVMPointerType(thread_data_type, 0); } diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h b/src/gallium/drivers/llvmpipe/lp_jit.h index 876b9bf198b..c79a87a7a47 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.h +++ b/src/gallium/drivers/llvmpipe/lp_jit.h @@ -421,11 +421,11 @@ enum { }; -#define lp_jit_cs_thread_data_cache(_gallivm, _ptr) \ - lp_build_struct_get(_gallivm, _ptr, LP_JIT_CS_THREAD_DATA_CACHE, "cache") +#define lp_jit_cs_thread_data_cache(_gallivm, _type, _ptr) \ + lp_build_struct_get2(_gallivm, _type, _ptr, LP_JIT_CS_THREAD_DATA_CACHE, "cache") -#define lp_jit_cs_thread_data_shared(_gallivm, _ptr) \ - lp_build_struct_get(_gallivm, _ptr, LP_JIT_CS_THREAD_DATA_SHARED, "shared") +#define lp_jit_cs_thread_data_shared(_gallivm, _type, _ptr) \ + lp_build_struct_get2(_gallivm, _type, _ptr, LP_JIT_CS_THREAD_DATA_SHARED, "shared") struct lp_jit_cs_context diff --git a/src/gallium/drivers/llvmpipe/lp_state_cs.c b/src/gallium/drivers/llvmpipe/lp_state_cs.c index d959dc01879..44976611ae9 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_cs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_cs.c @@ -337,7 +337,9 @@ generate_compute(struct llvmpipe_context *lp, variant->jit_cs_context_type, context_ptr); - shared_ptr = lp_jit_cs_thread_data_shared(gallivm, thread_data_ptr); + shared_ptr = lp_jit_cs_thread_data_shared(gallivm, + variant->jit_cs_thread_data_type, + thread_data_ptr); LLVMValueRef coro_num_hdls = LLVMBuildMul(gallivm->builder, num_x_loop, block_y_size_arg, ""); coro_num_hdls = LLVMBuildMul(gallivm->builder, coro_num_hdls, block_z_size_arg, ""); diff --git a/src/gallium/drivers/llvmpipe/lp_state_cs.h b/src/gallium/drivers/llvmpipe/lp_state_cs.h index 7fb2127a1cd..6a4b8027035 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_cs.h +++ b/src/gallium/drivers/llvmpipe/lp_state_cs.h @@ -82,6 +82,7 @@ struct lp_compute_shader_variant LLVMTypeRef jit_cs_context_type; LLVMTypeRef jit_cs_context_ptr_type; + LLVMTypeRef jit_cs_thread_data_type; LLVMTypeRef jit_cs_thread_data_ptr_type; LLVMValueRef function;