nvk: Don't free the NIR in nvk_compile_nir
authorFaith Ekstrand <faith.ekstrand@collabora.com>
Tue, 31 Jan 2023 02:11:52 +0000 (20:11 -0600)
committerMarge Bot <emma+marge@anholt.net>
Fri, 4 Aug 2023 21:31:56 +0000 (21:31 +0000)
It's a layering violation and the NIR is currently leaked if we the
compile fails.  It's better to make the caller clean up.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

src/nouveau/vulkan/nvk_compute_pipeline.c
src/nouveau/vulkan/nvk_shader.c

index 11d2959..41c763a 100644 (file)
@@ -101,6 +101,7 @@ nvk_compute_pipeline_create(struct nvk_device *device,
    nvk_lower_nir(device, nir, pipeline_layout);
 
    result = nvk_compile_nir(pdevice, nir, &pipeline->base.shaders[MESA_SHADER_COMPUTE]);
+   ralloc_free(nir);
    if (result != VK_SUCCESS)
       goto fail;
 
index f496866..d9dc08f 100644 (file)
@@ -193,7 +193,6 @@ nvk_compile_nir(struct nvk_physical_device *device, nir_shader *nir,
    if (info_out.io.fp64)
       shader->hdr[0] |= 1 << 27;
 
-   ralloc_free(nir);
    return VK_SUCCESS;
 }