free(state);
}
+static void
+fd6_rebind_resource(struct fd_context *ctx, struct fd_resource *rsc)
+{
+ if (!(rsc->dirty & FD_DIRTY_TEX))
+ return;
+
+ struct fd6_context *fd6_ctx = fd6_context(ctx);
+
+ hash_table_foreach (fd6_ctx->tex_cache, entry) {
+ struct fd6_texture_state *state = entry->data;
+
+ for (unsigned i = 0; i < ARRAY_SIZE(state->key.view); i++) {
+ if (rsc->seqno == state->key.view[i].rsc_seqno) {
+ fd6_texture_state_destroy(entry->data);
+ _mesa_hash_table_remove(fd6_ctx->tex_cache, entry);
+ }
+ }
+ }
+}
+
void
fd6_texture_init(struct pipe_context *pctx)
{
- struct fd6_context *fd6_ctx = fd6_context(fd_context(pctx));
+ struct fd_context *ctx = fd_context(pctx);
+ struct fd6_context *fd6_ctx = fd6_context(ctx);
pctx->create_sampler_state = fd6_sampler_state_create;
pctx->delete_sampler_state = fd6_sampler_state_delete;
pctx->sampler_view_destroy = fd6_sampler_view_destroy;
pctx->set_sampler_views = fd_set_sampler_views;
+ ctx->rebind_resource = fd6_rebind_resource;
+
fd6_ctx->tex_cache = _mesa_hash_table_create(NULL, key_hash, key_equals);
}
struct pipe_debug_callback debug;
+ /* Called on rebind_resource() for any per-gen cleanup required: */
+ void (*rebind_resource)(struct fd_context *ctx, struct fd_resource *rsc);
+
/* GMEM/tile handling fxns: */
void (*emit_tile_init)(struct fd_batch *batch);
void (*emit_tile_prep)(struct fd_batch *batch, const struct fd_tile *tile);
{
struct pipe_resource *prsc = &rsc->base;
+ if (ctx->rebind_resource)
+ ctx->rebind_resource(ctx, rsc);
+
/* VBOs */
if (rsc->dirty & FD_DIRTY_VTXBUF) {
struct fd_vertexbuf_stateobj *vb = &ctx->vtx.vertexbuf;