mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
panvk: Fix valgrind issue in panvk_compile_shaders
Ensure we've read all the relevant NIR state before freeing it for the
current shader.
Also ensure we free the shaders in the same order we compile them.
Fixes: d93f9d6d1a ("panvk: use static noperspective when statically linking VS and FS")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33011>
This commit is contained in:
parent
eabf8054b8
commit
358dcdabba
1 changed files with 6 additions and 6 deletions
|
|
@ -1097,9 +1097,6 @@ panvk_compile_shaders(struct vk_device *vk_dev, uint32_t shader_count,
|
|||
pAllocator,
|
||||
&shaders_out[i]);
|
||||
|
||||
/* Clean up NIR for the current shader */
|
||||
ralloc_free(infos[i].nir);
|
||||
|
||||
if (result != VK_SUCCESS)
|
||||
goto err_cleanup;
|
||||
|
||||
|
|
@ -1112,6 +1109,9 @@ panvk_compile_shaders(struct vk_device *vk_dev, uint32_t shader_count,
|
|||
use_static_noperspective = true;
|
||||
noperspective_varyings = shader->info.varyings.noperspective;
|
||||
}
|
||||
|
||||
/* Clean up NIR for the current shader */
|
||||
ralloc_free(infos[i].nir);
|
||||
}
|
||||
|
||||
/* TODO: If we get multiple shaders here, we can perform part of the link
|
||||
|
|
@ -1121,11 +1121,11 @@ panvk_compile_shaders(struct vk_device *vk_dev, uint32_t shader_count,
|
|||
|
||||
err_cleanup:
|
||||
/* Clean up all the shaders before this point */
|
||||
for (uint32_t j = 0; j < i; j++)
|
||||
for (int32_t j = shader_count - 1; j > i; j--)
|
||||
panvk_shader_destroy(&dev->vk, shaders_out[j], pAllocator);
|
||||
|
||||
/* Clean up all the NIR after this point */
|
||||
for (uint32_t j = i + 1; j < shader_count; j++)
|
||||
/* Clean up all the NIR from this point */
|
||||
for (int32_t j = i; j >= 0; j--)
|
||||
ralloc_free(infos[j].nir);
|
||||
|
||||
/* Memset the output array */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue