mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 02:50:16 +01:00
ac/llvm: Remove "structurized" argument and instead check vindex.
Change ac_build_buffer_load_common and ac_build_tbuffer_load so the use structurized load when the vindex argument is not NULL. Adjust callers to match the new behaviour. This fixes the load_buffer_amd intrinsic with index source. Signed-off-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Qiang Yu <yuq825@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Acked-by: Konstantin Seurer <konstantin.seurer@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21358>
This commit is contained in:
parent
881c52ba19
commit
b5b0ded4c1
1 changed files with 16 additions and 17 deletions
|
|
@ -1297,20 +1297,19 @@ static LLVMValueRef ac_build_buffer_load_common(struct ac_llvm_context *ctx, LLV
|
|||
LLVMValueRef vindex, LLVMValueRef voffset,
|
||||
LLVMValueRef soffset, unsigned num_channels,
|
||||
LLVMTypeRef channel_type, unsigned cache_policy,
|
||||
bool can_speculate, bool use_format,
|
||||
bool structurized)
|
||||
bool can_speculate, bool use_format)
|
||||
{
|
||||
LLVMValueRef args[5];
|
||||
int idx = 0;
|
||||
args[idx++] = LLVMBuildBitCast(ctx->builder, rsrc, ctx->v4i32, "");
|
||||
if (structurized)
|
||||
args[idx++] = vindex ? vindex : ctx->i32_0;
|
||||
if (vindex)
|
||||
args[idx++] = vindex;
|
||||
args[idx++] = voffset ? voffset : ctx->i32_0;
|
||||
args[idx++] = soffset ? soffset : ctx->i32_0;
|
||||
args[idx++] = LLVMConstInt(ctx->i32, get_load_cache_policy(ctx, cache_policy), 0);
|
||||
unsigned func =
|
||||
!ac_has_vec3_support(ctx->gfx_level, use_format) && num_channels == 3 ? 4 : num_channels;
|
||||
const char *indexing_kind = structurized ? "struct" : "raw";
|
||||
const char *indexing_kind = vindex ? "struct" : "raw";
|
||||
char name[256], type_name[8];
|
||||
|
||||
/* D16 is only supported on gfx8+ */
|
||||
|
|
@ -1367,7 +1366,7 @@ LLVMValueRef ac_build_buffer_load(struct ac_llvm_context *ctx, LLVMValueRef rsrc
|
|||
}
|
||||
|
||||
return ac_build_buffer_load_common(ctx, rsrc, vindex, voffset, soffset, num_channels,
|
||||
channel_type, cache_policy, can_speculate, false, false);
|
||||
channel_type, cache_policy, can_speculate, false);
|
||||
}
|
||||
|
||||
LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx, LLVMValueRef rsrc,
|
||||
|
|
@ -1411,29 +1410,29 @@ LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx, LLVMValueR
|
|||
ac_llvm_extract_elem(ctx, res, 4));
|
||||
}
|
||||
|
||||
return ac_build_buffer_load_common(ctx, rsrc, vindex, voffset, ctx->i32_0, num_channels,
|
||||
d16 ? ctx->f16 : ctx->f32, cache_policy, can_speculate, true,
|
||||
true);
|
||||
return ac_build_buffer_load_common(ctx, rsrc, vindex, voffset, ctx->i32_0,
|
||||
num_channels, d16 ? ctx->f16 : ctx->f32, cache_policy,
|
||||
can_speculate, true);
|
||||
}
|
||||
|
||||
static LLVMValueRef ac_build_tbuffer_load(struct ac_llvm_context *ctx, LLVMValueRef rsrc,
|
||||
LLVMValueRef vindex, LLVMValueRef voffset,
|
||||
LLVMValueRef soffset, unsigned num_channels,
|
||||
unsigned dfmt, unsigned nfmt, unsigned cache_policy,
|
||||
bool can_speculate, bool structurized)
|
||||
bool can_speculate)
|
||||
{
|
||||
LLVMValueRef args[6];
|
||||
int idx = 0;
|
||||
args[idx++] = LLVMBuildBitCast(ctx->builder, rsrc, ctx->v4i32, "");
|
||||
if (structurized)
|
||||
args[idx++] = vindex ? vindex : ctx->i32_0;
|
||||
if (vindex)
|
||||
args[idx++] = vindex;
|
||||
args[idx++] = voffset ? voffset : ctx->i32_0;
|
||||
args[idx++] = soffset ? soffset : ctx->i32_0;
|
||||
args[idx++] = LLVMConstInt(ctx->i32, ac_get_tbuffer_format(ctx->gfx_level, dfmt, nfmt), 0);
|
||||
args[idx++] = LLVMConstInt(ctx->i32, get_load_cache_policy(ctx, cache_policy), 0);
|
||||
unsigned func =
|
||||
!ac_has_vec3_support(ctx->gfx_level, true) && num_channels == 3 ? 4 : num_channels;
|
||||
const char *indexing_kind = structurized ? "struct" : "raw";
|
||||
const char *indexing_kind = vindex ? "struct" : "raw";
|
||||
char name[256], type_name[8];
|
||||
|
||||
LLVMTypeRef type = func > 1 ? LLVMVectorType(ctx->i32, func) : ctx->i32;
|
||||
|
|
@ -1452,7 +1451,7 @@ LLVMValueRef ac_build_struct_tbuffer_load(struct ac_llvm_context *ctx, LLVMValue
|
|||
bool can_speculate)
|
||||
{
|
||||
return ac_build_tbuffer_load(ctx, rsrc, vindex, voffset, soffset, num_channels, dfmt,
|
||||
nfmt, cache_policy, can_speculate, true);
|
||||
nfmt, cache_policy, can_speculate);
|
||||
}
|
||||
|
||||
LLVMValueRef ac_build_buffer_load_short(struct ac_llvm_context *ctx, LLVMValueRef rsrc,
|
||||
|
|
@ -1460,7 +1459,7 @@ LLVMValueRef ac_build_buffer_load_short(struct ac_llvm_context *ctx, LLVMValueRe
|
|||
unsigned cache_policy)
|
||||
{
|
||||
return ac_build_buffer_load_common(ctx, rsrc, NULL, voffset, soffset, 1, ctx->i16,
|
||||
cache_policy, false, false, false);
|
||||
cache_policy, false, false);
|
||||
}
|
||||
|
||||
LLVMValueRef ac_build_buffer_load_byte(struct ac_llvm_context *ctx, LLVMValueRef rsrc,
|
||||
|
|
@ -1468,7 +1467,7 @@ LLVMValueRef ac_build_buffer_load_byte(struct ac_llvm_context *ctx, LLVMValueRef
|
|||
unsigned cache_policy)
|
||||
{
|
||||
return ac_build_buffer_load_common(ctx, rsrc, NULL, voffset, soffset, 1, ctx->i8, cache_policy,
|
||||
false, false, false);
|
||||
false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1594,7 +1593,7 @@ LLVMValueRef ac_build_opencoded_load_format(struct ac_llvm_context *ctx, unsigne
|
|||
unsigned num_channels = 1 << (MAX2(load_log_size, 2) - 2);
|
||||
loads[i] =
|
||||
ac_build_buffer_load_common(ctx, rsrc, vindex, voffset, tmp, num_channels, channel_type,
|
||||
cache_policy, can_speculate, false, true);
|
||||
cache_policy, can_speculate, false);
|
||||
if (load_log_size >= 2)
|
||||
loads[i] = ac_to_integer(ctx, loads[i]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue