mirror of
https://github.com/KhronosGroup/SPIRV-Cross.git
synced 2024-11-09 13:50:05 +00:00
GLSL: Convert switch blocks to if statements in legacy desktop versions
This commit is contained in:
parent
6a1fb66eef
commit
83f74950b8
@ -17608,7 +17608,7 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
|
|||||||
|
|
||||||
if (!collapsed_switch)
|
if (!collapsed_switch)
|
||||||
{
|
{
|
||||||
if (block_like_switch || is_legacy_es())
|
if (block_like_switch || is_legacy())
|
||||||
{
|
{
|
||||||
// ESSL 1.0 is not guaranteed to support do/while.
|
// ESSL 1.0 is not guaranteed to support do/while.
|
||||||
if (is_legacy_es())
|
if (is_legacy_es())
|
||||||
@ -17638,7 +17638,7 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
|
|||||||
// Default case.
|
// Default case.
|
||||||
if (!block_like_switch)
|
if (!block_like_switch)
|
||||||
{
|
{
|
||||||
if (is_legacy_es())
|
if (is_legacy())
|
||||||
statement("else");
|
statement("else");
|
||||||
else
|
else
|
||||||
statement("default:");
|
statement("default:");
|
||||||
@ -17646,7 +17646,7 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (is_legacy_es())
|
if (is_legacy())
|
||||||
{
|
{
|
||||||
statement((i ? "else " : ""), "if (", to_legacy_case_label(block.condition, literals, label_suffix),
|
statement((i ? "else " : ""), "if (", to_legacy_case_label(block.condition, literals, label_suffix),
|
||||||
")");
|
")");
|
||||||
@ -17698,7 +17698,7 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
|
|||||||
|
|
||||||
if (block.default_block == block.next_block)
|
if (block.default_block == block.next_block)
|
||||||
{
|
{
|
||||||
if (is_legacy_es())
|
if (is_legacy())
|
||||||
statement("else");
|
statement("else");
|
||||||
else
|
else
|
||||||
statement("default:");
|
statement("default:");
|
||||||
@ -17712,7 +17712,7 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
|
|||||||
|
|
||||||
if (!collapsed_switch)
|
if (!collapsed_switch)
|
||||||
{
|
{
|
||||||
if (block_like_switch && !is_legacy_es())
|
if ((block_like_switch || is_legacy()) && !is_legacy_es())
|
||||||
end_scope_decl("while(false)");
|
end_scope_decl("while(false)");
|
||||||
else
|
else
|
||||||
end_scope();
|
end_scope();
|
||||||
|
Loading…
Reference in New Issue
Block a user