From 2d286ec80a73d4a2f889b594d73db460f05f1fcd Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Mon, 1 Dec 2025 11:35:13 -0500 Subject: [PATCH] pan/compiler: Move all NIR passe definitions to pan_nir.h While we're at it, rename pan_lower_* to pan_nir_lower_* for consistency with everything else. The intention is that eventually this will be a private header and drivers will stop calling these passes themselves. However, that is a long way off so for now we'll just move them to the sensibly named place. Notably, pan_preprocess/optimize/postprocess_nir stay in pan_compiler.h because those are intended to be external APIs indefinitely. Acked-by: Erik Faye-Lund Acked-by: Boris Brezillon Part-of: --- src/gallium/drivers/panfrost/pan_blend_cso.c | 4 +- src/gallium/drivers/panfrost/pan_fb_preload.c | 1 + src/gallium/drivers/panfrost/pan_shader.c | 7 +- src/panfrost/clc/pan_compile.c | 1 + .../compiler/bifrost/bifrost_compile.c | 6 +- .../compiler/midgard/midgard_compile.c | 6 +- src/panfrost/compiler/pan_compiler.c | 1 + src/panfrost/compiler/pan_compiler.h | 4 +- src/panfrost/compiler/pan_ir.h | 30 ------- src/panfrost/compiler/pan_nir.h | 78 +++++++++++++++++++ .../compiler/pan_nir_collect_varyings.c | 2 +- .../compiler/pan_nir_lower_frag_coord_zw.c | 2 +- .../compiler/pan_nir_lower_framebuffer.c | 10 ++- .../compiler/pan_nir_lower_framebuffer.h | 41 ---------- .../pan_nir_lower_helper_invocation.c | 4 +- .../compiler/pan_nir_lower_image_index.c | 4 +- .../compiler/pan_nir_lower_image_ms.c | 2 +- .../compiler/pan_nir_lower_noperspective.c | 2 +- .../compiler/pan_nir_lower_sample_position.c | 4 +- .../compiler/pan_nir_lower_store_component.c | 2 +- .../compiler/pan_nir_lower_vertex_id.c | 2 +- .../compiler/pan_nir_lower_writeout.c | 2 +- src/panfrost/compiler/pan_nir_lower_xfb.c | 4 +- src/panfrost/lib/pan_blend.c | 2 +- src/panfrost/lib/pan_shader.h | 1 - src/panfrost/vulkan/panvk_vX_cmd_fb_preload.c | 1 + src/panfrost/vulkan/panvk_vX_shader.c | 7 +- 27 files changed, 123 insertions(+), 107 deletions(-) create mode 100644 src/panfrost/compiler/pan_nir.h delete mode 100644 src/panfrost/compiler/pan_nir_lower_framebuffer.h diff --git a/src/gallium/drivers/panfrost/pan_blend_cso.c b/src/gallium/drivers/panfrost/pan_blend_cso.c index 9a20bbb9673..2b6e404541a 100644 --- a/src/gallium/drivers/panfrost/pan_blend_cso.c +++ b/src/gallium/drivers/panfrost/pan_blend_cso.c @@ -10,7 +10,7 @@ #include "compiler/nir/nir_builder.h" #include "pan_shader.h" #include "panfrost/compiler/pan_compiler.h" -#include "panfrost/compiler/pan_nir_lower_framebuffer.h" +#include "panfrost/compiler/pan_nir.h" #include "pan_context.h" #ifndef PAN_ARCH @@ -119,7 +119,7 @@ GENX(pan_blend_get_shader_locked)(struct pan_blend_shader_cache *cache, #if PAN_ARCH >= 6 NIR_PASS(_, nir, GENX(pan_inline_rt_conversion), rt_formats); #else - NIR_PASS(_, nir, pan_lower_framebuffer, rt_formats, + NIR_PASS(_, nir, pan_nir_lower_framebuffer, rt_formats, pan_raw_format_mask_midgard(rt_formats), MAX2(key.nr_samples, 1), (cache->gpu_id >> 16) < 0x700); #endif diff --git a/src/gallium/drivers/panfrost/pan_fb_preload.c b/src/gallium/drivers/panfrost/pan_fb_preload.c index 19e6c5ad7a5..d345317802e 100644 --- a/src/gallium/drivers/panfrost/pan_fb_preload.c +++ b/src/gallium/drivers/panfrost/pan_fb_preload.c @@ -39,6 +39,7 @@ #include "pan_shader.h" #include "pan_texture.h" #include "compiler/pan_compiler.h" +#include "compiler/pan_nir.h" #if PAN_ARCH >= 6 /* On Midgard, the native preload infrastructure (via MFBD preloads) is broken diff --git a/src/gallium/drivers/panfrost/pan_shader.c b/src/gallium/drivers/panfrost/pan_shader.c index a4d610e952a..8e829c3e099 100644 --- a/src/gallium/drivers/panfrost/pan_shader.c +++ b/src/gallium/drivers/panfrost/pan_shader.c @@ -39,6 +39,7 @@ #include "pan_bo.h" #include "pan_context.h" #include "pan_compiler.h" +#include "pan_nir.h" #include "shader_enums.h" static struct panfrost_uncompiled_shader * @@ -162,7 +163,7 @@ panfrost_shader_compile(struct panfrost_screen *screen, const nir_shader *ir, if (s->info.has_transform_feedback_varyings) { NIR_PASS(_, s, nir_opt_constant_folding); NIR_PASS(_, s, nir_io_add_intrinsic_xfb_info); - NIR_PASS(_, s, pan_lower_xfb); + NIR_PASS(_, s, pan_nir_lower_xfb); } } @@ -200,7 +201,7 @@ panfrost_shader_compile(struct panfrost_screen *screen, const nir_shader *ir, } if (dev->arch <= 5 && s->info.stage == MESA_SHADER_FRAGMENT) { - NIR_PASS(_, s, pan_lower_framebuffer, key->fs.rt_formats, + NIR_PASS(_, s, pan_nir_lower_framebuffer, key->fs.rt_formats, pan_raw_format_mask_midgard(key->fs.rt_formats), 0, panfrost_device_gpu_prod_id(dev) < 0x700); } @@ -567,7 +568,7 @@ panfrost_create_shader_state(struct pipe_context *pctx, * to the right attribute. */ if (nir->info.stage == MESA_SHADER_VERTEX && dev->arch <= 7) { - NIR_PASS(_, nir, pan_lower_image_index, + NIR_PASS(_, nir, pan_nir_lower_image_index, util_bitcount64(nir->info.inputs_read)); } diff --git a/src/panfrost/clc/pan_compile.c b/src/panfrost/clc/pan_compile.c index c7cc9e1c772..5feed5103dd 100644 --- a/src/panfrost/clc/pan_compile.c +++ b/src/panfrost/clc/pan_compile.c @@ -10,6 +10,7 @@ #include "compiler/spirv/nir_spirv.h" #include "panfrost/compiler/bifrost/bifrost_compile.h" #include "panfrost/compiler/pan_compiler.h" +#include "panfrost/compiler/pan_nir.h" #include "nir.h" #include "nir_builder.h" #include "nir_builder_opcodes.h" diff --git a/src/panfrost/compiler/bifrost/bifrost_compile.c b/src/panfrost/compiler/bifrost/bifrost_compile.c index d0db87ca609..070d914cde7 100644 --- a/src/panfrost/compiler/bifrost/bifrost_compile.c +++ b/src/panfrost/compiler/bifrost/bifrost_compile.c @@ -30,7 +30,9 @@ #include "compiler/glsl_types.h" #include "compiler/nir/nir_builder.h" #include "compiler/nir/nir_deref.h" +#include "panfrost/compiler/pan_compiler.h" #include "panfrost/compiler/pan_ir.h" +#include "panfrost/compiler/pan_nir.h" #include "util/perf/cpu_trace.h" #include "util/u_debug.h" #include "util/u_qsort.h" @@ -6372,8 +6374,8 @@ void bifrost_lower_texture_nir(nir_shader *nir, unsigned gpu_id) if (nir->info.stage == MESA_SHADER_FRAGMENT) { NIR_PASS(_, nir, nir_lower_is_helper_invocation); - NIR_PASS(_, nir, pan_lower_helper_invocation); - NIR_PASS(_, nir, pan_lower_sample_pos); + NIR_PASS(_, nir, pan_nir_lower_helper_invocation); + NIR_PASS(_, nir, pan_nir_lower_sample_pos); } } diff --git a/src/panfrost/compiler/midgard/midgard_compile.c b/src/panfrost/compiler/midgard/midgard_compile.c index a3306e47391..62658f5b5ce 100644 --- a/src/panfrost/compiler/midgard/midgard_compile.c +++ b/src/panfrost/compiler/midgard/midgard_compile.c @@ -49,6 +49,8 @@ #include "midgard_ops.h" #include "midgard_quirks.h" +#include "panfrost/compiler/pan_nir.h" + #include "disassemble.h" #include "shader_enums.h" @@ -459,8 +461,8 @@ void midgard_lower_texture_nir(nir_shader *nir, unsigned gpu_id) if (nir->info.stage == MESA_SHADER_FRAGMENT) { NIR_PASS(_, nir, nir_lower_helper_writes, true); NIR_PASS(_, nir, nir_lower_is_helper_invocation); - NIR_PASS(_, nir, pan_lower_helper_invocation); - NIR_PASS(_, nir, pan_lower_sample_pos); + NIR_PASS(_, nir, pan_nir_lower_helper_invocation); + NIR_PASS(_, nir, pan_nir_lower_sample_pos); } } diff --git a/src/panfrost/compiler/pan_compiler.c b/src/panfrost/compiler/pan_compiler.c index 85e2b132d36..0a1741a477e 100644 --- a/src/panfrost/compiler/pan_compiler.c +++ b/src/panfrost/compiler/pan_compiler.c @@ -23,6 +23,7 @@ */ #include "pan_compiler.h" +#include "pan_nir.h" #include "bifrost/bifrost_compile.h" #include "bifrost/bifrost/disassemble.h" diff --git a/src/panfrost/compiler/pan_compiler.h b/src/panfrost/compiler/pan_compiler.h index 76c82d628b7..71227cd4de6 100644 --- a/src/panfrost/compiler/pan_compiler.h +++ b/src/panfrost/compiler/pan_compiler.h @@ -30,6 +30,7 @@ typedef struct nir_shader nir_shader; struct nir_shader_compiler_options; +struct pan_shader_info; const struct nir_shader_compiler_options * pan_get_nir_shader_compiler_options(unsigned arch); @@ -38,9 +39,6 @@ void pan_preprocess_nir(nir_shader *nir, unsigned gpu_id); void pan_optimize_nir(nir_shader *nir, unsigned gpu_id); void pan_postprocess_nir(nir_shader *nir, unsigned gpu_id); -void pan_nir_lower_texture_early(nir_shader *nir, unsigned gpu_id); -void pan_nir_lower_texture_late(nir_shader *nir, unsigned gpu_id); - void pan_disassemble(FILE *fp, const void *code, size_t size, unsigned gpu_id, bool verbose); diff --git a/src/panfrost/compiler/pan_ir.h b/src/panfrost/compiler/pan_ir.h index 5c4e167dc24..05c0b40d51d 100644 --- a/src/panfrost/compiler/pan_ir.h +++ b/src/panfrost/compiler/pan_ir.h @@ -356,36 +356,6 @@ uint16_t pan_to_bytemask(unsigned bytes, unsigned mask); #define PAN_WRITEOUT_S 4 #define PAN_WRITEOUT_2 8 -/* Specify the mediump lowering behavior for pan_nir_collect_varyings */ -enum pan_mediump_vary { - /* Always assign a 32-bit format to mediump varyings */ - PAN_MEDIUMP_VARY_32BIT, - /* Assign a 16-bit format to varyings with smooth interpolation, and a - * 32-bit format to varyings with flat interpolation */ - PAN_MEDIUMP_VARY_SMOOTH_16BIT, -}; - -bool pan_nir_lower_zs_store(nir_shader *nir); -bool pan_nir_lower_store_component(nir_shader *shader); - -bool pan_nir_lower_vertex_id(nir_shader *shader); - -bool pan_nir_lower_image_ms(nir_shader *shader); - -bool pan_nir_lower_frag_coord_zw(nir_shader *shader); -bool pan_nir_lower_noperspective_vs(nir_shader *shader); -bool pan_nir_lower_noperspective_fs(nir_shader *shader); - -bool pan_lower_helper_invocation(nir_shader *shader); -bool pan_lower_sample_pos(nir_shader *shader); -bool pan_lower_xfb(nir_shader *nir); - -bool pan_lower_image_index(nir_shader *shader, unsigned vs_img_attrib_offset); - -uint32_t pan_nir_collect_noperspective_varyings_fs(nir_shader *s); -void pan_nir_collect_varyings(nir_shader *s, struct pan_shader_info *info, - enum pan_mediump_vary mediump); - /* * Helper returning the subgroup size. Generally, this is equal to the number of * threads in a warp. For Midgard (including warping models), this returns 1, as diff --git a/src/panfrost/compiler/pan_nir.h b/src/panfrost/compiler/pan_nir.h new file mode 100644 index 00000000000..e63ebc37fce --- /dev/null +++ b/src/panfrost/compiler/pan_nir.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2025 Collabora, Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef __PAN_NIR_H__ +#define __PAN_NIR_H__ + +#include "nir.h" +#include "pan_compiler.h" +#include "pan_ir.h" + +struct util_format_description; + +bool pan_nir_lower_zs_store(nir_shader *nir); +bool pan_nir_lower_store_component(nir_shader *shader); + +bool pan_nir_lower_vertex_id(nir_shader *shader); + +bool pan_nir_lower_image_ms(nir_shader *shader); + +bool pan_nir_lower_frag_coord_zw(nir_shader *shader); +bool pan_nir_lower_noperspective_vs(nir_shader *shader); +bool pan_nir_lower_noperspective_fs(nir_shader *shader); + +bool pan_nir_lower_helper_invocation(nir_shader *shader); +bool pan_nir_lower_sample_pos(nir_shader *shader); +bool pan_nir_lower_xfb(nir_shader *nir); + +bool pan_nir_lower_image_index(nir_shader *shader, + unsigned vs_img_attrib_offset); + +void pan_nir_lower_texture_early(nir_shader *nir, unsigned gpu_id); +void pan_nir_lower_texture_late(nir_shader *nir, unsigned gpu_id); + +nir_alu_type +pan_unpacked_type_for_format(const struct util_format_description *desc); + +bool pan_nir_lower_framebuffer(nir_shader *shader, + const enum pipe_format *rt_fmts, + uint8_t raw_fmt_mask, + unsigned blend_shader_nr_samples, + bool broken_ld_special); + +uint32_t pan_nir_collect_noperspective_varyings_fs(nir_shader *s); + +/* Specify the mediump lowering behavior for pan_nir_collect_varyings */ +enum pan_mediump_vary { + /* Always assign a 32-bit format to mediump varyings */ + PAN_MEDIUMP_VARY_32BIT, + /* Assign a 16-bit format to varyings with smooth interpolation, and a + * 32-bit format to varyings with flat interpolation */ + PAN_MEDIUMP_VARY_SMOOTH_16BIT, +}; + +void pan_nir_collect_varyings(nir_shader *s, struct pan_shader_info *info, + enum pan_mediump_vary mediump); + +#endif /* __PAN_NIR_H__ */ diff --git a/src/panfrost/compiler/pan_nir_collect_varyings.c b/src/panfrost/compiler/pan_nir_collect_varyings.c index 0c546b0c392..68902bfc7a2 100644 --- a/src/panfrost/compiler/pan_nir_collect_varyings.c +++ b/src/panfrost/compiler/pan_nir_collect_varyings.c @@ -24,7 +24,7 @@ #include "compiler/nir/nir.h" #include "compiler/nir/nir_builder.h" -#include "pan_ir.h" +#include "pan_nir.h" static enum pipe_format varying_format(nir_alu_type t, unsigned ncomps) diff --git a/src/panfrost/compiler/pan_nir_lower_frag_coord_zw.c b/src/panfrost/compiler/pan_nir_lower_frag_coord_zw.c index 7535226feec..a1069a67120 100644 --- a/src/panfrost/compiler/pan_nir_lower_frag_coord_zw.c +++ b/src/panfrost/compiler/pan_nir_lower_frag_coord_zw.c @@ -4,7 +4,7 @@ */ #include "compiler/nir/nir_builder.h" -#include "pan_ir.h" +#include "pan_nir.h" /* Lowers nir_load_frag_coord_zw to nir_load_frag_coord_zw_pan. */ diff --git a/src/panfrost/compiler/pan_nir_lower_framebuffer.c b/src/panfrost/compiler/pan_nir_lower_framebuffer.c index 461bf4a9b5b..0ed32d237a9 100644 --- a/src/panfrost/compiler/pan_nir_lower_framebuffer.c +++ b/src/panfrost/compiler/pan_nir_lower_framebuffer.c @@ -47,7 +47,7 @@ * smallest precision necessary to store the pixel losslessly. */ -#include "pan_nir_lower_framebuffer.h" +#include "pan_nir.h" #include "compiler/nir/nir.h" #include "compiler/nir/nir_builder.h" #include "compiler/nir/nir_format_convert.h" @@ -618,9 +618,11 @@ lower(nir_builder *b, nir_instr *instr, void *data) } bool -pan_lower_framebuffer(nir_shader *shader, const enum pipe_format *rt_fmts, - uint8_t raw_fmt_mask, unsigned blend_shader_nr_samples, - bool broken_ld_special) +pan_nir_lower_framebuffer(nir_shader *shader, + const enum pipe_format *rt_fmts, + uint8_t raw_fmt_mask, + unsigned blend_shader_nr_samples, + bool broken_ld_special) { assert(shader->info.stage == MESA_SHADER_FRAGMENT); diff --git a/src/panfrost/compiler/pan_nir_lower_framebuffer.h b/src/panfrost/compiler/pan_nir_lower_framebuffer.h deleted file mode 100644 index bf6509175bb..00000000000 --- a/src/panfrost/compiler/pan_nir_lower_framebuffer.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2020 Collabora, Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Authors (Collabora): - * Alyssa Rosenzweig - */ - -#ifndef __PAN_LOWER_FRAMEBUFFER_H -#define __PAN_LOWER_FRAMEBUFFER_H - -#include "compiler/nir/nir.h" -#include "util/format/u_format.h" - -nir_alu_type -pan_unpacked_type_for_format(const struct util_format_description *desc); - -bool pan_lower_framebuffer(nir_shader *shader, const enum pipe_format *rt_fmts, - uint8_t raw_fmt_mask, - unsigned blend_shader_nr_samples, - bool broken_ld_special); - -#endif diff --git a/src/panfrost/compiler/pan_nir_lower_helper_invocation.c b/src/panfrost/compiler/pan_nir_lower_helper_invocation.c index 80035788dfb..1b38e27c27e 100644 --- a/src/panfrost/compiler/pan_nir_lower_helper_invocation.c +++ b/src/panfrost/compiler/pan_nir_lower_helper_invocation.c @@ -22,7 +22,7 @@ */ #include "compiler/nir/nir_builder.h" -#include "pan_ir.h" +#include "pan_nir.h" /* Lower gl_HelperInvocation to (gl_SampleMaskIn == 0), this depends on * architectural details but is more efficient than NIR's lowering. @@ -42,7 +42,7 @@ pan_lower_helper_invocation_instr(nir_builder *b, nir_intrinsic_instr *intr, } bool -pan_lower_helper_invocation(nir_shader *shader) +pan_nir_lower_helper_invocation(nir_shader *shader) { return nir_shader_intrinsics_pass(shader, pan_lower_helper_invocation_instr, nir_metadata_control_flow, NULL); diff --git a/src/panfrost/compiler/pan_nir_lower_image_index.c b/src/panfrost/compiler/pan_nir_lower_image_index.c index cb98044e11d..c6717b24f5c 100644 --- a/src/panfrost/compiler/pan_nir_lower_image_index.c +++ b/src/panfrost/compiler/pan_nir_lower_image_index.c @@ -4,7 +4,7 @@ */ #include "compiler/nir/nir_builder.h" -#include "pan_ir.h" +#include "pan_nir.h" /* Vertex shader gets passed image attribute descriptors through the * vertex attribute descriptor array. This forces us to apply an offset @@ -44,7 +44,7 @@ lower_image_intr(struct nir_builder *b, nir_intrinsic_instr *intr, void *data) } bool -pan_lower_image_index(nir_shader *shader, unsigned vs_img_attrib_offset) +pan_nir_lower_image_index(nir_shader *shader, unsigned vs_img_attrib_offset) { if (shader->info.stage != MESA_SHADER_VERTEX) return false; diff --git a/src/panfrost/compiler/pan_nir_lower_image_ms.c b/src/panfrost/compiler/pan_nir_lower_image_ms.c index c1585f1ecad..bdd9f0d1a82 100644 --- a/src/panfrost/compiler/pan_nir_lower_image_ms.c +++ b/src/panfrost/compiler/pan_nir_lower_image_ms.c @@ -26,7 +26,7 @@ #include "compiler/nir/nir.h" #include "compiler/nir/nir_builder.h" -#include "pan_ir.h" +#include "pan_nir.h" static bool nir_lower_image_ms(nir_builder *b, nir_intrinsic_instr *intr, diff --git a/src/panfrost/compiler/pan_nir_lower_noperspective.c b/src/panfrost/compiler/pan_nir_lower_noperspective.c index 3c9930d0ebb..f189c51da95 100644 --- a/src/panfrost/compiler/pan_nir_lower_noperspective.c +++ b/src/panfrost/compiler/pan_nir_lower_noperspective.c @@ -4,7 +4,7 @@ */ #include "compiler/nir/nir_builder.h" -#include "pan_ir.h" +#include "pan_nir.h" /* Mali only provides instructions to fetch varyings with either flat or * perspective-correct interpolation. This pass lowers noperspective varyings diff --git a/src/panfrost/compiler/pan_nir_lower_sample_position.c b/src/panfrost/compiler/pan_nir_lower_sample_position.c index 7a9d2c78f73..f429d4f2618 100644 --- a/src/panfrost/compiler/pan_nir_lower_sample_position.c +++ b/src/panfrost/compiler/pan_nir_lower_sample_position.c @@ -22,7 +22,7 @@ */ #include "compiler/nir/nir_builder.h" -#include "pan_ir.h" +#include "pan_nir.h" /* Sample positions are supplied in a packed 8:8 fixed-point vec2 format in GPU * memory indexed by the sample. We lower in NIR to take advantage of possible @@ -85,7 +85,7 @@ pan_lower_sample_pos_impl(struct nir_builder *b, nir_intrinsic_instr *intr, } bool -pan_lower_sample_pos(nir_shader *shader) +pan_nir_lower_sample_pos(nir_shader *shader) { if (shader->info.stage != MESA_SHADER_FRAGMENT) return false; diff --git a/src/panfrost/compiler/pan_nir_lower_store_component.c b/src/panfrost/compiler/pan_nir_lower_store_component.c index c0f19f86f5e..bfd958177f4 100644 --- a/src/panfrost/compiler/pan_nir_lower_store_component.c +++ b/src/panfrost/compiler/pan_nir_lower_store_component.c @@ -25,7 +25,7 @@ */ #include "compiler/nir/nir_builder.h" -#include "pan_ir.h" +#include "pan_nir.h" /* * If the shader packs multiple varyings into the same location with different diff --git a/src/panfrost/compiler/pan_nir_lower_vertex_id.c b/src/panfrost/compiler/pan_nir_lower_vertex_id.c index 80397353467..dd77e7897f3 100644 --- a/src/panfrost/compiler/pan_nir_lower_vertex_id.c +++ b/src/panfrost/compiler/pan_nir_lower_vertex_id.c @@ -4,7 +4,7 @@ */ #include "compiler/nir/nir_builder.h" -#include "pan_ir.h" +#include "pan_nir.h" /* * load_vertex_id_zero_base() is supposed to return the zero-based diff --git a/src/panfrost/compiler/pan_nir_lower_writeout.c b/src/panfrost/compiler/pan_nir_lower_writeout.c index 1c0d623d988..bfe16713bc8 100644 --- a/src/panfrost/compiler/pan_nir_lower_writeout.c +++ b/src/panfrost/compiler/pan_nir_lower_writeout.c @@ -23,7 +23,7 @@ */ #include "compiler/nir/nir_builder.h" -#include "pan_ir.h" +#include "pan_nir.h" /* Midgard can write all of color, depth and stencil in a single writeout * operation, so we merge depth/stencil stores with color stores. diff --git a/src/panfrost/compiler/pan_nir_lower_xfb.c b/src/panfrost/compiler/pan_nir_lower_xfb.c index 8226ada8d8b..39e031221b1 100644 --- a/src/panfrost/compiler/pan_nir_lower_xfb.c +++ b/src/panfrost/compiler/pan_nir_lower_xfb.c @@ -22,7 +22,7 @@ */ #include "compiler/nir/nir_builder.h" -#include "pan_ir.h" +#include "pan_nir.h" static void lower_xfb_output(nir_builder *b, nir_intrinsic_instr *intr, @@ -98,7 +98,7 @@ lower_xfb(nir_builder *b, nir_intrinsic_instr *intr, UNUSED void *data) } bool -pan_lower_xfb(nir_shader *nir) +pan_nir_lower_xfb(nir_shader *nir) { return nir_shader_intrinsics_pass( nir, lower_xfb, nir_metadata_control_flow, NULL); diff --git a/src/panfrost/lib/pan_blend.c b/src/panfrost/lib/pan_blend.c index 20a6a4c4263..25bc3a93814 100644 --- a/src/panfrost/lib/pan_blend.c +++ b/src/panfrost/lib/pan_blend.c @@ -34,7 +34,7 @@ #include "compiler/nir/nir_conversion_builder.h" #include "compiler/nir/nir_lower_blend.h" #include "compiler/pan_compiler.h" -#include "compiler/pan_nir_lower_framebuffer.h" +#include "compiler/pan_nir.h" #include "util/format/u_format.h" #ifndef PAN_ARCH diff --git a/src/panfrost/lib/pan_shader.h b/src/panfrost/lib/pan_shader.h index 6b88f5630aa..c8a286cb389 100644 --- a/src/panfrost/lib/pan_shader.h +++ b/src/panfrost/lib/pan_shader.h @@ -29,7 +29,6 @@ #include "genxml/gen_macros.h" #include "panfrost/lib/pan_props.h" #include "panfrost/compiler/pan_ir.h" -#include "panfrost/compiler/pan_nir_lower_framebuffer.h" static unsigned pan_get_fixed_varying_mask(unsigned varyings_used) diff --git a/src/panfrost/vulkan/panvk_vX_cmd_fb_preload.c b/src/panfrost/vulkan/panvk_vX_cmd_fb_preload.c index cd51d28d4ba..7bc0c625499 100644 --- a/src/panfrost/vulkan/panvk_vX_cmd_fb_preload.c +++ b/src/panfrost/vulkan/panvk_vX_cmd_fb_preload.c @@ -12,6 +12,7 @@ #include "nir_builder.h" #include "pan_shader.h" +#include "pan_nir.h" struct panvk_fb_preload_shader_key { enum panvk_meta_object_key_type type; diff --git a/src/panfrost/vulkan/panvk_vX_shader.c b/src/panfrost/vulkan/panvk_vX_shader.c index 96b9f7e6c97..06cbe942df4 100644 --- a/src/panfrost/vulkan/panvk_vX_shader.c +++ b/src/panfrost/vulkan/panvk_vX_shader.c @@ -56,6 +56,7 @@ #include "compiler/bifrost/bifrost_nir.h" #include "compiler/pan_compiler.h" +#include "compiler/pan_nir.h" #include "pan_shader.h" #include "vk_log.h" @@ -789,7 +790,7 @@ panvk_lower_nir(struct panvk_device *dev, nir_shader *nir, assert(nir_can_lower_multiview(nir, options)); NIR_PASS(_, nir, nir_lower_multiview, options); /* Pull output writes out of the loop and give them constant offsets for - * pan_lower_store_components */ + * pan_nir_lower_store_components */ NIR_PASS(_, nir, nir_lower_io_vars_to_temporaries, nir_shader_get_entrypoint(nir), nir_var_shader_out); } @@ -929,10 +930,10 @@ panvk_lower_nir(struct panvk_device *dev, nir_shader *nir, nir_metadata_control_flow, NULL); /* since valhall, panvk_per_arch(nir_lower_descriptors) separates the - * driver set and the user sets, and does not need pan_lower_image_index + * driver set and the user sets, and does not need pan_nir_lower_image_index */ if (PAN_ARCH < 9 && stage == MESA_SHADER_VERTEX) - NIR_PASS(_, nir, pan_lower_image_index, MAX_VS_ATTRIBS); + NIR_PASS(_, nir, pan_nir_lower_image_index, MAX_VS_ATTRIBS); if (noperspective_varyings && stage == MESA_SHADER_VERTEX) { NIR_PASS(_, nir, nir_inline_sysval,