diff options
| author | spicyjpeg <thatspicyjpeg@gmail.com> | 2022-10-18 17:29:42 +0200 |
|---|---|---|
| committer | spicyjpeg <thatspicyjpeg@gmail.com> | 2022-10-18 17:29:42 +0200 |
| commit | 9b2ffc6078a850b7d354855cca7622090b41f30c (patch) | |
| tree | 33654513b0b184c27f8035dbc405640fcbeb44ab /libpsn00b/psxgpu/image.c | |
| parent | b71a55bc489db6bc9beca5cee9cd584e82846ac8 (diff) | |
| download | psn00bsdk-9b2ffc6078a850b7d354855cca7622090b41f30c.tar.gz | |
Add debug log buffering, fix GetHeapUsage()
Diffstat (limited to 'libpsn00b/psxgpu/image.c')
| -rw-r--r-- | libpsn00b/psxgpu/image.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/libpsn00b/psxgpu/image.c b/libpsn00b/psxgpu/image.c index c09a59d..968dde5 100644 --- a/libpsn00b/psxgpu/image.c +++ b/libpsn00b/psxgpu/image.c @@ -4,7 +4,7 @@ */ #include <stdint.h> -#include <stdio.h> +#include <psxetc.h> #include <psxgpu.h> #include <hwregs_c.h> @@ -12,20 +12,14 @@ /* Private utilities */ -#ifdef NDEBUG -#define _LOG(...) -#else -#define _LOG(...) printf(__VA_ARGS__) -#endif - static void _dma_transfer(const RECT *rect, uint32_t *data, int write) { size_t length = rect->w * rect->h; if (length % 2) - _LOG("psxgpu: can't transfer an odd number of pixels\n"); + _sdk_log("psxgpu: can't transfer an odd number of pixels\n"); length /= 2; if ((length >= DMA_CHUNK_LENGTH) && (length % DMA_CHUNK_LENGTH)) { - _LOG("psxgpu: transfer data length (%d) is not a multiple of %d, rounding\n", length, DMA_CHUNK_LENGTH); + _sdk_log("psxgpu: transfer data length (%d) is not a multiple of %d, rounding\n", length, DMA_CHUNK_LENGTH); length += DMA_CHUNK_LENGTH - 1; } @@ -53,15 +47,19 @@ static void _dma_transfer(const RECT *rect, uint32_t *data, int write) { /* VRAM transfer API */ int LoadImage(const RECT *rect, const uint32_t *data) { - return EnqueueDrawOp(&_dma_transfer, (uint32_t) rect, (uint32_t) data, 1); + return EnqueueDrawOp( + (void *) &_dma_transfer, (uint32_t) rect, (uint32_t) data, 1 + ); } int StoreImage(const RECT *rect, uint32_t *data) { - return EnqueueDrawOp(&_dma_transfer, (uint32_t) rect, (uint32_t) data, 0); + return EnqueueDrawOp( + (void *) &_dma_transfer, (uint32_t) rect, (uint32_t) data, 0 + ); } int MoveImage(const RECT *rect, int x, int y) { - return EnqueueDrawOp(&MoveImage2, (uint32_t) rect, x, y); + return EnqueueDrawOp((void *) &MoveImage2, (uint32_t) rect, x, y); } void LoadImage2(const RECT *rect, const uint32_t *data) { |
