Commit 3ef22f21 by John Kessenich

SPV compressor: Fixes a possible asserts. Attribution: spvremapper@lunarg.com

parent b8478d7e
...@@ -319,7 +319,7 @@ namespace spv { ...@@ -319,7 +319,7 @@ namespace spv {
mapped.clear(); mapped.clear();
idMapL.clear(); idMapL.clear();
nameMap.clear(); // preserve nameMap, so we don't clear that.
fnPos.clear(); fnPos.clear();
fnPosDCE.clear(); fnPosDCE.clear();
fnCalls.clear(); fnCalls.clear();
...@@ -344,7 +344,7 @@ namespace spv { ...@@ -344,7 +344,7 @@ namespace spv {
const spv::Id target = asId(start+1); const spv::Id target = asId(start+1);
const std::string name = literalString(start+2); const std::string name = literalString(start+2);
nameMap[name] = target; nameMap[name] = target;
return true;
} else if (opCode == spv::Op::OpFunctionCall) { } else if (opCode == spv::Op::OpFunctionCall) {
++fnCalls[asId(start + 3)]; ++fnCalls[asId(start + 3)];
} else if (opCode == spv::Op::OpEntryPoint) { } else if (opCode == spv::Op::OpEntryPoint) {
...@@ -713,7 +713,6 @@ namespace spv { ...@@ -713,7 +713,6 @@ namespace spv {
); );
strip(); // strip out data we decided to eliminate strip(); // strip out data we decided to eliminate
buildLocalMaps(); // rebuild ID mapping data
} }
// remove bodies of uncalled functions // remove bodies of uncalled functions
...@@ -798,7 +797,6 @@ namespace spv { ...@@ -798,7 +797,6 @@ namespace spv {
); );
strip(); // strip out data we decided to eliminate strip(); // strip out data we decided to eliminate
buildLocalMaps(); // rebuild ID mapping data
} }
// remove bodies of uncalled functions // remove bodies of uncalled functions
...@@ -1116,6 +1114,8 @@ namespace spv { ...@@ -1116,6 +1114,8 @@ namespace spv {
spv.resize(strippedPos); spv.resize(strippedPos);
stripRange.clear(); stripRange.clear();
buildLocalMaps();
} }
// Strip a single binary by removing ranges given in stripRange // Strip a single binary by removing ranges given in stripRange
...@@ -1131,6 +1131,8 @@ namespace spv { ...@@ -1131,6 +1131,8 @@ namespace spv {
msg(3, 4, std::string("ID bound: ") + std::to_string(bound())); msg(3, 4, std::string("ID bound: ") + std::to_string(bound()));
strip(); // strip out data we decided to eliminate
if (options & OPT_LOADSTORE) optLoadStore(); if (options & OPT_LOADSTORE) optLoadStore();
if (options & OPT_FWD_LS) forwardLoadStores(); if (options & OPT_FWD_LS) forwardLoadStores();
if (options & DCE_FUNCS) dceFuncs(); if (options & DCE_FUNCS) dceFuncs();
...@@ -1139,7 +1141,6 @@ namespace spv { ...@@ -1139,7 +1141,6 @@ namespace spv {
if (options & MAP_TYPES) mapTypeConst(); if (options & MAP_TYPES) mapTypeConst();
if (options & MAP_NAMES) mapNames(); if (options & MAP_NAMES) mapNames();
if (options & MAP_FUNCS) mapFnBodies(); if (options & MAP_FUNCS) mapFnBodies();
// if (options & STRIP) stripDebug();
mapRemainder(); // map any unmapped IDs mapRemainder(); // map any unmapped IDs
applyMap(); // Now remap each shader to the new IDs we've come up with applyMap(); // Now remap each shader to the new IDs we've come up with
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment