mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-20 01:20:44 +02:00
pco: set up and tear down glsl type singleton with context
Signed-off-by: Simon Perretta <simon.perretta@imgtec.com> Acked-by: Frank Binns <frank.binns@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32258>
This commit is contained in:
parent
1b36e34095
commit
45139c72f7
1 changed files with 14 additions and 0 deletions
|
|
@ -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 <assert.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* \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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue