From f3c9161b15988e90a2f727c8260ac3bff41912fd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20K=C3=B6nig?= Date: Sun, 27 Mar 2011 20:41:43 +0200 Subject: [PATCH] [g3dvl] remove texture dependencies from mc code --- src/gallium/auxiliary/vl/vl_mpeg12_context.c | 4 ++-- .../auxiliary/vl/vl_mpeg12_mc_renderer.c | 22 +++++++------------ .../auxiliary/vl/vl_mpeg12_mc_renderer.h | 8 +------ 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_context.c b/src/gallium/auxiliary/vl/vl_mpeg12_context.c index 004d79d7324..6388b3e23cb 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_context.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_context.c @@ -372,8 +372,8 @@ vl_mpeg12_create_buffer(struct pipe_video_context *vpipe) if(!vl_mpeg12_mc_init_buffer(&ctx->mc_renderer, &buffer->mc, buffer->idct_2_mc.resources.y, - buffer->idct_2_mc.resources.cr, - buffer->idct_2_mc.resources.cb)) { + buffer->idct_2_mc.resources.cb, + buffer->idct_2_mc.resources.cr)) { FREE(buffer); return NULL; } diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index 60d61abbf2a..d2ed7470598 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -539,30 +539,29 @@ vl_mpeg12_mc_renderer_cleanup(struct vl_mpeg12_mc_renderer *renderer) bool vl_mpeg12_mc_init_buffer(struct vl_mpeg12_mc_renderer *renderer, struct vl_mpeg12_mc_buffer *buffer, - struct pipe_resource *y, struct pipe_resource *cr, struct pipe_resource *cb) + struct pipe_resource *y, struct pipe_resource *cb, struct pipe_resource *cr) { struct pipe_sampler_view sampler_view; + struct pipe_resource *res[3]; unsigned i; assert(renderer && buffer); assert(y && cb && cr); - pipe_resource_reference(&buffer->textures.individual.y, y); - pipe_resource_reference(&buffer->textures.individual.cr, cr); - pipe_resource_reference(&buffer->textures.individual.cb, cb); + res[0] = y; + res[1] = cb; + res[2] = cr; for (i = 0; i < 3; ++i) { memset(&sampler_view, 0, sizeof(sampler_view)); - u_sampler_view_default_template(&sampler_view, - buffer->textures.all[i], - buffer->textures.all[i]->format); + u_sampler_view_default_template(&sampler_view, res[i], res[i]->format); sampler_view.swizzle_r = i == 0 ? PIPE_SWIZZLE_RED : PIPE_SWIZZLE_ZERO; sampler_view.swizzle_g = i == 1 ? PIPE_SWIZZLE_RED : PIPE_SWIZZLE_ZERO; sampler_view.swizzle_b = i == 2 ? PIPE_SWIZZLE_RED : PIPE_SWIZZLE_ZERO; sampler_view.swizzle_a = PIPE_SWIZZLE_ONE; buffer->sampler_views.all[i] = renderer->pipe->create_sampler_view( - renderer->pipe, buffer->textures.all[i], &sampler_view); + renderer->pipe, res[i], &sampler_view); if (!buffer->sampler_views.all[i]) goto error_samplers; } @@ -570,10 +569,8 @@ vl_mpeg12_mc_init_buffer(struct vl_mpeg12_mc_renderer *renderer, struct vl_mpeg1 return true; error_samplers: - for (i = 0; i < 3; ++i) { + for (i = 0; i < 3; ++i) pipe_sampler_view_reference(&buffer->sampler_views.all[i], NULL); - pipe_resource_reference(&buffer->textures.all[i], NULL); - } return false; } @@ -587,9 +584,6 @@ vl_mpeg12_mc_cleanup_buffer(struct vl_mpeg12_mc_buffer *buffer) for (i = 0; i < 5; ++i) pipe_sampler_view_reference(&buffer->sampler_views.all[i], NULL); - - for (i = 0; i < 3; ++i) - pipe_resource_reference(&buffer->textures.all[i], NULL); } void diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h index 29a548ef70d..0bb17ef487b 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h @@ -67,12 +67,6 @@ struct vl_mpeg12_mc_buffer struct pipe_sampler_view *all[5]; struct { struct pipe_sampler_view *y, *cb, *cr, *ref[2]; } individual; } sampler_views; - - union - { - struct pipe_resource *all[3]; - struct { struct pipe_resource *y, *cb, *cr; } individual; - } textures; }; bool vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer *renderer, @@ -84,7 +78,7 @@ bool vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer *renderer, void vl_mpeg12_mc_renderer_cleanup(struct vl_mpeg12_mc_renderer *renderer); bool vl_mpeg12_mc_init_buffer(struct vl_mpeg12_mc_renderer *renderer, struct vl_mpeg12_mc_buffer *buffer, - struct pipe_resource *y, struct pipe_resource *cr, struct pipe_resource *cb); + struct pipe_resource *y, struct pipe_resource *cb, struct pipe_resource *cr); void vl_mpeg12_mc_cleanup_buffer(struct vl_mpeg12_mc_buffer *buffer); -- 2.30.2