diff options
| author | spicyjpeg <thatspicyjpeg@gmail.com> | 2022-08-10 22:49:49 +0200 |
|---|---|---|
| committer | spicyjpeg <thatspicyjpeg@gmail.com> | 2022-08-10 22:49:49 +0200 |
| commit | a1081f296bca4f718cf31e5b6a262661d132e9e4 (patch) | |
| tree | ee979fe0120fed803d0c63ca824dbff3921dadc6 /libpsn00b/psxgpu | |
| parent | ce33eee403c678d3e2850046955f265585af76d7 (diff) | |
| download | psn00bsdk-a1081f296bca4f718cf31e5b6a262661d132e9e4.tar.gz | |
Misc. fixes, add texturing to graphics/gte example
Diffstat (limited to 'libpsn00b/psxgpu')
| -rw-r--r-- | libpsn00b/psxgpu/common.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libpsn00b/psxgpu/common.c b/libpsn00b/psxgpu/common.c index a65e0c9..4591012 100644 --- a/libpsn00b/psxgpu/common.c +++ b/libpsn00b/psxgpu/common.c @@ -122,12 +122,13 @@ static void _vsync_halt(void) { int VSync(int mode) { if (mode < 0) return _vblank_counter; + if (mode == 1) + return TIMER_VALUE(1) - _last_hblank; uint32_t status = GPU_GP1; - // If mode = 0, wait for one vertical blank event to occur. If mode = 1, do - // not wait. - for (int i = ((mode < 2) ? (mode ^ 1) : mode); i; i--) { + // Wait for at least one vertical blank event to occur. + do { _vsync_halt(); // If interlaced mode is enabled, wait until the GPU starts displaying @@ -136,7 +137,7 @@ int VSync(int mode) { while (!((GPU_GP1 ^ status) & (1 << 31))) __asm__ volatile(""); } - } + } while ((--mode) > 0); // Update the horizontal blank counter and return the time elapsed since // the last time it was updated. |
