summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2010-11-28 19:45:17 +0800
committerChia-I Wu <olv@lunarg.com>2010-11-29 15:32:36 +0800
commit8afce545ada6f7ec13f22a18f819597dd63803a8 (patch)
tree21c36a6905e9de85bb7ade8d74b12371220d16dd
parente90ea0c4f8e7645abf0864010d15f39b4cb334d2 (diff)
st/vega: Get rid of renderer_copy_texture.vega-polish
-rw-r--r--src/gallium/state_trackers/vega/image.c25
-rw-r--r--src/gallium/state_trackers/vega/mask.c25
-rw-r--r--src/gallium/state_trackers/vega/renderer.c49
-rw-r--r--src/gallium/state_trackers/vega/renderer.h8
4 files changed, 29 insertions, 78 deletions
diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c
index 88705d093e..303e979012 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 3b042cec0e..e40df06347 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 868393a86f..f436ee56fe 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 44ea972958..3cbd1c5e69 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,