/* textures */
cell->pipe.texture_create = cell_texture_create;
cell->pipe.texture_release = cell_texture_release;
+ cell->pipe.texture_update = cell_texture_update;
cell->pipe.get_tex_surface = cell_get_tex_surface;
cell->pipe.set_sampler_texture = cell_set_sampler_texture;
}
+void
+cell_texture_update(struct pipe_context *pipe, struct pipe_texture *texture)
+{
+ /* XXX TO DO: re-tile the texture data ... */
+
+}
+
+
/**
* Called via pipe->get_tex_surface()
*/
extern void
cell_texture_release(struct pipe_context *pipe, struct pipe_texture **pt);
+extern void
+cell_texture_update(struct pipe_context *pipe, struct pipe_texture *texture);
+
extern struct pipe_surface *
cell_get_tex_surface(struct pipe_context *pipe,
struct pipe_texture *pt,
failover_init_state_functions( failover );
-#if 0
- failover->pipe.surface_alloc = hw->surface_alloc;
-#endif
- failover->pipe.get_tex_surface = hw->get_tex_surface;
-
failover->pipe.surface_copy = hw->surface_copy;
failover->pipe.surface_fill = hw->surface_fill;
+
failover->pipe.texture_create = hw->texture_create;
failover->pipe.texture_release = hw->texture_release;
+ failover->pipe.texture_update = hw->texture_update;
+ failover->pipe.get_tex_surface = hw->get_tex_surface;
+
failover->pipe.flush = hw->flush;
failover->dirty = 0;
i915->pipe.texture_create = i915_texture_create;
i915->pipe.texture_release = i915_texture_release;
+ i915->pipe.texture_update = i915_texture_update;
i915->dirty = ~0;
i915->hardware_dirty = ~0;
}
*pt = NULL;
}
+
+
+void
+i915_texture_update(struct pipe_context *pipe, struct pipe_texture *texture)
+{
+ /* no-op? */
+}
i915_texture_release(struct pipe_context *pipe, struct pipe_texture **pt);
+extern void
+i915_texture_update(struct pipe_context *pipe, struct pipe_texture *texture);
+
+
#endif /* I915_TEXTURE_H */
brw->pipe.clear = brw_clear;
brw->pipe.texture_create = brw_texture_create;
brw->pipe.texture_release = brw_texture_release;
+ brw->pipe.texture_update = brw_texture_update;
brw_init_surface_functions(brw);
brw_init_state_functions(brw);
}
*pt = NULL;
}
+
+
+void
+brw_texture_update(struct pipe_context *pipe, struct pipe_texture *texture)
+{
+ /* no-op? */
+}
+
extern void
brw_texture_release(struct pipe_context *pipe, struct pipe_texture **pt);
+extern void
+brw_texture_update(struct pipe_context *pipe, struct pipe_texture *texture);
+
#endif
/* textures */
softpipe->pipe.texture_create = softpipe_texture_create;
softpipe->pipe.texture_release = softpipe_texture_release;
+ softpipe->pipe.texture_update = softpipe_texture_update;
softpipe->pipe.get_tex_surface = softpipe_get_tex_surface;
/*
#include "sp_context.h"
#include "sp_state.h"
#include "sp_texture.h"
+#include "sp_tile_cache.h"
/* Simple, maximally packed layout.
}
+void
+softpipe_texture_update(struct pipe_context *pipe,
+ struct pipe_texture *texture)
+{
+ struct softpipe_context *softpipe = softpipe_context(pipe);
+ uint unit;
+ for (unit = 0; unit < PIPE_MAX_SAMPLERS; unit++) {
+ if (softpipe->texture[unit] == texture) {
+ sp_flush_tile_cache(softpipe, softpipe->tex_cache[unit]);
+ }
+ }
+}
+
+
/**
* Called via pipe->get_tex_surface()
*/
extern void
softpipe_texture_release(struct pipe_context *pipe, struct pipe_texture **pt);
+extern void
+softpipe_texture_update(struct pipe_context *pipe,
+ struct pipe_texture *texture);
+
extern struct pipe_surface *
softpipe_get_tex_surface(struct pipe_context *pipe,
struct pipe_texture *pt,
struct pipe_surface *ps = tc->surface;
int inuse = 0, pos;
- if (!ps || !ps->buffer)
- return;
-
- for (pos = 0; pos < NUM_ENTRIES; pos++) {
- struct softpipe_cached_tile *tile = tc->entries + pos;
- if (tile->x >= 0) {
- if (tc->depth_stencil) {
- pipe_put_tile_raw(pipe, ps,
- tile->x, tile->y, TILE_SIZE, TILE_SIZE,
- tile->data.depth32, 0/*STRIDE*/);
- }
- else {
- pipe_put_tile_rgba(pipe, ps,
- tile->x, tile->y, TILE_SIZE, TILE_SIZE,
- (float *) tile->data.color);
+ if (ps && ps->buffer) {
+ /* caching a drawing surface */
+ for (pos = 0; pos < NUM_ENTRIES; pos++) {
+ struct softpipe_cached_tile *tile = tc->entries + pos;
+ if (tile->x >= 0) {
+ if (tc->depth_stencil) {
+ pipe_put_tile_raw(pipe, ps,
+ tile->x, tile->y, TILE_SIZE, TILE_SIZE,
+ tile->data.depth32, 0/*STRIDE*/);
+ }
+ else {
+ pipe_put_tile_rgba(pipe, ps,
+ tile->x, tile->y, TILE_SIZE, TILE_SIZE,
+ (float *) tile->data.color);
+ }
+ tile->x = tile->y = -1; /* mark as empty */
+ inuse++;
}
- tile->x = tile->y = -1; /* mark as empty */
- inuse++;
}
- }
#if TILE_CLEAR_OPTIMIZATION
- sp_tile_cache_flush_clear(&softpipe->pipe, tc);
+ sp_tile_cache_flush_clear(&softpipe->pipe, tc);
#endif
+ }
+ else if (tc->texture) {
+ /* caching a texture, mark all entries as embpy */
+ for (pos = 0; pos < NUM_ENTRIES; pos++) {
+ tc->entries[pos].x = -1;
+ }
+ tc->tex_face = -1;
+ }
#if 0
debug_printf("flushed tiles in use: %d\n", inuse);
void (*texture_release)(struct pipe_context *pipe,
struct pipe_texture **pt);
+ /**
+ * Called when texture data is changed.
+ * Note: we could pass some hints about which mip levels or cube faces
+ * have changed...
+ */
+ void (*texture_update)(struct pipe_context *pipe,
+ struct pipe_texture *texture);
+
/** Get a surface which is a "view" into a texture */
struct pipe_surface *(*get_tex_surface)(struct pipe_context *pipe,
struct pipe_texture *texture,
* this table before being deleted, otherwise the pointer
* comparison below could fail.
*/
- if (st->state.sampler_texture[unit] != stObj ||
- (stObj && stObj->dirtyData)) {
+ if (st->state.sampler_texture[unit] != stObj) {
struct pipe_texture *pt = st_get_stobj_texture(stObj);
st->state.sampler_texture[unit] = stObj;
st->pipe->set_sampler_texture(st->pipe, unit, pt);
- if (stObj)
- stObj->dirtyData = GL_FALSE;
}
+
+ stObj = st->state.sampler_texture[unit];
+
+ if (stObj && stObj->dirtyData) {
+ struct pipe_texture *pt = st_get_stobj_texture(stObj);
+ st->pipe->texture_update(st->pipe, pt);
+ stObj->dirtyData = GL_FALSE;
+ }
+
}
}