Add C3D_VideoSync()

This commit is contained in:
fincs 2015-11-28 16:41:20 +01:00
parent ae4d9aba93
commit c188bcf5df
6 changed files with 15 additions and 26 deletions

View File

@ -206,9 +206,8 @@ int main()
// Main loop
while (aptMainLoop())
{
gspWaitForVBlank(); // Synchronize with the start of VBlank
gfxSwapBuffersGpu(); // Swap the framebuffers so that the frame that we rendered last frame is now visible
hidScanInput(); // Read the user input
C3D_VideoSync();
hidScanInput();
// Respond to user input
u32 kDown = hidKeysDown();
@ -231,9 +230,6 @@ int main()
C3D_RenderBufTransfer(&rb, (u32*)gfxGetFramebuffer(GFX_TOP, GFX_RIGHT, NULL, NULL), DISPLAY_TRANSFER_FLAGS);
C3D_RenderBufClear(&rb);
}
// Flush the framebuffers out of the data cache (not necessary with pure GPU rendering)
//gfxFlushBuffers();
}
// Deinitialize the scene

View File

@ -163,8 +163,7 @@ int main()
// Main loop
while (aptMainLoop())
{
gspWaitForVBlank();
gfxSwapBuffersGpu();
C3D_VideoSync();
hidScanInput();
u32 kDown = hidKeysDown();

View File

@ -88,9 +88,8 @@ int main()
// Main loop
while (aptMainLoop())
{
gspWaitForVBlank(); // Synchronize with the start of VBlank
gfxSwapBuffersGpu(); // Swap the framebuffers so that the frame that we rendered last frame is now visible
hidScanInput(); // Read the user input
C3D_VideoSync();
hidScanInput();
// Respond to user input
u32 kDown = hidKeysDown();
@ -102,9 +101,6 @@ int main()
C3D_Flush();
C3D_RenderBufTransfer(&rb, (u32*)gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), DISPLAY_TRANSFER_FLAGS);
C3D_RenderBufClear(&rb);
// Flush the framebuffers out of the data cache (not necessary with pure GPU rendering)
gfxFlushBuffers();
}
// Deinitialize the scene

View File

@ -106,9 +106,8 @@ int main()
// Main loop
while (aptMainLoop())
{
gspWaitForVBlank(); // Synchronize with the start of VBlank
gfxSwapBuffersGpu(); // Swap the framebuffers so that the frame that we rendered last frame is now visible
hidScanInput(); // Read the user input
C3D_VideoSync();
hidScanInput();
// Respond to user input
u32 kDown = hidKeysDown();
@ -120,9 +119,6 @@ int main()
C3D_Flush();
C3D_RenderBufTransfer(&rb, (u32*)gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), DISPLAY_TRANSFER_FLAGS);
C3D_RenderBufClear(&rb);
// Flush the framebuffers out of the data cache (not necessary with pure GPU rendering)
gfxFlushBuffers();
}
// Deinitialize the scene

View File

@ -204,9 +204,8 @@ int main()
// Main loop
while (aptMainLoop())
{
gspWaitForVBlank(); // Synchronize with the start of VBlank
gfxSwapBuffersGpu(); // Swap the framebuffers so that the frame that we rendered last frame is now visible
hidScanInput(); // Read the user input
C3D_VideoSync();
hidScanInput();
// Respond to user input
u32 kDown = hidKeysDown();
@ -218,9 +217,6 @@ int main()
C3D_Flush();
C3D_RenderBufTransfer(&rb, (u32*)gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), DISPLAY_TRANSFER_FLAGS);
C3D_RenderBufClear(&rb);
// Flush the framebuffers out of the data cache (not necessary with pure GPU rendering)
gfxFlushBuffers();
}
// Deinitialize the scene

View File

@ -37,6 +37,12 @@ static inline void C3D_Flush(void)
C3D_FlushAwait();
}
static inline void C3D_VideoSync(void)
{
gspWaitForEvent(GSPGPU_EVENT_VBlank0, false);
gfxSwapBuffersGpu();
}
// Fixed vertex attributes
C3D_FVec* C3D_FixedAttribGetWritePtr(int id);