agx_create_shader_state(struct pipe_context *pctx,
const struct pipe_shader_state *cso)
{
- struct agx_uncompiled_shader *so = CALLOC_STRUCT(agx_uncompiled_shader);
+ struct agx_uncompiled_shader *so =
+ rzalloc(NULL, struct agx_uncompiled_shader);
struct agx_device *dev = agx_device(pctx->screen);
if (!so)
? cso->ir.nir
: tgsi_to_nir(cso->tokens, pctx->screen, false);
+ /* The driver gets ownership of the nir_shader for graphics. The NIR is
+ * ralloc'd. Free the NIR when we free the uncompiled shader.
+ */
+ ralloc_steal(so, nir);
+
if (nir->info.stage == MESA_SHADER_VERTEX) {
so->variants = _mesa_hash_table_create(NULL, asahi_vs_shader_key_hash,
asahi_vs_shader_key_equal);
agx_create_compute_state(struct pipe_context *pctx,
const struct pipe_compute_state *cso)
{
- struct agx_uncompiled_shader *so = CALLOC_STRUCT(agx_uncompiled_shader);
+ struct agx_uncompiled_shader *so =
+ rzalloc(NULL, struct agx_uncompiled_shader);
if (!so)
return NULL;
{
struct agx_uncompiled_shader *so = cso;
_mesa_hash_table_destroy(so->variants, agx_delete_compiled_shader);
- free(so);
+ ralloc_free(so);
}
static uint32_t