Don't restore buffer bindings if they weren't changed

This commit is contained in:
baldurk
2020-05-20 20:19:42 +01:00
parent 6362e7fe70
commit 597230f352
+14 -11
View File
@@ -1119,19 +1119,22 @@ void WrappedOpenGL::RestoreClientMemoryArrays(ClientMemoryData *clientMemoryArra
if(!clientMemoryArrays)
return;
// Restore the 0-buffer bindings and attrib pointers.
gl_CurChunk = GLChunk::glBindBuffer;
glBindBuffer(eGL_ARRAY_BUFFER, 0);
for(const ClientMemoryData::VertexAttrib &attrib : clientMemoryArrays->attribs)
if(!clientMemoryArrays->attribs.empty())
{
gl_CurChunk = GLChunk::glVertexAttribPointer;
glVertexAttribPointer(attrib.index, attrib.size, attrib.type, attrib.normalized, attrib.stride,
attrib.pointer);
}
// Restore the 0-buffer bindings and attrib pointers.
gl_CurChunk = GLChunk::glBindBuffer;
glBindBuffer(eGL_ARRAY_BUFFER, 0);
gl_CurChunk = GLChunk::glBindBuffer;
glBindBuffer(eGL_ARRAY_BUFFER, clientMemoryArrays->prevArrayBufferBinding);
for(const ClientMemoryData::VertexAttrib &attrib : clientMemoryArrays->attribs)
{
gl_CurChunk = GLChunk::glVertexAttribPointer;
glVertexAttribPointer(attrib.index, attrib.size, attrib.type, attrib.normalized,
attrib.stride, attrib.pointer);
}
gl_CurChunk = GLChunk::glBindBuffer;
glBindBuffer(eGL_ARRAY_BUFFER, clientMemoryArrays->prevArrayBufferBinding);
}
delete clientMemoryArrays;
}