radv: clone shader in radv_shader_compile_to_nir

This way, radv_shader_compile_to_nir doesn't alter the NIR.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14087>
This commit is contained in:
Rhys Perry 2021-12-06 19:11:06 +00:00 committed by Marge Bot
parent 2020a1799b
commit 85161fb8ac
2 changed files with 3 additions and 9 deletions

View File

@ -3563,13 +3563,6 @@ radv_create_shaders(struct radv_pipeline *pipeline, struct radv_pipeline_layout
stage ? stage->pSpecializationInfo : NULL,
pipeline_layout, pipeline_key);
/* We don't want to alter meta shaders IR directly so clone it
* first.
*/
if (nir[i]->info.name) {
nir[i] = nir_shader_clone(NULL, nir[i]);
}
radv_stop_feedback(stage_feedbacks[i], false);
}

View File

@ -443,8 +443,9 @@ radv_shader_compile_to_nir(struct radv_device *device, struct vk_shader_module *
if (module->nir) {
/* Some things such as our meta clear/blit code will give us a NIR
* shader directly. In that case, we just ignore the SPIR-V entirely
* and just use the NIR shader */
nir = module->nir;
* and just use the NIR shader. We don't want to alter meta and RT
* shaders IR directly, so clone it first. */
nir = nir_shader_clone(NULL, module->nir);
nir->options = &device->physical_device->nir_options;
nir_validate_shader(nir, "in internal shader");