glamor: Fix requested composite VBO size.

The argument to setup_composte_vbo is the number of verts.

v2: Drop the now-unused vert_stride value.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Markus Wick <markus at selfnet.de>
This commit is contained in:
Eric Anholt 2014-01-12 07:54:51 -08:00
parent d310d566b1
commit 9b86f7a1ab

View File

@ -1189,7 +1189,6 @@ glamor_composite_with_shader(CARD8 op,
PictFormatShort saved_source_format = 0; PictFormatShort saved_source_format = 0;
float src_matrix[9], mask_matrix[9]; float src_matrix[9], mask_matrix[9];
float *psrc_matrix = NULL, *pmask_matrix = NULL; float *psrc_matrix = NULL, *pmask_matrix = NULL;
int vert_stride = 4;
int nrect_max; int nrect_max;
Bool ret = FALSE; Bool ret = FALSE;
glamor_composite_shader *shader = NULL, *shader_ca = NULL; glamor_composite_shader *shader = NULL, *shader_ca = NULL;
@ -1238,7 +1237,6 @@ glamor_composite_with_shader(CARD8 op,
psrc_matrix = src_matrix; psrc_matrix = src_matrix;
glamor_picture_get_matrixf(source, psrc_matrix); glamor_picture_get_matrixf(source, psrc_matrix);
} }
vert_stride += 4;
} }
if (glamor_priv->has_mask_coords) { if (glamor_priv->has_mask_coords) {
@ -1250,11 +1248,9 @@ glamor_composite_with_shader(CARD8 op,
pmask_matrix = mask_matrix; pmask_matrix = mask_matrix;
glamor_picture_get_matrixf(mask, pmask_matrix); glamor_picture_get_matrixf(mask, pmask_matrix);
} }
vert_stride += 4;
} }
nrect_max = (vert_stride * nrect) > GLAMOR_COMPOSITE_VBO_VERT_CNT ? nrect_max = MIN(nrect, GLAMOR_COMPOSITE_VBO_VERT_CNT / 4);
(GLAMOR_COMPOSITE_VBO_VERT_CNT / vert_stride) : nrect;
while (nrect) { while (nrect) {
int mrect, rect_processed; int mrect, rect_processed;
@ -1262,7 +1258,7 @@ glamor_composite_with_shader(CARD8 op,
float *vertices; float *vertices;
mrect = nrect > nrect_max ? nrect_max : nrect; mrect = nrect > nrect_max ? nrect_max : nrect;
vertices = glamor_setup_composite_vbo(screen, mrect * vert_stride); vertices = glamor_setup_composite_vbo(screen, mrect * 4);
rect_processed = mrect; rect_processed = mrect;
vb_stride = glamor_priv->vb_stride / sizeof(float); vb_stride = glamor_priv->vb_stride / sizeof(float);
while (mrect--) { while (mrect--) {