OpenGL: Restore ProgramBinary cache for GL shaders (#1209)

This commit is contained in:
goeiecool9999 2024-05-22 04:23:33 +02:00 committed by GitHub
parent c913a59c7a
commit 523a1652df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -23,16 +23,13 @@ bool RendererShaderGL::loadBinary()
cemu_assert_debug(m_baseHash != 0); cemu_assert_debug(m_baseHash != 0);
uint64 h1, h2; uint64 h1, h2;
GenerateShaderPrecompiledCacheFilename(m_type, m_baseHash, m_auxHash, h1, h2); GenerateShaderPrecompiledCacheFilename(m_type, m_baseHash, m_auxHash, h1, h2);
sint32 fileSize = 0;
std::vector<uint8> cacheFileData; std::vector<uint8> cacheFileData;
if (!s_programBinaryCache->GetFile({h1, h2 }, cacheFileData)) if (!s_programBinaryCache->GetFile({h1, h2 }, cacheFileData))
return false; return false;
if (fileSize < sizeof(uint32)) if (cacheFileData.size() <= sizeof(uint32))
{
return false; return false;
}
uint32 shaderBinFormat = *(uint32*)(cacheFileData.data() + 0); uint32 shaderBinFormat = *(uint32*)(cacheFileData.data());
m_program = glCreateProgram(); m_program = glCreateProgram();
glProgramBinary(m_program, shaderBinFormat, cacheFileData.data()+4, cacheFileData.size()-4); glProgramBinary(m_program, shaderBinFormat, cacheFileData.data()+4, cacheFileData.size()-4);