static void nvc0_destroy(struct pipe_context *pipe) { struct nvc0_context *nvc0 = nvc0_context(pipe); if (nvc0->screen->cur_ctx == nvc0) { nvc0->base.pushbuf->kick_notify = NULL; nvc0->screen->cur_ctx = NULL; nouveau_pushbuf_bufctx(nvc0->base.pushbuf, NULL); } nouveau_pushbuf_kick(nvc0->base.pushbuf, nvc0->base.pushbuf->channel); nvc0_context_unreference_resources(nvc0); #ifdef NVC0_WITH_DRAW_MODULE draw_destroy(nvc0->draw); #endif nouveau_context_destroy(&nvc0->base); }
static void st_destroy_context_priv( struct st_context *st ) { uint i; #if FEATURE_feedback || FEATURE_drawpix draw_destroy(st->draw); #endif st_destroy_atoms( st ); st_destroy_draw( st ); st_destroy_generate_mipmap(st); #if FEATURE_EXT_framebuffer_blit st_destroy_blit(st); #endif st_destroy_clear(st); #if FEATURE_drawpix st_destroy_bitmap(st); st_destroy_drawpix(st); #endif #ifdef FEATURE_OES_draw_texture st_destroy_drawtex(st); #endif _vbo_DestroyContext(st->ctx); for (i = 0; i < Elements(st->state.sampler_texture); i++) { pipe_texture_reference(&st->state.sampler_texture[i], NULL); } for (i = 0; i < Elements(st->state.constants); i++) { if (st->state.constants[i].buffer) { pipe_buffer_reference(st->pipe->screen, &st->state.constants[i].buffer, NULL); } } if (st->default_texture) { st->ctx->Driver.DeleteTexture(st->ctx, st->default_texture); st->default_texture = NULL; } free( st ); }
static void nv50_destroy(struct pipe_context *pipe) { struct nv50_context *nv50 = nv50_context(pipe); if (nv50_context_screen(nv50)->cur_ctx == nv50) { nv50->base.pushbuf->kick_notify = NULL; nv50_context_screen(nv50)->cur_ctx = NULL; nouveau_pushbuf_bufctx(nv50->base.pushbuf, NULL); } /* need to flush before destroying the bufctx */ nouveau_pushbuf_kick(nv50->base.pushbuf, nv50->base.pushbuf->channel); nv50_context_unreference_resources(nv50); #ifdef NV50_WITH_DRAW_MODULE draw_destroy(nv50->draw); #endif nouveau_context_destroy(&nv50->base); }
static void llvmpipe_destroy( struct pipe_context *pipe ) { struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe ); uint i, j; lp_print_counters(); /* This will also destroy llvmpipe->setup: */ if (llvmpipe->draw) draw_destroy( llvmpipe->draw ); for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { pipe_surface_reference(&llvmpipe->framebuffer.cbufs[i], NULL); } pipe_surface_reference(&llvmpipe->framebuffer.zsbuf, NULL); for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { pipe_sampler_view_reference(&llvmpipe->fragment_sampler_views[i], NULL); } for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { pipe_sampler_view_reference(&llvmpipe->vertex_sampler_views[i], NULL); } for (i = 0; i < Elements(llvmpipe->constants); i++) { for (j = 0; j < Elements(llvmpipe->constants[i]); j++) { pipe_resource_reference(&llvmpipe->constants[i][j], NULL); } } for (i = 0; i < llvmpipe->num_vertex_buffers; i++) { pipe_resource_reference(&llvmpipe->vertex_buffer[i].buffer, NULL); } lp_delete_setup_variants(llvmpipe); align_free( llvmpipe ); }
static void nvc0_destroy(struct pipe_context *pipe) { struct nvc0_context *nvc0 = nvc0_context(pipe); if (nvc0->screen->cur_ctx == nvc0) nvc0->screen->cur_ctx = NULL; /* Unset bufctx, we don't want to revalidate any resources after the flush. * Other contexts will always set their bufctx again on action calls. */ nouveau_pushbuf_bufctx(nvc0->base.pushbuf, NULL); nouveau_pushbuf_kick(nvc0->base.pushbuf, nvc0->base.pushbuf->channel); nvc0_context_unreference_resources(nvc0); nvc0_blitctx_destroy(nvc0); #ifdef NVC0_WITH_DRAW_MODULE draw_destroy(nvc0->draw); #endif nouveau_context_destroy(&nvc0->base); }
struct draw_context *draw_create( struct pipe_context *pipe ) { struct draw_context *draw = CALLOC_STRUCT( draw_context ); if (draw == NULL) goto fail; ASSIGN_4V( draw->plane[0], -1, 0, 0, 1 ); ASSIGN_4V( draw->plane[1], 1, 0, 0, 1 ); ASSIGN_4V( draw->plane[2], 0, -1, 0, 1 ); ASSIGN_4V( draw->plane[3], 0, 1, 0, 1 ); ASSIGN_4V( draw->plane[4], 0, 0, 1, 1 ); /* yes these are correct */ ASSIGN_4V( draw->plane[5], 0, 0, -1, 1 ); /* mesa's a bit wonky */ draw->nr_planes = 6; draw->reduced_prim = ~0; /* != any of PIPE_PRIM_x */ if (!draw_pipeline_init( draw )) goto fail; if (!draw_pt_init( draw )) goto fail; if (!draw_vs_init( draw )) goto fail; if (!draw_gs_init( draw )) goto fail; draw->pipe = pipe; return draw; fail: draw_destroy( draw ); return NULL; }
boolean svga_init_swtnl( struct svga_context *svga ) { svga->swtnl.backend = svga_vbuf_render_create(svga); if(!svga->swtnl.backend) goto fail; /* * Create drawing context and plug our rendering stage into it. */ svga->swtnl.draw = draw_create(&svga->pipe); if (svga->swtnl.draw == NULL) goto fail; draw_set_rasterize_stage(svga->swtnl.draw, draw_vbuf_stage( svga->swtnl.draw, svga->swtnl.backend )); draw_set_render(svga->swtnl.draw, svga->swtnl.backend); draw_install_aaline_stage(svga->swtnl.draw, &svga->pipe); draw_install_aapoint_stage(svga->swtnl.draw, &svga->pipe); draw_install_pstipple_stage(svga->swtnl.draw, &svga->pipe); if (debug_get_bool_option("SVGA_SWTNL_FSE", FALSE)) draw_set_driver_clipping(svga->swtnl.draw, TRUE, TRUE, TRUE); return TRUE; fail: if (svga->swtnl.backend) svga->swtnl.backend->destroy( svga->swtnl.backend ); if (svga->swtnl.draw) draw_destroy( svga->swtnl.draw ); return FALSE; }
/** * Create new draw module context with gallivm state for LLVM JIT. */ struct draw_context * draw_create_gallivm(struct pipe_context *pipe, struct gallivm_state *gallivm) { struct draw_context *draw = CALLOC_STRUCT( draw_context ); if (draw == NULL) goto fail; #if HAVE_LLVM if (draw_get_option_use_llvm() && gallivm) { draw->llvm = draw_llvm_create(draw, gallivm); } #endif if (!draw_init(draw)) goto fail; draw->pipe = pipe; return draw; fail: draw_destroy( draw ); return NULL; }
void svga_destroy_swtnl( struct svga_context *svga ) { draw_destroy( svga->swtnl.draw ); }
void st_destroy_draw(struct st_context *st) { draw_destroy(st->draw); }
static void softpipe_destroy( struct pipe_context *pipe ) { struct softpipe_context *softpipe = softpipe_context( pipe ); uint i; #if DO_PSTIPPLE_IN_HELPER_MODULE if (softpipe->pstipple.sampler) pipe->delete_sampler_state(pipe, softpipe->pstipple.sampler); pipe_resource_reference(&softpipe->pstipple.texture, NULL); pipe_sampler_view_reference(&softpipe->pstipple.sampler_view, NULL); #endif if (softpipe->draw) draw_destroy( softpipe->draw ); if (softpipe->quad.shade) softpipe->quad.shade->destroy( softpipe->quad.shade ); if (softpipe->quad.depth_test) softpipe->quad.depth_test->destroy( softpipe->quad.depth_test ); if (softpipe->quad.blend) softpipe->quad.blend->destroy( softpipe->quad.blend ); if (softpipe->quad.pstipple) softpipe->quad.pstipple->destroy( softpipe->quad.pstipple ); for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { sp_destroy_tile_cache(softpipe->cbuf_cache[i]); pipe_surface_reference(&softpipe->framebuffer.cbufs[i], NULL); } sp_destroy_tile_cache(softpipe->zsbuf_cache); pipe_surface_reference(&softpipe->framebuffer.zsbuf, NULL); for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { sp_destroy_tex_tile_cache(softpipe->fragment_tex_cache[i]); pipe_sampler_view_reference(&softpipe->fragment_sampler_views[i], NULL); } for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { sp_destroy_tex_tile_cache(softpipe->vertex_tex_cache[i]); pipe_sampler_view_reference(&softpipe->vertex_sampler_views[i], NULL); } for (i = 0; i < PIPE_MAX_GEOMETRY_SAMPLERS; i++) { sp_destroy_tex_tile_cache(softpipe->geometry_tex_cache[i]); pipe_sampler_view_reference(&softpipe->geometry_sampler_views[i], NULL); } for (i = 0; i < PIPE_SHADER_TYPES; i++) { uint j; for (j = 0; j < PIPE_MAX_CONSTANT_BUFFERS; j++) { if (softpipe->constants[i][j]) { pipe_resource_reference(&softpipe->constants[i][j], NULL); } } } for (i = 0; i < softpipe->num_vertex_buffers; i++) { pipe_resource_reference(&softpipe->vertex_buffer[i].buffer, NULL); } tgsi_exec_machine_destroy(softpipe->fs_machine); FREE( softpipe ); }
boolean svga_init_swtnl( struct svga_context *svga ) { struct svga_screen *screen = svga_screen(svga->pipe.screen); svga->swtnl.backend = svga_vbuf_render_create(svga); if(!svga->swtnl.backend) goto fail; /* * Create drawing context and plug our rendering stage into it. */ svga->swtnl.draw = draw_create(&svga->pipe); if (svga->swtnl.draw == NULL) goto fail; draw_set_rasterize_stage(svga->swtnl.draw, draw_vbuf_stage( svga->swtnl.draw, svga->swtnl.backend )); draw_set_render(svga->swtnl.draw, svga->swtnl.backend); svga->blitter = util_blitter_create(&svga->pipe); if (!svga->blitter) goto fail; /* must be done before installing Draw stages */ util_blitter_cache_all_shaders(svga->blitter); if (!screen->haveLineSmooth) draw_install_aaline_stage(svga->swtnl.draw, &svga->pipe); /* always install polygon stipple stage */ draw_install_pstipple_stage(svga->swtnl.draw, &svga->pipe); /* enable/disable line stipple stage depending on device caps */ draw_enable_line_stipple(svga->swtnl.draw, !screen->haveLineStipple); /* always install AA point stage */ draw_install_aapoint_stage(svga->swtnl.draw, &svga->pipe); /* Set wide line threshold above device limit (so we'll never really use it) */ draw_wide_line_threshold(svga->swtnl.draw, MAX2(screen->maxLineWidth, screen->maxLineWidthAA)); if (debug_get_bool_option("SVGA_SWTNL_FSE", FALSE)) draw_set_driver_clipping(svga->swtnl.draw, TRUE, TRUE, TRUE, FALSE); return TRUE; fail: if (svga->blitter) util_blitter_destroy(svga->blitter); if (svga->swtnl.backend) svga->swtnl.backend->destroy( svga->swtnl.backend ); if (svga->swtnl.draw) draw_destroy( svga->swtnl.draw ); return FALSE; }
static void softpipe_destroy( struct pipe_context *pipe ) { struct softpipe_context *softpipe = softpipe_context( pipe ); uint i, sh; #if DO_PSTIPPLE_IN_HELPER_MODULE if (softpipe->pstipple.sampler) pipe->delete_sampler_state(pipe, softpipe->pstipple.sampler); pipe_resource_reference(&softpipe->pstipple.texture, NULL); pipe_sampler_view_reference(&softpipe->pstipple.sampler_view, NULL); #endif if (softpipe->blitter) { util_blitter_destroy(softpipe->blitter); } if (softpipe->draw) draw_destroy( softpipe->draw ); if (softpipe->quad.shade) softpipe->quad.shade->destroy( softpipe->quad.shade ); if (softpipe->quad.depth_test) softpipe->quad.depth_test->destroy( softpipe->quad.depth_test ); if (softpipe->quad.blend) softpipe->quad.blend->destroy( softpipe->quad.blend ); if (softpipe->quad.pstipple) softpipe->quad.pstipple->destroy( softpipe->quad.pstipple ); for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { sp_destroy_tile_cache(softpipe->cbuf_cache[i]); pipe_surface_reference(&softpipe->framebuffer.cbufs[i], NULL); } sp_destroy_tile_cache(softpipe->zsbuf_cache); pipe_surface_reference(&softpipe->framebuffer.zsbuf, NULL); for (sh = 0; sh < Elements(softpipe->tex_cache); sh++) { for (i = 0; i < Elements(softpipe->tex_cache[0]); i++) { sp_destroy_tex_tile_cache(softpipe->tex_cache[sh][i]); pipe_sampler_view_reference(&softpipe->sampler_views[sh][i], NULL); } } for (sh = 0; sh < Elements(softpipe->constants); sh++) { for (i = 0; i < Elements(softpipe->constants[0]); i++) { if (softpipe->constants[sh][i]) { pipe_resource_reference(&softpipe->constants[sh][i], NULL); } } } for (i = 0; i < softpipe->num_vertex_buffers; i++) { pipe_resource_reference(&softpipe->vertex_buffer[i].buffer, NULL); } tgsi_exec_machine_destroy(softpipe->fs_machine); for (i = 0; i < PIPE_SHADER_TYPES; i++) { FREE(softpipe->tgsi.sampler[i]); FREE(softpipe->tgsi.image[i]); FREE(softpipe->tgsi.buffer[i]); } FREE( softpipe ); }