From: Chia-I Wu Date: Sun, 28 Nov 2010 11:45:17 +0000 (+0800) Subject: st/vega: Get rid of renderer_copy_texture. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=20ce148c305200c760f34d2098d92bc77cb6deee;p=mesa.git st/vega: Get rid of renderer_copy_texture. --- diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c index 88705d093ea..303e979012a 100644 --- a/src/gallium/state_trackers/vega/image.c +++ b/src/gallium/state_trackers/vega/image.c @@ -135,19 +135,20 @@ static void vg_copy_texture(struct vg_context *ctx, if (src_loc[2] >= 0 && src_loc[3] >= 0 && dst_loc[2] >= 0 && dst_loc[3] >= 0) { - renderer_copy_texture(ctx->renderer, - src, - src_loc[0], - src_loc[1] + src_loc[3], - src_loc[0] + src_loc[2], - src_loc[1], - dst, - dst_loc[0], - dst_loc[1] + dst_loc[3], - dst_loc[0] + dst_loc[2], - dst_loc[1]); - } + struct pipe_surface *surf; + + /* get the destination surface */ + surf = ctx->pipe->screen->get_tex_surface(ctx->pipe->screen, + dst, 0, 0, 0, PIPE_BIND_RENDER_TARGET); + if (surf && renderer_copy_begin(ctx->renderer, surf, VG_TRUE, src)) { + renderer_copy(ctx->renderer, + dst_loc[0], dst_loc[1], dst_loc[2], dst_loc[3], + src_loc[0], src_loc[1], src_loc[2], src_loc[3]); + renderer_copy_end(ctx->renderer); + } + pipe_surface_reference(&surf, NULL); + } } void vg_copy_surface(struct vg_context *ctx, diff --git a/src/gallium/state_trackers/vega/mask.c b/src/gallium/state_trackers/vega/mask.c index 3b042cec0e4..e40df063470 100644 --- a/src/gallium/state_trackers/vega/mask.c +++ b/src/gallium/state_trackers/vega/mask.c @@ -399,16 +399,21 @@ void mask_copy(struct vg_mask_layer *layer, VGint dx, VGint dy, VGint width, VGint height) { - struct vg_context *ctx = vg_current_context(); - struct st_framebuffer *fb_buffers = ctx->draw_buffer; - - renderer_copy_texture(ctx->renderer, - layer->sampler_view, - sx, sy, - sx + width, sy + height, - fb_buffers->alpha_mask_view->texture, - dx, dy, - dx + width, dy + height); + struct vg_context *ctx = vg_current_context(); + struct pipe_sampler_view *src = ctx->draw_buffer->alpha_mask_view; + struct pipe_surface *surf; + + /* get the destination surface */ + surf = ctx->pipe->screen->get_tex_surface(ctx->pipe->screen, + layer->sampler_view->texture, 0, 0, 0, PIPE_BIND_RENDER_TARGET); + if (surf && renderer_copy_begin(ctx->renderer, surf, VG_FALSE, src)) { + renderer_copy(ctx->renderer, + dx, dy, width, height, + sx, sy, width, height); + renderer_copy_end(ctx->renderer); + } + + pipe_surface_reference(&surf, NULL); } static void mask_layer_render_to(struct vg_mask_layer *layer, diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c index 868393a86fa..f436ee56fe9 100644 --- a/src/gallium/state_trackers/vega/renderer.c +++ b/src/gallium/state_trackers/vega/renderer.c @@ -1308,55 +1308,6 @@ void renderer_validate_for_shader(struct renderer *renderer, const_buffer, const_buffer_len); } -void renderer_copy_texture(struct renderer *ctx, - struct pipe_sampler_view *src, - VGfloat sx1, VGfloat sy1, - VGfloat sx2, VGfloat sy2, - struct pipe_resource *dst, - VGfloat dx1, VGfloat dy1, - VGfloat dx2, VGfloat dy2) -{ - struct pipe_surface *surf; - VGint x, y, w, h, sx, sy, sw, sh; - - /* get the destination surface */ - surf = ctx->pipe->screen->get_tex_surface(ctx->pipe->screen, - dst, 0, 0, 0, PIPE_BIND_RENDER_TARGET); - if (!surf) - return; - - assert(ctx->state == RENDERER_STATE_INIT); - assert(src->texture->width0 != 0); - assert(src->texture->height0 != 0); - assert(dst->width0 != 0); - assert(dst->height0 != 0); - - x = (VGint) dx1; - y = (VGint) dy1; - w = (VGint) (dx2 - dx1); - h = (VGint) (dy2 - dy1); - assert(floatsEqual(x, dx1) && - floatsEqual(y, dy1) && - floatsEqual(w, (dx2 - dx1)) && - floatsEqual(h, (dy2 - dy1))); - - sx = (VGint) sx1; - sy = (VGint) sy1; - sw = (VGint) (sx2 - sx1); - sh = (VGint) (sy2 - sy1); - assert(floatsEqual(sx, sx1) && - floatsEqual(sy, sy1) && - floatsEqual(sw, (sx2 - sx1)) && - floatsEqual(sh, (sy2 - sy1))); - - if (renderer_copy_begin(ctx, surf, VG_TRUE, src)) { - renderer_copy(ctx, x, y, w, h, sx, sy, sw, sh); - renderer_copy_end(ctx); - } - - pipe_surface_reference(&surf, NULL); -} - void renderer_copy_surface(struct renderer *ctx, struct pipe_surface *src, int srcX0, int srcY0, diff --git a/src/gallium/state_trackers/vega/renderer.h b/src/gallium/state_trackers/vega/renderer.h index 44ea972958e..3cbd1c5e692 100644 --- a/src/gallium/state_trackers/vega/renderer.h +++ b/src/gallium/state_trackers/vega/renderer.h @@ -139,13 +139,7 @@ void renderer_texture_quad(struct renderer *, VGfloat x2, VGfloat y2, VGfloat x3, VGfloat y3, VGfloat x4, VGfloat y4); -void renderer_copy_texture(struct renderer *r, - struct pipe_sampler_view *src, - VGfloat sx1, VGfloat sy1, - VGfloat sx2, VGfloat sy2, - struct pipe_resource *dst, - VGfloat dx1, VGfloat dy1, - VGfloat dx2, VGfloat dy2); + void renderer_copy_surface(struct renderer *r, struct pipe_surface *src, int sx1, int sy1,