summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2009-05-07 11:46:08 +0100
committerKeith Whitwell <keithw@vmware.com>2009-05-08 10:04:14 +0100
commit01280cff537544299fe0c5f1a282abde8e69b1f3 (patch)
treea1e9ec25b5be9c9ff99d9a01b2d39df45162e72c /src/mesa
parent4a333c64faf78dd39f07574bb94f62ba48995e7d (diff)
mesa/st: cope with non-ibo index data in st_draw_feedback.c
Previously only non-indexed or indicies-in-a-vbo cases were handled in this code. This change adds the missing regular indices-in-memory case.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_draw_feedback.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c
index e533afd051..32502a9cda 100644
--- a/src/mesa/state_tracker/st_draw_feedback.c
+++ b/src/mesa/state_tracker/st_draw_feedback.c
@@ -196,13 +196,10 @@ st_feedback_draw_vbo(GLcontext *ctx,
draw_set_vertex_elements(draw, vp->num_inputs, velements);
if (ib) {
- unsigned indexSize;
struct gl_buffer_object *bufobj = ib->obj;
- struct st_buffer_object *stobj = st_buffer_object(bufobj);
+ unsigned indexSize;
void *map;
- index_buffer_handle = stobj->buffer;
-
switch (ib->type) {
case GL_UNSIGNED_INT:
indexSize = 4;
@@ -215,9 +212,19 @@ st_feedback_draw_vbo(GLcontext *ctx,
return;
}
- map = pipe_buffer_map(pipe->screen, index_buffer_handle,
- PIPE_BUFFER_USAGE_CPU_READ);
- draw_set_mapped_element_buffer(draw, indexSize, map);
+ if (bufobj && bufobj->Name) {
+ struct st_buffer_object *stobj = st_buffer_object(bufobj);
+
+ index_buffer_handle = stobj->buffer;
+
+ map = pipe_buffer_map(pipe->screen, index_buffer_handle,
+ PIPE_BUFFER_USAGE_CPU_READ);
+
+ draw_set_mapped_element_buffer(draw, indexSize, map);
+ }
+ else {
+ draw_set_mapped_element_buffer(draw, indexSize, (void *) ib->ptr);
+ }
}
else {
/* no index/element buffer */
@@ -252,7 +259,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
draw_set_mapped_vertex_buffer(draw, i, NULL);
}
}
- if (ib) {
+ if (index_buffer_handle) {
pipe_buffer_unmap(pipe->screen, index_buffer_handle);
draw_set_mapped_element_buffer(draw, 0, NULL);
}