Properly flush shader cache

This commit is contained in:
wheremyfoodat 2024-07-15 14:29:49 +03:00
parent fe53214c86
commit 11c9279329
3 changed files with 42 additions and 25 deletions

View file

@ -23,6 +23,11 @@ void RendererGL::reset() {
colourBufferCache.reset();
textureCache.reset();
for (auto& shader : shaderCache) {
shader.second.program.free();
}
shaderCache.clear();
// Init the colour/depth buffer settings to some random defaults on reset
colourBufferLoc = 0;
colourBufferFormat = PICA::ColorFmt::RGBA8;
@ -899,6 +904,11 @@ void RendererGL::deinitGraphicsContext() {
depthBufferCache.reset();
colourBufferCache.reset();
for (auto& shader : shaderCache) {
shader.second.program.free();
}
shaderCache.clear();
// All other GL objects should be invalidated automatically and be recreated by the next call to initGraphicsContext
// TODO: Make it so that depth and colour buffers get written back to 3DS memory
printf("RendererGL::DeinitGraphicsContext called\n");