diff options
| author | spicyjpeg <thatspicyjpeg@gmail.com> | 2022-10-08 10:12:31 +0200 |
|---|---|---|
| committer | spicyjpeg <thatspicyjpeg@gmail.com> | 2022-10-08 10:12:31 +0200 |
| commit | 3acc4f93f3b6a96da484aab1f08d61f900085e43 (patch) | |
| tree | 042ba2e5c35ba6b1e409c5c700177c7069e4c450 /libpsn00b/psxgpu/image.c | |
| parent | 6ee55c23b042a1559e8cabfccf3b9d3320c4c5cc (diff) | |
| download | psn00bsdk-3acc4f93f3b6a96da484aab1f08d61f900085e43.tar.gz | |
Fix DMACallback bug, disable logging in release builds
Diffstat (limited to 'libpsn00b/psxgpu/image.c')
| -rw-r--r-- | libpsn00b/psxgpu/image.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libpsn00b/psxgpu/image.c b/libpsn00b/psxgpu/image.c index da51e7d..6190c7a 100644 --- a/libpsn00b/psxgpu/image.c +++ b/libpsn00b/psxgpu/image.c @@ -10,7 +10,13 @@ #define DMA_CHUNK_LENGTH 8 -/* VRAM transfer API */ +/* Private utilities */ + +#ifdef DEBUG +#define _LOG(...) printf(__VA_ARGS__) +#else +#define _LOG(...) +#endif static void _load_store_image( uint32_t command, @@ -20,11 +26,11 @@ static void _load_store_image( ) { size_t length = rect->w * rect->h; if (length % 2) - printf("psxgpu: can't transfer an odd number of pixels\n"); + _LOG("psxgpu: can't transfer an odd number of pixels\n"); length /= 2; if ((length >= DMA_CHUNK_LENGTH) && (length % DMA_CHUNK_LENGTH)) { - printf("psxgpu: transfer data length (%d) is not a multiple of %d, rounding\n", length, DMA_CHUNK_LENGTH); + _LOG("psxgpu: transfer data length (%d) is not a multiple of %d, rounding\n", length, DMA_CHUNK_LENGTH); length += DMA_CHUNK_LENGTH - 1; } @@ -50,6 +56,8 @@ static void _load_store_image( DMA_CHCR(2) = 0x01000200 | ((mode & 1) ^ 1); } +/* VRAM transfer API */ + void LoadImage(const RECT *rect, const uint32_t *data) { _load_store_image(0xa0000000, 2, rect, (uint32_t *) data); } |
