mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-08 19:40:06 +00:00
SPV compressor: Fixes a possible asserts. Attribution: spvremapper@lunarg.com
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31451 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
b8478d7eac
commit
3ef22f2139
@ -319,7 +319,7 @@ namespace spv {
|
||||
|
||||
mapped.clear();
|
||||
idMapL.clear();
|
||||
nameMap.clear();
|
||||
// preserve nameMap, so we don't clear that.
|
||||
fnPos.clear();
|
||||
fnPosDCE.clear();
|
||||
fnCalls.clear();
|
||||
@ -344,7 +344,7 @@ namespace spv {
|
||||
const spv::Id target = asId(start+1);
|
||||
const std::string name = literalString(start+2);
|
||||
nameMap[name] = target;
|
||||
return true;
|
||||
|
||||
} else if (opCode == spv::Op::OpFunctionCall) {
|
||||
++fnCalls[asId(start + 3)];
|
||||
} else if (opCode == spv::Op::OpEntryPoint) {
|
||||
@ -713,7 +713,6 @@ namespace spv {
|
||||
);
|
||||
|
||||
strip(); // strip out data we decided to eliminate
|
||||
buildLocalMaps(); // rebuild ID mapping data
|
||||
}
|
||||
|
||||
// remove bodies of uncalled functions
|
||||
@ -798,7 +797,6 @@ namespace spv {
|
||||
);
|
||||
|
||||
strip(); // strip out data we decided to eliminate
|
||||
buildLocalMaps(); // rebuild ID mapping data
|
||||
}
|
||||
|
||||
// remove bodies of uncalled functions
|
||||
@ -1116,6 +1114,8 @@ namespace spv {
|
||||
|
||||
spv.resize(strippedPos);
|
||||
stripRange.clear();
|
||||
|
||||
buildLocalMaps();
|
||||
}
|
||||
|
||||
// Strip a single binary by removing ranges given in stripRange
|
||||
@ -1131,6 +1131,8 @@ namespace spv {
|
||||
|
||||
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_FWD_LS) forwardLoadStores();
|
||||
if (options & DCE_FUNCS) dceFuncs();
|
||||
@ -1139,7 +1141,6 @@ namespace spv {
|
||||
if (options & MAP_TYPES) mapTypeConst();
|
||||
if (options & MAP_NAMES) mapNames();
|
||||
if (options & MAP_FUNCS) mapFnBodies();
|
||||
// if (options & STRIP) stripDebug();
|
||||
|
||||
mapRemainder(); // map any unmapped IDs
|
||||
applyMap(); // Now remap each shader to the new IDs we've come up with
|
||||
|
Loading…
Reference in New Issue
Block a user