Skip to content

Commit 4861860

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 99c619f commit 4861860

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() {
@@ -1416,10 +1415,6 @@ bool GLShaderManager::LoadShaderBinary( const std::vector<ShaderEntry>& shaders,
14161415
return false;
14171416
}
14181417

1419-
if ( _shaderBinaryCacheInvalidated ) {
1420-
return false;
1421-
}
1422-
14231418
const int start = Sys::Milliseconds();
14241419

14251420
std::error_code err;
@@ -1459,14 +1454,7 @@ bool GLShaderManager::LoadShaderBinary( const std::vector<ShaderEntry>& shaders,
14591454

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

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)