From 8c44c5b1eae74417d9574b148b5d4bca3836f37e Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Fri, 22 Sep 2023 21:21:45 +0300 Subject: [PATCH] fix uploading to vram --- source/psp/video_hardware_draw.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source/psp/video_hardware_draw.cpp b/source/psp/video_hardware_draw.cpp index 003bbde..e674077 100644 --- a/source/psp/video_hardware_draw.cpp +++ b/source/psp/video_hardware_draw.cpp @@ -3340,6 +3340,16 @@ void GL_Upload4(int texture_index, const byte *data, int width, int height) memcpy(texture.ram, data, buffer_size); memcpy(texture.palette, data + buffer_size, 16 * 4); + // Copy to VRAM? + if (texture.vram) + { + // Copy. + memcpy(texture.vram, texture.ram, buffer_size); + + // Flush the data cache. + sceKernelDcacheWritebackRange(texture.vram, buffer_size); + } + // Flush the data cache. sceKernelDcacheWritebackRange(texture.ram, buffer_size); } @@ -3410,7 +3420,7 @@ int GL_LoadTexture4(const char *identifier, unsigned int width, unsigned int hei } // Allocate the VRAM. causes problems? - // texture.vram = static_cast(vramalloc(buffer_size)); + texture.vram = static_cast(vramalloc(buffer_size)); // Upload the texture. GL_Upload4(texture_index, data, width, height);