ac/nir: remove type and num_channels args from ac_build_buffer_store_common
They were only used for type overloading where we can just use the type of data. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5003>
This commit is contained in:
@@ -1183,8 +1183,6 @@ ac_build_buffer_store_common(struct ac_llvm_context *ctx,
|
|||||||
LLVMValueRef vindex,
|
LLVMValueRef vindex,
|
||||||
LLVMValueRef voffset,
|
LLVMValueRef voffset,
|
||||||
LLVMValueRef soffset,
|
LLVMValueRef soffset,
|
||||||
unsigned num_channels,
|
|
||||||
LLVMTypeRef return_channel_type,
|
|
||||||
unsigned cache_policy,
|
unsigned cache_policy,
|
||||||
bool use_format,
|
bool use_format,
|
||||||
bool structurized)
|
bool structurized)
|
||||||
@@ -1198,12 +1196,10 @@ ac_build_buffer_store_common(struct ac_llvm_context *ctx,
|
|||||||
args[idx++] = voffset ? voffset : ctx->i32_0;
|
args[idx++] = voffset ? voffset : ctx->i32_0;
|
||||||
args[idx++] = soffset ? soffset : ctx->i32_0;
|
args[idx++] = soffset ? soffset : ctx->i32_0;
|
||||||
args[idx++] = LLVMConstInt(ctx->i32, cache_policy, 0);
|
args[idx++] = LLVMConstInt(ctx->i32, cache_policy, 0);
|
||||||
unsigned func = !ac_has_vec3_support(ctx->chip_class, use_format) && num_channels == 3 ? 4 : num_channels;
|
|
||||||
const char *indexing_kind = structurized ? "struct" : "raw";
|
const char *indexing_kind = structurized ? "struct" : "raw";
|
||||||
char name[256], type_name[8];
|
char name[256], type_name[8];
|
||||||
|
|
||||||
LLVMTypeRef type = func > 1 ? LLVMVectorType(return_channel_type, func) : return_channel_type;
|
ac_build_type_name_for_intr(LLVMTypeOf(data), type_name, sizeof(type_name));
|
||||||
ac_build_type_name_for_intr(type, type_name, sizeof(type_name));
|
|
||||||
|
|
||||||
if (use_format) {
|
if (use_format) {
|
||||||
snprintf(name, sizeof(name), "llvm.amdgcn.%s.buffer.store.format.%s",
|
snprintf(name, sizeof(name), "llvm.amdgcn.%s.buffer.store.format.%s",
|
||||||
@@ -1223,13 +1219,10 @@ ac_build_buffer_store_format(struct ac_llvm_context *ctx,
|
|||||||
LLVMValueRef data,
|
LLVMValueRef data,
|
||||||
LLVMValueRef vindex,
|
LLVMValueRef vindex,
|
||||||
LLVMValueRef voffset,
|
LLVMValueRef voffset,
|
||||||
unsigned num_channels,
|
|
||||||
unsigned cache_policy)
|
unsigned cache_policy)
|
||||||
{
|
{
|
||||||
ac_build_buffer_store_common(ctx, rsrc, data, vindex,
|
ac_build_buffer_store_common(ctx, rsrc, data, vindex, voffset, NULL,
|
||||||
voffset, NULL, num_channels,
|
cache_policy, true, true);
|
||||||
ctx->f32, cache_policy,
|
|
||||||
true, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TBUFFER_STORE_FORMAT_{X,XY,XYZ,XYZW} <- the suffix is selected by num_channels=1..4.
|
/* TBUFFER_STORE_FORMAT_{X,XY,XYZ,XYZW} <- the suffix is selected by num_channels=1..4.
|
||||||
@@ -1278,7 +1271,6 @@ ac_build_buffer_store_dword(struct ac_llvm_context *ctx,
|
|||||||
|
|
||||||
ac_build_buffer_store_common(ctx, rsrc, ac_to_float(ctx, vdata),
|
ac_build_buffer_store_common(ctx, rsrc, ac_to_float(ctx, vdata),
|
||||||
ctx->i32_0, voffset, offset,
|
ctx->i32_0, voffset, offset,
|
||||||
num_channels, ctx->f32,
|
|
||||||
cache_policy, false, false);
|
cache_policy, false, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1936,8 +1928,7 @@ ac_build_tbuffer_store_short(struct ac_llvm_context *ctx,
|
|||||||
if (LLVM_VERSION_MAJOR >= 9) {
|
if (LLVM_VERSION_MAJOR >= 9) {
|
||||||
/* LLVM 9+ supports i8/i16 with struct/raw intrinsics. */
|
/* LLVM 9+ supports i8/i16 with struct/raw intrinsics. */
|
||||||
ac_build_buffer_store_common(ctx, rsrc, vdata, NULL,
|
ac_build_buffer_store_common(ctx, rsrc, vdata, NULL,
|
||||||
voffset, soffset, 1,
|
voffset, soffset, cache_policy,
|
||||||
ctx->i16, cache_policy,
|
|
||||||
false, false);
|
false, false);
|
||||||
} else {
|
} else {
|
||||||
unsigned dfmt = V_008F0C_BUF_DATA_FORMAT_16;
|
unsigned dfmt = V_008F0C_BUF_DATA_FORMAT_16;
|
||||||
@@ -1963,8 +1954,7 @@ ac_build_tbuffer_store_byte(struct ac_llvm_context *ctx,
|
|||||||
if (LLVM_VERSION_MAJOR >= 9) {
|
if (LLVM_VERSION_MAJOR >= 9) {
|
||||||
/* LLVM 9+ supports i8/i16 with struct/raw intrinsics. */
|
/* LLVM 9+ supports i8/i16 with struct/raw intrinsics. */
|
||||||
ac_build_buffer_store_common(ctx, rsrc, vdata, NULL,
|
ac_build_buffer_store_common(ctx, rsrc, vdata, NULL,
|
||||||
voffset, soffset, 1,
|
voffset, soffset, cache_policy,
|
||||||
ctx->i8, cache_policy,
|
|
||||||
false, false);
|
false, false);
|
||||||
} else {
|
} else {
|
||||||
unsigned dfmt = V_008F0C_BUF_DATA_FORMAT_8;
|
unsigned dfmt = V_008F0C_BUF_DATA_FORMAT_8;
|
||||||
|
@@ -318,7 +318,6 @@ ac_build_buffer_store_format(struct ac_llvm_context *ctx,
|
|||||||
LLVMValueRef data,
|
LLVMValueRef data,
|
||||||
LLVMValueRef vindex,
|
LLVMValueRef vindex,
|
||||||
LLVMValueRef voffset,
|
LLVMValueRef voffset,
|
||||||
unsigned num_channels,
|
|
||||||
unsigned cache_policy);
|
unsigned cache_policy);
|
||||||
|
|
||||||
LLVMValueRef
|
LLVMValueRef
|
||||||
|
@@ -2857,8 +2857,7 @@ static void visit_image_store(struct ac_nir_context *ctx,
|
|||||||
ctx->ac.i32_0, "");
|
ctx->ac.i32_0, "");
|
||||||
|
|
||||||
ac_build_buffer_store_format(&ctx->ac, rsrc, src, vindex,
|
ac_build_buffer_store_format(&ctx->ac, rsrc, src, vindex,
|
||||||
ctx->ac.i32_0, src_channels,
|
ctx->ac.i32_0, args.cache_policy);
|
||||||
args.cache_policy);
|
|
||||||
} else {
|
} else {
|
||||||
bool level_zero = nir_src_is_const(instr->src[4]) && nir_src_as_uint(instr->src[4]) == 0;
|
bool level_zero = nir_src_is_const(instr->src[4]) && nir_src_as_uint(instr->src[4]) == 0;
|
||||||
|
|
||||||
|
@@ -825,7 +825,7 @@ void si_build_prim_discard_compute_shader(struct si_shader_context *ctx)
|
|||||||
if (!ac_has_vec3_support(ctx->ac.chip_class, true))
|
if (!ac_has_vec3_support(ctx->ac.chip_class, true))
|
||||||
vdata = ac_build_expand_to_vec4(&ctx->ac, vdata, 3);
|
vdata = ac_build_expand_to_vec4(&ctx->ac, vdata, 3);
|
||||||
|
|
||||||
ac_build_buffer_store_format(&ctx->ac, output_indexbuf, vdata, vindex, ctx->ac.i32_0, 3,
|
ac_build_buffer_store_format(&ctx->ac, output_indexbuf, vdata, vindex, ctx->ac.i32_0,
|
||||||
ac_glc | (INDEX_STORES_USE_SLC ? ac_slc : 0));
|
ac_glc | (INDEX_STORES_USE_SLC ? ac_slc : 0));
|
||||||
}
|
}
|
||||||
ac_build_endif(&ctx->ac, 16607);
|
ac_build_endif(&ctx->ac, 16607);
|
||||||
|
Reference in New Issue
Block a user