diff options
author | Marek Olšák <[email protected]> | 2011-04-08 19:31:26 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-04-08 19:31:26 +0200 |
commit | a0d154dc1385d92a31dca8e65e50d958bdf6d532 (patch) | |
tree | 48907cc9204f0a00f9c9540754118ad49fcdfc8b /src/gallium | |
parent | 1329d9433496618ad02bb9a91eccecd9736fdf54 (diff) |
u_vbuf_mgr: fix crash with unsupported vertex format in hw VBOs
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/util/u_vbuf_mgr.c | 6 | ||||
-rw-r--r-- | 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 521ac07747c..b2eaff851ac 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 8b241854c83..9380dce4f72 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. * |