vbo: Fix array pointer calculation for MapBufferRange-mapped vertex data.

We would end up with the offset from the start of the mapping rather than
the offset from the start of the buffer.
This commit is contained in:
Eric Anholt 2009-08-28 14:44:55 -07:00
parent 2d5c74fac3
commit 8096aa5213
1 changed files with 3 additions and 1 deletions

View File

@ -218,7 +218,9 @@ vbo_exec_bind_arrays( GLcontext *ctx )
/* a real buffer obj: Ptr is an offset, not a pointer*/
GLsizeiptr offset;
assert(exec->vtx.bufferobj->Pointer); /* buf should be mapped */
offset = (GLbyte *) data - (GLbyte *) exec->vtx.bufferobj->Pointer;
offset = (GLbyte *) data -
(GLbyte *) exec->vtx.bufferobj->Pointer +
exec->vtx.bufferobj->Offset;
assert(offset >= 0);
arrays[attr].Ptr = (void *) offset;
}