1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +00:00

Implement depth buffer copy for Mario Golf.

Fix Mario Golf: Animated effects render in front of course #312
This commit is contained in:
Sergey Lipskiy 2016-09-06 19:37:11 +07:00
parent bbcd0be949
commit 7dca7f8f4d
2 changed files with 11 additions and 8 deletions

View File

@ -382,19 +382,23 @@ CachedTexture * FrameBuffer::_getSubTexture(u32 _t)
CachedTexture * FrameBuffer::getTexture(u32 _t)
{
const bool getDepthTexture = m_isDepthBuffer &&
gDP.colorImage.address == gDP.depthImageAddress &&
m_pDepthBuffer != nullptr;
CachedTexture *pTexture = getDepthTexture ? m_pDepthBuffer->m_pDepthBufferTexture : m_pTexture;
const u32 shift = (gSP.textureTile[_t]->imageAddress - m_startAddress) >> (m_size - 1);
const u32 factor = m_width;
if (m_loadType == LOADTYPE_TILE) {
m_pTexture->offsetS = (float)(m_loadTileOrigin.uls + (shift % factor));
m_pTexture->offsetT = (float)(m_height - (m_loadTileOrigin.ult + shift / factor));
pTexture->offsetS = (float)(m_loadTileOrigin.uls + (shift % factor));
pTexture->offsetT = (float)(m_height - (m_loadTileOrigin.ult + shift / factor));
} else {
m_pTexture->offsetS = (float)(shift % factor);
m_pTexture->offsetT = (float)(m_height - shift / factor);
pTexture->offsetS = (float)(shift % factor);
pTexture->offsetT = (float)(m_height - shift / factor);
}
CachedTexture *pTexture = m_pTexture;
// if (gSP.textureTile[_t]->loadType == LOADTYPE_TILE && pTexture->size > 1)
if (gSP.textureTile[_t]->clamps == 0 || gSP.textureTile[_t]->clampt == 0)
if (!getDepthTexture && (gSP.textureTile[_t]->clamps == 0 || gSP.textureTile[_t]->clampt == 0))
pTexture = _getSubTexture(_t);
pTexture->scaleS = m_scaleX / (float)pTexture->realWidth;

View File

@ -321,8 +321,7 @@ void RSP_Init()
config.generalEmulation.hacks = 0;
if (strstr(RSP.romname, (const char *)"OgreBattle64") != nullptr)
config.generalEmulation.hacks |= hack_Ogre64;
else if (strstr(RSP.romname, (const char *)"MarioGolf64") != nullptr ||
strstr(RSP.romname, (const char *)"F1 POLE POSITION 64") != nullptr)
else if (strstr(RSP.romname, (const char *)"F1 POLE POSITION 64") != nullptr)
config.generalEmulation.hacks |= hack_noDepthFrameBuffers;
else if (strstr(RSP.romname, (const char *)"CONKER BFD") != nullptr)
config.generalEmulation.hacks |= hack_blurPauseScreen | hack_rectDepthBufferCopyCBFD;