summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/r600_blit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/r600/r600_blit.c')
-rw-r--r--src/gallium/drivers/r600/r600_blit.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c
index 93df1a2911d..ff720c9a028 100644
--- a/src/gallium/drivers/r600/r600_blit.c
+++ b/src/gallium/drivers/r600/r600_blit.c
@@ -202,7 +202,7 @@ static void r600_clear(struct pipe_context *ctx, unsigned buffers,
{
struct r600_context *rctx = (struct r600_context *)ctx;
struct pipe_framebuffer_state *fb = &rctx->framebuffer;
-
+
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,
@@ -263,6 +263,10 @@ struct texture_orig_info {
unsigned format;
unsigned width0;
unsigned height0;
+ unsigned npix_x;
+ unsigned npix_y;
+ unsigned npix0_x;
+ unsigned npix0_y;
};
static void r600_compressed_to_blittable(struct pipe_resource *tex,
@@ -270,6 +274,7 @@ static void r600_compressed_to_blittable(struct pipe_resource *tex,
struct texture_orig_info *orig)
{
struct r600_resource_texture *rtex = (struct r600_resource_texture*)tex;
+ struct r600_screen *rscreen = (struct r600_screen *)tex->screen;
unsigned pixsize = util_format_get_blocksize(rtex->real_format);
int new_format;
int new_height, new_width;
@@ -277,6 +282,10 @@ static void r600_compressed_to_blittable(struct pipe_resource *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;
if (pixsize == 8)
new_format = PIPE_FORMAT_R16G16B16A16_UINT; /* 64-bit block */
@@ -289,14 +298,26 @@ static void r600_compressed_to_blittable(struct pipe_resource *tex,
tex->width0 = new_width;
tex->height0 = new_height;
tex->format = new_format;
+ rtex->surface.level[0].npix_x = util_format_get_nblocksx(orig->format, orig->npix0_x);
+ rtex->surface.level[0].npix_y = util_format_get_nblocksy(orig->format, orig->npix0_y);
+ rtex->surface.level[level].npix_x = util_format_get_nblocksx(orig->format, orig->npix_x);
+ 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)
{
+ struct r600_resource_texture *rtex = (struct r600_resource_texture*)tex;
+ struct r600_screen *rscreen = (struct r600_screen *)tex->screen;
+
tex->format = orig->format;
tex->width0 = orig->width0;
tex->height0 = orig->height0;
+ rtex->surface.level[0].npix_x = orig->npix0_x;
+ rtex->surface.level[0].npix_y = orig->npix0_y;
+ rtex->surface.level[level].npix_x = orig->npix_x;
+ rtex->surface.level[level].npix_y = orig->npix_y;
}
static void r600_resource_copy_region(struct pipe_context *ctx,
@@ -352,10 +373,10 @@ static void r600_resource_copy_region(struct pipe_context *ctx,
src, src_level, psbox);
if (restore_orig[0])
- r600_reset_blittable_to_compressed(src, &orig_info[0]);
+ r600_reset_blittable_to_compressed(src, src_level, &orig_info[0]);
if (restore_orig[1])
- r600_reset_blittable_to_compressed(dst, &orig_info[1]);
+ r600_reset_blittable_to_compressed(dst, dst_level, &orig_info[1]);
}
void r600_init_blit_functions(struct r600_context *rctx)