Skip to content

Commit bd43514

Browse files
committed
Check that driver matches when loading GLSL cache
Commenting out the code that does this was a regression in ab59550. This was one cause of #1604.
1 parent 36196cc commit bd43514

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

src/engine/renderer/gl_shader.cpp

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,6 @@ void GLShaderManager::InitDriverInfo()
892892
{
893893
std::string driverInfo = std::string(glConfig.renderer_string) + glConfig.version_string;
894894
_driverVersionHash = Com_BlockChecksum(driverInfo.c_str(), static_cast<int>(driverInfo.size()));
895-
_shaderBinaryCacheInvalidated = false;
896895
}
897896

898897
void GLShaderManager::GenerateBuiltinHeaders() {
@@ -1418,10 +1417,6 @@ bool GLShaderManager::LoadShaderBinary( const std::vector<ShaderEntry>& shaders,
14181417
return false;
14191418
}
14201419

1421-
if ( _shaderBinaryCacheInvalidated ) {
1422-
return false;
1423-
}
1424-
14251420
const int start = Sys::Milliseconds();
14261421

14271422
std::error_code err;
@@ -1461,14 +1456,7 @@ bool GLShaderManager::LoadShaderBinary( const std::vector<ShaderEntry>& shaders,
14611456

14621457
/* Check if the header struct is the correct format
14631458
and the binary was produced by the same GL driver */
1464-
if ( shaderHeader.version != GL_SHADER_VERSION /* || shaderHeader.driverVersionHash != _driverVersionHash */ ) {
1465-
/* These two fields should be the same for all shaders. So if there is a mismatch,
1466-
don't bother opening any of the remaining files.
1467-
I've disabled the cache invalidation on driver version change, because we now also cache shader programs that use
1468-
non-empty deformVertexes. This would mean that after updating the driver, any time you load a new map with
1469-
deformVertexes, it would cause the rebuild of *all* shaders */
1470-
Log::Notice( "Invalidating shader binary cache" );
1471-
_shaderBinaryCacheInvalidated = true;
1459+
if ( shaderHeader.version != GL_SHADER_VERSION || shaderHeader.driverVersionHash != _driverVersionHash ) {
14721460
return false;
14731461
}
14741462

src/engine/renderer/gl_shader.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ class GLShaderManager {
328328
std::unordered_map<std::string, int> _deformShaderLookup;
329329

330330
unsigned int _driverVersionHash; // For cache invalidation if hardware changes
331-
bool _shaderBinaryCacheInvalidated;
332331

333332
public:
334333
GLHeader GLVersionDeclaration;

0 commit comments

Comments
 (0)