diff options
author | Ian Romanick <[email protected]> | 2015-11-03 15:55:14 -0800 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2015-11-24 11:31:29 -0800 |
commit | 52921f8e089abbc6871060fc50f90b62aaf1e11b (patch) | |
tree | 011893757fefbefc25aeccaf2534caf172f814bd /src/mesa | |
parent | 1035e00a815f0babddac0c6c43d01fd34f7e8a94 (diff) |
meta: Use DSA functions for VBOs in _mesa_meta_setup_vertex_objects
The fixed-function attribute paths don't get the DSA treatment because
there are no DSA entry-points for fixed-function attributes. These
could have been added, but this is a temporary patch intended to make
later patches easier to review.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/common/meta.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 939f8c3837e..e9bffe36a69 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -349,19 +349,19 @@ _mesa_meta_setup_vertex_objects(struct gl_context *ctx, _mesa_BindVertexArray(*VAO); /* create vertex array buffer */ - _mesa_GenBuffers(1, &VBO); - _mesa_BindBuffer(GL_ARRAY_BUFFER, VBO); + _mesa_CreateBuffers(1, &VBO); *buf_obj = _mesa_lookup_bufferobj(ctx, VBO); /* _mesa_lookup_bufferobj only returns NULL if name is 0. If the object * does not yet exist (i.e., hasn't been bound) it will return a dummy - * object that you can't do anything with. + * object that you can't do anything with. _mesa_CreateBuffers also + * makes the object exist. */ assert(*buf_obj != NULL && (*buf_obj)->Name == VBO); - assert(*buf_obj == ctx->Array.ArrayBufferObj); + assert(*buf_obj != ctx->Array.ArrayBufferObj); - _mesa_BufferData(GL_ARRAY_BUFFER, 4 * sizeof(struct vertex), NULL, - GL_DYNAMIC_DRAW); + _mesa_NamedBufferData(VBO, 4 * sizeof(struct vertex), NULL, + GL_DYNAMIC_DRAW); assert((*buf_obj)->Size == 4 * sizeof(struct vertex)); @@ -369,16 +369,21 @@ _mesa_meta_setup_vertex_objects(struct gl_context *ctx, if (use_generic_attributes) { assert(color_size == 0); - _mesa_VertexAttribPointer(0, vertex_size, GL_FLOAT, GL_FALSE, - sizeof(struct vertex), OFFSET(x)); + _mesa_VertexArrayAttribFormat(*VAO, 0, vertex_size, GL_FLOAT, + GL_FALSE, OFFSET(x)); + _mesa_VertexArrayVertexBuffer(*VAO, 0, VBO, 0, + sizeof(struct vertex)); _mesa_EnableVertexAttribArray(0); if (texcoord_size > 0) { - _mesa_VertexAttribPointer(1, texcoord_size, GL_FLOAT, GL_FALSE, - sizeof(struct vertex), OFFSET(tex)); + _mesa_VertexArrayAttribFormat(*VAO, 1, texcoord_size, GL_FLOAT, + GL_FALSE, OFFSET(tex)); + _mesa_VertexArrayVertexBuffer(*VAO, 1, VBO, 0, + sizeof(struct vertex)); _mesa_EnableVertexAttribArray(1); } } else { + _mesa_BindBuffer(GL_ARRAY_BUFFER, VBO); _mesa_VertexPointer(vertex_size, GL_FLOAT, sizeof(struct vertex), OFFSET(x)); _mesa_EnableClientState(GL_VERTEX_ARRAY); @@ -394,16 +399,16 @@ _mesa_meta_setup_vertex_objects(struct gl_context *ctx, sizeof(struct vertex), OFFSET(r)); _mesa_EnableClientState(GL_COLOR_ARRAY); } - } - /* Restore the old VBO. This is done because we don't want the new VBO - * to be bound on exit. It would be nicer to use DSA type functions, - * but there are no DSA functions to bind a VBO to a VAO for - * fixed-function vertex attributes. - */ - { - struct save_state *save = &ctx->Meta->Save[ctx->Meta->SaveStackDepth - 1]; - _mesa_BindBuffer(GL_ARRAY_BUFFER, save->ArrayBufferObj->Name); + /* Restore the old VBO. This is done because we don't want the new VBO + * to be bound on exit. It would be nicer to use DSA type functions, + * but there are no DSA functions to bind a VBO to a VAO for + * fixed-function vertex attributes. + */ + { + struct save_state *save = &ctx->Meta->Save[ctx->Meta->SaveStackDepth - 1]; + _mesa_BindBuffer(GL_ARRAY_BUFFER, save->ArrayBufferObj->Name); + } } } else { _mesa_BindVertexArray(*VAO); |