Permalink
Browse files

Fix possible crash when loading GL shader caches. Should help #9930.

  • Loading branch information...
hrydgard committed Aug 25, 2017
1 parent 2180b1d commit 4938ab786e9676cb76906d51fe6cf8f8a707cdb2
Showing with 10 additions and 2 deletions.
  1. +10 −2 GPU/GLES/ShaderManagerGLES.cpp
@@ -1023,15 +1023,23 @@ void ShaderManagerGLES::LoadAndPrecompile(const std::string &filename) {
delete vs;
return;
}
vsCache_.Insert(id, vs);
if (!vsCache_.Get(id)) {
vsCache_.Insert(id, vs);
} else {
WARN_LOG(G3D, "Duplicate vertex shader found in GL shader cache, ignoring");
}
}
for (int i = 0; i < header.numFragmentShaders; i++) {
ShaderID id;
if (!f.ReadArray(&id, 1)) {
ERROR_LOG(G3D, "Truncated shader cache file, aborting.");
return;
}
fsCache_.Insert(id, CompileFragmentShader(id));
if (!fsCache_.Get(id)) {
fsCache_.Insert(id, CompileFragmentShader(id));
} else {
WARN_LOG(G3D, "Duplicate fragment shader found in GL shader cache, ignoring");
}
}
for (int i = 0; i < header.numLinkedPrograms; i++) {
ShaderID vsid, fsid;

0 comments on commit 4938ab7

Please sign in to comment.