/** * Free a context's vertex/fragment program state */ void _mesa_free_program_data(struct gl_context *ctx) { #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, NULL); _mesa_delete_program_cache(ctx, ctx->VertexProgram.Cache); #endif #if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, NULL); _mesa_delete_program_cache(ctx, ctx->FragmentProgram.Cache); #endif #if FEATURE_ARB_geometry_shader4 _mesa_reference_geomprog(ctx, &ctx->GeometryProgram.Current, NULL); _mesa_delete_program_cache(ctx, ctx->GeometryProgram.Cache); #endif /* XXX probably move this stuff */ #if FEATURE_ATI_fragment_shader if (ctx->ATIFragmentShader.Current) { ctx->ATIFragmentShader.Current->RefCount--; if (ctx->ATIFragmentShader.Current->RefCount <= 0) { free(ctx->ATIFragmentShader.Current); } } #endif free((void *) ctx->Program.ErrorString); }
void st_destroy_context( struct st_context *st ) { struct pipe_context *pipe = st->pipe; struct gl_context *ctx = st->ctx; GLuint i; _mesa_HashWalk(ctx->Shared->TexObjects, destroy_tex_sampler_cb, st); st_reference_fragprog(st, &st->fp, NULL); st_reference_geomprog(st, &st->gp, NULL); st_reference_vertprog(st, &st->vp, NULL); /* release framebuffer surfaces */ for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { pipe_surface_reference(&st->state.framebuffer.cbufs[i], NULL); } pipe_surface_reference(&st->state.framebuffer.zsbuf, NULL); _mesa_delete_program_cache(st->ctx, st->pixel_xfer.cache); _vbo_DestroyContext(st->ctx); st_destroy_program_variants(st); _mesa_free_context_data(ctx); /* This will free the st_context too, so 'st' must not be accessed * afterwards. */ st_destroy_context_priv(st); st = NULL; pipe->destroy( pipe ); free(ctx); }
void st_destroy_context( struct st_context *st ) { struct pipe_context *pipe = st->pipe; struct cso_context *cso = st->cso_context; GLcontext *ctx = st->ctx; GLuint i; /* need to unbind and destroy CSO objects before anything else */ cso_release_all(st->cso_context); st_reference_fragprog(st, &st->fp, NULL); st_reference_vertprog(st, &st->vp, NULL); /* release framebuffer surfaces */ for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { pipe_surface_reference(&st->state.framebuffer.cbufs[i], NULL); } pipe_surface_reference(&st->state.framebuffer.zsbuf, NULL); _mesa_delete_program_cache(st->ctx, st->pixel_xfer.cache); _vbo_DestroyContext(st->ctx); _mesa_free_context_data(ctx); st_destroy_context_priv(st); cso_destroy_context(cso); pipe->destroy( pipe ); free(ctx); }
void st_destroy_context( struct st_context *st ) { struct pipe_context *pipe = st->pipe; struct cso_context *cso = st->cso_context; struct gl_context *ctx = st->ctx; GLuint i; _mesa_HashWalk(ctx->Shared->TexObjects, destroy_tex_sampler_cb, st); /* need to unbind and destroy CSO objects before anything else */ cso_release_all(st->cso_context); st_reference_fragprog(st, &st->fp, NULL); st_reference_geomprog(st, &st->gp, NULL); st_reference_vertprog(st, &st->vp, NULL); /* release framebuffer surfaces */ for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { pipe_surface_reference(&st->state.framebuffer.cbufs[i], NULL); } pipe_surface_reference(&st->state.framebuffer.zsbuf, NULL); pipe->set_index_buffer(pipe, NULL); for (i = 0; i < PIPE_SHADER_TYPES; i++) { pipe->set_constant_buffer(pipe, i, 0, NULL); } _mesa_delete_program_cache(st->ctx, st->pixel_xfer.cache); _vbo_DestroyContext(st->ctx); st_destroy_program_variants(st); _mesa_free_context_data(ctx); /* This will free the st_context too, so 'st' must not be accessed * afterwards. */ st_destroy_context_priv(st); st = NULL; cso_destroy_context(cso); pipe->destroy( pipe ); free(ctx); }
/** * Free a context's vertex/fragment program state */ void _mesa_free_program_data(struct gl_context *ctx) { _mesa_reference_program(ctx, &ctx->VertexProgram.Current, NULL); _mesa_delete_program_cache(ctx, ctx->VertexProgram.Cache); _mesa_reference_program(ctx, &ctx->FragmentProgram.Current, NULL); _mesa_delete_shader_cache(ctx, ctx->FragmentProgram.Cache); /* XXX probably move this stuff */ if (ctx->ATIFragmentShader.Current) { ctx->ATIFragmentShader.Current->RefCount--; if (ctx->ATIFragmentShader.Current->RefCount <= 0) { free(ctx->ATIFragmentShader.Current); } } free((void *) ctx->Program.ErrorString); }
void st_destroy_context( struct st_context *st ) { struct pipe_context *pipe = st->pipe; struct cso_context *cso = st->cso_context; GLcontext *ctx = st->ctx; /* need to unbind and destroy CSO objects before anything else */ cso_release_all(st->cso_context); st_reference_fragprog(st, &st->fp, NULL); st_reference_vertprog(st, &st->vp, NULL); _mesa_delete_program_cache(st->ctx, st->pixel_xfer.cache); _mesa_free_context_data(ctx); st_destroy_context_priv(st); cso_destroy_context(cso); pipe->destroy( pipe ); free(ctx); }