Move check for structured OpSwitch to CompilerGLSL.
Can still parse correctly.
This commit is contained in:
parent
a94490498d
commit
45baf24a17
@ -10747,6 +10747,9 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
|
|||||||
auto &type = expression_type(block.condition);
|
auto &type = expression_type(block.condition);
|
||||||
bool unsigned_case = type.basetype == SPIRType::UInt || type.basetype == SPIRType::UShort;
|
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)
|
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.
|
// SPIR-V spec suggests this is allowed, but we cannot support it in higher level languages.
|
||||||
|
@ -879,9 +879,6 @@ void Parser::parse(const Instruction &instruction)
|
|||||||
if (!current_block)
|
if (!current_block)
|
||||||
SPIRV_CROSS_THROW("Trying to end a non-existing 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->terminator = SPIRBlock::MultiSelect;
|
||||||
|
|
||||||
current_block->condition = ops[0];
|
current_block->condition = ops[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user