diff options
author | Marek Olšák <[email protected]> | 2012-11-29 02:55:01 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-11-29 20:31:41 +0100 |
commit | 3e163a137be7f9a80ec720903c4bda028de5681f (patch) | |
tree | f227c113227d2440d700d66bb6fc9dc27d98b9b1 /src/gallium/auxiliary/postprocess/pp_program.c | |
parent | 135fe907a016ec20b6779f6b3a657563e89c1081 (diff) |
gallium/postprocess: share pipe_context and cso_context with the state tracker
Using one context instead of two is more efficient and
we can skip another context flush.
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/postprocess/pp_program.c')
-rw-r--r-- | src/gallium/auxiliary/postprocess/pp_program.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/gallium/auxiliary/postprocess/pp_program.c b/src/gallium/auxiliary/postprocess/pp_program.c index 31e2bee7696..c25078df6f1 100644 --- a/src/gallium/auxiliary/postprocess/pp_program.c +++ b/src/gallium/auxiliary/postprocess/pp_program.c @@ -38,26 +38,22 @@ /** Initialize the internal details */ struct program * -pp_init_prog(struct pp_queue_t *ppq, struct pipe_screen *pscreen) +pp_init_prog(struct pp_queue_t *ppq, struct pipe_context *pipe, + struct cso_context *cso) { - struct program *p; pp_debug("Initializing program\n"); - if (!pscreen) + if (!pipe) return NULL; p = CALLOC(1, sizeof(struct program)); if (!p) return NULL; - p->screen = pscreen; - p->pipe = pscreen->context_create(pscreen, NULL); - - /* XXX this doesn't use the cso_context of the state tracker, but creates - * its own. Having 2 existing cso_contexts use 1 pipe_context may cause - * undefined behavior! */ - p->cso = cso_create_context(p->pipe); + p->screen = pipe->screen; + p->pipe = pipe; + p->cso = cso; { static const float verts[4][2][4] = { @@ -79,7 +75,7 @@ pp_init_prog(struct pp_queue_t *ppq, struct pipe_screen *pscreen) } }; - p->vbuf = pipe_buffer_create(pscreen, PIPE_BIND_VERTEX_BUFFER, + p->vbuf = pipe_buffer_create(pipe->screen, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_STATIC, sizeof(verts)); pipe_buffer_write(p->pipe, p->vbuf, 0, sizeof(verts), verts); } @@ -140,7 +136,5 @@ pp_init_prog(struct pp_queue_t *ppq, struct pipe_screen *pscreen) p->surf.usage = PIPE_BIND_RENDER_TARGET; p->surf.format = PIPE_FORMAT_B8G8R8A8_UNORM; - p->pipe->set_sample_mask(p->pipe, ~0); - return p; } |