Skip to content

Commit

Permalink
Merge pull request #2377 from flafflar/legacy-glsl-switch-handling
Browse files Browse the repository at this point in the history
GLSL: Convert switch blocks to if statements in legacy desktop versions
  • Loading branch information
HansKristian-Work authored Sep 10, 2024
2 parents 6a1fb66 + 83f7495 commit f84c1fb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions spirv_glsl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17608,7 +17608,7 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)

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.
if (is_legacy_es())
Expand Down Expand Up @@ -17638,15 +17638,15 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)
// Default case.
if (!block_like_switch)
{
if (is_legacy_es())
if (is_legacy())
statement("else");
else
statement("default:");
}
}
else
{
if (is_legacy_es())
if (is_legacy())
{
statement((i ? "else " : ""), "if (", to_legacy_case_label(block.condition, literals, label_suffix),
")");
Expand Down Expand Up @@ -17698,7 +17698,7 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)

if (block.default_block == block.next_block)
{
if (is_legacy_es())
if (is_legacy())
statement("else");
else
statement("default:");
Expand All @@ -17712,7 +17712,7 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block)

if (!collapsed_switch)
{
if (block_like_switch && !is_legacy_es())
if ((block_like_switch || is_legacy()) && !is_legacy_es())
end_scope_decl("while(false)");
else
end_scope();
Expand Down

0 comments on commit f84c1fb

Please sign in to comment.