summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2011-02-28 23:54:47 +0100
committerMarek Olšák <[email protected]>2011-03-01 00:46:58 +0100
commitfbedd9c73a2ad4bdded2d900244fd5ea5bcfad97 (patch)
tree1c13f9ae1e5065c93be3622b7ee51344f71f0d47 /src/gallium
parent2f665885cda87a533fb224cefaf7a9e98a084601 (diff)
u_vbuf_mgr: compute user buffer size for instance data from instance_count
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/util/u_vbuf_mgr.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/util/u_vbuf_mgr.c b/src/gallium/auxiliary/util/u_vbuf_mgr.c
index 3cf8ee0831d..7d157c99ccc 100644
--- a/src/gallium/auxiliary/util/u_vbuf_mgr.c
+++ b/src/gallium/auxiliary/util/u_vbuf_mgr.c
@@ -515,6 +515,7 @@ void u_vbuf_mgr_set_vertex_buffers(struct u_vbuf_mgr *mgrb,
static void u_vbuf_upload_buffers(struct u_vbuf_mgr_priv *mgr,
int min_index, int max_index,
+ unsigned instance_count,
boolean *upload_flushed)
{
int i, nr = mgr->ve->count;
@@ -530,10 +531,12 @@ static void u_vbuf_upload_buffers(struct u_vbuf_mgr_priv *mgr,
!uploaded[index]) {
unsigned first, size;
boolean flushed;
+ unsigned instance_div = mgr->ve->ve[i].instance_divisor;
- if (mgr->ve->ve[i].instance_divisor) {
+ if (instance_div) {
first = 0;
- size = vb->buffer->width0;
+ size = vb->stride *
+ ((instance_count + instance_div - 1) / instance_div);
} else if (vb->stride) {
first = vb->stride * min_index;
size = vb->stride * count;
@@ -581,7 +584,8 @@ void u_vbuf_mgr_draw_begin(struct u_vbuf_mgr *mgrb,
/* Upload user buffers. */
if (mgr->any_user_vbs) {
- u_vbuf_upload_buffers(mgr, min_index, max_index, &upload_flushed);
+ u_vbuf_upload_buffers(mgr, min_index, max_index, info->instance_count,
+ &upload_flushed);
bufs_updated = TRUE;
}