gallium: remove pipe parameter from pipe_texture_reference()
authorBrian <brian@i915.localnet.net>
Wed, 27 Feb 2008 02:31:22 +0000 (19:31 -0700)
committerBrian <brian@i915.localnet.net>
Wed, 27 Feb 2008 02:31:22 +0000 (19:31 -0700)
Added pipe field to pipe_texture (temporary, see comments).
First step toward context-less texture creation...

src/gallium/drivers/cell/ppu/cell_pipe_state.c
src/gallium/drivers/i915simple/i915_state.c
src/gallium/drivers/i915simple/i915_texture.c
src/gallium/drivers/i965simple/brw_state.c
src/gallium/drivers/softpipe/sp_state_sampler.c
src/gallium/drivers/softpipe/sp_texture.c
src/gallium/drivers/softpipe/sp_tile_cache.c
src/gallium/include/pipe/p_inlines.h
src/gallium/include/pipe/p_state.h
src/mesa/state_tracker/st_cb_texture.c

index 95bfc29fbeb0316390f73102f03bc4b66ad52235..075e0a0c471bf2a5a50583df3a6e3aa303aa1ad0 100644 (file)
@@ -242,8 +242,7 @@ cell_set_sampler_texture(struct pipe_context *pipe,
 
    draw_flush(cell->draw);
 
-   pipe_texture_reference(pipe,
-                          (struct pipe_texture **) &cell->texture[sampler],
+   pipe_texture_reference((struct pipe_texture **) &cell->texture[sampler],
                           texture);
 
    cell_update_texture_mapping(cell);
index 9df0e1254069026ea93efeb5a861d2c628ea35f5..27af46bea033cfadfdb791cca0bb7a6e86930fb3 100644 (file)
@@ -532,8 +532,7 @@ static void i915_set_sampler_texture(struct pipe_context *pipe,
 {
    struct i915_context *i915 = i915_context(pipe);
 
-   pipe_texture_reference(pipe,
-                          (struct pipe_texture **) &i915->texture[sampler],
+   pipe_texture_reference((struct pipe_texture **) &i915->texture[sampler],
                           texture);
 
    i915->dirty |= I915_NEW_TEXTURE;
index 1b415a94d4094a30b2ba14a8105381753c96b49a..7fcf4332e14a304189673967c1d41727c607e302 100644 (file)
@@ -489,6 +489,7 @@ i915_texture_create(struct pipe_context *pipe,
 
       tex->base = *templat;
       tex->base.refcount = 1;
+      tex->base.pipe = pipe;
 
       if (i915->flags.is_i945 ? i945_miptree_layout(pipe, tex) :
          i915_miptree_layout(pipe, tex))
index 2fc048bde00ea796743845d501db6c7ce579822d..7466fdc403dbea5460fadbdaecf2edfa37f56143 100644 (file)
@@ -328,8 +328,7 @@ static void brw_set_sampler_texture(struct pipe_context *pipe,
 {
    struct brw_context *brw = brw_context(pipe);
 
-   pipe_texture_reference(pipe,
-                          (struct pipe_texture **) &brw->attribs.Texture[unit],
+   pipe_texture_reference((struct pipe_texture **) &brw->attribs.Texture[unit],
                           texture);
 
    brw->state.dirty.brw |= BRW_NEW_TEXTURE;
index 18669a1c6ef9445417f2ff5c7ee4015e69574d75..1d6dd17d1d979d393e2a35784a021048c6f0f9f2 100644 (file)
@@ -83,7 +83,7 @@ softpipe_set_sampler_texture(struct pipe_context *pipe,
    draw_flush(softpipe->draw);
 
    assert(unit < PIPE_MAX_SAMPLERS);
-   pipe_texture_reference(pipe, &softpipe->texture[unit], texture);
+   pipe_texture_reference(&softpipe->texture[unit], texture);
 
    sp_tile_cache_set_texture(pipe, softpipe->tex_cache[unit], texture);
 
index 6ba0f09e0a1269b00b7bec6eb52b6a2aa58d1a26..a96447fa7a1f9c7a9fe5b50da9389805d65914ad 100644 (file)
@@ -90,6 +90,7 @@ softpipe_texture_create(struct pipe_context *pipe,
 
    spt->base = *templat;
    spt->base.refcount = 1;
+   spt->base.pipe = pipe;
 
    softpipe_texture_layout(spt);
 
index da30dd6c4847f8ebbf2c901cf0fe995b08ff327f..0ff93c55277e3f6888b7ceebe0c2aa71ddd47622 100644 (file)
@@ -220,7 +220,7 @@ sp_tile_cache_set_texture(struct pipe_context *pipe,
 
    assert(!tc->surface);
 
-   pipe_texture_reference(pipe, &tc->texture, texture);
+   pipe_texture_reference(&tc->texture, texture);
 
    if (tc->tex_surf_map) {
       pipe_surface_unmap(tc->tex_surf);
index de3fa555c5c310e863d33a89ba73cb4a21796e66..21d4827e675e2f6375552db57bbcaaf153a51d2e 100644 (file)
@@ -97,7 +97,7 @@ pipe_buffer_reference(struct pipe_winsys *winsys,
  * \sa pipe_surface_reference
  */
 static INLINE void
-pipe_texture_reference(struct pipe_context *pipe, struct pipe_texture **ptr,
+pipe_texture_reference(struct pipe_texture **ptr,
                       struct pipe_texture *pt)
 {
    assert(ptr);
@@ -106,6 +106,7 @@ pipe_texture_reference(struct pipe_context *pipe, struct pipe_texture **ptr,
       pt->refcount++;
 
    if (*ptr) {
+      struct pipe_context *pipe = (*ptr)->pipe;
       pipe->texture_release(pipe, ptr);
       assert(!*ptr);
    }
@@ -114,6 +115,17 @@ pipe_texture_reference(struct pipe_context *pipe, struct pipe_texture **ptr,
 }
 
 
+static INLINE void
+pipe_texture_release(struct pipe_texture **ptr)
+{
+   struct pipe_context *pipe;
+   assert(ptr);
+   pipe = (*ptr)->pipe;
+   pipe->texture_release(pipe, ptr);
+   *ptr = NULL;
+}
+
+
 #ifdef __cplusplus
 }
 #endif
index ddf3c1c79bf53d48c7939e100c030e10c11bbfa6..25a6fcc9e63c4f1f663962a7d7a4f1b6ee13f38d 100644 (file)
@@ -296,6 +296,11 @@ struct pipe_texture
    /* These are also refcounted:
     */
    unsigned refcount;
+
+   /**< pipe that created the texture
+    * XXX this'll change to a pipe_winsys (or pipe_screen)...
+    */
+   struct pipe_context *pipe;
 };
 
 
index 778fb536bc74fdbf9f97d400f796ea201846d4e3..f5f956f6eadec8a0bfd61a938f0adaee39f84f85 100644 (file)
@@ -573,7 +573,7 @@ st_TexImage(GLcontext * ctx,
        st_texture_match_image(stObj->pt, &stImage->base,
                                  stImage->face, stImage->level)) {
 
-      pipe_texture_reference(ctx->st->pipe, &stImage->pt, stObj->pt);
+      pipe_texture_reference(&stImage->pt, stObj->pt);
       assert(stImage->pt);
    }
 
@@ -1371,7 +1371,7 @@ copy_image_data_to_texture(struct st_context *st,
       stImage->base.Data = NULL;
    }
 
-   pipe_texture_reference(st->pipe, &stImage->pt, stObj->pt);
+   pipe_texture_reference(&stImage->pt, stObj->pt);
 }
 
 
@@ -1426,7 +1426,7 @@ st_finalize_texture(GLcontext *ctx,
       if (stObj->pt)
          ctx->st->pipe->texture_release(ctx->st->pipe, &stObj->pt);
 
-      pipe_texture_reference(ctx->st->pipe, &stObj->pt, firstImage->pt);
+      pipe_texture_reference(&stObj->pt, firstImage->pt);
    }
 
    if (firstImage->base.IsCompressed) {