Skip to content

Commit

Permalink
Merge pull request #10232 from unknownbrackets/shader-ids
Browse files Browse the repository at this point in the history
GLES: Improve shader cache logging, another hashmap fix
  • Loading branch information
unknownbrackets committed Dec 2, 2017
2 parents 7f858cc + 668b17f commit 1f9fabe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Common/Hashmaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class DenseHashMap {

void Clear() {
memset(state.data(), (int)BucketState::FREE, state.size());
count_ = 0;
}

void Rebuild() {
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 1 addition & 5 deletions GPU/GLES/ShaderManagerGLES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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)) {
Expand All @@ -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);
Expand Down

0 comments on commit 1f9fabe

Please sign in to comment.