Fixes to in-game GPU shutdown/switching. Fixes #10860

This commit is contained in:
Henrik Rydgård committed 2018-04-05 20:26:29 +02:00
1 parent 4624d09e29
commit 2cd8bd9bc3
2 files changed
+8 -1

No files matched your search

+1 -1
View File
@@ -130,7 +130,7 @@ GPU_GLES::~GPU_GLES() {
shaderManagerGL_->ClearCache(true);
depalShaderCache_.Clear();
fragmentTestCache_.Clear();
if (!shaderCachePath_.empty()) {
if (!shaderCachePath_.empty() && draw_) {
shaderManagerGL_->Save(shaderCachePath_);
}
delete shaderManagerGL_;
+7
View File
@@ -141,6 +141,12 @@ void GPU_Vulkan::LoadCache(std::string filename) {
}
void GPU_Vulkan::SaveCache(std::string filename) {
if (!draw_) {
// Already got the lost message, we're in shutdown.
WARN_LOG(G3D, "Not saving shaders - shutting down from in-game.");
return;
}
FILE *f = File::OpenCFile(filename, "wb");
if (!f)
return;
@@ -474,6 +480,7 @@ void GPU_Vulkan::DeviceLost() {
textureCacheVulkan_->DeviceLost();
depalShaderCache_.DeviceLost();
shaderManagerVulkan_->ClearShaders();
draw_ = nullptr;
}
void GPU_Vulkan::DeviceRestore() {