clover: Stop leaking NIR shaders

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7068>
This commit is contained in:
Jason Ekstrand 2020-10-08 10:41:31 -05:00 committed by Marge Bot
parent cc00d57a3c
commit 54eae33558
1 changed files with 4 additions and 0 deletions

View File

@ -342,12 +342,16 @@ module clover::nir::spirv_to_nir(const module &mod, const device &dev,
blob_init(&blob);
nir_serialize(&blob, nir, false);
ralloc_free(nir);
const pipe_binary_program_header header { uint32_t(blob.size) };
module::section text { section_id, module::section::text_executable, header.num_bytes, {} };
text.data.insert(text.data.end(), reinterpret_cast<const char *>(&header),
reinterpret_cast<const char *>(&header) + sizeof(header));
text.data.insert(text.data.end(), blob.data, blob.data + blob.size);
free(blob.data);
m.syms.emplace_back(sym.name, std::string(),
sym.reqd_work_group_size, section_id, 0, args);
m.secs.push_back(text);