mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-26 15:49:50 -06:00
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:
@ -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?
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <d3dx9.h>
|
||||
|
||||
#include "Common.h"
|
||||
#include "Atomic.h"
|
||||
#include "Thread.h"
|
||||
#include "LogManager.h"
|
||||
|
||||
@ -59,10 +60,9 @@ SVideoInitialize g_VideoInitialize;
|
||||
PLUGIN_GLOBALS* globals = NULL;
|
||||
int initCount = 0;
|
||||
|
||||
static volatile u32 s_AccessEFBResult = 0, s_EFBx, s_EFBy;
|
||||
static u32 s_efbAccessRequested = FALSE;
|
||||
|
||||
static volatile EFBAccessType s_AccessEFBType;
|
||||
static Common::Event s_AccessEFBDone;
|
||||
static Common::CriticalSection s_criticalEFB;
|
||||
|
||||
bool HandleDisplayList(u32 address, u32 size)
|
||||
{
|
||||
@ -413,65 +413,40 @@ void Video_Screenshot(const char *_szFilename)
|
||||
}
|
||||
}
|
||||
|
||||
static struct
|
||||
{
|
||||
EFBAccessType type;
|
||||
u32 x;
|
||||
u32 y;
|
||||
} s_accessEFBArgs;
|
||||
|
||||
static u32 s_AccessEFBResult = 0;
|
||||
|
||||
void VideoFifo_CheckEFBAccess()
|
||||
{
|
||||
s_criticalEFB.Enter();
|
||||
s_AccessEFBResult = 0;
|
||||
|
||||
/*
|
||||
switch (s_AccessEFBType)
|
||||
if (Common::AtomicLoadAcquire(s_efbAccessRequested))
|
||||
{
|
||||
case PEEK_Z:
|
||||
break;
|
||||
s_AccessEFBResult = Renderer::AccessEFB(s_accessEFBArgs.type, s_accessEFBArgs.x, s_accessEFBArgs.y);
|
||||
|
||||
case POKE_Z:
|
||||
break;
|
||||
|
||||
case PEEK_COLOR:
|
||||
break;
|
||||
|
||||
case POKE_COLOR:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
Common::AtomicStoreRelease(s_efbAccessRequested, FALSE);
|
||||
}
|
||||
*/
|
||||
|
||||
if (g_VideoInitialize.bUseDualCore)
|
||||
s_AccessEFBDone.Set();
|
||||
|
||||
s_criticalEFB.Leave();
|
||||
}
|
||||
|
||||
u32 Video_AccessEFB(EFBAccessType type, u32 x, u32 y)
|
||||
{
|
||||
u32 result;
|
||||
s_accessEFBArgs.type = type;
|
||||
s_accessEFBArgs.x = x;
|
||||
s_accessEFBArgs.y = y;
|
||||
|
||||
s_criticalEFB.Enter();
|
||||
|
||||
s_AccessEFBType = type;
|
||||
s_EFBx = x;
|
||||
s_EFBy = y;
|
||||
Common::AtomicStoreRelease(s_efbAccessRequested, TRUE);
|
||||
|
||||
if (g_VideoInitialize.bUseDualCore)
|
||||
s_AccessEFBDone.Init();
|
||||
|
||||
s_criticalEFB.Leave();
|
||||
|
||||
if (g_VideoInitialize.bUseDualCore)
|
||||
s_AccessEFBDone.Wait();
|
||||
{
|
||||
while (Common::AtomicLoadAcquire(s_efbAccessRequested))
|
||||
Common::YieldCPU();
|
||||
}
|
||||
else
|
||||
VideoFifo_CheckEFBAccess();
|
||||
|
||||
s_criticalEFB.Enter();
|
||||
|
||||
if (g_VideoInitialize.bUseDualCore)
|
||||
s_AccessEFBDone.Shutdown();
|
||||
|
||||
result = s_AccessEFBResult;
|
||||
|
||||
s_criticalEFB.Leave();
|
||||
|
||||
return result;
|
||||
return s_AccessEFBResult;
|
||||
}
|
||||
|
Reference in New Issue
Block a user