From 7736e693b11a14005ec079afb0299510b3d48e1e Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 6 Nov 2025 00:39:12 -0800 Subject: [PATCH] brw: Pass devinfo into remap_patch_urb_offsets Reviewed-by: Alyssa Rosenzweig Part-of: --- src/intel/compiler/brw/brw_nir.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/intel/compiler/brw/brw_nir.c b/src/intel/compiler/brw/brw_nir.c index 16d5c7d8674..6b16bd9c032 100644 --- a/src/intel/compiler/brw/brw_nir.c +++ b/src/intel/compiler/brw/brw_nir.c @@ -328,9 +328,17 @@ remap_tess_levels(nir_shader *nir, (void *)(uintptr_t) prim); } +struct remap_patch_cb_data { + const struct intel_device_info *devinfo; + const struct intel_vue_map *vue_map; +}; + static bool remap_patch_urb_offsets_instr(nir_builder *b, nir_intrinsic_instr *intrin, void *data) { + struct remap_patch_cb_data *cb_data = data; + const struct intel_vue_map *vue_map = cb_data->vue_map; + if (!(b->shader->info.stage == MESA_SHADER_TESS_CTRL && is_output(intrin)) && !(b->shader->info.stage == MESA_SHADER_TESS_EVAL && is_input(intrin))) return false; @@ -343,7 +351,6 @@ remap_patch_urb_offsets_instr(nir_builder *b, nir_intrinsic_instr *intrin, void gl_varying_slot varying = nir_intrinsic_base(intrin); - const struct intel_vue_map *vue_map = data; int vue_slot = vue_map->varying_to_slot[varying]; assert(vue_slot != -1); nir_intrinsic_set_base(intrin, vue_slot); @@ -401,10 +408,16 @@ remap_patch_urb_offsets_instr(nir_builder *b, nir_intrinsic_instr *intrin, void } static bool -remap_patch_urb_offsets(nir_shader *nir, const struct intel_vue_map *vue_map) +remap_patch_urb_offsets(nir_shader *nir, + const struct intel_device_info *devinfo, + const struct intel_vue_map *vue_map) { + struct remap_patch_cb_data cb_data = { + .devinfo = devinfo, + .vue_map = vue_map, + }; return nir_shader_intrinsics_pass(nir, remap_patch_urb_offsets_instr, - nir_metadata_control_flow, (void *)vue_map); + nir_metadata_control_flow, (void *)&cb_data); } /* Replace store_per_view_output to plain store_output, mapping the view index @@ -674,7 +687,7 @@ brw_nir_lower_tes_inputs(nir_shader *nir, NIR_PASS(_, nir, remap_tess_levels, devinfo, nir->info.tess._primitive_mode); - NIR_PASS(_, nir, remap_patch_urb_offsets, vue_map); + NIR_PASS(_, nir, remap_patch_urb_offsets, devinfo, vue_map); /* remap_patch_urb_offsets can add constant math into the shader, * just fold it for the backend. @@ -958,7 +971,7 @@ brw_nir_lower_tcs_outputs(nir_shader *nir, NIR_PASS(_, nir, nir_io_add_const_offset_to_base, nir_var_shader_out); NIR_PASS(_, nir, remap_tess_levels, devinfo, tes_primitive_mode); - NIR_PASS(_, nir, remap_patch_urb_offsets, vue_map); + NIR_PASS(_, nir, remap_patch_urb_offsets, devinfo, vue_map); /* remap_patch_urb_offsets can add constant math into the shader, * just fold it for the backend.