Permalink
Browse files

Merge pull request #10232 from unknownbrackets/shader-ids

GLES: Improve shader cache logging, another hashmap fix
  • Loading branch information...
unknownbrackets committed Dec 2, 2017
2 parents 7f858cc + 668b17f commit 1f9fabee579422053d49e2de557aec6f20ee4405
Showing with 3 additions and 5 deletions.
  1. +2 −0 Common/Hashmaps.h
  2. +1 −5 GPU/GLES/ShaderManagerGLES.cpp
@@ -131,6 +131,7 @@ class DenseHashMap {
void Clear() {
memset(state.data(), (int)BucketState::FREE, state.size());
count_ = 0;
}
void Rebuild() {
@@ -275,6 +276,7 @@ class PrehashMap {
void Clear() {
memset(state.data(), (int)BucketState::FREE, state.size());
count_ = 0;
}
// Gets rid of REMOVED tombstones, making lookups somewhat more efficient.
@@ -983,14 +983,13 @@ void ShaderManagerGLES::LoadAndPrecompile(const std::string &filename) {
expectedSize += header.numFragmentShaders * sizeof(FShaderID);
expectedSize += header.numLinkedPrograms * (sizeof(VShaderID) + sizeof(FShaderID));
if (sz != expectedSize) {
ERROR_LOG(G3D, "Shader cache file is too large, aborting.");
ERROR_LOG(G3D, "Shader cache file is wrong size: %lld instead of %lld", sz, expectedSize);
return;
}
for (int i = 0; i < header.numVertexShaders; i++) {
VShaderID id;
if (!f.ReadArray(&id, 1)) {
ERROR_LOG(G3D, "Truncated shader cache file, aborting.");
return;
}
if (!vsCache_.Get(id)) {
@@ -1016,7 +1015,6 @@ void ShaderManagerGLES::LoadAndPrecompile(const std::string &filename) {
for (int i = 0; i < header.numFragmentShaders; i++) {
FShaderID id;
if (!f.ReadArray(&id, 1)) {
ERROR_LOG(G3D, "Truncated shader cache file, aborting.");
return;
}
if (!fsCache_.Get(id)) {
@@ -1029,11 +1027,9 @@ void ShaderManagerGLES::LoadAndPrecompile(const std::string &filename) {
VShaderID vsid;
FShaderID fsid;
if (!f.ReadArray(&vsid, 1)) {
ERROR_LOG(G3D, "Truncated shader cache file, aborting.");
return;
}
if (!f.ReadArray(&fsid, 1)) {
ERROR_LOG(G3D, "Truncated shader cache file, aborting.");
return;
}
Shader *vs = vsCache_.Get(vsid);

0 comments on commit 1f9fabe

Please sign in to comment.