diff options
author | Marek Olšák <[email protected]> | 2012-09-12 23:37:17 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-09-30 18:57:56 +0200 |
commit | 0b0697e80dd442d7e7cb23641ad8f58f82df120d (patch) | |
tree | 3f842d9000c8c26fc3812f08276846af4772b579 /src/gallium/drivers/r600 | |
parent | 84d2f2295e8274c1b3676b59fedfc173836d378e (diff) |
gallium/u_blitter: add gallium blit implementation
The original blit function is extended and the otAher functions reuse it.
Tested-by: Michel Dänzer <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r-- | src/gallium/drivers/r600/r600_blit.c | 38 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state_common.c | 2 |
3 files changed, 17 insertions, 25 deletions
diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 3da583c5d09..536b2a19bde 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -379,10 +379,11 @@ static void r600_copy_first_sample(struct pipe_context *ctx, /* Copy the first sample into dst. */ r600_blitter_begin(ctx, R600_COPY_TEXTURE); - util_blitter_copy_texture_view(rctx->blitter, dst_view, ~0, info->dst.x0, - info->dst.y0, src_view, 0, &box, - info->src.res->width0, info->src.res->height0, - info->mask); + util_blitter_blit_generic(rctx->blitter, dst_view, info->dst.x0, + info->dst.y0, abs(box.width), abs(box.height), + src_view, &box, + info->src.res->width0, info->src.res->height0, + info->mask, PIPE_TEX_FILTER_NEAREST, NULL, FALSE); r600_blitter_end(ctx); pipe_surface_reference(&dst_view, NULL); @@ -460,8 +461,8 @@ static void r600_color_resolve(struct pipe_context *ctx, r600_blitter_begin(ctx, R600_COPY_TEXTURE); util_blitter_copy_texture(rctx->blitter, info->dst.res, info->dst.level, - ~0, info->dst.x0, info->dst.y0, info->dst.layer, - tmp, 0, 0, &box); + info->dst.x0, info->dst.y0, info->dst.layer, + tmp, 0, &box, PIPE_MASK_RGBAZS, FALSE); r600_blitter_end(ctx); pipe_resource_reference(&tmp, NULL); @@ -678,7 +679,6 @@ 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)); @@ -689,7 +689,6 @@ static void r600_resource_copy_region(struct pipe_context *ctx, } assert(u_max_sample(dst) == u_max_sample(src)); - last_sample = u_max_sample(dst); /* The driver doesn't decompress resources automatically while * u_blitter is rendering. */ @@ -756,21 +755,14 @@ static void r600_resource_copy_region(struct pipe_context *ctx, restore_orig[1] = TRUE; } - /* XXX Properly implement multisample textures on Cayman. In the meantime, - * copy only the first sample (which is the only one that doesn't return garbage). */ - if (rctx->chip_class == CAYMAN) { - 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); - } else { - 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); - } - } + /* XXX Multisample texturing is unimplemented on Cayman. In the meantime, + * copy only the first sample (which is the only one that is uncompressed + * and therefore doesn't return garbage). */ + r600_blitter_begin(ctx, R600_COPY_TEXTURE); + util_blitter_copy_texture(rctx->blitter, dst, dst_level, dstx, dsty, dstz, + src, src_level, psbox, PIPE_MASK_RGBAZS, + rctx->chip_class != CAYMAN); + r600_blitter_end(ctx); if (restore_orig[0]) r600_reset_blittable_to_orig(src, src_level, &orig_info[0]); diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index e66766a9844..315253ac730 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -643,7 +643,7 @@ void r600_sampler_states_dirty(struct r600_context *rctx, void r600_set_max_scissor(struct r600_context *rctx); void r600_constant_buffers_dirty(struct r600_context *rctx, struct r600_constbuf_state *state); void r600_draw_rectangle(struct blitter_context *blitter, - unsigned x1, unsigned y1, unsigned x2, unsigned y2, float depth, + int x1, int y1, int x2, int y2, float depth, enum blitter_attrib_type type, const union pipe_color_union *attrib); uint32_t r600_translate_stencil_op(int s_op); uint32_t r600_translate_fill(uint32_t func); diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index 95beaa1cc7e..b1a0f66d2ef 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -1343,7 +1343,7 @@ static void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info } void r600_draw_rectangle(struct blitter_context *blitter, - unsigned x1, unsigned y1, unsigned x2, unsigned y2, float depth, + int x1, int y1, int x2, int y2, float depth, enum blitter_attrib_type type, const union pipe_color_union *attrib) { struct r600_context *rctx = (struct r600_context*)util_blitter_get_pipe(blitter); |