void vg_destroy_context(struct vg_context *ctx) { struct pipe_resource **cbuf = &ctx->mask.cbuf; renderer_destroy(ctx->renderer); shaders_cache_destroy(ctx->sc); shader_destroy(ctx->shader); paint_destroy(ctx->default_paint); if (*cbuf) pipe_resource_reference(cbuf, NULL); if (ctx->mask.union_fs) vg_shader_destroy(ctx, ctx->mask.union_fs); if (ctx->mask.intersect_fs) vg_shader_destroy(ctx, ctx->mask.intersect_fs); if (ctx->mask.subtract_fs) vg_shader_destroy(ctx, ctx->mask.subtract_fs); if (ctx->mask.set_fs) vg_shader_destroy(ctx, ctx->mask.set_fs); cso_destroy_context(ctx->cso_context); cso_hash_delete(ctx->owned_objects[VG_OBJECT_PAINT]); cso_hash_delete(ctx->owned_objects[VG_OBJECT_IMAGE]); cso_hash_delete(ctx->owned_objects[VG_OBJECT_MASK]); cso_hash_delete(ctx->owned_objects[VG_OBJECT_FONT]); cso_hash_delete(ctx->owned_objects[VG_OBJECT_PATH]); api_destroy_dispatch(ctx->dispatch); FREE(ctx); }
void vg_destroy_context(struct vg_context *ctx) { struct pipe_resource **cbuf = &ctx->mask.cbuf; struct pipe_resource **vsbuf = &ctx->vs_const_buffer; util_destroy_blit(ctx->blit); renderer_destroy(ctx->renderer); shaders_cache_destroy(ctx->sc); shader_destroy(ctx->shader); paint_destroy(ctx->default_paint); if (*cbuf) pipe_resource_reference(cbuf, NULL); if (*vsbuf) pipe_resource_reference(vsbuf, NULL); if (ctx->clear.fs) { cso_delete_fragment_shader(ctx->cso_context, ctx->clear.fs); ctx->clear.fs = NULL; } if (ctx->plain_vs) { vg_shader_destroy(ctx, ctx->plain_vs); ctx->plain_vs = NULL; } if (ctx->clear_vs) { vg_shader_destroy(ctx, ctx->clear_vs); ctx->clear_vs = NULL; } if (ctx->texture_vs) { vg_shader_destroy(ctx, ctx->texture_vs); ctx->texture_vs = NULL; } if (ctx->pass_through_depth_fs) vg_shader_destroy(ctx, ctx->pass_through_depth_fs); if (ctx->mask.union_fs) vg_shader_destroy(ctx, ctx->mask.union_fs); if (ctx->mask.intersect_fs) vg_shader_destroy(ctx, ctx->mask.intersect_fs); if (ctx->mask.subtract_fs) vg_shader_destroy(ctx, ctx->mask.subtract_fs); if (ctx->mask.set_fs) vg_shader_destroy(ctx, ctx->mask.set_fs); cso_release_all(ctx->cso_context); cso_destroy_context(ctx->cso_context); cso_hash_delete(ctx->owned_objects[VG_OBJECT_PAINT]); cso_hash_delete(ctx->owned_objects[VG_OBJECT_IMAGE]); cso_hash_delete(ctx->owned_objects[VG_OBJECT_MASK]); cso_hash_delete(ctx->owned_objects[VG_OBJECT_FONT]); cso_hash_delete(ctx->owned_objects[VG_OBJECT_PATH]); api_destroy_dispatch(ctx->dispatch); FREE(ctx); }