void st_destroy_drawpix(struct st_context *st) { st_reference_fragprog(st, &st->drawpix.z_shader, NULL); st_reference_fragprog(st, &st->pixel_xfer.combined_prog, NULL); st_reference_vertprog(st, &st->drawpix.vert_shaders[0], NULL); st_reference_vertprog(st, &st->drawpix.vert_shaders[1], NULL); }
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); }
/** * Update vertex program state/atom. This involves translating the * Mesa vertex program into a gallium fragment program and binding it. */ static void update_vp( struct st_context *st ) { struct st_vertex_program *stvp; struct st_vp_variant_key key; /* find active shader and params -- Should be covered by * ST_NEW_VERTEX_PROGRAM */ assert(st->ctx->VertexProgram._Current); stvp = st_vertex_program(st->ctx->VertexProgram._Current); assert(stvp->Base.Base.Target == GL_VERTEX_PROGRAM_ARB); memset(&key, 0, sizeof key); key.st = st->has_shareable_shaders ? NULL : st; /* When this is true, we will add an extra input to the vertex * shader translation (for edgeflags), an extra output with * edgeflag semantics, and extend the vertex shader to pass through * the input to the output. We'll need to use similar logic to set * up the extra vertex_element input for edgeflags. */ key.passthrough_edgeflags = st->vertdata_edgeflags; key.clamp_color = st->clamp_vert_color_in_shader && st->ctx->Light._ClampVertexColor && (stvp->Base.Base.OutputsWritten & (VARYING_SLOT_COL0 | VARYING_SLOT_COL1 | VARYING_SLOT_BFC0 | VARYING_SLOT_BFC1)); st->vp_variant = st_get_vp_variant(st, stvp, &key); st_reference_vertprog(st, &st->vp, stvp); cso_set_vertex_shader_handle(st->cso_context, st->vp_variant->driver_shader); st->vertex_result_to_slot = stvp->result_to_output; }
/** * Update vertex program state/atom. This involves translating the * Mesa vertex program into a gallium fragment program and binding it. */ static void update_vp( struct st_context *st ) { struct st_vertex_program *stvp; struct st_vp_variant_key key; /* find active shader and params -- Should be covered by * ST_NEW_VERTEX_PROGRAM */ assert(st->ctx->VertexProgram._Current); stvp = st_vertex_program(st->ctx->VertexProgram._Current); assert(stvp->Base.Base.Target == GL_VERTEX_PROGRAM_ARB); memset(&key, 0, sizeof key); key.st = st; /* variants are per-context */ /* When this is true, we will add an extra input to the vertex * shader translation (for edgeflags), an extra output with * edgeflag semantics, and extend the vertex shader to pass through * the input to the output. We'll need to use similar logic to set * up the extra vertex_element input for edgeflags. * _NEW_POLYGON, ST_NEW_EDGEFLAGS_DATA */ key.passthrough_edgeflags = (st->vertdata_edgeflags && ( st->ctx->Polygon.FrontMode != GL_FILL || st->ctx->Polygon.BackMode != GL_FILL)); key.clamp_color = st->clamp_vert_color_in_shader && st->ctx->Light._ClampVertexColor; st->vp_variant = st_get_vp_variant(st, stvp, &key); st_reference_vertprog(st, &st->vp, stvp); cso_set_vertex_shader_handle(st->cso_context, st->vp_variant->driver_shader); st->vertex_result_to_slot = stvp->result_to_output; }
static void update_linkage( struct st_context *st ) { struct st_vertex_program *stvp; struct st_fragment_program *stfp; struct translated_vertex_program *xvp; /* find active shader and params -- Should be covered by * ST_NEW_VERTEX_PROGRAM */ assert(st->ctx->VertexProgram._Current); stvp = st_vertex_program(st->ctx->VertexProgram._Current); assert(stvp->Base.Base.Target == GL_VERTEX_PROGRAM_ARB); assert(st->ctx->FragmentProgram._Current); stfp = st_fragment_program(st->ctx->FragmentProgram._Current); assert(stfp->Base.Base.Target == GL_FRAGMENT_PROGRAM_ARB); xvp = find_translated_vp(st, stvp, stfp); st_reference_vertprog(st, &st->vp, stvp); st_reference_fragprog(st, &st->fp, stfp); cso_set_vertex_shader_handle(st->cso_context, stvp->driver_shader); if (st->missing_textures) { /* use a pass-through frag shader that uses no textures */ void *fs = get_passthrough_fs(st); cso_set_fragment_shader_handle(st->cso_context, fs); } else { cso_set_fragment_shader_handle(st->cso_context, stfp->driver_shader); } st->vertex_result_to_slot = xvp->output_to_slot; }
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); }