mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Move to new Virtual XFB system which correctly handles games which store multiple XFB's in memory. More OpenGL cleanup.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3591 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -25,7 +25,7 @@ namespace Common {
|
||||
|
||||
typedef void (__cdecl* TVideo_Prepare)();
|
||||
typedef void (__cdecl* TVideo_SendFifoData)(u8*,u32);
|
||||
typedef void (__cdecl* TVideo_UpdateXFB)(u8*, u32, u32, s32, bool);
|
||||
typedef void (__cdecl* TVideo_UpdateXFB)(u32, u32, u32, s32, bool);
|
||||
typedef bool (__cdecl* TVideo_Screenshot)(const char* filename);
|
||||
typedef void (__cdecl* TVideo_EnterLoop)();
|
||||
typedef void (__cdecl* TVideo_ExitLoop)();
|
||||
|
@ -995,6 +995,14 @@ u8* GetXFBPointerTop()
|
||||
return Memory::GetPointer(m_XFBInfoTop.FBB);
|
||||
}
|
||||
|
||||
u32 GetXFBPointerTop_GC()
|
||||
{
|
||||
if (m_XFBInfoTop.POFF)
|
||||
return m_XFBInfoTop.FBB << 5;
|
||||
else
|
||||
return m_XFBInfoTop.FBB;
|
||||
}
|
||||
|
||||
u8* GetXFBPointerBottom()
|
||||
{
|
||||
// POFF for XFB bottom is connected to POFF for XFB top
|
||||
@ -1004,6 +1012,15 @@ u8* GetXFBPointerBottom()
|
||||
return Memory::GetPointer(m_XFBInfoBottom.FBB);
|
||||
}
|
||||
|
||||
u32 GetXFBPointerBottom_GC()
|
||||
{
|
||||
// POFF for XFB bottom is connected to POFF for XFB top
|
||||
if (m_XFBInfoTop.POFF)
|
||||
return m_XFBInfoBottom.FBB << 5;
|
||||
else
|
||||
return m_XFBInfoBottom.FBB;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Screenshot and screen message
|
||||
@ -1077,7 +1094,7 @@ void Update()
|
||||
|
||||
if (m_VBeamPos == NextXFBRender)
|
||||
{
|
||||
u8* xfbPtr = 0;
|
||||
u32 xfbAddr = 0;
|
||||
int yOffset = 0;
|
||||
|
||||
if (NextXFBRender == 1)
|
||||
@ -1086,34 +1103,34 @@ void Update()
|
||||
// TODO: proper VI regs typedef and logic for XFB to work.
|
||||
// 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."
|
||||
xfbPtr = GetXFBPointerTop();
|
||||
_dbg_assert_msg_(VIDEOINTERFACE, xfbPtr, "Bad top XFB address");
|
||||
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
|
||||
xfbPtr = GetXFBPointerBottom();
|
||||
_dbg_assert_msg_(VIDEOINTERFACE, xfbPtr, "Bad bottom XFB address");
|
||||
xfbAddr = GetXFBPointerBottom_GC();
|
||||
_dbg_assert_msg_(VIDEOINTERFACE, xfbAddr, "Bad bottom XFB address");
|
||||
yOffset = -1;
|
||||
}
|
||||
|
||||
Common::PluginVideo* video = CPluginManager::GetInstance().GetVideo();
|
||||
|
||||
if (xfbPtr && video->IsValid())
|
||||
if (xfbAddr && video->IsValid())
|
||||
{
|
||||
int fbWidth = m_HorizontalStepping.FieldSteps * 16;
|
||||
int fbHeight = (m_HorizontalStepping.FbSteps / m_HorizontalStepping.FieldSteps) * m_VerticalTimingRegister.ACV;
|
||||
|
||||
DEBUG_LOG(VIDEOINTERFACE, "(VI->XFBUpdate): ptr: %p | %ix%i | xoff: %i",
|
||||
xfbPtr, fbWidth, fbHeight, m_XFBInfoTop.XOFF);
|
||||
DEBUG_LOG(VIDEOINTERFACE, "(VI->XFBUpdate): ptr: %.08X | %ix%i | xoff: %i",
|
||||
xfbAddr, fbWidth, fbHeight, m_XFBInfoTop.XOFF);
|
||||
|
||||
if (Core::GetStartupParameter().bUseDualCore)
|
||||
// scheduled on EmuThread in DC mode
|
||||
video->Video_UpdateXFB(xfbPtr, fbWidth, fbHeight, yOffset, TRUE);
|
||||
video->Video_UpdateXFB(xfbAddr, fbWidth, fbHeight, yOffset, TRUE);
|
||||
else
|
||||
// otherwise do it now from here (CPUthread)
|
||||
video->Video_UpdateXFB(xfbPtr, fbWidth, fbHeight, yOffset, FALSE);
|
||||
video->Video_UpdateXFB(xfbAddr, fbWidth, fbHeight, yOffset, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ void SetColorMask(const Bypass &bp);
|
||||
float GetRendererTargetScaleX();
|
||||
float GetRendererTargetScaleY();
|
||||
void CopyEFB(const Bypass &bp, const TRectangle &rc, const u32 &address, const bool &fromZBuffer, const bool &isIntensityFmt, const u32 ©fmt, const bool &scaleByHalf);
|
||||
void RenderToXFB(const Bypass &bp, const TRectangle &multirc, const float &yScale, const float &xfbLines, u8* pXFB, const u32 &dstWidth, const u32 &dstHeight);
|
||||
void RenderToXFB(const Bypass &bp, const TRectangle &multirc, const float &yScale, const float &xfbLines, u32 xfbAddr, const u32 &dstWidth, const u32 &dstHeight);
|
||||
void ClearScreen(const Bypass &bp, const TRectangle &multirc);
|
||||
void RestoreRenderState(const Bypass &bp);
|
||||
u8 *GetPointer(const u32 &address);
|
||||
|
@ -220,7 +220,7 @@ void BPWritten(const Bypass& bp)
|
||||
const float yScale = bpmem.dispcopyyscale / 256.0f;
|
||||
const float xfbLines = ((bpmem.copyTexSrcWH.y + 1.0f) * yScale);
|
||||
RenderToXFB(bp, multirc, yScale, xfbLines,
|
||||
Memory_GetPtr(bpmem.copyTexDest << 5),
|
||||
bpmem.copyTexDest << 5,
|
||||
bpmem.copyMipMapStrideChannels << 4,
|
||||
(u32)ceil(xfbLines));
|
||||
}
|
||||
|
Reference in New Issue
Block a user