glslang -> SPV: fix degenerate switch topologies (bug 14118).

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31485 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2015-06-12 22:34:37 +00:00
parent 93930d6f9a
commit 8d64d44c3f
3 changed files with 29 additions and 2 deletions

View File

@@ -1109,7 +1109,8 @@ bool TGlslangToSpvTraverser::visitSwitch(glslang::TVisit /* visit */, glslang::T
// handle the case where the last code segment is missing, due to no code
// statements between the last case and the end of the switch statement
if ((int)codeSegments.size() == valueIndexToSegment[caseValues.size() - 1])
if ((caseValues.size() && (int)codeSegments.size() == valueIndexToSegment[caseValues.size() - 1]) ||
(int)codeSegments.size() == defaultSegment)
codeSegments.push_back(nullptr);
// make the switch statement