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:
Pierre-Eric Pelloux-Prayer
2022-07-05 12:26:00 +02:00
committed by Marge Bot
parent c275e69cee
commit 196c4ebe1a
3 changed files with 8 additions and 3 deletions
+3 -2
View File
@@ -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;
}
}
}
+2
View File
@@ -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;