From eb965b58cb96bbf921740e92ff64733dc89db9ac Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Fri, 19 Jan 2024 18:04:41 +0000 Subject: [PATCH] nir/lower_non_uniform: set non_uniform=false when lowering is not needed Fixes RADV compilation of a Doom Eternal pipeline with PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT, because nir_opt_non_uniform_access was skipped and later passes don't expect non-uniform access. Signed-off-by: Rhys Perry Reviewed-by: Faith Ekstrand Reviewed-by: Lionel Landwerlin Fixes: b1619109ca91 ("nir/lower_non_uniform: remove non_uniform flags after lowering") Part-of: (cherry picked from commit 015b0d678f8027008a5ae4cc3bb066a859839c8a) --- .pick_status.json | 2 +- src/compiler/nir/nir_lower_non_uniform_access.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 3fff39eca9a..49877d1969f 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -284,7 +284,7 @@ "description": "nir/lower_non_uniform: set non_uniform=false when lowering is not needed", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "b1619109ca91f5b9b4f29d75479241ec82c31549", "notes": null diff --git a/src/compiler/nir/nir_lower_non_uniform_access.c b/src/compiler/nir/nir_lower_non_uniform_access.c index 41ad860f110..153337eb150 100644 --- a/src/compiler/nir/nir_lower_non_uniform_access.c +++ b/src/compiler/nir/nir_lower_non_uniform_access.c @@ -136,8 +136,12 @@ lower_non_uniform_tex_access(const nir_lower_non_uniform_access_options *options num_handles++; } - if (num_handles == 0) + if (num_handles == 0) { + /* nu_handle_init() returned false because the handles are uniform. */ + tex->texture_non_uniform = false; + tex->sampler_non_uniform = false; return false; + } b->cursor = nir_instr_remove(&tex->instr); @@ -177,8 +181,10 @@ lower_non_uniform_access_intrin(const nir_lower_non_uniform_access_options *opti return false; struct nu_handle handle; - if (!nu_handle_init(&handle, &intrin->src[handle_src])) + if (!nu_handle_init(&handle, &intrin->src[handle_src])) { + nir_intrinsic_set_access(intrin, nir_intrinsic_access(intrin) & ~ACCESS_NON_UNIFORM); return false; + } b->cursor = nir_instr_remove(&intrin->instr);