OSDN Git Service

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 95bfc29..075e0a0 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 9df0e12..27af46b 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 1b415a9..7fcf433 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 2fc048b..7466fdc 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 18669a1..1d6dd17 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 6ba0f09..a96447f 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 da30dd6..0ff93c5 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 de3fa55..21d4827 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 ddf3c1c..25a6fcc 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 778fb53..f5f956f 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) {