r600g: add a flag to just create flushed texture without flushing.
This just adds a flag to create the texture without doing any flushing to it. Flushing occurs in the draw function. This avoids unnecessary flushes when we end up rebinding a CB/DB/texture due to the blitter just restoring state. Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
446bc12c17
commit
3e9bc43fba
|
@ -382,7 +382,7 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte
|
|||
}
|
||||
tmp = (struct r600_resource_texture *)texture;
|
||||
if (tmp->depth && tmp->tile_type == 1) {
|
||||
r600_texture_depth_flush(ctx, texture);
|
||||
r600_texture_depth_flush(ctx, texture, TRUE);
|
||||
tmp = tmp->flushed_depth_texture;
|
||||
}
|
||||
rbuffer = &tmp->resource;
|
||||
|
|
|
@ -222,7 +222,7 @@ static void r600_resource_copy_region(struct pipe_context *ctx,
|
|||
struct r600_resource_texture *rsrc = (struct r600_resource_texture*)src;
|
||||
|
||||
if (rsrc->depth && !rsrc->is_flushing_texture)
|
||||
r600_texture_depth_flush(ctx, src);
|
||||
r600_texture_depth_flush(ctx, src, FALSE);
|
||||
|
||||
r600_hw_copy_region(ctx, dst, dst_level, dstx, dsty, dstz,
|
||||
src, src_level, src_box);
|
||||
|
|
|
@ -103,7 +103,7 @@ static INLINE boolean r600_is_user_buffer(struct pipe_resource *buffer)
|
|||
return r600_buffer(buffer)->user_buffer ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
int r600_texture_depth_flush(struct pipe_context *ctx, struct pipe_resource *texture);
|
||||
int r600_texture_depth_flush(struct pipe_context *ctx, struct pipe_resource *texture, boolean just_create);
|
||||
|
||||
/* r600_texture.c texture transfer functions. */
|
||||
struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx,
|
||||
|
|
|
@ -430,7 +430,7 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c
|
|||
}
|
||||
tmp = (struct r600_resource_texture *)texture;
|
||||
if (tmp->depth && !tmp->is_flushing_texture) {
|
||||
r600_texture_depth_flush(ctx, texture);
|
||||
r600_texture_depth_flush(ctx, texture, TRUE);
|
||||
tmp = tmp->flushed_depth_texture;
|
||||
}
|
||||
rbuffer = &tmp->resource;
|
||||
|
@ -692,6 +692,12 @@ static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta
|
|||
|
||||
surf = (struct r600_surface *)state->cbufs[cb];
|
||||
rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture;
|
||||
|
||||
if (rtex->depth && !rtex->is_flushing_texture) {
|
||||
r600_texture_depth_flush(&rctx->context, state->cbufs[cb]->texture, TRUE);
|
||||
rtex = rtex->flushed_depth_texture;
|
||||
}
|
||||
|
||||
rbuffer = &rtex->resource;
|
||||
bo[0] = rbuffer->bo;
|
||||
bo[1] = rbuffer->bo;
|
||||
|
|
|
@ -488,7 +488,7 @@ struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen,
|
|||
}
|
||||
|
||||
int r600_texture_depth_flush(struct pipe_context *ctx,
|
||||
struct pipe_resource *texture)
|
||||
struct pipe_resource *texture, boolean just_create)
|
||||
{
|
||||
struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture;
|
||||
struct pipe_resource resource;
|
||||
|
@ -517,6 +517,9 @@ int r600_texture_depth_flush(struct pipe_context *ctx,
|
|||
|
||||
((struct r600_resource_texture *)rtex->flushed_depth_texture)->is_flushing_texture = TRUE;
|
||||
out:
|
||||
if (just_create)
|
||||
return 0;
|
||||
|
||||
/* XXX: only do this if the depth texture has actually changed:
|
||||
*/
|
||||
r600_blit_uncompress_depth(ctx, rtex);
|
||||
|
@ -582,7 +585,7 @@ struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx,
|
|||
*/
|
||||
/* XXX: when discard is true, no need to read back from depth texture
|
||||
*/
|
||||
r = r600_texture_depth_flush(ctx, texture);
|
||||
r = r600_texture_depth_flush(ctx, texture, FALSE);
|
||||
if (r < 0) {
|
||||
R600_ERR("failed to create temporary texture to hold untiled copy\n");
|
||||
pipe_resource_reference(&trans->transfer.resource, NULL);
|
||||
|
|
Loading…
Reference in New Issue