Ejemplo n.º 1
0
struct pipe_context *
fd2_context_create(struct pipe_screen *pscreen, void *priv)
{
	struct fd2_context *fd2_ctx = CALLOC_STRUCT(fd2_context);
	struct pipe_context *pctx;

	if (!fd2_ctx)
		return NULL;

	pctx = &fd2_ctx->base.base;

	pctx->destroy = fd2_context_destroy;
	pctx->create_blend_state = fd2_blend_state_create;
	pctx->create_rasterizer_state = fd2_rasterizer_state_create;
	pctx->create_depth_stencil_alpha_state = fd2_zsa_state_create;

	fd2_draw_init(pctx);
	fd2_gmem_init(pctx);
	fd2_texture_init(pctx);
	fd2_prog_init(pctx);

	pctx = fd_context_init(&fd2_ctx->base, pscreen, priv);
	if (!pctx)
		return NULL;

	/* construct vertex state used for solid ops (clear, and gmem<->mem) */
	fd2_ctx->solid_vertexbuf = create_solid_vertexbuf(pctx);

	fd2_emit_setup(&fd2_ctx->base);

	return pctx;
}
Ejemplo n.º 2
0
struct pipe_context *
fd2_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
{
	struct fd_screen *screen = fd_screen(pscreen);
	struct fd2_context *fd2_ctx = CALLOC_STRUCT(fd2_context);
	struct pipe_context *pctx;

	if (!fd2_ctx)
		return NULL;

	pctx = &fd2_ctx->base.base;
	pctx->screen = pscreen;

	fd2_ctx->base.dev = fd_device_ref(screen->dev);
	fd2_ctx->base.screen = fd_screen(pscreen);

	pctx->destroy = fd2_context_destroy;
	pctx->create_blend_state = fd2_blend_state_create;
	pctx->create_rasterizer_state = fd2_rasterizer_state_create;
	pctx->create_depth_stencil_alpha_state = fd2_zsa_state_create;

	fd2_draw_init(pctx);
	fd2_gmem_init(pctx);
	fd2_texture_init(pctx);
	fd2_prog_init(pctx);
	fd2_emit_init(pctx);

	pctx = fd_context_init(&fd2_ctx->base, pscreen,
			(screen->gpu_id >= 220) ? a22x_primtypes : a20x_primtypes,
			priv, flags);
	if (!pctx)
		return NULL;

	/* construct vertex state used for solid ops (clear, and gmem<->mem) */
	fd2_ctx->solid_vertexbuf = create_solid_vertexbuf(pctx);

	fd2_query_context_init(pctx);

	return pctx;
}