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
This commit is contained in:
Nolan Check 2009-06-29 20:54:47 +00:00
parent 37fe91bad1
commit dbe42dd755
2 changed files with 25 additions and 14 deletions

View File

@ -194,7 +194,7 @@ union UVIFBInfoRegister
{ {
// TODO: mask out lower 9bits/align to 9bits??? // TODO: mask out lower 9bits/align to 9bits???
unsigned FBB : 24; // Base address of the framebuffer in external mem 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 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 POFF : 1; // Page offest: 1: fb address is (address>>5)
unsigned CLRPOFF : 3; // ? setting bit 31 clears POFF unsigned CLRPOFF : 3; // ? setting bit 31 clears POFF
@ -1104,14 +1104,12 @@ void Update()
// eg. Animal Crossing gc have smth in TFBL.XOF bitfield. // 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." // "XOF - Horizontal Offset of the left-most pixel within the first word of the fetched picture."
xfbAddr = GetXFBPointerTop_GC(); xfbAddr = GetXFBPointerTop_GC();
_dbg_assert_msg_(VIDEOINTERFACE, xfbAddr, "Bad top XFB address");
} }
else else
{ {
NextXFBRender = 1; NextXFBRender = 1;
// Previously checked m_XFBInfoTop.POFF then used m_XFBInfoBottom.FBB, try reverting if there are problems // Previously checked m_XFBInfoTop.POFF then used m_XFBInfoBottom.FBB, try reverting if there are problems
xfbAddr = GetXFBPointerBottom_GC(); xfbAddr = GetXFBPointerBottom_GC();
_dbg_assert_msg_(VIDEOINTERFACE, xfbAddr, "Bad bottom XFB address");
yOffset = -1; yOffset = -1;
} }

View File

@ -112,6 +112,7 @@ static int s_targetwidth; // Size of render buffer FBO.
static int s_targetheight; static int s_targetheight;
static FramebufferManager s_framebufferManager; static FramebufferManager s_framebufferManager;
static GLuint s_tempScreenshotFramebuffer = 0;
#ifndef _WIN32 #ifndef _WIN32
int OSDChoice = 0 , OSDTime = 0, OSDInternalW = 0, OSDInternalH = 0; int OSDChoice = 0 , OSDTime = 0, OSDInternalW = 0, OSDInternalH = 0;
@ -361,6 +362,9 @@ void Renderer::Shutdown(void)
g_cgcontext = 0; g_cgcontext = 0;
} }
glDeleteFramebuffersEXT(1, &s_tempScreenshotFramebuffer);
s_tempScreenshotFramebuffer = 0;
s_framebufferManager.Shutdown(); s_framebufferManager.Shutdown();
#ifdef _WIN32 #ifdef _WIN32
@ -725,7 +729,7 @@ void Renderer::Swap(u32 xfbAddr, u32 srcWidth, u32 srcHeight, s32 yOffset)
v_max -= yOffset; v_max -= yOffset;
// Tell the OSD Menu about the current internal resolution // 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. // Make sure that the wireframe setting doesn't screw up the screen copy.
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
@ -789,31 +793,37 @@ void Renderer::Swap(u32 xfbAddr, u32 srcWidth, u32 srcHeight, s32 yOffset)
// Save screenshot // Save screenshot
if (s_bScreenshot) if (s_bScreenshot)
{ {
// TODO: Wrong. The EFB may contain something else by now. We want to read from the XFB. if (!s_tempScreenshotFramebuffer)
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, s_framebufferManager.GetEFBFramebuffer()); 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(); s_criticalScreenshot.Enter();
// Save screenshot // 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 // Reset settings
s_sScreenshotName = ""; s_sScreenshotName = "";
s_bScreenshot = false; s_bScreenshot = false;
s_criticalScreenshot.Leave(); 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 // Frame dumps are handled a little differently in Windows
#ifdef _WIN32 #ifdef _WIN32
if (g_Config.bDumpFrames) if (g_Config.bDumpFrames)
{ {
// TODO: Wrong. The EFB may contain something else by now. We want to read from the XFB. if (!s_tempScreenshotFramebuffer)
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, s_framebufferManager.GetEFBFramebuffer()); 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(); s_criticalScreenshot.Enter();
int w = xfbSource->sourceRc.right; int w = xfbSource->sourceRc.GetWidth();
int h = xfbSource->sourceRc.bottom; int h = xfbSource->sourceRc.GetHeight();
int t = (int)(v_min); int t = (int)(v_min);
u8 *data = (u8 *) malloc(3 * w * h); u8 *data = (u8 *) malloc(3 * w * h);
glPixelStorei(GL_PACK_ALIGNMENT, 1); glPixelStorei(GL_PACK_ALIGNMENT, 1);
@ -842,6 +852,9 @@ void Renderer::Swap(u32 xfbAddr, u32 srcWidth, u32 srcHeight, s32 yOffset)
} }
free(data); free(data);
s_criticalScreenshot.Leave(); 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 else
{ {