llvmpipe/fs: convert linear context to opaque pointers friendly
Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Mihai Preda <mhpreda@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18837>
This commit is contained in:
@@ -374,6 +374,7 @@ lp_jit_create_types(struct lp_fragment_shader_variant *lp)
|
||||
LP_CHECK_STRUCT_SIZE(struct lp_jit_linear_context,
|
||||
gallivm->target, linear_context_type);
|
||||
|
||||
lp->jit_linear_context_type = linear_context_type;
|
||||
lp->jit_linear_context_ptr_type = LLVMPointerType(linear_context_type, 0);
|
||||
}
|
||||
|
||||
|
@@ -366,23 +366,23 @@ enum {
|
||||
};
|
||||
|
||||
|
||||
#define lp_jit_linear_context_constants(_gallivm, _ptr) \
|
||||
lp_build_struct_get(_gallivm, _ptr, LP_JIT_LINEAR_CTX_CONSTANTS, "constants")
|
||||
#define lp_jit_linear_context_constants(_gallivm, _type, _ptr) \
|
||||
lp_build_struct_get2(_gallivm, _type, _ptr, LP_JIT_LINEAR_CTX_CONSTANTS, "constants")
|
||||
|
||||
#define lp_jit_linear_context_tex(_gallivm, _ptr) \
|
||||
lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_LINEAR_CTX_TEX, "tex")
|
||||
#define lp_jit_linear_context_tex(_gallivm, _type, _ptr) \
|
||||
lp_build_struct_get_ptr2(_gallivm, _type, _ptr, LP_JIT_LINEAR_CTX_TEX, "tex")
|
||||
|
||||
#define lp_jit_linear_context_inputs(_gallivm, _ptr) \
|
||||
lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_LINEAR_CTX_INPUTS, "inputs")
|
||||
#define lp_jit_linear_context_inputs(_gallivm, _type, _ptr) \
|
||||
lp_build_struct_get_ptr2(_gallivm, _type, _ptr, LP_JIT_LINEAR_CTX_INPUTS, "inputs")
|
||||
|
||||
#define lp_jit_linear_context_color0(_gallivm, _ptr) \
|
||||
lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_LINEAR_CTX_COLOR0, "color0")
|
||||
#define lp_jit_linear_context_color0(_gallivm, _type, _ptr) \
|
||||
lp_build_struct_get_ptr2(_gallivm, _type, _ptr, LP_JIT_LINEAR_CTX_COLOR0, "color0")
|
||||
|
||||
#define lp_jit_linear_context_blend_color(_gallivm, _ptr) \
|
||||
lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_LINEAR_CTX_BLEND_COLOR, "blend_color")
|
||||
#define lp_jit_linear_context_blend_color(_gallivm, _type, _ptr) \
|
||||
lp_build_struct_get_ptr2(_gallivm, _type, _ptr, LP_JIT_LINEAR_CTX_BLEND_COLOR, "blend_color")
|
||||
|
||||
#define lp_jit_linear_context_alpha_ref(_gallivm, _ptr) \
|
||||
lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_LINEAR_CTX_ALPHA_REF, "alpha_ref_value")
|
||||
#define lp_jit_linear_context_alpha_ref(_gallivm, _type, _ptr) \
|
||||
lp_build_struct_get_ptr2(_gallivm, _type, _ptr, LP_JIT_LINEAR_CTX_ALPHA_REF, "alpha_ref_value")
|
||||
|
||||
|
||||
typedef const uint8_t *
|
||||
|
@@ -177,6 +177,7 @@ struct lp_fragment_shader_variant
|
||||
LLVMTypeRef jit_context_ptr_type;
|
||||
LLVMTypeRef jit_thread_data_type;
|
||||
LLVMTypeRef jit_thread_data_ptr_type;
|
||||
LLVMTypeRef jit_linear_context_type;
|
||||
LLVMTypeRef jit_linear_context_ptr_type;
|
||||
|
||||
LLVMValueRef function[2]; // [RAST_WHOLE], [RAST_EDGE_TEST]
|
||||
|
@@ -336,20 +336,30 @@ llvmpipe_fs_variant_linear_llvm(struct llvmpipe_context *lp,
|
||||
* Get context data
|
||||
*/
|
||||
LLVMValueRef consts_ptr =
|
||||
lp_jit_linear_context_constants(gallivm, context_ptr);
|
||||
lp_jit_linear_context_constants(gallivm,
|
||||
variant->jit_linear_context_type,
|
||||
context_ptr);
|
||||
LLVMValueRef interpolators_ptr =
|
||||
lp_jit_linear_context_inputs(gallivm, context_ptr);
|
||||
lp_jit_linear_context_inputs(gallivm,
|
||||
variant->jit_linear_context_type,
|
||||
context_ptr);
|
||||
LLVMValueRef samplers_ptr =
|
||||
lp_jit_linear_context_tex(gallivm, context_ptr);
|
||||
lp_jit_linear_context_tex(gallivm,
|
||||
variant->jit_linear_context_type,
|
||||
context_ptr);
|
||||
|
||||
LLVMValueRef color0_ptr =
|
||||
lp_jit_linear_context_color0(gallivm, context_ptr);
|
||||
lp_jit_linear_context_color0(gallivm,
|
||||
variant->jit_linear_context_type,
|
||||
context_ptr);
|
||||
color0_ptr = LLVMBuildLoad(builder, color0_ptr, "");
|
||||
color0_ptr = LLVMBuildBitCast(builder, color0_ptr,
|
||||
LLVMPointerType(bld.vec_type, 0), "");
|
||||
|
||||
LLVMValueRef blend_color =
|
||||
lp_jit_linear_context_blend_color(gallivm, context_ptr);
|
||||
lp_jit_linear_context_blend_color(gallivm,
|
||||
variant->jit_linear_context_type,
|
||||
context_ptr);
|
||||
blend_color = LLVMBuildLoad(builder, blend_color, "");
|
||||
blend_color = lp_build_broadcast(gallivm, LLVMVectorType(int32t, 4),
|
||||
blend_color);
|
||||
@@ -357,7 +367,9 @@ llvmpipe_fs_variant_linear_llvm(struct llvmpipe_context *lp,
|
||||
LLVMVectorType(int8t, 16), "");
|
||||
|
||||
LLVMValueRef alpha_ref =
|
||||
lp_jit_linear_context_alpha_ref(gallivm, context_ptr);
|
||||
lp_jit_linear_context_alpha_ref(gallivm,
|
||||
variant->jit_linear_context_type,
|
||||
context_ptr);
|
||||
alpha_ref = LLVMBuildLoad(builder, alpha_ref, "");
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user