mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Add optimization hacks for depth buffer read in PD and CBFD:
- read depth buffer only when texturedRectDepthBufferCopy called for current frame - for Conker, read depth buffer only in texturedRectDepthBufferCopy. - for PD the buffer need to be read twice, otherwise coronas may poke through objects.
This commit is contained in:
parent
444aa8320a
commit
2840c89629
|
@ -146,8 +146,10 @@ struct Config
|
||||||
#define hack_scoreboardJ (1<<4) //Copy data from RDRAM to auxilary frame buffer. Scoreboard in Mario Tennis (J).
|
#define hack_scoreboardJ (1<<4) //Copy data from RDRAM to auxilary frame buffer. Scoreboard in Mario Tennis (J).
|
||||||
#define hack_pilotWings (1<<5) //Special blend mode for PilotWings.
|
#define hack_pilotWings (1<<5) //Special blend mode for PilotWings.
|
||||||
#define hack_subscreen (1<<6) //Fix subscreen delay in Zelda OOT and Doubutsu no Mori
|
#define hack_subscreen (1<<6) //Fix subscreen delay in Zelda OOT and Doubutsu no Mori
|
||||||
#define hack_blastCorps (1<<8) //Blast Corps black polygons
|
#define hack_blastCorps (1<<7) //Blast Corps black polygons
|
||||||
#define hack_ignoreVIHeightChange (1<<9) //Do not reset FBO when VI height is changed. Space Invaders need it.
|
#define hack_ignoreVIHeightChange (1<<8) //Do not reset FBO when VI height is changed. Space Invaders need it.
|
||||||
|
#define hack_rectDepthBufferCopyPD (1<<9) //Copy depth buffer only when game need it. Optimized for PD
|
||||||
|
#define hack_rectDepthBufferCopyCBFD (1<<10) //Copy depth buffer only when game need it. Optimized for CBFD
|
||||||
#define hack_skipVIChangeCheck (1<<11) //Don't reset FBO when VI parameters changed. Zelda MM
|
#define hack_skipVIChangeCheck (1<<11) //Don't reset FBO when VI parameters changed. Zelda MM
|
||||||
#define hack_ZeldaCamera (1<<12) //Special hack to detect and process Zelda MM camera.
|
#define hack_ZeldaCamera (1<<12) //Special hack to detect and process Zelda MM camera.
|
||||||
|
|
||||||
|
|
|
@ -930,6 +930,7 @@ bool texturedRectShadowMap(const OGLRender::TexturedRectParams &)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 rectDepthBufferCopyFrame = 0xFFFFFFFF;
|
||||||
static
|
static
|
||||||
bool texturedRectDepthBufferCopy(const OGLRender::TexturedRectParams & _params)
|
bool texturedRectDepthBufferCopy(const OGLRender::TexturedRectParams & _params)
|
||||||
{
|
{
|
||||||
|
@ -937,7 +938,6 @@ bool texturedRectDepthBufferCopy(const OGLRender::TexturedRectParams & _params)
|
||||||
// Data from depth buffer loaded into TMEM and then rendered to RDRAM by texrect.
|
// Data from depth buffer loaded into TMEM and then rendered to RDRAM by texrect.
|
||||||
// Works only with depth buffer emulation enabled.
|
// Works only with depth buffer emulation enabled.
|
||||||
// Load of arbitrary data to that area causes weird camera rotation in CBFD.
|
// Load of arbitrary data to that area causes weird camera rotation in CBFD.
|
||||||
static u32 lastDList = 0xFFFFFFFF;
|
|
||||||
const gDPTile * pTile = gSP.textureTile[0];
|
const gDPTile * pTile = gSP.textureTile[0];
|
||||||
if (pTile->loadType == LOADTYPE_BLOCK && gDP.textureImage.size == 2 && gDP.textureImage.address >= gDP.depthImageAddress && gDP.textureImage.address < (gDP.depthImageAddress + gDP.colorImage.width*gDP.colorImage.width * 6 / 4)) {
|
if (pTile->loadType == LOADTYPE_BLOCK && gDP.textureImage.size == 2 && gDP.textureImage.address >= gDP.depthImageAddress && gDP.textureImage.address < (gDP.depthImageAddress + gDP.colorImage.width*gDP.colorImage.width * 6 / 4)) {
|
||||||
if (config.frameBufferEmulation.copyDepthToRDRAM == 0)
|
if (config.frameBufferEmulation.copyDepthToRDRAM == 0)
|
||||||
|
@ -946,8 +946,8 @@ bool texturedRectDepthBufferCopy(const OGLRender::TexturedRectParams & _params)
|
||||||
if (pBuffer == NULL)
|
if (pBuffer == NULL)
|
||||||
return true;
|
return true;
|
||||||
pBuffer->m_cleared = true;
|
pBuffer->m_cleared = true;
|
||||||
if (lastDList != video().getBuffersSwapCount()) {
|
if (rectDepthBufferCopyFrame != video().getBuffersSwapCount()) {
|
||||||
lastDList = video().getBuffersSwapCount();
|
rectDepthBufferCopyFrame = video().getBuffersSwapCount();
|
||||||
if (!FrameBuffer_CopyDepthBuffer(gDP.colorImage.address))
|
if (!FrameBuffer_CopyDepthBuffer(gDP.colorImage.address))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
28
src/RSP.cpp
28
src/RSP.cpp
|
@ -210,8 +210,15 @@ void RSP_ProcessDList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.frameBufferEmulation.copyDepthToRDRAM != Config::ctDisable && !FBInfo::fbInfo.isSupported())
|
if (config.frameBufferEmulation.copyDepthToRDRAM != Config::ctDisable) {
|
||||||
FrameBuffer_CopyDepthBuffer(gDP.colorImage.address);
|
if ((config.generalEmulation.hacks & hack_rectDepthBufferCopyCBFD) != 0) {
|
||||||
|
; // do nothing
|
||||||
|
} else if ((config.generalEmulation.hacks & hack_rectDepthBufferCopyPD) != 0) {
|
||||||
|
if (rectDepthBufferCopyFrame == video().getBuffersSwapCount())
|
||||||
|
FrameBuffer_CopyDepthBuffer(gDP.colorImage.address);
|
||||||
|
} else if (!FBInfo::fbInfo.isSupported())
|
||||||
|
FrameBuffer_CopyDepthBuffer(gDP.colorImage.address);
|
||||||
|
}
|
||||||
|
|
||||||
RSP.busy = FALSE;
|
RSP.busy = FALSE;
|
||||||
gDP.changed |= CHANGED_COLORBUFFER;
|
gDP.changed |= CHANGED_COLORBUFFER;
|
||||||
|
@ -309,12 +316,11 @@ void RSP_Init()
|
||||||
if (strstr(RSP.romname, (const char *)"OgreBattle64") != NULL)
|
if (strstr(RSP.romname, (const char *)"OgreBattle64") != NULL)
|
||||||
config.generalEmulation.hacks |= hack_Ogre64;
|
config.generalEmulation.hacks |= hack_Ogre64;
|
||||||
else if (strstr(RSP.romname, (const char *)"MarioGolf64") != NULL ||
|
else if (strstr(RSP.romname, (const char *)"MarioGolf64") != NULL ||
|
||||||
strstr(RSP.romname, (const char *)"F1 POLE POSITION 64") != NULL
|
strstr(RSP.romname, (const char *)"F1 POLE POSITION 64") != NULL)
|
||||||
)
|
|
||||||
config.generalEmulation.hacks |= hack_noDepthFrameBuffers;
|
config.generalEmulation.hacks |= hack_noDepthFrameBuffers;
|
||||||
else if (strstr(RSP.romname, (const char *)"CONKER BFD") != NULL ||
|
else if (strstr(RSP.romname, (const char *)"CONKER BFD") != NULL)
|
||||||
strstr(RSP.romname, (const char *)"MICKEY USA") != NULL
|
config.generalEmulation.hacks |= hack_blurPauseScreen | hack_rectDepthBufferCopyCBFD;
|
||||||
)
|
else if (strstr(RSP.romname, (const char *)"MICKEY USA") != NULL)
|
||||||
config.generalEmulation.hacks |= hack_blurPauseScreen;
|
config.generalEmulation.hacks |= hack_blurPauseScreen;
|
||||||
else if (strstr(RSP.romname, (const char *)"MarioTennis64") != NULL)
|
else if (strstr(RSP.romname, (const char *)"MarioTennis64") != NULL)
|
||||||
config.generalEmulation.hacks |= hack_scoreboardJ;
|
config.generalEmulation.hacks |= hack_scoreboardJ;
|
||||||
|
@ -323,9 +329,8 @@ void RSP_Init()
|
||||||
else if (strstr(RSP.romname, (const char *)"Pilot Wings64") != NULL)
|
else if (strstr(RSP.romname, (const char *)"Pilot Wings64") != NULL)
|
||||||
config.generalEmulation.hacks |= hack_pilotWings;
|
config.generalEmulation.hacks |= hack_pilotWings;
|
||||||
else if (strstr(RSP.romname, (const char *)"THE LEGEND OF ZELDA") != NULL ||
|
else if (strstr(RSP.romname, (const char *)"THE LEGEND OF ZELDA") != NULL ||
|
||||||
strstr(RSP.romname, (const char *)"ZELDA MASTER QUEST") != NULL ||
|
strstr(RSP.romname, (const char *)"ZELDA MASTER QUEST") != NULL ||
|
||||||
strstr(RSP.romname, (const char *)"DOUBUTSUNOMORI") != NULL
|
strstr(RSP.romname, (const char *)"DOUBUTSUNOMORI") != NULL)
|
||||||
)
|
|
||||||
config.generalEmulation.hacks |= hack_subscreen;
|
config.generalEmulation.hacks |= hack_subscreen;
|
||||||
else if (strstr(RSP.romname, (const char *)"Blast") != NULL)
|
else if (strstr(RSP.romname, (const char *)"Blast") != NULL)
|
||||||
config.generalEmulation.hacks |= hack_blastCorps;
|
config.generalEmulation.hacks |= hack_blastCorps;
|
||||||
|
@ -333,6 +338,9 @@ void RSP_Init()
|
||||||
config.generalEmulation.hacks |= hack_ignoreVIHeightChange;
|
config.generalEmulation.hacks |= hack_ignoreVIHeightChange;
|
||||||
else if (strstr(RSP.romname, (const char *)"MASK") != NULL) // Zelda MM
|
else if (strstr(RSP.romname, (const char *)"MASK") != NULL) // Zelda MM
|
||||||
config.generalEmulation.hacks |= hack_skipVIChangeCheck | hack_ZeldaCamera;
|
config.generalEmulation.hacks |= hack_skipVIChangeCheck | hack_ZeldaCamera;
|
||||||
|
else if (strstr(RSP.romname, (const char *)"Perfect Dark") != NULL ||
|
||||||
|
strstr(RSP.romname, (const char *)"PERFECT DARK") != NULL)
|
||||||
|
config.generalEmulation.hacks |= hack_rectDepthBufferCopyPD;
|
||||||
|
|
||||||
api().FindPluginPath(RSP.pluginpath);
|
api().FindPluginPath(RSP.pluginpath);
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ typedef struct
|
||||||
extern RSPInfo RSP;
|
extern RSPInfo RSP;
|
||||||
|
|
||||||
extern u32 DepthClearColor;
|
extern u32 DepthClearColor;
|
||||||
|
extern u32 rectDepthBufferCopyFrame;
|
||||||
|
|
||||||
#define RSP_SegmentToPhysical( segaddr ) ((gSP.segment[(segaddr >> 24) & 0x0F] + (segaddr & RDRAMSize)) & RDRAMSize)
|
#define RSP_SegmentToPhysical( segaddr ) ((gSP.segment[(segaddr >> 24) & 0x0F] + (segaddr & RDRAMSize)) & RDRAMSize)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user