nir,glsl,zink: remove the option nir_io_separate_clip_cull_distance_arrays
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

This calls nir_separate_merged_clip_cull_io in zink, which is better
than having to handle separate clip & cull arrays in all passes.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38452>
This commit is contained in:
Marek Olšák 2025-11-14 13:40:31 -05:00 committed by Marge Bot
parent da52bc466f
commit f9341082a2
4 changed files with 5 additions and 22 deletions

View file

@ -1446,9 +1446,7 @@ prelink_lowering(const struct pipe_screen *screen,
* - shader_info::clip_distance_array_size
* - shader_info::cull_distance_array_size
*/
if (!(nir->options->io_options &
nir_io_separate_clip_cull_distance_arrays))
NIR_PASS(_, nir, nir_lower_clip_cull_distance_array_vars);
NIR_PASS(_, nir, nir_lower_clip_cull_distance_array_vars);
}
return true;

View file

@ -207,15 +207,6 @@ typedef enum {
* This is only affects GLSL compilation and Gallium.
*/
nir_io_has_intrinsics = BITFIELD_BIT(16),
/**
* Whether clip and cull distance arrays should be separate. If this is not
* set, cull distances will be moved into VARYING_SLOT_CLIP_DISTn after clip
* distances, and shader_info::clip_distance_array_size will be the index
* of the first cull distance. nir_lower_clip_cull_distance_array_vars does
* that.
*/
nir_io_separate_clip_cull_distance_arrays = BITFIELD_BIT(17),
} nir_io_options;
typedef enum {

View file

@ -288,15 +288,8 @@ create_vars(nir_builder *b, nir_intrinsic_instr *intr, void *opaque)
case VARYING_SLOT_CLIP_DIST1:
case VARYING_SLOT_CULL_DIST0:
case VARYING_SLOT_CULL_DIST1:
if (nir->options->io_options &
nir_io_separate_clip_cull_distance_arrays) {
decl_size = desc.sem.location >= VARYING_SLOT_CULL_DIST0 ?
nir->info.cull_distance_array_size :
nir->info.clip_distance_array_size;
} else {
decl_size = nir->info.clip_distance_array_size +
nir->info.cull_distance_array_size;
}
decl_size = nir->info.clip_distance_array_size +
nir->info.cull_distance_array_size;
component = (desc.sem.location == VARYING_SLOT_CLIP_DIST1 ||
desc.sem.location == VARYING_SLOT_CULL_DIST1) * 4 +
desc.component;

View file

@ -1265,7 +1265,7 @@ zink_screen_init_compiler(struct zink_screen *screen)
{
static const struct nir_shader_compiler_options
default_options = {
.io_options = nir_io_has_intrinsics | nir_io_separate_clip_cull_distance_arrays,
.io_options = nir_io_has_intrinsics,
.lower_ffma16 = true,
.lower_ffma32 = true,
.lower_ffma64 = true,
@ -6189,6 +6189,7 @@ zink_shader_init(struct zink_screen *screen, struct zink_shader *zs)
}
NIR_PASS(_, nir, nir_lower_io_to_scalar, nir_var_shader_in | nir_var_shader_out, NULL, NULL);
NIR_PASS(_, nir, nir_separate_merged_clip_cull_io);
optimize_nir(nir, NULL, true);
NIR_PASS(_, nir, bound_image_arrays);
NIR_PASS(_, nir, flatten_image_arrays);