Pause the VBlank counters while the application is suspended
This commit is contained in:
parent
7999093588
commit
bbbadebeae
@ -42,10 +42,12 @@ static void C3Di_AptEventHook(APT_HookType hookType, C3D_UNUSED void* param)
|
|||||||
case APTHOOK_ONSUSPEND:
|
case APTHOOK_ONSUSPEND:
|
||||||
{
|
{
|
||||||
C3Di_RenderQueueWaitDone();
|
C3Di_RenderQueueWaitDone();
|
||||||
|
C3Di_RenderQueueDisableVBlank();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case APTHOOK_ONRESTORE:
|
case APTHOOK_ONRESTORE:
|
||||||
{
|
{
|
||||||
|
C3Di_RenderQueueEnableVBlank();
|
||||||
ctx->flags |= C3DiF_AttrInfo | C3DiF_BufInfo | C3DiF_Effect | C3DiF_FrameBuf
|
ctx->flags |= C3DiF_AttrInfo | C3DiF_BufInfo | C3DiF_Effect | C3DiF_FrameBuf
|
||||||
| C3DiF_Viewport | C3DiF_Scissor | C3DiF_Program | C3DiF_VshCode | C3DiF_GshCode
|
| C3DiF_Viewport | C3DiF_Scissor | C3DiF_Program | C3DiF_VshCode | C3DiF_GshCode
|
||||||
| C3DiF_TexAll | C3DiF_TexEnvBuf | C3DiF_TexEnvAll | C3DiF_LightEnv | C3DiF_Gas;
|
| C3DiF_TexAll | C3DiF_TexEnvBuf | C3DiF_TexEnvAll | C3DiF_LightEnv | C3DiF_Gas;
|
||||||
|
@ -144,3 +144,5 @@ bool C3Di_SplitFrame(u32** pBuf, u32* pSize);
|
|||||||
void C3Di_RenderQueueInit(void);
|
void C3Di_RenderQueueInit(void);
|
||||||
void C3Di_RenderQueueExit(void);
|
void C3Di_RenderQueueExit(void);
|
||||||
void C3Di_RenderQueueWaitDone(void);
|
void C3Di_RenderQueueWaitDone(void);
|
||||||
|
void C3Di_RenderQueueEnableVBlank(void);
|
||||||
|
void C3Di_RenderQueueDisableVBlank(void);
|
||||||
|
@ -99,12 +99,23 @@ static bool C3Di_WaitAndClearQueue(s64 timeout)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void C3Di_RenderQueueEnableVBlank(void)
|
||||||
|
{
|
||||||
|
gspSetEventCallback(GSPGPU_EVENT_VBlank0, onVBlank0, NULL, false);
|
||||||
|
gspSetEventCallback(GSPGPU_EVENT_VBlank1, onVBlank1, NULL, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void C3Di_RenderQueueDisableVBlank(void)
|
||||||
|
{
|
||||||
|
gspSetEventCallback(GSPGPU_EVENT_VBlank0, NULL, NULL, false);
|
||||||
|
gspSetEventCallback(GSPGPU_EVENT_VBlank1, NULL, NULL, false);
|
||||||
|
}
|
||||||
|
|
||||||
void C3Di_RenderQueueInit(void)
|
void C3Di_RenderQueueInit(void)
|
||||||
{
|
{
|
||||||
C3D_Context* ctx = C3Di_GetContext();
|
C3D_Context* ctx = C3Di_GetContext();
|
||||||
|
|
||||||
gspSetEventCallback(GSPGPU_EVENT_VBlank0, onVBlank0, NULL, false);
|
C3Di_RenderQueueEnableVBlank();
|
||||||
gspSetEventCallback(GSPGPU_EVENT_VBlank1, onVBlank1, NULL, false);
|
|
||||||
|
|
||||||
GX_BindQueue(&ctx->gxQueue);
|
GX_BindQueue(&ctx->gxQueue);
|
||||||
gxCmdQueueSetCallback(&ctx->gxQueue, onQueueFinish, NULL);
|
gxCmdQueueSetCallback(&ctx->gxQueue, onQueueFinish, NULL);
|
||||||
@ -120,8 +131,7 @@ void C3Di_RenderQueueExit(void)
|
|||||||
gxCmdQueueSetCallback(&C3Di_GetContext()->gxQueue, NULL, NULL);
|
gxCmdQueueSetCallback(&C3Di_GetContext()->gxQueue, NULL, NULL);
|
||||||
GX_BindQueue(NULL);
|
GX_BindQueue(NULL);
|
||||||
|
|
||||||
gspSetEventCallback(GSPGPU_EVENT_VBlank0, NULL, NULL, false);
|
C3Di_RenderQueueDisableVBlank();
|
||||||
gspSetEventCallback(GSPGPU_EVENT_VBlank1, NULL, NULL, false);
|
|
||||||
|
|
||||||
for (i = 0; i < 3; i ++)
|
for (i = 0; i < 3; i ++)
|
||||||
linkedTarget[i] = NULL;
|
linkedTarget[i] = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user