ac: add per output is_16bit flag to ac_shader_abi
Outputs are always f32 except for FS that may use unpacked f16. Store this information here to make it available to later processing. Reviewed-by: Mihai Preda <mhpreda@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17361>
This commit is contained in:

committed by
Marge Bot

parent
c275e69cee
commit
196c4ebe1a
@@ -5377,8 +5377,9 @@ void ac_handle_shader_output_decl(struct ac_llvm_context *ctx, struct ac_shader_
|
||||
LLVMTypeRef type = is_16bit ? ctx->f16 : ctx->f32;
|
||||
for (unsigned i = 0; i < attrib_count; ++i) {
|
||||
for (unsigned chan = 0; chan < 4; chan++) {
|
||||
abi->outputs[ac_llvm_reg_index_soa(output_loc + i, chan)] =
|
||||
ac_build_alloca_undef(ctx, type, "");
|
||||
int idx = ac_llvm_reg_index_soa(output_loc + i, chan);
|
||||
abi->outputs[idx] = ac_build_alloca_undef(ctx, type, "");
|
||||
abi->is_16bit[idx] = is_16bit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -38,7 +38,9 @@
|
||||
* radv to share a compiler backend.
|
||||
*/
|
||||
struct ac_shader_abi {
|
||||
/* Each entry is a pointer to a f32 or a f16 value (only possible for FS) */
|
||||
LLVMValueRef outputs[AC_LLVM_MAX_OUTPUTS * 4];
|
||||
bool is_16bit[AC_LLVM_MAX_OUTPUTS * 4];
|
||||
|
||||
/* These input registers sometimes need to be fixed up. */
|
||||
LLVMValueRef vertex_id;
|
||||
|
@@ -1062,8 +1062,10 @@ bool si_llvm_translate_nir(struct si_shader_context *ctx, struct si_shader *shad
|
||||
nir_alu_type_get_type_size(ctx->shader->selector->info.output_type[i]) == 16)
|
||||
type = ctx->ac.f16;
|
||||
|
||||
for (unsigned j = 0; j < 4; j++)
|
||||
for (unsigned j = 0; j < 4; j++) {
|
||||
ctx->abi.outputs[i * 4 + j] = ac_build_alloca_undef(&ctx->ac, type, "");
|
||||
ctx->abi.is_16bit[i * 4 + j] = type == ctx->ac.f16;
|
||||
}
|
||||
}
|
||||
|
||||
ac_nir_translate(&ctx->ac, &ctx->abi, &ctx->args, nir);
|
||||
|
Reference in New Issue
Block a user