From 63968a36f86b972f87a22200fde191f85e337ffc Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Fri, 28 Jul 2023 18:42:03 +0200 Subject: [PATCH] nv50/ir/nir: Fix zero source handling of tex instructions. For TXQ we know make sure that we at least add one source. If the nir instruction however didn't had any sources, we inserted a fake 0 source ending up with two 0s for TXQ. It's unclear to me if we have other ops where this would be necessary. Fixes: 85a31fa1fc9 ("nv50/ir/nir: fix txq emission on MS textures") Signed-off-by: Karol Herbst Acked-by: M Henning Part-of: (cherry picked from commit 8d7f682bdbaee2cd7185203770bfc3f0e07ee427) --- .pick_status.json | 2 +- src/nouveau/codegen/nv50_ir_from_nir.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 0ee03461c94..45d89f8f6cd 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -22284,7 +22284,7 @@ "description": "nv50/ir/nir: Fix zero source handling of tex instructions.", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "85a31fa1fc906d500e10a7fa5c9973aa17e7f1d6", "notes": null diff --git a/src/nouveau/codegen/nv50_ir_from_nir.cpp b/src/nouveau/codegen/nv50_ir_from_nir.cpp index b1aa76add75..030efafae37 100644 --- a/src/nouveau/codegen/nv50_ir_from_nir.cpp +++ b/src/nouveau/codegen/nv50_ir_from_nir.cpp @@ -2964,10 +2964,6 @@ Converter::visit(nir_tex_instr *insn) srcs.push_back(getSSA()); } - if (insn->op == nir_texop_texture_samples) - srcs.push_back(zero); - else if (!insn->num_srcs) - srcs.push_back(loadImm(NULL, 0)); if (biasIdx != -1) srcs.push_back(getSrc(&insn->src[biasIdx].src, 0)); // TXQ requires a lod argument for all queries we care about here. @@ -3016,6 +3012,10 @@ Converter::visit(nir_tex_instr *insn) if (target.isMS() || (op == OP_TEX && prog->getType() != Program::TYPE_FRAGMENT)) lz = true; + // TODO figure out which instructions still need this. + if (srcs.empty()) + srcs.push_back(loadImm(NULL, 0)); + TexInstruction *texi = mkTex(op, target.getEnum(), r, s, defs, srcs); texi->tex.levelZero = lz; texi->tex.mask = mask;