void *dst_map;
const void *src_map;
- assert(dst_trans->block.size == src_trans->block.size);
- assert(dst_trans->block.width == src_trans->block.width);
- assert(dst_trans->block.height == src_trans->block.height);
-
assert(src->texture && dst->texture);
if (!src->texture || !dst->texture)
return;
PIPE_TRANSFER_WRITE,
dst_x, dst_y, w, h);
+ assert(dst_trans->block.size == src_trans->block.size);
+ assert(dst_trans->block.width == src_trans->block.width);
+ assert(dst_trans->block.height == src_trans->block.height);
+
src_map = pipe->screen->transfer_map(screen, src_trans);
dst_map = pipe->screen->transfer_map(screen, dst_trans);
sp_tile_cache_set_surface(struct softpipe_tile_cache *tc,
struct pipe_surface *ps)
{
- struct pipe_screen *screen = ps->texture->screen;
-
assert(!tc->texture);
if (tc->transfer) {
+ struct pipe_screen *screen = tc->transfer->texture->screen;
+
if (ps == tc->surface)
return;
tc->surface = ps;
- tc->transfer = screen->get_tex_transfer(screen, ps->texture, ps->face,
- ps->level, ps->zslice,
- PIPE_TRANSFER_READ_WRITE,
- 0, 0, ps->width, ps->height);
-
- tc->depth_stencil = (ps->format == PIPE_FORMAT_S8Z24_UNORM ||
- ps->format == PIPE_FORMAT_X8Z24_UNORM ||
- ps->format == PIPE_FORMAT_Z24S8_UNORM ||
- ps->format == PIPE_FORMAT_Z24X8_UNORM ||
- ps->format == PIPE_FORMAT_Z16_UNORM ||
- ps->format == PIPE_FORMAT_Z32_UNORM ||
- ps->format == PIPE_FORMAT_S8_UNORM);
+ if (ps) {
+ struct pipe_screen *screen = ps->texture->screen;
+
+ tc->transfer = screen->get_tex_transfer(screen, ps->texture, ps->face,
+ ps->level, ps->zslice,
+ PIPE_TRANSFER_READ_WRITE,
+ 0, 0, ps->width, ps->height);
+
+ tc->depth_stencil = (ps->format == PIPE_FORMAT_S8Z24_UNORM ||
+ ps->format == PIPE_FORMAT_X8Z24_UNORM ||
+ ps->format == PIPE_FORMAT_Z24S8_UNORM ||
+ ps->format == PIPE_FORMAT_Z24X8_UNORM ||
+ ps->format == PIPE_FORMAT_Z16_UNORM ||
+ ps->format == PIPE_FORMAT_Z32_UNORM ||
+ ps->format == PIPE_FORMAT_S8_UNORM);
+ }
}
struct softpipe_tile_cache *tc,
struct pipe_texture *texture)
{
- struct pipe_screen *screen = texture->screen;
uint i;
assert(!tc->transfer);
pipe_texture_reference(&tc->texture, texture);
- if (tc->tex_trans_map) {
- tc->screen->transfer_unmap(tc->screen, tc->tex_trans);
- tc->tex_trans_map = NULL;
+ if (tc->transfer) {
+ struct pipe_screen *screen = tc->transfer->texture->screen;
+
+ if (tc->tex_trans_map) {
+ tc->screen->transfer_unmap(tc->screen, tc->tex_trans);
+ tc->tex_trans_map = NULL;
+ }
+
+ screen->tex_transfer_release(screen, &tc->tex_trans);
}
- screen->tex_transfer_release(screen, &tc->tex_trans);
/* mark as entries as invalid/empty */
/* XXX we should try to avoid this when the teximage hasn't changed */
tc->tex_z != z) {
/* get new transfer (view into texture) */
- if (tc->tex_trans_map)
- tc->screen->transfer_unmap(tc->screen, tc->tex_trans);
- screen->tex_transfer_release(screen, &tc->tex_trans);
+ if (tc->transfer) {
+ if (tc->tex_trans_map)
+ tc->screen->transfer_unmap(tc->screen, tc->tex_trans);
+
+ screen->tex_transfer_release(screen, &tc->tex_trans);
+ }
tc->tex_trans = screen->get_tex_transfer(screen, tc->texture, face, level, z,
PIPE_TRANSFER_READ, 0, 0,