From 015b0d678f8027008a5ae4cc3bb066a859839c8a 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: --- src/compiler/nir/nir_lower_non_uniform_access.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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);