summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2018-03-15 00:32:39 +1000
committerStenzek <stenzek@gmail.com>2018-03-15 00:32:39 +1000
commitdc9012ae086629207ae225e1e1d40a96607c1bca (patch)
treeca3defc510fc2078f365d9b9193887e5d2efeef0 /Source/Core/VideoBackends/OGL
parent6813c5e1e946fda239d1769a3893099357c5274c (diff)
OGL: Ensure VAO is active before unmapping buffers
Fixes a crash which could occur in platforms which do not support buffer_storage, and EFB2RAM is enabled (which indirectly uses the attributeless buffer).
Diffstat (limited to 'Source/Core/VideoBackends/OGL')
-rw-r--r--Source/Core/VideoBackends/OGL/VertexManager.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Source/Core/VideoBackends/OGL/VertexManager.cpp b/Source/Core/VideoBackends/OGL/VertexManager.cpp
index 00b20e3c76..00cf6b3cfa 100644
--- a/Source/Core/VideoBackends/OGL/VertexManager.cpp
+++ b/Source/Core/VideoBackends/OGL/VertexManager.cpp
@@ -86,6 +86,10 @@ void VertexManager::PrepareDrawBuffers(u32 stride)
u32 vertex_data_size = IndexGenerator::GetNumVerts() * stride;
u32 index_data_size = IndexGenerator::GetIndexLen() * sizeof(u16);
+ // 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);
s_vertexBuffer->Unmap(vertex_data_size);
s_indexBuffer->Unmap(index_data_size);