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); }
void util_surfaces_destroy(struct util_surfaces *us, struct pipe_resource *pt, void (*destroy_surface) (struct pipe_surface *)) { if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE) { /* or 2D array */ if(us->u.hash) { struct cso_hash_iter iter; iter = cso_hash_first_node(us->u.hash); while (!cso_hash_iter_is_null(iter)) { destroy_surface(cso_hash_iter_data(iter)); iter = cso_hash_iter_next(iter); } cso_hash_delete(us->u.hash); us->u.hash = NULL; } } else { if(us->u.array) { unsigned i; for(i = 0; i <= pt->last_level; ++i) { struct pipe_surface *ps = us->u.array[i]; if(ps) destroy_surface(ps); } FREE(us->u.array); us->u.array = NULL; } } }
/** * Delete/free a keymap and all entries. The deleteFunc that was given at * create time will be called for each entry. * \param user user-provided pointer passed through to the delete callback */ void util_delete_keymap(struct keymap *map, void *user) { util_keymap_remove_all(map, user); cso_hash_delete(map->cso); FREE(map); }
void cso_cache_delete(struct cso_cache *sc) { assert(sc); if (!sc) return; /* delete driver data */ cso_for_each_state(sc, CSO_BLEND, delete_blend_state, 0); cso_for_each_state(sc, CSO_DEPTH_STENCIL_ALPHA, delete_depth_stencil_state, 0); cso_for_each_state(sc, CSO_FRAGMENT_SHADER, delete_fs_state, 0); cso_for_each_state(sc, CSO_VERTEX_SHADER, delete_vs_state, 0); cso_for_each_state(sc, CSO_RASTERIZER, delete_rasterizer_state, 0); cso_for_each_state(sc, CSO_SAMPLER, delete_sampler_state, 0); cso_for_each_state(sc, CSO_VELEMENTS, delete_velements, 0); cso_hash_delete(sc->blend_hash); cso_hash_delete(sc->sampler_hash); cso_hash_delete(sc->depth_stencil_hash); cso_hash_delete(sc->rasterizer_hash); cso_hash_delete(sc->fs_hash); cso_hash_delete(sc->vs_hash); cso_hash_delete(sc->velements_hash); FREE(sc); }
static void regs_hash_destroy(struct cso_hash *hash) { struct cso_hash_iter iter = cso_hash_first_node(hash); while (!cso_hash_iter_is_null(iter)) { scan_register *reg = (scan_register *)cso_hash_iter_data(iter); iter = cso_hash_erase(hash, iter); assert(reg->file < TGSI_FILE_COUNT); FREE(reg); } cso_hash_delete(hash); }
void shaders_cache_destroy(struct shaders_cache *sc) { struct cso_hash_iter iter = cso_hash_first_node(sc->hash); while (!cso_hash_iter_is_null(iter)) { struct cached_shader *cached = (struct cached_shader *)cso_hash_iter_data(iter); cso_delete_fragment_shader(sc->pipe->cso_context, cached->driver_shader); iter = cso_hash_erase(sc->hash, iter); } cso_hash_delete(sc->hash); FREE(sc); }
static void cache_destroy(struct cso_context *cso, struct cso_hash *hash, unsigned processor) { struct cso_hash_iter iter = cso_hash_first_node(hash); while (!cso_hash_iter_is_null(iter)) { void *shader = (void *)cso_hash_iter_data(iter); if (processor == PIPE_SHADER_FRAGMENT) { cso_delete_fragment_shader(cso, shader); } else if (processor == PIPE_SHADER_VERTEX) { cso_delete_vertex_shader(cso, shader); } iter = cso_hash_erase(hash, iter); } cso_hash_delete(hash); }
void font_destroy(struct vg_font *font) { struct vg_context *ctx = vg_current_context(); struct cso_hash_iter iter; vg_context_remove_object(ctx, &font->base); iter = cso_hash_first_node(font->glyphs); while (!cso_hash_iter_is_null(iter)) { struct vg_glyph *glyph = (struct vg_glyph *) cso_hash_iter_data(iter); FREE(glyph); iter = cso_hash_iter_next(iter); } cso_hash_delete(font->glyphs); vg_free_object(&font->base); FREE(font); }
void cso_cache_delete(struct cso_cache *sc) { int i; assert(sc); if (!sc) return; /* delete driver data */ cso_for_each_state(sc, CSO_BLEND, delete_blend_state, 0); cso_for_each_state(sc, CSO_DEPTH_STENCIL_ALPHA, delete_depth_stencil_state, 0); cso_for_each_state(sc, CSO_RASTERIZER, delete_rasterizer_state, 0); cso_for_each_state(sc, CSO_SAMPLER, delete_sampler_state, 0); cso_for_each_state(sc, CSO_VELEMENTS, delete_velements, 0); for (i = 0; i < CSO_CACHE_MAX; i++) cso_hash_delete(sc->hashes[i]); FREE(sc); }
void translate_cache_destroy(struct translate_cache *cache) { delete_translates(cache); cso_hash_delete(cache->hash); FREE(cache); }