summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2011-05-17 01:16:27 +0200
committerMarek Olšák <[email protected]>2011-05-17 01:21:30 +0200
commit390196ecc73cd5d6bed48bf460d1abf70deb0eb4 (patch)
tree730525aec6f8aec19aaeaca2083c0fcde93f0656
parenta3ac28a736c56cbdee0daa6e30c7a8b984a90ec6 (diff)
u_vbuf_mgr: fix max_index computation when src_offset is abused as buffer_offset
-rw-r--r--src/gallium/auxiliary/util/u_vbuf_mgr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/util/u_vbuf_mgr.c b/src/gallium/auxiliary/util/u_vbuf_mgr.c
index a034483ee5c..04149525ea7 100644
--- a/src/gallium/auxiliary/util/u_vbuf_mgr.c
+++ b/src/gallium/auxiliary/util/u_vbuf_mgr.c
@@ -581,7 +581,12 @@ static void u_vbuf_mgr_compute_max_index(struct u_vbuf_mgr_priv *mgr)
* for that when dividing by stride. */
unused = vb->stride -
(mgr->ve->ve[i].src_offset + mgr->ve->src_format_size[i]);
- assert(unused >= 0);
+
+ /* If src_offset is greater than stride (which means it's a buffer
+ * offset rather than a vertex offset)... */
+ if (unused < 0) {
+ unused = 0;
+ }
/* Compute the maximum index for this vertex element. */
max_index =