radv: move lowering the view index to radv_pipeline_link_shaders()

This is a link step because it needs to know if the previous stage is
a mesh shader.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18138>
This commit is contained in:
Samuel Pitoiset
2022-08-19 12:41:39 +02:00
committed by Marge Bot
parent 98fe5acbdb
commit 8a78fbb832
3 changed files with 10 additions and 6 deletions

View File

@@ -2716,6 +2716,9 @@ radv_pipeline_link_shaders(const struct radv_device *device,
!(producer->info.outputs_written & VARYING_BIT_LAYER)) {
NIR_PASS(_, producer, radv_lower_multiview);
}
/* Lower the view index to map on the layer. */
NIR_PASS(_, consumer, radv_lower_view_index, producer->info.stage == MESA_SHADER_MESH);
}
if (pipeline_key->optimisations_disabled)
@@ -4719,7 +4722,7 @@ radv_create_shaders(struct radv_pipeline *pipeline, struct radv_pipeline_layout
/* Gather info again, information such as outputs_read can be out-of-date. */
nir_shader_gather_info(stages[i].nir, nir_shader_get_entrypoint(stages[i].nir));
radv_lower_io(device, stages[i].nir, stages[MESA_SHADER_MESH].nir);
radv_lower_io(device, stages[i].nir);
stages[i].feedback.duration += os_time_get_nano() - stage_start;
}

View File

@@ -1089,8 +1089,8 @@ find_layer_in_var(nir_shader *nir)
* driver_location.
*/
static bool
lower_view_index(nir_shader *nir, bool per_primitive)
bool
radv_lower_view_index(nir_shader *nir, bool per_primitive)
{
bool progress = false;
nir_function_impl *entry = nir_shader_get_entrypoint(nir);
@@ -1134,13 +1134,12 @@ lower_view_index(nir_shader *nir, bool per_primitive)
}
void
radv_lower_io(struct radv_device *device, nir_shader *nir, bool is_mesh_shading)
radv_lower_io(struct radv_device *device, nir_shader *nir)
{
if (nir->info.stage == MESA_SHADER_COMPUTE)
return;
if (nir->info.stage == MESA_SHADER_FRAGMENT) {
NIR_PASS(_, nir, lower_view_index, is_mesh_shading);
nir_assign_io_var_locations(nir, nir_var_shader_in, &nir->num_inputs, MESA_SHADER_FRAGMENT);
}

View File

@@ -732,10 +732,12 @@ get_tcs_num_patches(unsigned tcs_num_input_vertices, unsigned tcs_num_output_ver
return num_patches;
}
void radv_lower_io(struct radv_device *device, nir_shader *nir, bool is_mesh_shading);
void radv_lower_io(struct radv_device *device, nir_shader *nir);
bool radv_lower_io_to_mem(struct radv_device *device, struct radv_pipeline_stage *stage);
bool radv_lower_view_index(nir_shader *nir, bool per_primitive);
void radv_lower_ngg(struct radv_device *device, struct radv_pipeline_stage *ngg_stage,
const struct radv_pipeline_key *pl_key);