r600g: implement copying between MSAA textures
authorMarek Olšák <maraeo@gmail.com>
Thu, 9 Aug 2012 15:21:56 +0000 (17:21 +0200)
committerMarek Olšák <maraeo@gmail.com>
Wed, 15 Aug 2012 17:20:58 +0000 (19:20 +0200)
src/gallium/drivers/r600/r600_blit.c

index 547386dfc741146d8a2b7cd876e4449b660687b0..f3a3b8f89bfdf641e73c1d654a17ae293906442c 100644 (file)
@@ -548,6 +548,7 @@ static void r600_resource_copy_region(struct pipe_context *ctx,
        struct pipe_box sbox;
        const struct pipe_box *psbox = src_box;
        boolean restore_orig[2];
+       unsigned last_sample, i;
 
        memset(orig_info, 0, sizeof(orig_info));
 
@@ -557,6 +558,9 @@ static void r600_resource_copy_region(struct pipe_context *ctx,
                return;
        }
 
+       assert(u_max_sample(dst) == u_max_sample(src));
+       last_sample = u_max_sample(dst);
+
        /* This must be done before entering u_blitter to avoid recursion. */
        if (rsrc->is_depth && !rsrc->is_flushing_texture) {
                if (!r600_init_flushed_depth_texture(ctx, src, NULL))
@@ -613,10 +617,12 @@ static void r600_resource_copy_region(struct pipe_context *ctx,
                restore_orig[1] = TRUE;
        }
 
-       r600_blitter_begin(ctx, R600_COPY_TEXTURE);
-       util_blitter_copy_texture(rctx->blitter, dst, dst_level, ~0, dstx, dsty, dstz,
-                                 src, src_level, 0, psbox);
-       r600_blitter_end(ctx);
+       for (i = 0; i <= last_sample; i++) {
+               r600_blitter_begin(ctx, R600_COPY_TEXTURE);
+               util_blitter_copy_texture(rctx->blitter, dst, dst_level, 1 << i, dstx, dsty, dstz,
+                                         src, src_level, i, psbox);
+               r600_blitter_end(ctx);
+       }
 
        if (restore_orig[0])
                r600_reset_blittable_to_orig(src, src_level, &orig_info[0]);