From 45139c72f73fb8b73a57a8dbf7cd426bc66a4b07 Mon Sep 17 00:00:00 2001 From: Simon Perretta Date: Sun, 26 May 2024 00:23:23 +0100 Subject: [PATCH] pco: set up and tear down glsl type singleton with context Signed-off-by: Simon Perretta Acked-by: Frank Binns Part-of: --- src/imagination/pco/pco.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/imagination/pco/pco.c b/src/imagination/pco/pco.c index aa0759143a8..a7cd1c8a58f 100644 --- a/src/imagination/pco/pco.c +++ b/src/imagination/pco/pco.c @@ -10,6 +10,7 @@ * \brief Main compiler interface. */ +#include "compiler/glsl_types.h" #include "pco.h" #include "pco_internal.h" #include "util/list.h" @@ -19,6 +20,16 @@ #include #include +/** + * \brief PCO compiler context destructor. + * + * \param[in,out] ptr PCO compiler context pointer. + */ +static void pco_ctx_destructor(UNUSED void *ptr) +{ + glsl_type_singleton_decref(); +} + /** * \brief Allocates and sets up a PCO compiler context. * @@ -42,6 +53,9 @@ pco_ctx *pco_ctx_create(const struct pvr_device_info *dev_info, void *mem_ctx) pco_setup_spirv_options(dev_info, &ctx->spirv_options); pco_setup_nir_options(dev_info, &ctx->nir_options); + glsl_type_singleton_init_or_ref(); + ralloc_set_destructor(ctx, pco_ctx_destructor); + return ctx; }