From 790502962928c35b696f189f60aa8f2870316621 Mon Sep 17 00:00:00 2001 From: Konstantin Seurer Date: Sat, 14 Dec 2024 11:20:44 +0100 Subject: [PATCH] nir: Rename in-bounds-agx to in-bounds This will be used by lavapipe for skipping bounds checking when robustness is disabled. Reviewed-by: Mike Blumenkrantz Part-of: --- src/asahi/compiler/agx_nir_lower_texture.c | 2 +- src/asahi/lib/agx_nir_lower_tilebuffer.c | 2 +- src/asahi/libagx/compression.cl | 4 ++-- src/compiler/nir/nir_print.c | 2 +- src/compiler/shader_enums.h | 6 ++---- src/gallium/drivers/asahi/agx_blit.c | 2 +- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/asahi/compiler/agx_nir_lower_texture.c b/src/asahi/compiler/agx_nir_lower_texture.c index 13852880555..12e84d6f9d0 100644 --- a/src/asahi/compiler/agx_nir_lower_texture.c +++ b/src/asahi/compiler/agx_nir_lower_texture.c @@ -572,7 +572,7 @@ lower_1d_image(nir_builder *b, nir_intrinsic_instr *intr) static bool lower_image_load_robustness(nir_builder *b, nir_intrinsic_instr *intr) { - if (nir_intrinsic_access(intr) & ACCESS_IN_BOUNDS_AGX) + if (nir_intrinsic_access(intr) & ACCESS_IN_BOUNDS) return false; /* We only need to worry about array-like loads */ diff --git a/src/asahi/lib/agx_nir_lower_tilebuffer.c b/src/asahi/lib/agx_nir_lower_tilebuffer.c index 9a6399b00cd..2bfd5a40e9c 100644 --- a/src/asahi/lib/agx_nir_lower_tilebuffer.c +++ b/src/asahi/lib/agx_nir_lower_tilebuffer.c @@ -259,7 +259,7 @@ load_memory(nir_builder *b, unsigned bindless_base, unsigned nr_samples, return nir_bindless_image_load( b, comps, bit_size, image, coords, sample, lod, .image_dim = dim, - .image_array = true, .format = format, .access = ACCESS_IN_BOUNDS_AGX); + .image_array = true, .format = format, .access = ACCESS_IN_BOUNDS); } static nir_def * diff --git a/src/asahi/libagx/compression.cl b/src/asahi/libagx/compression.cl index e5e2fa673d0..809562efbc4 100644 --- a/src/asahi/libagx/compression.cl +++ b/src/asahi/libagx/compression.cl @@ -107,12 +107,12 @@ libagx_decompress(constant struct libagx_decompress_images *images, if (samples == 1) { texels[i] = nir_bindless_image_load( HANDLE(compressed), c_sa, 0, 0, GLSL_SAMPLER_DIM_2D, true, 0, - ACCESS_IN_BOUNDS_AGX, nir_type_uint32); + ACCESS_IN_BOUNDS, nir_type_uint32); } else { int4 dec_px = decompose_px(c_sa, samples); texels[i] = nir_bindless_image_load( HANDLE(compressed), dec_px, sample_id(c_sa, samples), 0, - GLSL_SAMPLER_DIM_MS, true, 0, ACCESS_IN_BOUNDS_AGX, + GLSL_SAMPLER_DIM_MS, true, 0, ACCESS_IN_BOUNDS, nir_type_uint32); } } diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index 36446f654c3..1ae2002ed5d 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -818,7 +818,7 @@ print_access(enum gl_access_qualifier access, print_state *state, const char *se { ACCESS_FMASK_LOWERED_AMD, "fmask-lowered-amd" }, { ACCESS_CAN_SPECULATE, "speculatable" }, { ACCESS_CP_GE_COHERENT_AMD, "cp-ge-coherent-amd" }, - { ACCESS_IN_BOUNDS_AGX, "in-bounds-agx" }, + { ACCESS_IN_BOUNDS, "in-bounds" }, { ACCESS_KEEP_SCALAR, "keep-scalar" }, { ACCESS_SMEM_AMD, "smem-amd" }, }; diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h index c1406be63d6..2af078de2f5 100644 --- a/src/compiler/shader_enums.h +++ b/src/compiler/shader_enums.h @@ -1142,10 +1142,8 @@ enum gl_access_qualifier */ ACCESS_CP_GE_COHERENT_AMD = (1 << 13), - /* Guarantee that an image_load is in bounds so we can skip robustness code - * on AGX, used for some internal shaders. - */ - ACCESS_IN_BOUNDS_AGX = (1 << 14), + /* Guarantee that an image_load is in bounds so we can skip robustness code. */ + ACCESS_IN_BOUNDS = (1 << 14), /** * Disallow vectorization. diff --git a/src/gallium/drivers/asahi/agx_blit.c b/src/gallium/drivers/asahi/agx_blit.c index 2f1b12912ac..493e9b05112 100644 --- a/src/gallium/drivers/asahi/agx_blit.c +++ b/src/gallium/drivers/asahi/agx_blit.c @@ -145,7 +145,7 @@ asahi_blit_compute_shader(struct pipe_context *ctx, struct asahi_blit_key *key) colour1 = nir_image_load( b, 4, 32, nir_imm_int(b, 0), nir_pad_vec4(b, image_pos_nd), zero, zero, .image_array = key->array, .image_dim = GLSL_SAMPLER_DIM_2D, - .access = ACCESS_IN_BOUNDS_AGX, .dest_type = nir_type_uint32); + .access = ACCESS_IN_BOUNDS, .dest_type = nir_type_uint32); } nir_pop_if(b, NULL); nir_def *color = nir_if_phi(b, colour0, colour1);