diff options
author | Brian <[email protected]> | 2007-08-20 10:23:28 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2007-08-20 10:23:28 -0600 |
commit | df1df82f1660996d09fa272e6129c194afde3ece (patch) | |
tree | a28e21bb697f637707ca95cdf20e09a8d3a94b9a /src/mesa/vbo/vbo_exec_api.c | |
parent | 8339ca7d1e9a3fe90f46e6e81f7ec8574d121072 (diff) | |
parent | 14327705fd53e984b74f8e9adb053df03fba7aff (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_api.c')
-rw-r--r-- | src/mesa/vbo/vbo_exec_api.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 7f56b3b6293..24e2eba4720 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -631,6 +631,41 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec ) } +/** + * Tell the VBO module to use a real OpenGL vertex buffer object to + * store accumulated immediate-mode vertex data. + * This replaces the malloced buffer which was created in + * vb_exec_vtx_init() below. + */ +void vbo_use_buffer_objects(GLcontext *ctx) +{ + struct vbo_exec_context *exec = &vbo_context(ctx)->exec; + /* Any buffer name but 0 can be used here since this bufferobj won't + * go into the bufferobj hashtable. + */ + GLuint bufName = 0xaabbccdd; + GLenum target = GL_ARRAY_BUFFER_ARB; + GLenum access = GL_READ_WRITE_ARB; + GLenum usage = GL_STREAM_DRAW_ARB; + GLsizei size = VBO_VERT_BUFFER_SIZE * sizeof(GLfloat); + + /* Make sure this func is only used once */ + assert(exec->vtx.bufferobj == ctx->Array.NullBufferObj); + if (exec->vtx.buffer_map) { + _mesa_align_free(exec->vtx.buffer_map); + } + + /* Allocate a real buffer object now */ + exec->vtx.bufferobj = ctx->Driver.NewBufferObject(ctx, bufName, target); + ctx->Driver.BufferData(ctx, target, size, NULL, usage, exec->vtx.bufferobj); + + /* and map it */ + exec->vtx.buffer_map + = ctx->Driver.MapBuffer(ctx, target, access, exec->vtx.bufferobj); +} + + + void vbo_exec_vtx_init( struct vbo_exec_context *exec ) { GLcontext *ctx = exec->ctx; |