X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fvbo%2Fvbo_exec_draw.c;h=5bf3d836db57224b8bc11d45ccc12cdc2c613e93;hb=a7d9fde24cb8ecc59b0a6fc610135d851806295b;hp=1d095c772f959cf42d1850d87f16e6fdb93fbe08;hpb=47ad296a183929c2007c35c60d722b4ac680417d;p=mesa.git diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 1d095c772f9..5bf3d836db5 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -150,6 +150,7 @@ static void vbo_exec_bind_arrays( GLcontext *ctx ) GLubyte *data = exec->vtx.buffer_map; const GLuint *map; GLuint attr; + GLbitfield varying_inputs = 0x0; /* Install the default (ie Current) attributes first, then overlay * all active ones. @@ -188,7 +189,18 @@ static void vbo_exec_bind_arrays( GLcontext *ctx ) /* 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); @@ -200,8 +212,11 @@ static void vbo_exec_bind_arrays( GLcontext *ctx ) arrays[attr]._MaxElement = count; /* ??? */ data += exec->vtx.attrsz[src] * sizeof(GLfloat); + varying_inputs |= 1<Driver.UnmapBuffer(ctx, target, exec->vtx.bufferobj); - exec->vtx.buffer_map = NULL; + if (ctx->NewState) + _mesa_update_state( ctx ); + + /* if using a real VBO, unmap it before drawing */ + if (exec->vtx.bufferobj->Name) { + ctx->Driver.UnmapBuffer(ctx, target, exec->vtx.bufferobj); + exec->vtx.buffer_map = NULL; + } vbo_context(ctx)->draw_prims( ctx, exec->vtx.inputs, @@ -242,11 +263,12 @@ void vbo_exec_vtx_flush( struct vbo_exec_context *exec ) 0, exec->vtx.vert_count - 1); - /* Get new data: - */ - ctx->Driver.BufferData(ctx, target, size, NULL, usage, exec->vtx.bufferobj); - exec->vtx.buffer_map - = ctx->Driver.MapBuffer(ctx, target, access, exec->vtx.bufferobj); + /* If using a real VBO, get new storage */ + if (exec->vtx.bufferobj->Name) { + ctx->Driver.BufferData(ctx, target, size, NULL, usage, exec->vtx.bufferobj); + exec->vtx.buffer_map = + ctx->Driver.MapBuffer(ctx, target, access, exec->vtx.bufferobj); + } } }