struct pipe_context * fd_context_create(struct pipe_screen *pscreen, void *priv) { struct fd_screen *screen = fd_screen(pscreen); struct fd_context *ctx = CALLOC_STRUCT(fd_context); struct pipe_context *pctx; if (!ctx) return NULL; DBG(""); ctx->screen = screen; ctx->ring = fd_ringbuffer_new(screen->pipe, 0x100000); ctx->draw_start = fd_ringmarker_new(ctx->ring); ctx->draw_end = fd_ringmarker_new(ctx->ring); pctx = &ctx->base; pctx->screen = pscreen; pctx->priv = priv; pctx->flush = fd_context_flush; pctx->destroy = fd_context_destroy; util_slab_create(&ctx->transfer_pool, sizeof(struct pipe_transfer), 16, UTIL_SLAB_SINGLETHREADED); fd_vbo_init(pctx); fd_blend_init(pctx); fd_rasterizer_init(pctx); fd_zsa_init(pctx); fd_state_init(pctx); fd_resource_context_init(pctx); fd_clear_init(pctx); fd_prog_init(pctx); fd_texture_init(pctx); ctx->blitter = util_blitter_create(pctx); if (!ctx->blitter) { fd_context_destroy(pctx); return NULL; } /* construct vertex state used for solid ops (clear, and gmem<->mem) */ ctx->solid_vertexbuf = create_solid_vertexbuf(pctx); fd_state_emit_setup(pctx); return pctx; }
static void fd3_context_destroy(struct pipe_context *pctx) { struct fd3_context *fd3_ctx = fd3_context(fd_context(pctx)); util_dynarray_fini(&fd3_ctx->rbrc_patches); fd_bo_del(fd3_ctx->vs_pvt_mem); fd_bo_del(fd3_ctx->fs_pvt_mem); fd_bo_del(fd3_ctx->vsc_size_mem); pipe_resource_reference(&fd3_ctx->solid_vbuf, NULL); pipe_resource_reference(&fd3_ctx->blit_texcoord_vbuf, NULL); fd_context_destroy(pctx); }
static void fd5_context_destroy(struct pipe_context *pctx) { struct fd5_context *fd5_ctx = fd5_context(fd_context(pctx)); fd_bo_del(fd5_ctx->vs_pvt_mem); fd_bo_del(fd5_ctx->fs_pvt_mem); fd_bo_del(fd5_ctx->vsc_size_mem); fd_bo_del(fd5_ctx->blit_mem); fd_context_cleanup_common_vbos(&fd5_ctx->base); u_upload_destroy(fd5_ctx->border_color_uploader); fd_context_destroy(pctx); }
static void fd4_context_destroy(struct pipe_context *pctx) { struct fd4_context *fd4_ctx = fd4_context(fd_context(pctx)); fd_bo_del(fd4_ctx->vs_pvt_mem); fd_bo_del(fd4_ctx->fs_pvt_mem); fd_bo_del(fd4_ctx->vsc_size_mem); pctx->delete_vertex_elements_state(pctx, fd4_ctx->solid_vbuf_state.vtx); pctx->delete_vertex_elements_state(pctx, fd4_ctx->blit_vbuf_state.vtx); pipe_resource_reference(&fd4_ctx->solid_vbuf, NULL); pipe_resource_reference(&fd4_ctx->blit_texcoord_vbuf, NULL); u_upload_destroy(fd4_ctx->border_color_uploader); fd_context_destroy(pctx); }
static void fd2_context_destroy(struct pipe_context *pctx) { fd_context_destroy(pctx); }