summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo/vbo_exec_draw.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-08-20 10:23:28 -0600
committerBrian <[email protected]>2007-08-20 10:23:28 -0600
commitdf1df82f1660996d09fa272e6129c194afde3ece (patch)
treea28e21bb697f637707ca95cdf20e09a8d3a94b9a /src/mesa/vbo/vbo_exec_draw.c
parent8339ca7d1e9a3fe90f46e6e81f7ec8574d121072 (diff)
parent14327705fd53e984b74f8e9adb053df03fba7aff (diff)
Merge branch 'softpipe_0_1_branch' of git+ssh://[email protected]/git/mesa/mesa into softpipe_0_1_branch
Diffstat (limited to 'src/mesa/vbo/vbo_exec_draw.c')
-rw-r--r--src/mesa/vbo/vbo_exec_draw.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index 0ef26cdfe36..68aba1df66b 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -175,16 +175,27 @@ 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]) {
- 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);
arrays[attr].Type = GL_FLOAT;
arrays[attr].Enabled = 1;
- arrays[attr].BufferObj = exec->vtx.bufferobj; /* NullBufferObj */
+ arrays[attr].BufferObj = exec->vtx.bufferobj;
arrays[attr]._MaxElement = count; /* ??? */
data += exec->vtx.attrsz[attr] * sizeof(GLfloat);