OpenGLDevice: Fix crash when driver doesn't support binaries

This commit is contained in:
Stenzek 2023-09-21 01:04:18 +10:00
parent 7d76643c02
commit 5bbb7cf906
1 changed files with 7 additions and 3 deletions

View File

@ -299,6 +299,7 @@ GLuint OpenGLDevice::LookupProgramCache(const OpenGLPipeline::ProgramCacheKey& k
item.file_compressed_size = 0; item.file_compressed_size = 0;
if (item.program_id != 0) if (item.program_id != 0)
{ {
if (m_pipeline_disk_cache_file)
AddToPipelineCache(&item); AddToPipelineCache(&item);
item.reference_count++; item.reference_count++;
} }
@ -938,8 +939,11 @@ bool OpenGLDevice::DiscardPipelineCache()
void OpenGLDevice::ClosePipelineCache() void OpenGLDevice::ClosePipelineCache()
{ {
const ScopedGuard file_closer = [this]() { const ScopedGuard file_closer = [this]() {
if (m_pipeline_disk_cache_file)
{
std::fclose(m_pipeline_disk_cache_file); std::fclose(m_pipeline_disk_cache_file);
m_pipeline_disk_cache_file = nullptr; m_pipeline_disk_cache_file = nullptr;
}
}; };
if (!m_pipeline_disk_cache_changed) if (!m_pipeline_disk_cache_changed)