From dbe42dd755150fc8432ec732314303dfaf89f496 Mon Sep 17 00:00:00 2001 From: Nolan Check Date: Mon, 29 Jun 2009 20:54:47 +0000 Subject: [PATCH] Remove obsolete debug-assertions in VideoInterface. Hopefully fix screenshots. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3604 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/HW/VideoInterface.cpp | 4 +-- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 35 +++++++++++++------ 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/Source/Core/Core/Src/HW/VideoInterface.cpp b/Source/Core/Core/Src/HW/VideoInterface.cpp index 8d08f1273a..3a58eec06c 100644 --- a/Source/Core/Core/Src/HW/VideoInterface.cpp +++ b/Source/Core/Core/Src/HW/VideoInterface.cpp @@ -194,7 +194,7 @@ union UVIFBInfoRegister { // TODO: mask out lower 9bits/align to 9bits??? unsigned FBB : 24; // Base address of the framebuffer in external mem - // TODO: do XOFF/POFF exist in bottom reg? + // POFF only seems to exist in the top reg. XOFF, unknown. unsigned XOFF : 4; // Horizontal Offset of the left-most pixel within the first word of the fetched picture unsigned POFF : 1; // Page offest: 1: fb address is (address>>5) unsigned CLRPOFF : 3; // ? setting bit 31 clears POFF @@ -1104,14 +1104,12 @@ void Update() // eg. Animal Crossing gc have smth in TFBL.XOF bitfield. // "XOF - Horizontal Offset of the left-most pixel within the first word of the fetched picture." xfbAddr = GetXFBPointerTop_GC(); - _dbg_assert_msg_(VIDEOINTERFACE, xfbAddr, "Bad top XFB address"); } else { NextXFBRender = 1; // Previously checked m_XFBInfoTop.POFF then used m_XFBInfoBottom.FBB, try reverting if there are problems xfbAddr = GetXFBPointerBottom_GC(); - _dbg_assert_msg_(VIDEOINTERFACE, xfbAddr, "Bad bottom XFB address"); yOffset = -1; } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 12c5d206d3..ec7d6ee02b 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -112,6 +112,7 @@ static int s_targetwidth; // Size of render buffer FBO. static int s_targetheight; static FramebufferManager s_framebufferManager; +static GLuint s_tempScreenshotFramebuffer = 0; #ifndef _WIN32 int OSDChoice = 0 , OSDTime = 0, OSDInternalW = 0, OSDInternalH = 0; @@ -361,6 +362,9 @@ void Renderer::Shutdown(void) g_cgcontext = 0; } + glDeleteFramebuffersEXT(1, &s_tempScreenshotFramebuffer); + s_tempScreenshotFramebuffer = 0; + s_framebufferManager.Shutdown(); #ifdef _WIN32 @@ -725,7 +729,7 @@ void Renderer::Swap(u32 xfbAddr, u32 srcWidth, u32 srcHeight, s32 yOffset) v_max -= yOffset; // Tell the OSD Menu about the current internal resolution - OSDInternalW = xfbSource->sourceRc.GetWidth(); OSDInternalH = xfbSource->sourceRc.bottom; + OSDInternalW = xfbSource->sourceRc.GetWidth(); OSDInternalH = xfbSource->sourceRc.GetHeight(); // Make sure that the wireframe setting doesn't screw up the screen copy. glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); @@ -789,31 +793,37 @@ void Renderer::Swap(u32 xfbAddr, u32 srcWidth, u32 srcHeight, s32 yOffset) // Save screenshot if (s_bScreenshot) { - // TODO: Wrong. The EFB may contain something else by now. We want to read from the XFB. - glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, s_framebufferManager.GetEFBFramebuffer()); + if (!s_tempScreenshotFramebuffer) + glGenFramebuffersEXT(1, &s_tempScreenshotFramebuffer); + + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, s_tempScreenshotFramebuffer); + glFramebufferTexture2DEXT(GL_READ_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB, xfbSource->texture, 0); s_criticalScreenshot.Enter(); // Save screenshot - SaveRenderTarget(s_sScreenshotName.c_str(), xfbSource->sourceRc.right, xfbSource->sourceRc.bottom, (int)(v_min)); + SaveRenderTarget(s_sScreenshotName.c_str(), xfbSource->sourceRc.GetWidth(), xfbSource->sourceRc.GetHeight(), (int)(v_min)); // Reset settings s_sScreenshotName = ""; s_bScreenshot = false; s_criticalScreenshot.Leave(); + + glFramebufferTexture2DEXT(GL_READ_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB, 0, 0); + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, s_framebufferManager.GetEFBFramebuffer()); } - // It should not be necessary to read from the window backbuffer beyond this point - if (/*s_bHaveFramebufferBlit*/ s_MSAASamples > 1) - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); // Frame dumps are handled a little differently in Windows #ifdef _WIN32 if (g_Config.bDumpFrames) { - // TODO: Wrong. The EFB may contain something else by now. We want to read from the XFB. - glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, s_framebufferManager.GetEFBFramebuffer()); + if (!s_tempScreenshotFramebuffer) + glGenFramebuffersEXT(1, &s_tempScreenshotFramebuffer); + + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, s_tempScreenshotFramebuffer); + glFramebufferTexture2DEXT(GL_READ_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB, xfbSource->texture, 0); s_criticalScreenshot.Enter(); - int w = xfbSource->sourceRc.right; - int h = xfbSource->sourceRc.bottom; + int w = xfbSource->sourceRc.GetWidth(); + int h = xfbSource->sourceRc.GetHeight(); int t = (int)(v_min); u8 *data = (u8 *) malloc(3 * w * h); glPixelStorei(GL_PACK_ALIGNMENT, 1); @@ -842,6 +852,9 @@ void Renderer::Swap(u32 xfbAddr, u32 srcWidth, u32 srcHeight, s32 yOffset) } free(data); s_criticalScreenshot.Leave(); + + glFramebufferTexture2DEXT(GL_READ_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB, 0, 0); + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, s_framebufferManager.GetEFBFramebuffer()); } else {