brw: Pass devinfo into remap_patch_urb_offsets
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38482>
This commit is contained in:
committed by
Marge Bot
parent
4dc6413de8
commit
7736e693b1
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user