Squashed commit of the following:
[mesa.git] / src / mesa / state_tracker / st_atom_pixeltransfer.c
index 0b2e3f53812861a2ec87899642287bd7e4e9ddce..4aac5bd97fe15a627f7169ed65efe465e453913b 100644 (file)
@@ -112,21 +112,21 @@ make_state_key(GLcontext *ctx,  struct state_key *key)
 }
 
 
-static struct pipe_texture *
+static struct pipe_resource *
 create_color_map_texture(GLcontext *ctx)
 {
    struct pipe_context *pipe = ctx->st->pipe;
-   struct pipe_texture *pt;
+   struct pipe_resource *pt;
    enum pipe_format format;
    const uint texSize = 256; /* simple, and usually perfect */
 
    /* find an RGBA texture format */
    format = st_choose_format(pipe->screen, GL_RGBA,
-                             PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER);
+                             PIPE_TEXTURE_2D, PIPE_BIND_SAMPLER_VIEW);
 
    /* create texture for color map/table */
    pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, format, 0,
-                          texSize, texSize, 1, PIPE_TEXTURE_USAGE_SAMPLER);
+                          texSize, texSize, 1, PIPE_BIND_SAMPLER_VIEW);
    return pt;
 }
 
@@ -135,10 +135,9 @@ create_color_map_texture(GLcontext *ctx)
  * Update the pixelmap texture with the contents of the R/G/B/A pixel maps.
  */
 static void
-load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt)
+load_color_map_texture(GLcontext *ctx, struct pipe_resource *pt)
 {
    struct pipe_context *pipe = ctx->st->pipe;
-   struct pipe_screen *screen = pipe->screen;
    struct pipe_transfer *transfer;
    const GLuint rSize = ctx->PixelMaps.RtoR.Size;
    const GLuint gSize = ctx->PixelMaps.GtoG.Size;
@@ -151,7 +150,7 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt)
    transfer = st_cond_flush_get_tex_transfer(st_context(ctx),
                                             pt, 0, 0, 0, PIPE_TRANSFER_WRITE,
                                             0, 0, texSize, texSize);
-   dest = (uint *) screen->transfer_map(screen, transfer);
+   dest = (uint *) pipe_transfer_map(pipe, transfer);
 
    /* Pack four 1D maps into a 2D texture:
     * R map is placed horizontally, indexed by S, in channel 0
@@ -172,8 +171,8 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt)
       }
    }
 
-   screen->transfer_unmap(screen, transfer);
-   screen->tex_transfer_destroy(transfer);
+   pipe_transfer_unmap(pipe, transfer);
+   pipe->transfer_destroy(pipe, transfer);
 }
 
 
@@ -257,6 +256,8 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key)
       /* create the colormap/texture now if not already done */
       if (!st->pixel_xfer.pixelmap_texture) {
          st->pixel_xfer.pixelmap_texture = create_color_map_texture(ctx);
+         st->pixel_xfer.pixelmap_sampler_view = st_sampler_view_from_texture(ctx->st->pipe,
+                                                                             st->pixel_xfer.pixelmap_texture);
       }
 
       /* with a little effort, we can do four pixel map look-ups with