radv: Remove dead shader temps after linking.
Prevent nir_lower_scratch accidentally turning these dead variables into scratch. This can especially happen to arrayed outputs of eg. tess control or mesh shaders, which become large shader temps. Signed-off-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18566>
This commit is contained in:
@@ -2399,6 +2399,14 @@ radv_pipeline_link_shaders(const struct radv_device *device,
|
|||||||
progress = nir_remove_unused_varyings(producer, consumer);
|
progress = nir_remove_unused_varyings(producer, consumer);
|
||||||
|
|
||||||
nir_compact_varyings(producer, consumer, true);
|
nir_compact_varyings(producer, consumer, true);
|
||||||
|
|
||||||
|
/* nir_compact_varyings changes deleted varyings into shader_temp.
|
||||||
|
* We need to remove these otherwise we risk them being lowered to scratch.
|
||||||
|
* This can especially happen to arrayed outputs.
|
||||||
|
*/
|
||||||
|
NIR_PASS(_, producer, nir_remove_dead_variables, nir_var_shader_temp, NULL);
|
||||||
|
NIR_PASS(_, consumer, nir_remove_dead_variables, nir_var_shader_temp, NULL);
|
||||||
|
|
||||||
nir_validate_shader(producer, "after nir_compact_varyings");
|
nir_validate_shader(producer, "after nir_compact_varyings");
|
||||||
nir_validate_shader(consumer, "after nir_compact_varyings");
|
nir_validate_shader(consumer, "after nir_compact_varyings");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user