r600g: track dirty registers better. (v2)
[mesa.git] / src / gallium / drivers / r600 / r600_blit.c
index 06375f72d19d431b2c0fe8fdf511df656c15a8e1..04408a5cc8eb434aa5aed9dd601bb064829cb8fb 100644 (file)
@@ -225,10 +225,11 @@ struct texture_orig_info {
        unsigned height0;
 };
 
-static void r600_s3tc_to_blittable(struct pipe_resource *tex,
+static void r600_compressed_to_blittable(struct pipe_resource *tex,
                                   unsigned level,
                                   struct texture_orig_info *orig)
 {
+       struct r600_resource_texture *rtex = (struct r600_resource_texture*)tex;
        unsigned pixsize = util_format_get_blocksize(tex->format);
        int new_format;
        int new_height, new_width;
@@ -245,16 +246,20 @@ static void r600_s3tc_to_blittable(struct pipe_resource *tex,
        new_width = util_format_get_nblocksx(tex->format, orig->width0);
        new_height = util_format_get_nblocksy(tex->format, orig->height0);
 
+       rtex->force_int_type = true;
        tex->width0 = new_width;
        tex->height0 = new_height;
        tex->format = new_format;
 
 }
 
-static void r600_reset_blittable_to_s3tc(struct pipe_resource *tex,
+static void r600_reset_blittable_to_compressed(struct pipe_resource *tex,
                                         unsigned level,
                                         struct texture_orig_info *orig)
 {
+       struct r600_resource_texture *rtex = (struct r600_resource_texture*)tex;
+       rtex->force_int_type = false;
+
        tex->format = orig->format;
        tex->width0 = orig->width0;
        tex->height0 = orig->height0;
@@ -277,27 +282,27 @@ static void r600_resource_copy_region(struct pipe_context *ctx,
 
        restore_orig[0] = restore_orig[1] = FALSE;
 
-       if (util_format_is_s3tc(src->format)) {
-               r600_s3tc_to_blittable(src, src_level, &orig_info[0]);
+       if (util_format_is_compressed(src->format)) {
+               r600_compressed_to_blittable(src, src_level, &orig_info[0]);
                restore_orig[0] = TRUE;
        }
 
-       if (util_format_is_s3tc(dst->format)) {
-               r600_s3tc_to_blittable(dst, dst_level, &orig_info[1]);
+       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_nblocksx(orig_info[1].format, dsty);
+               dsty = util_format_get_nblocksy(orig_info[1].format, dsty);
        }
 
        r600_hw_copy_region(ctx, dst, dst_level, dstx, dsty, dstz,
                            src, src_level, src_box);
 
        if (restore_orig[0])
-               r600_reset_blittable_to_s3tc(src, src_level, &orig_info[0]);
+               r600_reset_blittable_to_compressed(src, src_level, &orig_info[0]);
 
        if (restore_orig[1])
-               r600_reset_blittable_to_s3tc(dst, dst_level, &orig_info[1]);
+               r600_reset_blittable_to_compressed(dst, dst_level, &orig_info[1]);
 }
 
 void r600_init_blit_functions(struct r600_pipe_context *rctx)