Add Renderer::deinitGraphicsContext

This commit is contained in:
wheremyfoodat 2023-10-25 22:46:45 +03:00
parent 1313f46ba4
commit e900e9d614
11 changed files with 31 additions and 1 deletions

View file

@ -801,4 +801,15 @@ void RendererGL::screenshot(const std::string& name) {
}
stbi_write_png(name.c_str(), width, height, 4, flippedPixels.data(), 0);
}
void RendererGL::deinitGraphicsContext() {
// Invalidate all surface caches since they'll no longer be valid
textureCache.reset();
depthBufferCache.reset();
colourBufferCache.reset();
// 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");
}

View file

@ -12,3 +12,4 @@ void RendererNull::displayTransfer(u32 inputAddr, u32 outputAddr, u32 inputSize,
void RendererNull::textureCopy(u32 inputAddr, u32 outputAddr, u32 totalBytes, u32 inputSize, u32 outputSize, u32 flags) {}
void RendererNull::drawVertices(PICA::PrimType primType, std::span<const PICA::Vertex> vertices) {}
void RendererNull::screenshot(const std::string& name) {}
void RendererNull::deinitGraphicsContext() {}

View file

@ -23,3 +23,4 @@ void RendererSw::drawVertices(PICA::PrimType primType, std::span<const PICA::Ver
}
void RendererSw::screenshot(const std::string& name) { printf("RendererSW: Unimplemented screenshot call\n"); }
void RendererSw::deinitGraphicsContext() { printf("RendererSW: Unimplemented DeinitGraphicsContext call\n"); }

View file

@ -1581,3 +1581,11 @@ void RendererVK::drawVertices(PICA::PrimType primType, std::span<const PICA::Ver
}
void RendererVK::screenshot(const std::string& name) {}
void RendererVK::deinitGraphicsContext() {
// Invalidate the entire texture cache since they'll no longer be valid
textureCache.clear();
// TODO: Make it so that depth and colour buffers get written back to 3DS memory
printf("RendererVK::DeinitGraphicsContext called\n");
}