[g3dvl] remove texture dependencies from mc code
authorChristian König <deathsimple@vodafone.de>
Sun, 27 Mar 2011 18:41:43 +0000 (20:41 +0200)
committerChristian König <deathsimple@vodafone.de>
Sun, 27 Mar 2011 18:41:43 +0000 (20:41 +0200)
src/gallium/auxiliary/vl/vl_mpeg12_context.c
src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h

index 004d79d732462663d07142aef5407f18192fda75..6388b3e23cbfdefa84c87b4c639cb04a3e459ef7 100644 (file)
@@ -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;
    }
index 60d61abbf2a3f627b72ca0edfff09cf580c6e16a..d2ed7470598001159b4f496c08a28c227959c92c 100644 (file)
@@ -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
index 29a548ef70d2a40337e9ccb3b395bb9e4c6935d4..0bb17ef487b691cbd3bef0cbe6020c682cee4bcc 100644 (file)
@@ -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);