aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/psxgpu
diff options
context:
space:
mode:
authorspicyjpeg <thatspicyjpeg@gmail.com>2022-10-19 14:15:28 +0200
committerspicyjpeg <thatspicyjpeg@gmail.com>2022-10-19 14:15:28 +0200
commit783014e53254fe17102a34c30120eeabf5227a47 (patch)
tree6c3e498295ddd293769b85e7b7cbecd80ce32be7 /libpsn00b/psxgpu
parente08a3d9366f8ca14a76b3dd569dac1fb9f569748 (diff)
downloadpsn00bsdk-783014e53254fe17102a34c30120eeabf5227a47.tar.gz
Clean up SDK debug logging, fix getTPage()
Diffstat (limited to 'libpsn00b/psxgpu')
-rw-r--r--libpsn00b/psxgpu/common.c22
-rw-r--r--libpsn00b/psxgpu/image.c6
2 files changed, 13 insertions, 15 deletions
diff --git a/libpsn00b/psxgpu/common.c b/libpsn00b/psxgpu/common.c
index a262472..9eb4ea4 100644
--- a/libpsn00b/psxgpu/common.c
+++ b/libpsn00b/psxgpu/common.c
@@ -4,6 +4,7 @@
*/
#include <stdint.h>
+#include <assert.h>
#include <psxetc.h>
#include <psxapi.h>
#include <psxgpu.h>
@@ -75,7 +76,7 @@ void ResetGraph(int mode) {
_gpu_video_mode = (GPU_GP1 >> 20) & 1;
ExitCriticalSection();
- _sdk_log("psxgpu: setup done, default mode is %s\n", _gpu_video_mode ? "PAL" : "NTSC");
+ _sdk_log("setup done, default mode is %s\n", _gpu_video_mode ? "PAL" : "NTSC");
}
if (mode == 3) {
@@ -113,8 +114,7 @@ static void _default_vsync_halt(void) {
return;
}
- _sdk_log("psxgpu: VSync() timeout\n");
- _sdk_dump_log();
+ _sdk_log("VSync() timeout\n");
ChangeClearPAD(0);
ChangeClearRCnt(3, 0);
}
@@ -130,7 +130,6 @@ int VSync(int mode) {
// Wait for at least one vertical blank event to occur.
do {
- _sdk_dump_log();
_vsync_halt_func();
// If interlaced mode is enabled, wait until the GPU starts displaying
@@ -182,17 +181,17 @@ int EnqueueDrawOp(
IRQ_MASK = 0;
if (_queue_length) {
- if (_queue_length >= QUEUE_LENGTH) {
+ int length = _queue_length;
+
+ if (length >= QUEUE_LENGTH) {
IRQ_MASK = mask;
- _sdk_log("psxgpu: draw queue overflow, dropping commands\n");
+ _sdk_log("draw queue overflow, dropping commands\n");
return -1;
}
- int length = _queue_length;
- _queue_length = length + 1;
-
volatile QueueEntry *entry = &_draw_queue[_queue_tail++];
- _queue_tail %= QUEUE_LENGTH;
+ _queue_tail %= QUEUE_LENGTH;
+ _queue_length = length + 1;
entry->func = func;
entry->arg1 = arg1;
@@ -230,8 +229,7 @@ int DrawSync(int mode) {
while (!(GPU_GP1 & (1 << 26)))
__asm__ volatile("");
} else {
- _sdk_log("psxgpu: DrawSync() timeout\n");
- _sdk_dump_log();
+ _sdk_log("DrawSync() timeout\n");
}
return _queue_length;
diff --git a/libpsn00b/psxgpu/image.c b/libpsn00b/psxgpu/image.c
index 968dde5..bbdb7c8 100644
--- a/libpsn00b/psxgpu/image.c
+++ b/libpsn00b/psxgpu/image.c
@@ -4,7 +4,7 @@
*/
#include <stdint.h>
-#include <psxetc.h>
+#include <assert.h>
#include <psxgpu.h>
#include <hwregs_c.h>
@@ -15,11 +15,11 @@
static void _dma_transfer(const RECT *rect, uint32_t *data, int write) {
size_t length = rect->w * rect->h;
if (length % 2)
- _sdk_log("psxgpu: can't transfer an odd number of pixels\n");
+ _sdk_log("can't transfer an odd number of pixels\n");
length /= 2;
if ((length >= DMA_CHUNK_LENGTH) && (length % DMA_CHUNK_LENGTH)) {
- _sdk_log("psxgpu: transfer data length (%d) is not a multiple of %d, rounding\n", length, DMA_CHUNK_LENGTH);
+ _sdk_log("transfer data length (%d) is not a multiple of %d, rounding\n", length, DMA_CHUNK_LENGTH);
length += DMA_CHUNK_LENGTH - 1;
}