Module: Mesa
Branch: main
Commit: c161337029f648cf2c0cc9d809cb984b66c2a167
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c161337029f648cf2c0cc9d809cb984b66c2a167

Author: Samuel Pitoiset <[email protected]>
Date:   Wed Aug 23 18:10:25 2023 +0200

ac: allow to mark shader arguments as preserved

These arguments would be used by ACO to generate a function signature
for merged shaders automatically.

Signed-off-by: Samuel Pitoiset <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24697>

---

 src/amd/common/ac_shader_args.c | 5 +++++
 src/amd/common/ac_shader_args.h | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/src/amd/common/ac_shader_args.c b/src/amd/common/ac_shader_args.c
index d90f14e2177..9c86b80cfa8 100644
--- a/src/amd/common/ac_shader_args.c
+++ b/src/amd/common/ac_shader_args.c
@@ -52,6 +52,11 @@ void ac_add_return(struct ac_shader_args *info, enum 
ac_arg_regfile regfile)
    info->return_count++;
 }
 
+void ac_add_preserved(struct ac_shader_args *info, const struct ac_arg *arg)
+{
+   info->args[arg->arg_index].preserved = true;
+}
+
 void ac_compact_ps_vgpr_args(struct ac_shader_args *info, uint32_t 
spi_ps_input)
 {
    /* LLVM optimizes away unused FS inputs and computes spi_ps_input_addr 
itself and then
diff --git a/src/amd/common/ac_shader_args.h b/src/amd/common/ac_shader_args.h
index 5882e8506b0..3c4ae916dfc 100644
--- a/src/amd/common/ac_shader_args.h
+++ b/src/amd/common/ac_shader_args.h
@@ -49,6 +49,7 @@ struct ac_shader_args {
       uint8_t size;
       bool skip : 1;
       bool pending_vmem : 1; /* Loaded from VMEM and needs waitcnt before use. 
*/
+      bool preserved : 1;
    } args[AC_MAX_ARGS];
 
    uint16_t arg_count;
@@ -189,6 +190,7 @@ struct ac_shader_args {
 void ac_add_arg(struct ac_shader_args *info, enum ac_arg_regfile regfile, 
unsigned registers,
                 enum ac_arg_type type, struct ac_arg *arg);
 void ac_add_return(struct ac_shader_args *info, enum ac_arg_regfile regfile);
+void ac_add_preserved(struct ac_shader_args *info, const struct ac_arg *arg);
 void ac_compact_ps_vgpr_args(struct ac_shader_args *info, uint32_t 
spi_ps_input);
 
 #endif

Reply via email to