summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo/vbo_exec_draw.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-08-17 15:26:33 +0100
committerKeith Whitwell <[email protected]>2008-09-23 18:26:00 -0700
commit6f765fbde42a4f729780aa39d2b0ed9d736dd5a8 (patch)
tree8363448a5caed5acc3edcfd2b75d0eabeecdc457 /src/mesa/vbo/vbo_exec_draw.c
parentb36bc54d3ceff5f514f87cdce67164147c1dd04f (diff)
added vbo_use_buffer_objects() to specify that immediate mode data should be put into bufferobjects
Diffstat (limited to 'src/mesa/vbo/vbo_exec_draw.c')
-rw-r--r--src/mesa/vbo/vbo_exec_draw.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index 86155d220d2..557a43bb876 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -182,13 +182,24 @@ static void vbo_exec_bind_arrays( GLcontext *ctx )
* arrays of floats.
*/
for (attr = 0; attr < VERT_ATTRIB_MAX ; attr++) {
- GLuint src = map[attr];
+ const GLuint src = map[attr];
if (exec->vtx.attrsz[src]) {
/* override the default array set above */
exec->vtx.inputs[attr] = &arrays[attr];
- arrays[attr].Ptr = (void *)data;
+ if (exec->vtx.bufferobj->Name) {
+ /* a real buffer obj: Ptr is an offset, not a pointer*/
+ int offset;
+ assert(exec->vtx.bufferobj->Pointer); /* buf should be mapped */
+ offset = (GLbyte *) data - (GLbyte *) exec->vtx.bufferobj->Pointer;
+ assert(offset >= 0);
+ arrays[attr].Ptr = (void *) offset;
+ }
+ else {
+ /* Ptr into ordinary app memory */
+ arrays[attr].Ptr = (void *) data;
+ }
arrays[attr].Size = exec->vtx.attrsz[src];
arrays[attr].StrideB = exec->vtx.vertex_size * sizeof(GLfloat);
arrays[attr].Stride = exec->vtx.vertex_size * sizeof(GLfloat);