if ((op & R600_DISABLE_RENDER_COND) && rctx->current_render_cond) {
rctx->saved_render_cond = rctx->current_render_cond;
+ rctx->saved_render_cond_cond = rctx->current_render_cond_cond;
rctx->saved_render_cond_mode = rctx->current_render_cond_mode;
- rctx->context.render_condition(&rctx->context, NULL, 0);
+ rctx->context.render_condition(&rctx->context, NULL, FALSE, 0);
}
}
if (rctx->saved_render_cond) {
rctx->context.render_condition(&rctx->context,
rctx->saved_render_cond,
+ rctx->saved_render_cond_cond,
rctx->saved_render_cond_mode);
rctx->saved_render_cond = NULL;
}
r600_context_queries_resume(rctx);
}
-static unsigned u_max_layer(struct pipe_resource *r, unsigned level)
-{
- switch (r->target) {
- case PIPE_TEXTURE_CUBE:
- return 6 - 1;
- case PIPE_TEXTURE_3D:
- return u_minify(r->depth0, level) - 1;
- case PIPE_TEXTURE_1D_ARRAY:
- case PIPE_TEXTURE_2D_ARRAY:
- return r->array_size - 1;
- default:
- return 0;
- }
-}
-
void si_blit_uncompress_depth(struct pipe_context *ctx,
struct r600_resource_texture *texture,
struct r600_resource_texture *staging,
/* The smaller the mipmap level, the less layers there are
* as far as 3D textures are concerned. */
- max_layer = u_max_layer(&texture->resource.b.b, level);
+ max_layer = util_max_layer(&texture->resource.b.b, level);
checked_last_layer = last_layer < max_layer ? last_layer : max_layer;
for (layer = first_layer; layer <= checked_last_layer; layer++) {
/* The smaller the mipmap level, the less layers there are
* as far as 3D textures are concerned. */
- max_layer = u_max_layer(&texture->resource.b.b, level);
+ max_layer = util_max_layer(&texture->resource.b.b, level);
checked_last_layer = last_layer < max_layer ? last_layer : max_layer;
for (layer = first_layer; layer <= checked_last_layer; layer++) {
si_blit_decompress_depth_in_place(rctx, tex,
view->u.tex.first_level, view->u.tex.last_level,
- 0, u_max_layer(&tex->resource.b.b, view->u.tex.first_level));
+ 0, util_max_layer(&tex->resource.b.b, view->u.tex.first_level));
}
}
r600_blitter_begin(ctx, R600_CLEAR);
util_blitter_clear(rctx->blitter, fb->width, fb->height,
- fb->nr_cbufs, buffers, fb->nr_cbufs ? fb->cbufs[0]->format : PIPE_FORMAT_NONE,
- color, depth, stencil);
+ buffers, color, depth, stencil);
r600_blitter_end(ctx);
}
rtex->surface.level[level].npix_y = util_format_get_nblocksy(orig->format, orig->npix_y);
}
-static void r600_reset_blittable_to_compressed(struct pipe_resource *tex,
- unsigned level,
- struct texture_orig_info *orig)
+static void r600_change_format(struct pipe_resource *tex,
+ unsigned level,
+ struct texture_orig_info *orig,
+ enum pipe_format format)
+{
+ struct r600_resource_texture *rtex = (struct r600_resource_texture*)tex;
+
+ orig->format = tex->format;
+ orig->width0 = tex->width0;
+ orig->height0 = tex->height0;
+ orig->npix0_x = rtex->surface.level[0].npix_x;
+ orig->npix0_y = rtex->surface.level[0].npix_y;
+ orig->npix_x = rtex->surface.level[level].npix_x;
+ orig->npix_y = rtex->surface.level[level].npix_y;
+
+ tex->format = format;
+}
+
+static void r600_reset_blittable_to_orig(struct pipe_resource *tex,
+ unsigned level,
+ struct texture_orig_info *orig)
{
struct r600_resource_texture *rtex = (struct r600_resource_texture*)tex;
struct r600_resource_texture *rsrc = (struct r600_resource_texture*)src;
struct texture_orig_info orig_info[2];
struct pipe_box sbox;
- const struct pipe_box *psbox;
+ const struct pipe_box *psbox = src_box;
boolean restore_orig[2];
memset(orig_info, 0, sizeof(orig_info));
restore_orig[0] = restore_orig[1] = FALSE;
- if (util_format_is_compressed(src->format)) {
+ if (util_format_is_compressed(src->format) &&
+ util_format_is_compressed(dst->format)) {
r600_compressed_to_blittable(src, src_level, &orig_info[0]);
restore_orig[0] = TRUE;
sbox.x = util_format_get_nblocksx(orig_info[0].format, src_box->x);
sbox.height = util_format_get_nblocksy(orig_info[0].format, src_box->height);
sbox.depth = src_box->depth;
psbox=&sbox;
- } else
- psbox=src_box;
- if (util_format_is_compressed(dst->format)) {
r600_compressed_to_blittable(dst, dst_level, &orig_info[1]);
restore_orig[1] = TRUE;
/* translate the dst box as well */
dstx = util_format_get_nblocksx(orig_info[1].format, dstx);
dsty = util_format_get_nblocksy(orig_info[1].format, dsty);
+ } else if (!util_blitter_is_copy_supported(rctx->blitter, dst, src,
+ PIPE_MASK_RGBAZS)) {
+ unsigned blocksize = util_format_get_blocksize(src->format);
+
+ switch (blocksize) {
+ case 1:
+ r600_change_format(src, src_level, &orig_info[0],
+ PIPE_FORMAT_R8_UNORM);
+ r600_change_format(dst, dst_level, &orig_info[1],
+ PIPE_FORMAT_R8_UNORM);
+ break;
+ case 2:
+ r600_change_format(src, src_level, &orig_info[0],
+ PIPE_FORMAT_R8G8_UNORM);
+ r600_change_format(dst, dst_level, &orig_info[1],
+ PIPE_FORMAT_R8G8_UNORM);
+ break;
+ case 4:
+ r600_change_format(src, src_level, &orig_info[0],
+ PIPE_FORMAT_R8G8B8A8_UNORM);
+ r600_change_format(dst, dst_level, &orig_info[1],
+ PIPE_FORMAT_R8G8B8A8_UNORM);
+ break;
+ case 8:
+ r600_change_format(src, src_level, &orig_info[0],
+ PIPE_FORMAT_R16G16B16A16_UINT);
+ r600_change_format(dst, dst_level, &orig_info[1],
+ PIPE_FORMAT_R16G16B16A16_UINT);
+ break;
+ case 16:
+ r600_change_format(src, src_level, &orig_info[0],
+ PIPE_FORMAT_R32G32B32A32_UINT);
+ r600_change_format(dst, dst_level, &orig_info[1],
+ PIPE_FORMAT_R32G32B32A32_UINT);
+ break;
+ default:
+ fprintf(stderr, "Unhandled format %s with blocksize %u\n",
+ util_format_short_name(src->format), blocksize);
+ assert(0);
+ }
+ restore_orig[0] = TRUE;
+ restore_orig[1] = TRUE;
}
r600_blitter_begin(ctx, R600_COPY);
r600_blitter_end(ctx);
if (restore_orig[0])
- r600_reset_blittable_to_compressed(src, src_level, &orig_info[0]);
+ r600_reset_blittable_to_orig(src, src_level, &orig_info[0]);
if (restore_orig[1])
- r600_reset_blittable_to_compressed(dst, dst_level, &orig_info[1]);
+ r600_reset_blittable_to_orig(dst, dst_level, &orig_info[1]);
}
static void si_blit(struct pipe_context *ctx,