diff --git a/src/amd/llvm/ac_llvm_build.c b/src/amd/llvm/ac_llvm_build.c index e7b82fa7f8a..52044ef258d 100644 --- a/src/amd/llvm/ac_llvm_build.c +++ b/src/amd/llvm/ac_llvm_build.c @@ -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 vindex, LLVMValueRef voffset, LLVMValueRef soffset, - unsigned inst_offset, unsigned cache_policy, bool can_speculate, - bool allow_smem) + unsigned inst_offset, LLVMTypeRef channel_type, + unsigned cache_policy, bool can_speculate, bool allow_smem) { LLVMValueRef offset = LLVMConstInt(ctx->i32, inst_offset, 0); 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_buffer_load_common(ctx, rsrc, vindex, offset, ctx->i32_0, num_channels, ctx->f32, - cache_policy, can_speculate, false, false); + return ac_build_buffer_load_common(ctx, rsrc, vindex, offset, ctx->i32_0, num_channels, + channel_type, cache_policy, can_speculate, false, false); } LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx, LLVMValueRef rsrc, diff --git a/src/amd/llvm/ac_llvm_build.h b/src/amd/llvm/ac_llvm_build.h index 5763276ce2e..fa82f52f64d 100644 --- a/src/amd/llvm/ac_llvm_build.h +++ b/src/amd/llvm/ac_llvm_build.h @@ -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 vindex, LLVMValueRef voffset, LLVMValueRef soffset, - unsigned inst_offset, unsigned cache_policy, bool can_speculate, - bool allow_smem); + unsigned inst_offset, LLVMTypeRef channel_type, + unsigned cache_policy, bool can_speculate, bool allow_smem); LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx, LLVMValueRef rsrc, LLVMValueRef vindex, LLVMValueRef voffset, diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c index 40379622331..a3e84029909 100644 --- a/src/amd/llvm/ac_nir_to_llvm.c +++ b/src/amd/llvm/ac_nir_to_llvm.c @@ -1984,7 +1984,7 @@ static LLVMValueRef visit_load_buffer(struct ac_nir_context *ctx, nir_intrinsic_ bool can_speculate = access & ACCESS_CAN_REORDER; 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))); @@ -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); 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. */ 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 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, ""); } diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c index b16bc53e930..dc69caeaec4 100644 --- a/src/amd/vulkan/radv_nir_to_llvm.c +++ b/src/amd/vulkan/radv_nir_to_llvm.c @@ -633,7 +633,7 @@ load_tes_input(struct ac_shader_abi *abi, 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, - 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); return result; } @@ -673,7 +673,7 @@ load_gs_input(struct ac_shader_abi *abi, ctx->esgs_ring, 1, ctx->ac.i32_0, vtx_offset, soffset, - 0, ac_glc, true, false); + 0, ctx->ac.f32, ac_glc, true, false); } 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], 1, ctx->ac.i32_0, 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)]); if (ac_get_type_size(type) == 2) { diff --git a/src/gallium/drivers/radeonsi/si_shader_llvm.c b/src/gallium/drivers/radeonsi/si_shader_llvm.c index 6bf934b326e..c558ca3872d 100644 --- a/src/gallium/drivers/radeonsi/si_shader_llvm.c +++ b/src/gallium/drivers/radeonsi/si_shader_llvm.c @@ -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 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) diff --git a/src/gallium/drivers/radeonsi/si_shader_llvm_gs.c b/src/gallium/drivers/radeonsi/si_shader_llvm_gs.c index f1ab3cb90a4..ec64ed70c48 100644 --- a/src/gallium/drivers/radeonsi/si_shader_llvm_gs.c +++ b/src/gallium/drivers/radeonsi/si_shader_llvm_gs.c @@ -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); 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, ""); } @@ -512,7 +512,7 @@ struct si_shader *si_generate_gs_copy_shader(struct si_screen *sscreen, outputs[i].values[chan] = 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); } } diff --git a/src/gallium/drivers/radeonsi/si_shader_llvm_tess.c b/src/gallium/drivers/radeonsi/si_shader_llvm_tess.c index 217b6c81e58..e1a5a2138b9 100644 --- a/src/gallium/drivers/radeonsi/si_shader_llvm_tess.c +++ b/src/gallium/drivers/radeonsi/si_shader_llvm_tess.c @@ -275,13 +275,13 @@ static LLVMValueRef buffer_load(struct si_shader_context *ctx, LLVMTypeRef type, LLVMTypeRef vec_type = LLVMVectorType(type, 4); 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); 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); value = LLVMBuildBitCast(ctx->ac.builder, value, vec_type, "");