{
COMPUTE_DBG(pool->screen, "* compute_memory_pool_delete()\n");
free(pool->shadow);
- if (pool->bo) {
- pool->screen->b.b.resource_destroy((struct pipe_screen *)
- pool->screen, (struct pipe_resource *)pool->bo);
- }
+ pipe_resource_reference(&pool->bo, NULL);
/* In theory, all of the items were freed in compute_memory_free.
* Just delete the list heads
*/
compute_memory_defrag(pool, src, dst, pipe);
- pool->screen->b.b.resource_destroy(
- (struct pipe_screen *)pool->screen,
- src);
-
+ /* Release the old buffer */
+ pipe_resource_reference(&pool->bo, NULL);
pool->bo = temp;
pool->size_in_dw = new_size_in_dw;
}
return -1;
pool->size_in_dw = new_size_in_dw;
- pool->screen->b.b.resource_destroy(
- (struct pipe_screen *)pool->screen,
- (struct pipe_resource *)pool->bo);
+ /* Release the old buffer */
+ pipe_resource_reference(&pool->bo, NULL);
pool->bo = r600_compute_buffer_alloc_vram(pool->screen, pool->size_in_dw * 4);
compute_memory_shadow(pool, pipe, 0);
rat_templ.u.tex.first_layer = 0;
rat_templ.u.tex.last_layer = 0;
- /* Add the RAT the list of color buffers */
+ /* Add the RAT the list of color buffers. Drop the old buffer first. */
+ pipe_surface_reference(&pipe->ctx->framebuffer.state.cbufs[id], NULL);
pipe->ctx->framebuffer.state.cbufs[id] = pipe->ctx->b.b.create_surface(
(struct pipe_context *)pipe->ctx,
(struct pipe_resource *)bo, &rat_templ);