From 290fd545e688639057c7657050335c3bf5729331 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Wed, 10 Dec 2014 23:19:18 -0800 Subject: [PATCH] OGL: Bind the attributeless VAO before EFB copies. Fixes crashes in Zack & Wiki using an older NVIDIA driver. --- Source/Core/VideoBackends/OGL/GLUtil.cpp | 11 +++++++---- Source/Core/VideoBackends/OGL/TextureCache.cpp | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Source/Core/VideoBackends/OGL/GLUtil.cpp b/Source/Core/VideoBackends/OGL/GLUtil.cpp index f9b3ccb844..d367c370bf 100644 --- a/Source/Core/VideoBackends/OGL/GLUtil.cpp +++ b/Source/Core/VideoBackends/OGL/GLUtil.cpp @@ -141,9 +141,12 @@ void OpenGL_BindAttributelessVAO() void OpenGL_DeleteAttributelessVAO() { - glDeleteVertexArrays(1, &attributelessVAO); - glDeleteBuffers(1, &attributelessVBO); + if (attributelessVAO) + { + glDeleteVertexArrays(1, &attributelessVAO); + glDeleteBuffers(1, &attributelessVBO); - attributelessVAO = 0; - attributelessVBO = 0; + attributelessVAO = 0; + attributelessVBO = 0; + } } diff --git a/Source/Core/VideoBackends/OGL/TextureCache.cpp b/Source/Core/VideoBackends/OGL/TextureCache.cpp index 49bfc98a55..f697d51c73 100644 --- a/Source/Core/VideoBackends/OGL/TextureCache.cpp +++ b/Source/Core/VideoBackends/OGL/TextureCache.cpp @@ -249,6 +249,8 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo { FramebufferManager::SetFramebuffer(framebuffer); + OpenGL_BindAttributelessVAO(); + glActiveTexture(GL_TEXTURE0+9); glBindTexture(GL_TEXTURE_2D_ARRAY, read_texture);