From 0acf46b973ddbe64f282df72eaad85e31660abaa Mon Sep 17 00:00:00 2001 From: Zan Dobersek Date: Fri, 14 Mar 2025 11:26:06 +0100 Subject: [PATCH] ir3: fix parsing of texture prefetch headers Adjust ir3 parsing rules for texture prefetches to the current state. Those rules expect the write mask to always be present, so the disassembly production code is adjusted accordingly. Signed-off-by: Zan Dobersek Reviewed-by: Danylo Piliaiev Reviewed-by: Job Noorman Part-of: --- src/freedreno/ir3/ir3_parser.y | 8 ++++++-- src/freedreno/ir3/ir3_shader.c | 4 +--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/freedreno/ir3/ir3_parser.y b/src/freedreno/ir3/ir3_parser.y index 1d994142572..611627c9f06 100644 --- a/src/freedreno/ir3/ir3_parser.y +++ b/src/freedreno/ir3/ir3_parser.y @@ -893,12 +893,16 @@ in_header: T_A_IN '(' T_REGISTER ')' T_IDENTIFIER '(' T_IDENTIFIER '=' i out_header: T_A_OUT '(' T_REGISTER ')' T_IDENTIFIER '(' T_IDENTIFIER '=' integer ')' { } +/* The only used OPC for texture prefetches seems to be SAM */ +tex_header_opc: T_OP_SAM + tex_header: T_A_TEX '(' T_REGISTER ')' T_IDENTIFIER '=' integer ',' /* src */ + T_IDENTIFIER '=' integer ',' /* bindless */ T_IDENTIFIER '=' integer ',' /* samp */ - T_IDENTIFIER '=' integer ',' /* tex */ + T_MOD_TEX '=' integer ',' /* tex */ T_IDENTIFIER '=' integer ',' /* wrmask */ - T_IDENTIFIER '=' integer /* cmd */ { } + T_IDENTIFIER '=' tex_header_opc /* cmd */ { } fullnop_start_section: T_A_FULLNOPSTART { is_in_fullnop_section = true; } fullnop_end_section: T_A_FULLNOPEND { is_in_fullnop_section = false; } diff --git a/src/freedreno/ir3/ir3_shader.c b/src/freedreno/ir3/ir3_shader.c index 28c4eadeb1d..56d824afd99 100644 --- a/src/freedreno/ir3/ir3_shader.c +++ b/src/freedreno/ir3/ir3_shader.c @@ -921,9 +921,7 @@ ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin, FILE *out) fprintf(out, "@in(%sr%d.%c)\tin%d", (reg->flags & IR3_REG_HALF) ? "h" : "", (regid >> 2), "xyzw"[regid & 0x3], i); - - if (reg->wrmask > 0x1) - fprintf(out, " (wrmask=0x%x)", reg->wrmask); + fprintf(out, " (wrmask=0x%x)", reg->wrmask); fprintf(out, "\n"); }