LLVMValueRef ac_build_buffer_load(struct ac_llvm_context *ctx, LLVMValueRef rsrc, int num_channels,
LLVMValueRef vindex, LLVMValueRef voffset, LLVMValueRef soffset,
- unsigned inst_offset, LLVMTypeRef channel_type,
- unsigned cache_policy, bool can_speculate, bool allow_smem)
+ LLVMTypeRef channel_type, unsigned cache_policy,
+ bool can_speculate, bool allow_smem)
{
- LLVMValueRef offset = LLVMConstInt(ctx->i32, inst_offset, 0);
- if (voffset)
- offset = LLVMBuildAdd(ctx->builder, offset, voffset, "");
-
if (allow_smem && !(cache_policy & ac_slc) &&
(!(cache_policy & ac_glc) || ctx->chip_class >= GFX8)) {
assert(vindex == NULL);
LLVMValueRef result[8];
+ LLVMValueRef offset = voffset ? voffset : ctx->i32_0;
if (soffset)
offset = LLVMBuildAdd(ctx->builder, offset, soffset, "");
return ac_build_gather_values(ctx, result, num_channels);
}
- return ac_build_buffer_load_common(ctx, rsrc, vindex, offset, soffset, num_channels,
+ return ac_build_buffer_load_common(ctx, rsrc, vindex, voffset, soffset, num_channels,
channel_type, cache_policy, can_speculate, false, false);
}
LLVMValueRef ac_build_buffer_load(struct ac_llvm_context *ctx, LLVMValueRef rsrc, int num_channels,
LLVMValueRef vindex, LLVMValueRef voffset, LLVMValueRef soffset,
- unsigned inst_offset, LLVMTypeRef channel_type,
- unsigned cache_policy, bool can_speculate, bool allow_smem);
+ 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,
int num_channels = util_next_power_of_two(load_bytes) / 4;
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,
ctx->ac.f32, cache_policy, can_speculate, false);
}
num_components = DIV_ROUND_UP(num_components, 4);
ret =
- ac_build_buffer_load(&ctx->ac, rsrc, num_components, NULL, offset, NULL, 0,
+ ac_build_buffer_load(&ctx->ac, rsrc, num_components, NULL, offset, NULL,
ctx->ac.f32, 0, true, true);
/* Convert to the original type. */
else
unreachable("Unsupported channel type for load_buffer_amd");
- result = ac_build_buffer_load(&ctx->ac, descriptor, num_components, NULL,
- addr_voffset, addr_soffset, const_offset,
- channel_type, cache_policy, reorder, false);
+ LLVMValueRef voffset = LLVMBuildAdd(ctx->ac.builder, addr_voffset,
+ LLVMConstInt(ctx->ac.i32, const_offset, 0), "");
+ result = ac_build_buffer_load(&ctx->ac, descriptor, num_components, NULL, voffset,
+ addr_soffset, channel_type, cache_policy, reorder, false);
result = ac_to_integer(&ctx->ac, ac_trim_vector(&ctx->ac, result, num_components));
break;
}
LLVMValueRef ubo_index = ctx->abi->load_ubo(ctx->abi, ctx->ac.i32_0);
LLVMValueRef ret =
- ac_build_buffer_load(&ctx->ac, ubo_index, 1, NULL, offset, NULL, 0, ctx->ac.f32, 0, true, true);
+ ac_build_buffer_load(&ctx->ac, ubo_index, 1, NULL, offset, NULL, ctx->ac.f32, 0, true, true);
return LLVMBuildBitCast(ctx->ac.builder, ret, ctx->ac.i32, "");
}
offset++;
value = ac_build_buffer_load(&ctx->ac, ctx->gsvs_ring[0], 1, ctx->ac.i32_0, vtx_offset,
- soffset, 0, ctx->ac.f32, ac_glc | ac_slc, true, false);
+ soffset, 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) {
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, ctx->ac.f32,
+ return ac_build_buffer_load(&ctx->ac, resource, 1, NULL, offset, NULL, ctx->ac.f32,
0, true, true);
}
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,
ctx->ac.f32, ac_glc, true, false);
return LLVMBuildBitCast(ctx->ac.builder, value, type, "");
}
offset++;
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,
ctx.ac.f32, ac_glc | ac_slc, true, false);
}
}
LLVMTypeRef vec_type = LLVMVectorType(type, 4);
if (swizzle == ~0) {
- value = ac_build_buffer_load(&ctx->ac, buffer, 4, NULL, base, offset, 0, type, ac_glc,
+ value = ac_build_buffer_load(&ctx->ac, buffer, 4, NULL, base, offset, 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, type, ac_glc,
+ value = ac_build_buffer_load(&ctx->ac, buffer, 4, NULL, base, offset, type, ac_glc,
can_speculate, false);
value = LLVMBuildBitCast(ctx->ac.builder, value, vec_type, "");