From adbc9cee0ddf5a542d3e503db673af30e6d8df5b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20K=C3=B6nig?= Date: Sat, 26 Mar 2011 01:26:52 +0100 Subject: [PATCH] [g3dvl] correct layer size calculation --- src/gallium/auxiliary/vl/vl_compositor.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index d65524b9918..673f9bdecd2 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -372,21 +372,17 @@ void vl_compositor_set_layers(struct vl_compositor *compositor, pipe_sampler_view_reference(&compositor->layers[i], NULL); } -static void gen_rect_verts(unsigned pos, - struct pipe_video_rect *src_rect, +static void gen_rect_verts(struct pipe_video_rect *src_rect, struct vertex2f *src_inv_size, struct pipe_video_rect *dst_rect, struct vertex2f *dst_inv_size, struct vertex4f *vb) { - assert(pos < VL_COMPOSITOR_MAX_LAYERS + 1); assert(src_rect); assert(src_inv_size); assert((dst_rect && dst_inv_size) /*|| (!dst_rect && !dst_inv_size)*/); assert(vb); - vb += pos * 4; - vb[0].x = dst_rect->x * dst_inv_size->x; vb[0].y = dst_rect->y * dst_inv_size->y; vb[0].z = src_rect->x * src_inv_size->x; @@ -415,7 +411,7 @@ static unsigned gen_data(struct vl_compositor *c, struct pipe_sampler_view **textures, void **frag_shaders) { - void *vb; + struct vertex4f *vb; struct pipe_transfer *buf_transfer; unsigned num_rects = 0; unsigned i; @@ -435,11 +431,12 @@ static unsigned gen_data(struct vl_compositor *c, { struct vertex2f src_inv_size = { 1.0f / src_surface->texture->width0, 1.0f / src_surface->texture->height0}; - gen_rect_verts(num_rects, src_rect, &src_inv_size, dst_rect, &c->fb_inv_size, vb); + gen_rect_verts(src_rect, &src_inv_size, dst_rect, &c->fb_inv_size, vb); textures[num_rects] = src_surface; /* XXX: Hack, sort of */ frag_shaders[num_rects] = c->fragment_shader.ycbcr_2_rgb; ++num_rects; + vb += 4; } for (i = 0; c->dirty_layers > 0; i++) { @@ -447,12 +444,12 @@ static unsigned gen_data(struct vl_compositor *c, if (c->dirty_layers & (1 << i)) { struct vertex2f layer_inv_size = {1.0f / c->layers[i]->texture->width0, 1.0f / c->layers[i]->texture->height0}; - gen_rect_verts(num_rects, &c->layer_src_rects[i], &layer_inv_size, - &c->layer_dst_rects[i], &c->fb_inv_size, vb); + gen_rect_verts(&c->layer_src_rects[i], &layer_inv_size, &c->layer_dst_rects[i], &layer_inv_size, vb); textures[num_rects] = c->layers[i]; /* XXX: Hack */ frag_shaders[num_rects] = c->fragment_shader.rgb_2_rgb; ++num_rects; + vb += 4; c->dirty_layers &= ~(1 << i); } } -- 2.30.2