summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL/VertexManager.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2018-01-21 00:59:10 +1000
committerStenzek <stenzek@gmail.com>2018-02-22 19:08:52 +1000
commit3fd4142f361bd6af2c147faf48e1d1d62d170067 (patch)
tree824e1fe80fab472c0073232ac7580a4132ce3e9a /Source/Core/VideoBackends/OGL/VertexManager.cpp
parentfca9c28f38e46b78bf65c3b427a21560e5fb42b7 (diff)
OGL: Track state of last bound vertex array object
This reduces the overhead of calling glBindVertexArray() every time RestoreAPIState() is called, even when it is redundant.
Diffstat (limited to 'Source/Core/VideoBackends/OGL/VertexManager.cpp')
-rw-r--r--Source/Core/VideoBackends/OGL/VertexManager.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Source/Core/VideoBackends/OGL/VertexManager.cpp b/Source/Core/VideoBackends/OGL/VertexManager.cpp
index fd005e4860..d9fce2bc75 100644
--- a/Source/Core/VideoBackends/OGL/VertexManager.cpp
+++ b/Source/Core/VideoBackends/OGL/VertexManager.cpp
@@ -95,6 +95,11 @@ void VertexManager::ResetBuffer(u32 stride)
}
else
{
+ // The index buffer is part of the VAO state, therefore we need to bind it first.
+ const GLVertexFormat* vertex_format =
+ static_cast<GLVertexFormat*>(VertexLoaderManager::GetCurrentVertexFormat());
+ ProgramShaderCache::BindVertexFormat(vertex_format);
+
auto buffer = s_vertexBuffer->Map(MAXVBUFFERSIZE, stride);
m_cur_buffer_pointer = m_base_buffer_pointer = buffer.first;
m_end_buffer_pointer = buffer.first + MAXVBUFFERSIZE;