Merge pull request #896 from KhronosGroup/fix-895

Move check for structured OpSwitch to CompilerGLSL.
This commit is contained in:
Hans-Kristian Arntzen 2019-03-20 12:12:00 +01:00 committed by GitHub
commit 1b00a6e48a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -10747,6 +10747,9 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
auto &type = expression_type(block.condition);
bool unsigned_case = type.basetype == SPIRType::UInt || type.basetype == SPIRType::UShort;
if (block.merge == SPIRBlock::MergeNone)
SPIRV_CROSS_THROW("Switch statement is not structured");
if (type.basetype == SPIRType::UInt64 || type.basetype == SPIRType::Int64)
{
// SPIR-V spec suggests this is allowed, but we cannot support it in higher level languages.

View File

@ -879,9 +879,6 @@ void Parser::parse(const Instruction &instruction)
if (!current_block)
SPIRV_CROSS_THROW("Trying to end a non-existing block.");
if (current_block->merge == SPIRBlock::MergeNone)
SPIRV_CROSS_THROW("Switch statement is not structured");
current_block->terminator = SPIRBlock::MultiSelect;
current_block->condition = ops[0];