From 5064c0decc59f4b40e0cf1264ab6712de227b966 Mon Sep 17 00:00:00 2001 From: Nolan Check Date: Mon, 29 Jun 2009 21:54:42 +0000 Subject: [PATCH] Use EXT_framebuffer_blit whenever possible. Some video cards may not handle glCopyTexImage2D correctly. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3607 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Plugin_VideoOGL/Src/FramebufferManager.cpp | 18 ++++++++++++++---- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp index 529c7fe876..76038be2c9 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp @@ -21,6 +21,8 @@ #include "TextureConverter.h" #include "XFB.h" +extern bool s_bHaveFramebufferBlit; // comes from Render.cpp + void FramebufferManager::Init(int targetWidth, int targetHeight, int msaaSamples, int msaaCoverageSamples) { m_targetWidth = targetWidth; @@ -105,10 +107,6 @@ void FramebufferManager::Init(int targetWidth, int targetHeight, int msaaSamples GL_REPORT_FBO_ERROR(); - // Create XFB framebuffer; targets will be created elsewhere. - - glGenFramebuffersEXT(1, &m_xfbFramebuffer); - // Create resolved targets for transferring multisampled EFB to texture. glGenFramebuffersEXT(1, &m_resolvedFramebuffer); @@ -139,6 +137,10 @@ void FramebufferManager::Init(int targetWidth, int targetHeight, int msaaSamples glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_efbFramebuffer); } + // Create XFB framebuffer; targets will be created elsewhere. + + glGenFramebuffersEXT(1, &m_xfbFramebuffer); + // EFB framebuffer is currently bound. } @@ -322,7 +324,11 @@ void FramebufferManager::copyToVirtualXFB(u32 xfbAddr, u32 dstWidth, u32 dstHeig glGenTextures(1, &xfbTexture); +#if 0 // XXX: Some video drivers don't handle glCopyTexImage2D correctly, so use EXT_framebuffer_blit whenever possible. if (m_msaaSamples > 1) +#else + if (s_bHaveFramebufferBlit) +#endif { // In MSAA mode, allocate the texture image here. In non-MSAA mode, // the image will be allocated by glCopyTexImage2D (later). @@ -358,7 +364,11 @@ void FramebufferManager::copyToVirtualXFB(u32 xfbAddr, u32 dstWidth, u32 dstHeig // Copy EFB to XFB texture +#if 0 if (m_msaaSamples <= 1) +#else + if (!s_bHaveFramebufferBlit) +#endif { // Just copy the EFB directly. diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index ec7d6ee02b..a5c46a0ac7 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -94,7 +94,7 @@ static int s_MSAASamples = 1; static int s_MSAACoverageSamples = 0; static bool s_bHaveStencilBuffer = false; -static bool s_bHaveFramebufferBlit = false; +bool s_bHaveFramebufferBlit = false; // export to FramebufferManager.cpp static bool s_bHaveCoverageMSAA = false; static u32 s_blendMode; static bool s_bNativeResolution = false;