void st_destroy_pbo_helpers(struct st_context *st) { unsigned i; if (st->pbo.upload_fs) { cso_delete_fragment_shader(st->cso_context, st->pbo.upload_fs); st->pbo.upload_fs = NULL; } for (i = 0; i < ARRAY_SIZE(st->pbo.download_fs); ++i) { if (st->pbo.download_fs[i]) { cso_delete_fragment_shader(st->cso_context, st->pbo.download_fs[i]); st->pbo.download_fs[i] = NULL; } } if (st->pbo.gs) { cso_delete_geometry_shader(st->cso_context, st->pbo.gs); st->pbo.gs = NULL; } if (st->pbo.vs) { cso_delete_vertex_shader(st->cso_context, st->pbo.vs); st->pbo.vs = NULL; } }
void st_context_destroy(struct st_context *st_ctx) { unsigned i; if(st_ctx) { struct st_device *st_dev = st_ctx->st_dev; if(st_ctx->cso) { cso_delete_vertex_shader(st_ctx->cso, st_ctx->vs); cso_delete_fragment_shader(st_ctx->cso, st_ctx->fs); cso_destroy_context(st_ctx->cso); } if(st_ctx->pipe) st_ctx->pipe->destroy(st_ctx->pipe); for(i = 0; i < PIPE_MAX_SAMPLERS; ++i) pipe_texture_reference(&st_ctx->sampler_textures[i], NULL); pipe_texture_reference(&st_ctx->default_texture, NULL); FREE(st_ctx); st_device_reference(&st_dev, NULL); } }
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 st_delete_program(GLcontext *ctx, struct gl_program *prog) { struct st_context *st = st_context(ctx); switch( prog->Target ) { case GL_VERTEX_PROGRAM_ARB: { struct st_vertex_program *stvp = (struct st_vertex_program *) prog; if (stvp->driver_shader) { cso_delete_vertex_shader(st->cso_context, stvp->driver_shader); stvp->driver_shader = NULL; } if (stvp->draw_shader) { #if FEATURE_feedback || FEATURE_drawpix /* this would only have been allocated for the RasterPos path */ draw_delete_vertex_shader(st->draw, stvp->draw_shader); stvp->draw_shader = NULL; #endif } if (stvp->state.tokens) { st_free_tokens(stvp->state.tokens); stvp->state.tokens = NULL; } } break; case GL_FRAGMENT_PROGRAM_ARB: { struct st_fragment_program *stfp = (struct st_fragment_program *) prog; if (stfp->driver_shader) { cso_delete_fragment_shader(st->cso_context, stfp->driver_shader); stfp->driver_shader = NULL; } if (stfp->state.tokens) { st_free_tokens(stfp->state.tokens); stfp->state.tokens = NULL; } if (stfp->bitmap_program) { struct gl_program *prg = &stfp->bitmap_program->Base.Base; _mesa_reference_program(ctx, &prg, NULL); stfp->bitmap_program = NULL; } st_free_translated_vertex_programs(st, stfp->vertex_programs); } break; default: assert(0); /* problem */ } /* delete base class */ _mesa_delete_program( ctx, prog ); }
void vg_shader_destroy(struct vg_context *ctx, struct vg_shader *shader) { if (shader->type == PIPE_SHADER_FRAGMENT) cso_delete_fragment_shader(ctx->cso_context, shader->driver); else cso_delete_vertex_shader(ctx->cso_context, shader->driver); FREE(shader->tokens); FREE(shader); }
/** * Delete a fragment program variant. Note the caller must unlink * the variant from the linked list. */ static void delete_fp_variant(struct st_context *st, struct st_fp_variant *fpv) { if (fpv->driver_shader) cso_delete_fragment_shader(st->cso_context, fpv->driver_shader); if (fpv->parameters) _mesa_free_parameter_list(fpv->parameters); FREE(fpv); }
void renderer_destroy(struct renderer *ctx) { #if 0 if (ctx->fs) { cso_delete_fragment_shader(ctx->cso, ctx->fs); ctx->fs = NULL; } #endif free(ctx); }
static void st_program_string_notify( GLcontext *ctx, GLenum target, struct gl_program *prog ) { struct st_context *st = st_context(ctx); if (target == GL_FRAGMENT_PROGRAM_ARB) { struct st_fragment_program *stfp = (struct st_fragment_program *) prog; stfp->serialNo++; if (stfp->driver_shader) { cso_delete_fragment_shader(st->cso_context, stfp->driver_shader); stfp->driver_shader = NULL; } if (stfp->state.tokens) { st_free_tokens(stfp->state.tokens); stfp->state.tokens = NULL; } stfp->param_state = stfp->Base.Base.Parameters->StateFlags; if (st->fp == stfp) st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM; } else if (target == GL_VERTEX_PROGRAM_ARB) { struct st_vertex_program *stvp = (struct st_vertex_program *) prog; stvp->serialNo++; if (stvp->driver_shader) { cso_delete_vertex_shader(st->cso_context, stvp->driver_shader); stvp->driver_shader = NULL; } if (stvp->draw_shader) { #if FEATURE_feedback || FEATURE_drawpix /* this would only have been allocated for the RasterPos path */ draw_delete_vertex_shader(st->draw, stvp->draw_shader); stvp->draw_shader = NULL; #endif } if (stvp->state.tokens) { st_free_tokens(stvp->state.tokens); stvp->state.tokens = NULL; } stvp->param_state = stvp->Base.Base.Parameters->StateFlags; if (st->vp == stvp) st->dirty.st |= ST_NEW_VERTEX_PROGRAM; } }
/** * Free per-context state for glClear. */ void st_destroy_clear(struct st_context *st) { if (st->clear.fs) { cso_delete_fragment_shader(st->cso_context, st->clear.fs); st->clear.fs = NULL; } if (st->clear.vs) { cso_delete_vertex_shader(st->cso_context, st->clear.vs); st->clear.vs = NULL; } }
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); }
void st_destroy_clear(struct st_context *st) { if (st->clear.fs) { cso_delete_fragment_shader(st->cso_context, st->clear.fs); st->clear.fs = NULL; } if (st->clear.vs) { cso_delete_vertex_shader(st->cso_context, st->clear.vs); st->clear.vs = NULL; } if (st->clear.vbuf) { pipe_buffer_reference(&st->clear.vbuf, NULL); st->clear.vbuf = NULL; } }
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 renderer_destroy(struct renderer *ctx) { int i; for (i = 0; i < NUM_RENDERER_VS; i++) { if (ctx->cached_vs[i]) cso_delete_vertex_shader(ctx->cso, ctx->cached_vs[i]); } for (i = 0; i < NUM_RENDERER_FS; i++) { if (ctx->cached_fs[i]) cso_delete_fragment_shader(ctx->cso, ctx->cached_fs[i]); } pipe_resource_reference(&ctx->vs_cbuf, NULL); pipe_resource_reference(&ctx->fs_cbuf, NULL); FREE(ctx); }