From: Christian König Date: Sun, 3 Apr 2011 18:49:15 +0000 (+0200) Subject: [g3dvl] fix vertex buffer size calculation X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=087e17f52e6391cecc002066f53dadc8f1b53074;p=mesa.git [g3dvl] fix vertex buffer size calculation --- diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_context.c b/src/gallium/auxiliary/vl/vl_mpeg12_context.c index d8605398d49..0eab9e3c614 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_context.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_context.c @@ -332,7 +332,8 @@ vl_mpeg12_create_buffer(struct pipe_video_context *vpipe) pipe_resource_reference(&buffer->vertex_bufs.individual.quad.buffer, ctx->quads.buffer); buffer->vertex_bufs.individual.stream = vl_vb_init(&buffer->vertex_stream, ctx->pipe, - ctx->vertex_buffer_size); + ctx->buffer_width / MACROBLOCK_WIDTH * + ctx->buffer_height / MACROBLOCK_HEIGHT); if (!buffer->vertex_bufs.individual.stream.buffer) goto error_vertex_stream; @@ -691,7 +692,6 @@ vl_create_mpeg12_context(struct pipe_context *pipe, ctx->pot_buffers = pot_buffers; ctx->quads = vl_vb_upload_quads(ctx->pipe, 2, 2); - ctx->vertex_buffer_size = width / MACROBLOCK_WIDTH * height / MACROBLOCK_HEIGHT; ctx->ves_y = vl_vb_get_elems_state(ctx->pipe, TGSI_SWIZZLE_X); ctx->ves_cb = vl_vb_get_elems_state(ctx->pipe, TGSI_SWIZZLE_Y); ctx->ves_cr = vl_vb_get_elems_state(ctx->pipe, TGSI_SWIZZLE_Z); diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_context.h b/src/gallium/auxiliary/vl/vl_mpeg12_context.h index a90110bf61b..698522f16ea 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_context.h +++ b/src/gallium/auxiliary/vl/vl_mpeg12_context.h @@ -47,7 +47,6 @@ struct vl_mpeg12_context const unsigned (*empty_block_mask)[3][2][2]; struct pipe_vertex_buffer quads; - unsigned vertex_buffer_size; void *ves_y, *ves_cb, *ves_cr; struct vl_idct idct_y, idct_c; diff --git a/src/gallium/auxiliary/vl/vl_vertex_buffers.c b/src/gallium/auxiliary/vl/vl_vertex_buffers.c index 59aa1e9db75..1094b76ec0d 100644 --- a/src/gallium/auxiliary/vl/vl_vertex_buffers.c +++ b/src/gallium/auxiliary/vl/vl_vertex_buffers.c @@ -264,6 +264,7 @@ vl_vb_add_block(struct vl_vertex_buffer *buffer, struct pipe_mpeg12_macroblock * assert(buffer); assert(mb); + assert(buffer->num_not_empty + buffer->num_empty < buffer->size); if(mb->cbp) stream = buffer->start + buffer->num_not_empty++;