gallium: remove pipe parameter from pipe_texture_reference()
Added pipe field to pipe_texture (temporary, see comments). First step toward context-less texture creation...
This commit is contained in:
parent
a6044bdf74
commit
4da19dbcaa
|
@ -242,8 +242,7 @@ cell_set_sampler_texture(struct pipe_context *pipe,
|
||||||
|
|
||||||
draw_flush(cell->draw);
|
draw_flush(cell->draw);
|
||||||
|
|
||||||
pipe_texture_reference(pipe,
|
pipe_texture_reference((struct pipe_texture **) &cell->texture[sampler],
|
||||||
(struct pipe_texture **) &cell->texture[sampler],
|
|
||||||
texture);
|
texture);
|
||||||
|
|
||||||
cell_update_texture_mapping(cell);
|
cell_update_texture_mapping(cell);
|
||||||
|
|
|
@ -532,8 +532,7 @@ static void i915_set_sampler_texture(struct pipe_context *pipe,
|
||||||
{
|
{
|
||||||
struct i915_context *i915 = i915_context(pipe);
|
struct i915_context *i915 = i915_context(pipe);
|
||||||
|
|
||||||
pipe_texture_reference(pipe,
|
pipe_texture_reference((struct pipe_texture **) &i915->texture[sampler],
|
||||||
(struct pipe_texture **) &i915->texture[sampler],
|
|
||||||
texture);
|
texture);
|
||||||
|
|
||||||
i915->dirty |= I915_NEW_TEXTURE;
|
i915->dirty |= I915_NEW_TEXTURE;
|
||||||
|
|
|
@ -489,6 +489,7 @@ i915_texture_create(struct pipe_context *pipe,
|
||||||
|
|
||||||
tex->base = *templat;
|
tex->base = *templat;
|
||||||
tex->base.refcount = 1;
|
tex->base.refcount = 1;
|
||||||
|
tex->base.pipe = pipe;
|
||||||
|
|
||||||
if (i915->flags.is_i945 ? i945_miptree_layout(pipe, tex) :
|
if (i915->flags.is_i945 ? i945_miptree_layout(pipe, tex) :
|
||||||
i915_miptree_layout(pipe, tex))
|
i915_miptree_layout(pipe, tex))
|
||||||
|
|
|
@ -328,8 +328,7 @@ static void brw_set_sampler_texture(struct pipe_context *pipe,
|
||||||
{
|
{
|
||||||
struct brw_context *brw = brw_context(pipe);
|
struct brw_context *brw = brw_context(pipe);
|
||||||
|
|
||||||
pipe_texture_reference(pipe,
|
pipe_texture_reference((struct pipe_texture **) &brw->attribs.Texture[unit],
|
||||||
(struct pipe_texture **) &brw->attribs.Texture[unit],
|
|
||||||
texture);
|
texture);
|
||||||
|
|
||||||
brw->state.dirty.brw |= BRW_NEW_TEXTURE;
|
brw->state.dirty.brw |= BRW_NEW_TEXTURE;
|
||||||
|
|
|
@ -83,7 +83,7 @@ softpipe_set_sampler_texture(struct pipe_context *pipe,
|
||||||
draw_flush(softpipe->draw);
|
draw_flush(softpipe->draw);
|
||||||
|
|
||||||
assert(unit < PIPE_MAX_SAMPLERS);
|
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);
|
sp_tile_cache_set_texture(pipe, softpipe->tex_cache[unit], texture);
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,7 @@ softpipe_texture_create(struct pipe_context *pipe,
|
||||||
|
|
||||||
spt->base = *templat;
|
spt->base = *templat;
|
||||||
spt->base.refcount = 1;
|
spt->base.refcount = 1;
|
||||||
|
spt->base.pipe = pipe;
|
||||||
|
|
||||||
softpipe_texture_layout(spt);
|
softpipe_texture_layout(spt);
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,7 @@ sp_tile_cache_set_texture(struct pipe_context *pipe,
|
||||||
|
|
||||||
assert(!tc->surface);
|
assert(!tc->surface);
|
||||||
|
|
||||||
pipe_texture_reference(pipe, &tc->texture, texture);
|
pipe_texture_reference(&tc->texture, texture);
|
||||||
|
|
||||||
if (tc->tex_surf_map) {
|
if (tc->tex_surf_map) {
|
||||||
pipe_surface_unmap(tc->tex_surf);
|
pipe_surface_unmap(tc->tex_surf);
|
||||||
|
|
|
@ -97,7 +97,7 @@ pipe_buffer_reference(struct pipe_winsys *winsys,
|
||||||
* \sa pipe_surface_reference
|
* \sa pipe_surface_reference
|
||||||
*/
|
*/
|
||||||
static INLINE void
|
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)
|
struct pipe_texture *pt)
|
||||||
{
|
{
|
||||||
assert(ptr);
|
assert(ptr);
|
||||||
|
@ -106,6 +106,7 @@ pipe_texture_reference(struct pipe_context *pipe, struct pipe_texture **ptr,
|
||||||
pt->refcount++;
|
pt->refcount++;
|
||||||
|
|
||||||
if (*ptr) {
|
if (*ptr) {
|
||||||
|
struct pipe_context *pipe = (*ptr)->pipe;
|
||||||
pipe->texture_release(pipe, ptr);
|
pipe->texture_release(pipe, ptr);
|
||||||
assert(!*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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -296,6 +296,11 @@ struct pipe_texture
|
||||||
/* These are also refcounted:
|
/* These are also refcounted:
|
||||||
*/
|
*/
|
||||||
unsigned refcount;
|
unsigned refcount;
|
||||||
|
|
||||||
|
/**< pipe that created the texture
|
||||||
|
* XXX this'll change to a pipe_winsys (or pipe_screen)...
|
||||||
|
*/
|
||||||
|
struct pipe_context *pipe;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -573,7 +573,7 @@ st_TexImage(GLcontext * ctx,
|
||||||
st_texture_match_image(stObj->pt, &stImage->base,
|
st_texture_match_image(stObj->pt, &stImage->base,
|
||||||
stImage->face, stImage->level)) {
|
stImage->face, stImage->level)) {
|
||||||
|
|
||||||
pipe_texture_reference(ctx->st->pipe, &stImage->pt, stObj->pt);
|
pipe_texture_reference(&stImage->pt, stObj->pt);
|
||||||
assert(stImage->pt);
|
assert(stImage->pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1371,7 +1371,7 @@ copy_image_data_to_texture(struct st_context *st,
|
||||||
stImage->base.Data = NULL;
|
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)
|
if (stObj->pt)
|
||||||
ctx->st->pipe->texture_release(ctx->st->pipe, &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) {
|
if (firstImage->base.IsCompressed) {
|
||||||
|
|
Loading…
Reference in New Issue