Squashed commit of the following:
[mesa.git] / src / gallium / auxiliary / draw / draw_pipe_aaline.c
index f4615064e655e66a9eb2415af4bba4182de519eb..3844c04dd3f7a986b2023456a5d64550393b4cca 100644 (file)
@@ -88,7 +88,7 @@ struct aaline_stage
    uint pos_slot;
 
    void *sampler_cso;
-   struct pipe_texture *texture;
+   struct pipe_resource *texture;
    struct pipe_sampler_view *sampler_view;
    uint num_samplers;
    uint num_sampler_views;
@@ -396,7 +396,7 @@ aaline_create_texture(struct aaline_stage *aaline)
 {
    struct pipe_context *pipe = aaline->pipe;
    struct pipe_screen *screen = pipe->screen;
-   struct pipe_texture texTemp;
+   struct pipe_resource texTemp;
    struct pipe_sampler_view viewTempl;
    uint level;
 
@@ -408,7 +408,7 @@ aaline_create_texture(struct aaline_stage *aaline)
    texTemp.height0 = 1 << MAX_TEXTURE_LEVEL;
    texTemp.depth0 = 1;
 
-   aaline->texture = screen->texture_create(screen, &texTemp);
+   aaline->texture = screen->resource_create(screen, &texTemp);
    if (!aaline->texture)
       return FALSE;
 
@@ -428,16 +428,23 @@ aaline_create_texture(struct aaline_stage *aaline)
     */
    for (level = 0; level <= MAX_TEXTURE_LEVEL; level++) {
       struct pipe_transfer *transfer;
+      struct pipe_box box;
       const uint size = u_minify(aaline->texture->width0, level);
       ubyte *data;
       uint i, j;
 
       assert(aaline->texture->width0 == aaline->texture->height0);
 
+      u_box_origin_2d( size, size, &box );
+
       /* This texture is new, no need to flush. 
        */
-      transfer = pipe->get_tex_transfer(pipe, aaline->texture, 0, level, 0,
-                                         PIPE_TRANSFER_WRITE, 0, 0, size, size);
+      transfer = pipe->get_transfer(pipe,
+                                   aaline->texture,
+                                   u_subresource(0, level), 
+                                   PIPE_TRANSFER_WRITE,
+                                   &box);
+
       data = pipe->transfer_map(pipe, transfer);
       if (data == NULL)
          return FALSE;
@@ -463,7 +470,7 @@ aaline_create_texture(struct aaline_stage *aaline)
 
       /* unmap */
       pipe->transfer_unmap(pipe, transfer);
-      pipe->tex_transfer_destroy(pipe, transfer);
+      pipe->transfer_destroy(pipe, transfer);
    }
    return TRUE;
 }
@@ -746,7 +753,7 @@ aaline_destroy(struct draw_stage *stage)
       aaline->pipe->delete_sampler_state(aaline->pipe, aaline->sampler_cso);
 
    if (aaline->texture)
-      pipe_texture_reference(&aaline->texture, NULL);
+      pipe_resource_reference(&aaline->texture, NULL);
 
    if (aaline->sampler_view) {
       pipe_sampler_view_reference(&aaline->sampler_view, NULL);