gallium/draw: fix LLVM opaque pointer warnings in draw_tcs_llvm_emit_fetch_input()

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18720>
This commit is contained in:
Mihai Preda 2022-09-21 13:08:59 +03:00 committed by Marge Bot
parent a9d37f8bc9
commit 3e6dd65acb

View file

@ -589,18 +589,22 @@ create_tcs_jit_context_type(struct gallivm_state *gallivm,
}
static LLVMTypeRef
create_tcs_jit_input_type(struct gallivm_state *gallivm)
create_tcs_jit_input_type_deref(struct gallivm_state *gallivm)
{
LLVMTypeRef float_type = LLVMFloatTypeInContext(gallivm->context);
LLVMTypeRef input_array;
input_array = LLVMArrayType(float_type, TGSI_NUM_CHANNELS); /* num channels */
input_array = LLVMArrayType(input_array, NUM_TCS_INPUTS); /* num attrs per vertex */
input_array = LLVMPointerType(input_array, 0); /* num vertices per prim */
return input_array;
}
static LLVMTypeRef
create_tcs_jit_input_type(struct gallivm_state *gallivm)
{
return LLVMPointerType(create_tcs_jit_input_type_deref(gallivm), 0); /* num vertices per prim */
}
static LLVMTypeRef
create_tcs_jit_output_type(struct gallivm_state *gallivm)
{
@ -3094,6 +3098,8 @@ draw_tcs_llvm_emit_fetch_input(const struct lp_build_tcs_iface *tes_iface,
LLVMValueRef indices[3];
LLVMValueRef res;
struct lp_type type = bld->type;
LLVMTypeRef input_type = create_tcs_jit_input_type_deref(gallivm);
LLVMTypeRef float_type = LLVMFloatTypeInContext(gallivm->context);
if (is_vindex_indirect || is_aindex_indirect || is_sindex_indirect) {
int i;
@ -3123,18 +3129,16 @@ draw_tcs_llvm_emit_fetch_input(const struct lp_build_tcs_iface *tes_iface,
indices[1] = attr_chan_index;
indices[2] = swiz_chan_index;
channel_vec = LLVMBuildGEP(builder, tcs->input, indices, 3, "");
channel_vec = LLVMBuildLoad(builder, channel_vec, "");
channel_vec = LLVMBuildGEP2(builder, input_type, tcs->input, indices, 3, "");
channel_vec = LLVMBuildLoad2(builder, float_type, channel_vec, "");
res = LLVMBuildInsertElement(builder, res, channel_vec, idx, "");
}
} else {
indices[0] = vertex_index;
indices[1] = attrib_index;
indices[2] = swizzle_index;
res = LLVMBuildGEP(builder, tcs->input, indices, 3, "");
res = LLVMBuildLoad(builder, res, "");
res = LLVMBuildGEP2(builder, input_type, tcs->input, indices, 3, "");
res = LLVMBuildLoad2(builder, float_type, res, "");
res = lp_build_broadcast_scalar(bld, res);
}
return res;