Mesa (master): u_vbuf_mgr: fix crash with unsupported vertex format in hw VBOs
Marek Olšák
mareko at kemper.freedesktop.org
Fri Apr 8 17:33:20 UTC 2011
Module: Mesa
Branch: master
Commit: a0d154dc1385d92a31dca8e65e50d958bdf6d532
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a0d154dc1385d92a31dca8e65e50d958bdf6d532
Author: Marek Olšák <maraeo at gmail.com>
Date: Fri Apr 8 19:31:26 2011 +0200
u_vbuf_mgr: fix crash with unsupported vertex format in hw VBOs
---
src/gallium/auxiliary/util/u_vbuf_mgr.c | 6 +++++-
src/gallium/auxiliary/util/u_vbuf_mgr.h | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_vbuf_mgr.c b/src/gallium/auxiliary/util/u_vbuf_mgr.c
index 521ac07..b2eaff8 100644
--- a/src/gallium/auxiliary/util/u_vbuf_mgr.c
+++ b/src/gallium/auxiliary/util/u_vbuf_mgr.c
@@ -572,7 +572,11 @@ void u_vbuf_mgr_draw_begin(struct u_vbuf_mgr *mgrb,
int min_index, max_index;
min_index = info->min_index - info->index_bias;
- max_index = info->max_index - info->index_bias;
+ if (info->max_index == ~0) {
+ max_index = mgr->b.max_index;
+ } else {
+ max_index = MIN2(info->max_index - info->index_bias, mgr->b.max_index);
+ }
/* Translate vertices with non-native layouts or formats. */
if (mgr->incompatible_vb_layout || mgr->ve->incompatible_layout) {
diff --git a/src/gallium/auxiliary/util/u_vbuf_mgr.h b/src/gallium/auxiliary/util/u_vbuf_mgr.h
index 8b24185..9380dce 100644
--- a/src/gallium/auxiliary/util/u_vbuf_mgr.h
+++ b/src/gallium/auxiliary/util/u_vbuf_mgr.h
@@ -53,7 +53,7 @@ struct u_vbuf_mgr {
int nr_real_vertex_buffers;
/* Precomputed max_index for hardware vertex buffers. */
- int max_index;
+ unsigned max_index;
/* This uploader can optionally be used by the driver.
*
More information about the mesa-commit
mailing list