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.
This commit is contained in:
Stenzek
2018-01-21 00:59:10 +10:00
parent fca9c28f38
commit 3fd4142f36
9 changed files with 59 additions and 29 deletions

View File

@ -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;