From 60a3b0742a6457e0f310704059fc075a1d30164a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ni=C3=B1o=20D=C3=ADaz?= Date: Tue, 25 Mar 2025 19:21:53 +0000 Subject: [PATCH] NDS: Stop flushing VRAM after copying to it The VRAM memory area isn't cacheable, so there is no need to use DC_FlushRange(), and we can improve performance a bit by removing the call. This function would only be required if we were using DMA to copy the data to VRAM. In that case, the source in main RAM would have to be flushed before doing the DMA copy. However, CopyHWords() is a plain CPU copy, so this isn't needed at all. The following two articles are a nice introduction to cache handling on the NDS: https://web.archive.org/web/20210622053504/https://www.coranac.com/2009/05/dma-vs-arm9-fight/ https://web.archive.org/web/20210622053550/https://www.coranac.com/2010/03/dma-vs-arm9-round-2/ --- src/Graphics_NDS.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Graphics_NDS.c b/src/Graphics_NDS.c index d14069069..728d94596 100644 --- a/src/Graphics_NDS.c +++ b/src/Graphics_NDS.c @@ -448,8 +448,6 @@ GfxResourceID Gfx_AllocTexture(struct Bitmap* bmp, int rowWidth, cc_uint8 flags, } } - // Ensure anything in data cache is flushed to VRAM - DC_FlushRange((u8*)VRAM_A + offset, tex_size); VRAM_CR = banks; int sSize = (Math_ilog2(tex->width) - 3) << 20;