summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2011-09-26 03:30:24 +0200
committerMarek Olšák <[email protected]>2011-09-26 15:25:05 +0200
commit60a77cf316a90cb5be4f73495c2545b3d49e5ca1 (patch)
tree1b1da63a5e9bd14ba7a5d9f16d82d291674296f4
parent21f71b6c050f8a746f6a671e57afc8e5500c5e77 (diff)
u_vbuf_mgr: fix uploading with a non-zero index bias
Also don't rely on pipe_draw_info being set correctly. NOTE: This is a candidate for the 7.11 branch.
-rw-r--r--src/gallium/auxiliary/util/u_vbuf_mgr.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/util/u_vbuf_mgr.c b/src/gallium/auxiliary/util/u_vbuf_mgr.c
index 282efdbfe9a..6c2d1ed6400 100644
--- a/src/gallium/auxiliary/util/u_vbuf_mgr.c
+++ b/src/gallium/auxiliary/util/u_vbuf_mgr.c
@@ -628,11 +628,18 @@ u_vbuf_draw_begin(struct u_vbuf_mgr *mgrb,
u_vbuf_compute_max_index(mgr);
- min_index = info->min_index - info->index_bias;
- if (info->max_index == ~0) {
- max_index = mgr->b.max_index;
+ if (info->indexed) {
+ min_index = info->min_index;
+ if (info->max_index == ~0) {
+ max_index = mgr->b.max_index;
+ } else {
+ max_index = MIN2(info->max_index, mgr->b.max_index);
+ }
+ min_index += info->index_bias;
+ max_index += info->index_bias;
} else {
- max_index = MIN2(info->max_index - info->index_bias, mgr->b.max_index);
+ min_index = info->start;
+ max_index = info->start + info->count - 1;
}
/* Translate vertices with non-native layouts or formats. */