From ffea7cd65ae1439b4317f7cc55315289421f5f46 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Tue, 15 Aug 2023 23:33:25 +0200 Subject: [PATCH] port: reset texcache on level change --- port/include/video.h | 2 ++ port/src/video.c | 5 +++++ src/game/texreset.c | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/port/include/video.h b/port/include/video.h index 70cba99ac..730605909 100644 --- a/port/include/video.h +++ b/port/include/video.h @@ -18,4 +18,6 @@ s32 videoGetWidth(void); s32 videoGetHeight(void); f32 videoGetAspect(void); +void videoResetTextureCache(void); + #endif diff --git a/port/src/video.c b/port/src/video.c index e88a9b0b1..f84b7263b 100644 --- a/port/src/video.c +++ b/port/src/video.c @@ -114,3 +114,8 @@ f32 videoGetAspect(void) { return gfx_current_dimensions.aspect_ratio; } + +void videoResetTextureCache(void) +{ + gfx_texture_cache_clear(); +} diff --git a/src/game/texreset.c b/src/game/texreset.c index 80112e685..90e82ec86 100644 --- a/src/game/texreset.c +++ b/src/game/texreset.c @@ -10,6 +10,9 @@ #include "data.h" #include "textureconfig.h" #include "types.h" +#ifndef PLATFORM_N64 +#include "video.h" +#endif void texSetBitstring(u8 *arg0) { @@ -130,6 +133,9 @@ void texReset(void) for (s32 i = 4; i < ARRAYCOUNT(tcptrs); ++i) { g_TexNumConfigs += tcptrs[i].count; } + + // reset backend texture cache + videoResetTextureCache(); #endif g_TexWords = mempAlloc(ALIGN16(g_TexNumConfigs * 4), MEMPOOL_STAGE);