summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFredrik Höglund <[email protected]>2013-04-11 16:49:44 +0200
committerFredrik Höglund <[email protected]>2013-11-07 16:20:45 +0100
commit193e8b4b93d1f77d7d55d5fafd0713f0d6d95667 (patch)
treea99f3b6b641c411a7fbaa5183bf6e95bd95e6a14 /src
parent965900e8305d3a3b966c97ad37699cb73ba3e4f1 (diff)
mesa: Optimize rebinding the same VBO
Check if the new buffer object has the same name as the current buffer object before looking it up. Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/varray.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 39e5ad30ab8..1025d6758c4 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1351,9 +1351,10 @@ void GLAPIENTRY
_mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset,
GLsizei stride)
{
+ GET_CURRENT_CONTEXT(ctx);
+ const struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
struct gl_buffer_object *vbo;
- GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
/* The ARB_vertex_attrib_binding spec says:
@@ -1398,7 +1399,9 @@ _mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset,
return;
}
- if (buffer != 0) {
+ if (buffer == arrayObj->VertexBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj->Name) {
+ vbo = arrayObj->VertexBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj;
+ } else if (buffer != 0) {
vbo = _mesa_lookup_bufferobj(ctx, buffer);
/* From the GL_ARB_vertex_attrib_array spec: