From dc9012ae086629207ae225e1e1d40a96607c1bca Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 15 Mar 2018 00:32:39 +1000 Subject: [PATCH] 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). --- Source/Core/VideoBackends/OGL/VertexManager.cpp | 4 ++++ 1 file changed, 4 insertions(+) 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(VertexLoaderManager::GetCurrentVertexFormat()); + ProgramShaderCache::BindVertexFormat(vertex_format); s_vertexBuffer->Unmap(vertex_data_size); s_indexBuffer->Unmap(index_data_size);