diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2011-07-08 10:03:07 +0200 |
---|---|---|
committer | Thomas Hellstrom <thellstrom@vmware.com> | 2011-09-29 20:24:57 +0200 |
commit | 5ec01ba7e85c41fce53ee5c2c3b53036923a0924 (patch) | |
tree | 12e8fda1f08a4d2c7aa5d946fe935a901ae57f46 /src/gallium/state_trackers/xa/xa_yuv.c | |
parent | ed48df84246caa40398ccd6a822cbd9b650f8282 (diff) |
st/xa: surfaces and sampler views are per context
Don't store references to these on the surface but on the context.
References to transfers are still stored on the surface since we allow
only a single map of a surface at a time.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Diffstat (limited to 'src/gallium/state_trackers/xa/xa_yuv.c')
-rw-r--r-- | src/gallium/state_trackers/xa/xa_yuv.c | 43 |
1 files changed, 13 insertions, 30 deletions
diff --git a/src/gallium/state_trackers/xa/xa_yuv.c b/src/gallium/state_trackers/xa/xa_yuv.c index 66cbc5393b5..a5a4010e524 100644 --- a/src/gallium/state_trackers/xa/xa_yuv.c +++ b/src/gallium/state_trackers/xa/xa_yuv.c @@ -71,7 +71,6 @@ xa_yuv_bind_samplers(struct xa_context *r, struct xa_surface *yuv[]) { struct pipe_sampler_state *samplers[3]; struct pipe_sampler_state sampler; - struct pipe_sampler_view *views[3]; struct pipe_sampler_view view_templ; unsigned int i; @@ -86,19 +85,15 @@ xa_yuv_bind_samplers(struct xa_context *r, struct xa_surface *yuv[]) for (i = 0; i < 3; ++i) { samplers[i] = &sampler; - if (!yuv[i]->view) { - u_sampler_view_default_template(&view_templ, - yuv[i]->tex, yuv[i]->tex->format); - - yuv[i]->view = r->pipe->create_sampler_view(r->pipe, - yuv[i]->tex, - &view_templ); - } - views[i] = yuv[i]->view; - } + u_sampler_view_default_template(&view_templ, yuv[i]->tex, + yuv[i]->tex->format); + r->bound_sampler_views[i] = + r->pipe->create_sampler_view(r->pipe, yuv[i]->tex, &view_templ); + } + r->num_bound_samplers = 3; cso_set_samplers(r->cso, 3, (const struct pipe_sampler_state **)samplers); - cso_set_fragment_sampler_views(r->cso, 3, views); + cso_set_fragment_sampler_views(r->cso, 3, r->bound_sampler_views); } static void @@ -110,16 +105,6 @@ xa_yuv_fs_constants(struct xa_context *r, const float conversion_matrix[]) conversion_matrix, param_bytes); } -static void -xa_yuv_destroy_sampler_views(struct xa_surface *yuv[]) -{ - unsigned int i; - - for (i = 0; i < 3; ++i) { - pipe_sampler_view_reference(&yuv[i]->view, NULL); - } -} - extern int xa_yuv_planar_blit(struct xa_context *r, int src_x, @@ -137,18 +122,16 @@ xa_yuv_planar_blit(struct xa_context *r, { float scale_x; float scale_y; - struct pipe_surface srf_templ; + int ret; if (dst_w == 0 || dst_h == 0) return XA_ERR_NONE; - memset(&srf_templ, 0, sizeof(srf_templ)); - u_surface_default_template(&srf_templ, dst->tex, PIPE_BIND_RENDER_TARGET); - dst->srf = r->pipe->create_surface(r->pipe, dst->tex, &srf_templ); - if (!dst->srf) + ret = xa_ctx_srf_create(r, dst); + if (ret != XA_ERR_NONE) return -XA_ERR_NORES; - renderer_bind_destination(r, dst->srf, dst->srf->width, dst->srf->height); + renderer_bind_destination(r, r->srf, r->srf->width, r->srf->height); xa_yuv_bind_blend_state(r); xa_yuv_bind_shaders(r); xa_yuv_bind_samplers(r, yuv); @@ -172,8 +155,8 @@ xa_yuv_planar_blit(struct xa_context *r, r->pipe->flush(r->pipe, &r->last_fence); - xa_yuv_destroy_sampler_views(yuv); - pipe_surface_reference(&dst->srf, NULL); + xa_ctx_sampler_views_destroy(r); + xa_ctx_srf_destroy(r); return XA_ERR_NONE; } |