Added pipe field to pipe_texture (temporary, see comments).
First step toward context-less texture creation...
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);
{
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;
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))
{
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;
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);
spt->base = *templat;
spt->base.refcount = 1;
+ spt->base.pipe = pipe;
softpipe_texture_layout(spt);
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);
* \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);
pt->refcount++;
if (*ptr) {
+ struct pipe_context *pipe = (*ptr)->pipe;
pipe->texture_release(pipe, ptr);
assert(!*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
/* 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;
};
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);
}
stImage->base.Data = NULL;
}
- pipe_texture_reference(st->pipe, &stImage->pt, stObj->pt);
+ pipe_texture_reference(&stImage->pt, stObj->pt);
}
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) {