From df7c4454a980044f5fc05f75a7e663e0c4d8fecf Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Sun, 2 May 2021 14:41:21 +0200 Subject: [PATCH] compiler/nir: check whether var is an input in lower_fragcoord_wtrans Otherwise the lowering pass might try to lower any other load from a deref if its data.location value happens to be zero. Fixes: 418c4c0d7d48a42f475df1ffb93b3a33763e7a4a compiler/nir: extend lower_fragcoord_wtrans to support VARYING_SLOT_POS Signed-off-by: Gert Wollny Part-of: (cherry picked from commit e418710f8bd2bc95a863d0a04154d7da37ead7ac) --- .pick_status.json | 2 +- src/compiler/nir/nir_lower_fragcoord_wtrans.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 46b20d2581c..43160f2c397 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -148,7 +148,7 @@ "description": "compiler/nir: check whether var is an input in lower_fragcoord_wtrans", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "418c4c0d7d48a42f475df1ffb93b3a33763e7a4a" }, diff --git a/src/compiler/nir/nir_lower_fragcoord_wtrans.c b/src/compiler/nir/nir_lower_fragcoord_wtrans.c index ed630bb7c21..25f93b4d10c 100644 --- a/src/compiler/nir/nir_lower_fragcoord_wtrans.c +++ b/src/compiler/nir/nir_lower_fragcoord_wtrans.c @@ -46,6 +46,9 @@ lower_fragcoord_wtrans_filter(const nir_instr *instr, UNUSED const void *_option return false; nir_variable *var = nir_intrinsic_get_var(intr, 0); + if (var->data.mode != nir_var_shader_in) + return false; + return var->data.location == VARYING_SLOT_POS; }