ac/llvm: add type parameter into ac_build_buffer_load to fix 16-bit TES inputs
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9395>
This commit is contained in:
parent
ed351b9a71
commit
18c1c1404d
|
@ -1222,8 +1222,8 @@ static LLVMValueRef ac_build_buffer_load_common(struct ac_llvm_context *ctx, LLV
|
||||||
|
|
||||||
LLVMValueRef ac_build_buffer_load(struct ac_llvm_context *ctx, LLVMValueRef rsrc, int num_channels,
|
LLVMValueRef ac_build_buffer_load(struct ac_llvm_context *ctx, LLVMValueRef rsrc, int num_channels,
|
||||||
LLVMValueRef vindex, LLVMValueRef voffset, LLVMValueRef soffset,
|
LLVMValueRef vindex, LLVMValueRef voffset, LLVMValueRef soffset,
|
||||||
unsigned inst_offset, unsigned cache_policy, bool can_speculate,
|
unsigned inst_offset, LLVMTypeRef channel_type,
|
||||||
bool allow_smem)
|
unsigned cache_policy, bool can_speculate, bool allow_smem)
|
||||||
{
|
{
|
||||||
LLVMValueRef offset = LLVMConstInt(ctx->i32, inst_offset, 0);
|
LLVMValueRef offset = LLVMConstInt(ctx->i32, inst_offset, 0);
|
||||||
if (voffset)
|
if (voffset)
|
||||||
|
@ -1257,8 +1257,8 @@ LLVMValueRef ac_build_buffer_load(struct ac_llvm_context *ctx, LLVMValueRef rsrc
|
||||||
return ac_build_gather_values(ctx, result, num_channels);
|
return ac_build_gather_values(ctx, result, num_channels);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ac_build_buffer_load_common(ctx, rsrc, vindex, offset, ctx->i32_0, num_channels, ctx->f32,
|
return ac_build_buffer_load_common(ctx, rsrc, vindex, offset, ctx->i32_0, num_channels,
|
||||||
cache_policy, can_speculate, false, false);
|
channel_type, cache_policy, can_speculate, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx, LLVMValueRef rsrc,
|
LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx, LLVMValueRef rsrc,
|
||||||
|
|
|
@ -260,8 +260,8 @@ void ac_build_buffer_store_format(struct ac_llvm_context *ctx, LLVMValueRef rsrc
|
||||||
|
|
||||||
LLVMValueRef ac_build_buffer_load(struct ac_llvm_context *ctx, LLVMValueRef rsrc, int num_channels,
|
LLVMValueRef ac_build_buffer_load(struct ac_llvm_context *ctx, LLVMValueRef rsrc, int num_channels,
|
||||||
LLVMValueRef vindex, LLVMValueRef voffset, LLVMValueRef soffset,
|
LLVMValueRef vindex, LLVMValueRef voffset, LLVMValueRef soffset,
|
||||||
unsigned inst_offset, unsigned cache_policy, bool can_speculate,
|
unsigned inst_offset, LLVMTypeRef channel_type,
|
||||||
bool allow_smem);
|
unsigned cache_policy, bool can_speculate, bool allow_smem);
|
||||||
|
|
||||||
LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx, LLVMValueRef rsrc,
|
LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx, LLVMValueRef rsrc,
|
||||||
LLVMValueRef vindex, LLVMValueRef voffset,
|
LLVMValueRef vindex, LLVMValueRef voffset,
|
||||||
|
|
|
@ -1984,7 +1984,7 @@ static LLVMValueRef visit_load_buffer(struct ac_nir_context *ctx, nir_intrinsic_
|
||||||
bool can_speculate = access & ACCESS_CAN_REORDER;
|
bool can_speculate = access & ACCESS_CAN_REORDER;
|
||||||
|
|
||||||
ret = ac_build_buffer_load(&ctx->ac, rsrc, num_channels, vindex, offset, immoffset, 0,
|
ret = ac_build_buffer_load(&ctx->ac, rsrc, num_channels, vindex, offset, immoffset, 0,
|
||||||
cache_policy, can_speculate, false);
|
ctx->ac.f32, cache_policy, can_speculate, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVMTypeRef byte_vec = LLVMVectorType(ctx->ac.i8, ac_get_type_size(LLVMTypeOf(ret)));
|
LLVMTypeRef byte_vec = LLVMVectorType(ctx->ac.i8, ac_get_type_size(LLVMTypeOf(ret)));
|
||||||
|
@ -2151,7 +2151,8 @@ static LLVMValueRef visit_load_ubo_buffer(struct ac_nir_context *ctx, nir_intrin
|
||||||
num_components = DIV_ROUND_UP(num_components, 4);
|
num_components = DIV_ROUND_UP(num_components, 4);
|
||||||
|
|
||||||
ret =
|
ret =
|
||||||
ac_build_buffer_load(&ctx->ac, rsrc, num_components, NULL, offset, NULL, 0, 0, true, true);
|
ac_build_buffer_load(&ctx->ac, rsrc, num_components, NULL, offset, NULL, 0,
|
||||||
|
ctx->ac.f32, 0, true, true);
|
||||||
|
|
||||||
/* Convert to the original type. */
|
/* Convert to the original type. */
|
||||||
if (instr->dest.ssa.bit_size == 64) {
|
if (instr->dest.ssa.bit_size == 64) {
|
||||||
|
@ -3958,7 +3959,7 @@ static LLVMValueRef get_bindless_index_from_uniform(struct ac_nir_context *ctx,
|
||||||
LLVMValueRef ubo_index = ctx->abi->load_ubo(ctx->abi, 0, 0, false, ctx->ac.i32_0);
|
LLVMValueRef ubo_index = ctx->abi->load_ubo(ctx->abi, 0, 0, false, ctx->ac.i32_0);
|
||||||
|
|
||||||
LLVMValueRef ret =
|
LLVMValueRef ret =
|
||||||
ac_build_buffer_load(&ctx->ac, ubo_index, 1, NULL, offset, NULL, 0, 0, true, true);
|
ac_build_buffer_load(&ctx->ac, ubo_index, 1, NULL, offset, NULL, 0, ctx->ac.f32, 0, true, true);
|
||||||
|
|
||||||
return LLVMBuildBitCast(ctx->ac.builder, ret, ctx->ac.i32, "");
|
return LLVMBuildBitCast(ctx->ac.builder, ret, ctx->ac.i32, "");
|
||||||
}
|
}
|
||||||
|
|
|
@ -633,7 +633,7 @@ load_tes_input(struct ac_shader_abi *abi,
|
||||||
buf_addr = LLVMBuildAdd(ctx->ac.builder, buf_addr, comp_offset, "");
|
buf_addr = LLVMBuildAdd(ctx->ac.builder, buf_addr, comp_offset, "");
|
||||||
|
|
||||||
result = ac_build_buffer_load(&ctx->ac, ctx->hs_ring_tess_offchip, num_components, NULL,
|
result = ac_build_buffer_load(&ctx->ac, ctx->hs_ring_tess_offchip, num_components, NULL,
|
||||||
buf_addr, oc_lds, 0, ac_glc, true, false);
|
buf_addr, oc_lds, 0, ctx->ac.f32, ac_glc, true, false);
|
||||||
result = ac_trim_vector(&ctx->ac, result, num_components);
|
result = ac_trim_vector(&ctx->ac, result, num_components);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -673,7 +673,7 @@ load_gs_input(struct ac_shader_abi *abi,
|
||||||
ctx->esgs_ring, 1,
|
ctx->esgs_ring, 1,
|
||||||
ctx->ac.i32_0,
|
ctx->ac.i32_0,
|
||||||
vtx_offset, soffset,
|
vtx_offset, soffset,
|
||||||
0, ac_glc, true, false);
|
0, ctx->ac.f32, ac_glc, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ac_get_type_size(type) == 2) {
|
if (ac_get_type_size(type) == 2) {
|
||||||
|
@ -4318,7 +4318,7 @@ ac_gs_copy_shader_emit(struct radv_shader_context *ctx)
|
||||||
ctx->gsvs_ring[0],
|
ctx->gsvs_ring[0],
|
||||||
1, ctx->ac.i32_0,
|
1, ctx->ac.i32_0,
|
||||||
vtx_offset, soffset,
|
vtx_offset, soffset,
|
||||||
0, ac_glc | ac_slc, true, false);
|
0, ctx->ac.f32, ac_glc | ac_slc, true, false);
|
||||||
|
|
||||||
LLVMTypeRef type = LLVMGetAllocatedType(ctx->abi.outputs[ac_llvm_reg_index_soa(i, j)]);
|
LLVMTypeRef type = LLVMGetAllocatedType(ctx->abi.outputs[ac_llvm_reg_index_soa(i, j)]);
|
||||||
if (ac_get_type_size(type) == 2) {
|
if (ac_get_type_size(type) == 2) {
|
||||||
|
|
|
@ -270,7 +270,8 @@ void si_llvm_dispose(struct si_shader_context *ctx)
|
||||||
LLVMValueRef si_buffer_load_const(struct si_shader_context *ctx, LLVMValueRef resource,
|
LLVMValueRef si_buffer_load_const(struct si_shader_context *ctx, LLVMValueRef resource,
|
||||||
LLVMValueRef offset)
|
LLVMValueRef offset)
|
||||||
{
|
{
|
||||||
return ac_build_buffer_load(&ctx->ac, resource, 1, NULL, offset, NULL, 0, 0, true, true);
|
return ac_build_buffer_load(&ctx->ac, resource, 1, NULL, offset, NULL, 0, ctx->ac.f32,
|
||||||
|
0, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void si_llvm_build_ret(struct si_shader_context *ctx, LLVMValueRef ret)
|
void si_llvm_build_ret(struct si_shader_context *ctx, LLVMValueRef ret)
|
||||||
|
|
|
@ -91,7 +91,7 @@ static LLVMValueRef si_llvm_load_input_gs(struct ac_shader_abi *abi, unsigned in
|
||||||
soffset = LLVMConstInt(ctx->ac.i32, (param * 4 + swizzle) * 256, 0);
|
soffset = LLVMConstInt(ctx->ac.i32, (param * 4 + swizzle) * 256, 0);
|
||||||
|
|
||||||
value = ac_build_buffer_load(&ctx->ac, ctx->esgs_ring, 1, ctx->ac.i32_0, vtx_offset, soffset, 0,
|
value = ac_build_buffer_load(&ctx->ac, ctx->esgs_ring, 1, ctx->ac.i32_0, vtx_offset, soffset, 0,
|
||||||
ac_glc, true, false);
|
ctx->ac.f32, ac_glc, true, false);
|
||||||
return LLVMBuildBitCast(ctx->ac.builder, value, type, "");
|
return LLVMBuildBitCast(ctx->ac.builder, value, type, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,7 +512,7 @@ struct si_shader *si_generate_gs_copy_shader(struct si_screen *sscreen,
|
||||||
|
|
||||||
outputs[i].values[chan] =
|
outputs[i].values[chan] =
|
||||||
ac_build_buffer_load(&ctx.ac, ctx.gsvs_ring[0], 1, ctx.ac.i32_0, voffset, soffset, 0,
|
ac_build_buffer_load(&ctx.ac, ctx.gsvs_ring[0], 1, ctx.ac.i32_0, voffset, soffset, 0,
|
||||||
ac_glc | ac_slc, true, false);
|
ctx.ac.f32, ac_glc | ac_slc, true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -275,13 +275,13 @@ static LLVMValueRef buffer_load(struct si_shader_context *ctx, LLVMTypeRef type,
|
||||||
LLVMTypeRef vec_type = LLVMVectorType(type, 4);
|
LLVMTypeRef vec_type = LLVMVectorType(type, 4);
|
||||||
|
|
||||||
if (swizzle == ~0) {
|
if (swizzle == ~0) {
|
||||||
value = ac_build_buffer_load(&ctx->ac, buffer, 4, NULL, base, offset, 0, ac_glc,
|
value = ac_build_buffer_load(&ctx->ac, buffer, 4, NULL, base, offset, 0, type, ac_glc,
|
||||||
can_speculate, false);
|
can_speculate, false);
|
||||||
|
|
||||||
return LLVMBuildBitCast(ctx->ac.builder, value, vec_type, "");
|
return LLVMBuildBitCast(ctx->ac.builder, value, vec_type, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
value = ac_build_buffer_load(&ctx->ac, buffer, 4, NULL, base, offset, 0, ac_glc,
|
value = ac_build_buffer_load(&ctx->ac, buffer, 4, NULL, base, offset, 0, type, ac_glc,
|
||||||
can_speculate, false);
|
can_speculate, false);
|
||||||
|
|
||||||
value = LLVMBuildBitCast(ctx->ac.builder, value, vec_type, "");
|
value = LLVMBuildBitCast(ctx->ac.builder, value, vec_type, "");
|
||||||
|
|
Loading…
Reference in New Issue