GL: Delete "exact-2x" feature. The way it's currently implemented it requires us to allocate double-sized buffers, which really hurt some GFX cards. So, it's gone for now but may return later in some form.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4201 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2009-09-04 17:29:16 +00:00
parent 8d4ecacb4b
commit 0d1662e020
8 changed files with 116 additions and 86 deletions

View File

@ -325,6 +325,86 @@ void Renderer::SetColorMask()
D3D::SetRenderState(D3DRS_COLORWRITEENABLE, write);
}
u32 Renderer::AccessEFB(EFBAccessType type, int x, int y)
{
// Get the rectangular target region covered by the EFB pixel.
EFBRectangle efbPixelRc;
efbPixelRc.left = x;
efbPixelRc.top = y;
efbPixelRc.right = x + 1;
efbPixelRc.bottom = y + 1;
TargetRectangle targetPixelRc = Renderer::ConvertEFBRectangle(efbPixelRc);
// TODO (FIX) : currently, AA path is broken/offset and doesn't return the correct pixel
switch (type)
{
case PEEK_Z:
{
// if (s_MSAASamples > 1)
{
// Resolve our rectangle.
// g_framebufferManager.GetEFBDepthTexture(efbPixelRc);
// glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, g_framebufferManager.GetResolvedFramebuffer());
}
// Sample from the center of the target region.
int srcX = (targetPixelRc.left + targetPixelRc.right) / 2;
int srcY = (targetPixelRc.top + targetPixelRc.bottom) / 2;
u32 z = 0;
// glReadPixels(srcX, srcY, 1, 1, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, &z);
// Scale the 32-bit value returned by glReadPixels to a 24-bit
// value (GC uses a 24-bit Z-buffer).
// TODO: in RE0 this value is often off by one, which causes lighting to disappear
return z >> 8;
}
case POKE_Z:
// TODO: Implement
break;
case PEEK_COLOR: // GXPeekARGB
{
// Although it may sound strange, this really is A8R8G8B8 and not RGBA or 24-bit...
// Tested in Killer 7, the first 8bits represent the alpha value which is used to
// determine if we're aiming at an enemy (0x80 / 0x88) or not (0x70)
// Wind Waker is also using it for the pictograph to determine the color of each pixel
// if (s_MSAASamples > 1)
{
// Resolve our rectangle.
// g_framebufferManager.GetEFBColorTexture(efbPixelRc);
// glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, g_framebufferManager.GetResolvedFramebuffer());
}
// Sample from the center of the target region.
int srcX = (targetPixelRc.left + targetPixelRc.right) / 2;
int srcY = (targetPixelRc.top + targetPixelRc.bottom) / 2;
// Read back pixel in BGRA format, then byteswap to get GameCube's ARGB Format.
u32 color = 0;
// glReadPixels(srcX, srcY, 1, 1, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, &color);
return color;
}
case POKE_COLOR:
// TODO: Implement. One way is to draw a tiny pixel-sized rectangle at
// the exact location. Note: EFB pokes are susceptible to Z-buffering
// and perhaps blending.
//WARN_LOG(VIDEOINTERFACE, "This is probably some kind of software rendering");
break;
}
return 0;
}
// mtx.m[0][3] = pMatrix[1]; // -0.5f/m_targetWidth; <-- fix d3d pixel center?
// mtx.m[1][3] = pMatrix[3]; // +0.5f/m_targetHeight; <-- fix d3d pixel center?