From a58d79067c92b46d94c723f449c3577a0781c299 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Sat, 11 Apr 2026 17:45:19 +0200 Subject: [PATCH] nak: the MS location comes last in TLD, same spot as depth compare in TEX Some Max Payne 3 shaders are impacted by this and probably will fix some issue there. The VK CTS isn't testing this, but it was verified to fix a real problem by inserting 0 offsets into the instruction and having CTS tests fail with the old ordering. Totals from 3 (0.00% of 1163204) affected shaders: CodeSize: 2496 -> 2736 (+9.62%) Static cycle count: 732 -> 741 (+1.23%) Fixes: ad01fbdda03 ("nak: Add a NIR texture lowering pass") Reviewed-by: Mel Henning (cherry picked from commit e09045e26cde23a3dc37dd5a70855257f066989c) Part-of: --- .pick_status.json | 2 +- src/nouveau/compiler/nak_nir_lower_tex.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 8a167d586ab..d7fef87ebbc 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -5494,7 +5494,7 @@ "description": "nak: the MS location comes last in TLD, same spot as depth compare in TEX", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "ad01fbdda030d2c5d2dd09f02bbaa7ab3613b7ae", "notes": null diff --git a/src/nouveau/compiler/nak_nir_lower_tex.c b/src/nouveau/compiler/nak_nir_lower_tex.c index 298a6ea328b..432ca70866b 100644 --- a/src/nouveau/compiler/nak_nir_lower_tex.c +++ b/src/nouveau/compiler/nak_nir_lower_tex.c @@ -298,8 +298,6 @@ lower_tex(nir_builder *b, nir_tex_instr *tex, const struct nak_compiler *nak) if (tex_h != NULL) PUSH(src1, tex_h); - if (ms_idx != NULL) - PUSH(src1, ms_idx); if (lod != NULL) PUSH(src1, lod); if (offset_mode == NAK_NIR_OFFSET_MODE_AOFFI) { @@ -310,6 +308,8 @@ lower_tex(nir_builder *b, nir_tex_instr *tex, const struct nak_compiler *nak) } if (z_cmpr != NULL) PUSH(src1, z_cmpr); + if (ms_idx != NULL) + PUSH(src1, ms_idx); } nir_tex_instr_add_src(tex, nir_tex_src_backend1,