Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[spv-in] Bubble up loop breaks, out of switch cases. #2323

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

eddyb
Copy link
Contributor

@eddyb eddyb commented Apr 27, 2023

The separate commits show the test's old (and broken) behavior, and the change induced by the fix is clear:

diff --git a/tests/out/wgsl/loop-break-from-switch.wgsl b/tests/out/wgsl/loop-break-from-switch.wgsl
index e21c3cf9..530c2ad9 100644
--- a/tests/out/wgsl/loop-break-from-switch.wgsl
+++ b/tests/out/wgsl/loop-break-from-switch.wgsl
@@ -2,17 +2,24 @@ var<private> global: i32;
 var<private> global_1: i32;
 
 fn function() {
+    var local: bool = false;
+
     let _e8 = global;
     loop {
         switch _e8 {
             case 0: {
                 global_1 = 0;
+                local = true;
                 break;
             }
             default: {
                 break;
             }
         }
+        let _e11 = local;
+        if _e11 {
+            break;
+        }
         global_1 = -9;
         break;
     }

@eddyb eddyb force-pushed the spv-in-loop-break-vs-switch-break branch from 9ed3040 to 13c52a0 Compare May 15, 2023 20:27
@cwfitzgerald
Copy link
Member

Hello, thank you for your PR against Naga!

As part of gfx-rs/wgpu#4231, we have moved development of Naga into the wgpu repository in the Naga subfolder. We have transferred all issues, but we are unable to automatically transfer PRs.

As such, please recreate your PR against the wgpu repository. We apologize for the inconvenience this causes, but will make contributing to both projects more streamlined going forward.

We are leaving PRs open, but once they are transferred, please close the original Naga PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[spv-in] Naga miscompiles SPIR-V with branches that exit more than one level of structured control flow
2 participants