-
Notifications
You must be signed in to change notification settings - Fork 329
Add break N
instead of continue
and continuing
.
#642
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
Conversation
|
||
Note: This is *proposed* but not in the [SHORTNAME] spec yet | ||
|
||
The `for(var i : i32 = 0; i < 4; i = i + 1) {}` statement is syntactic sugar on | ||
The `for(var i : i32 = 0; i < 4; i = i + 1) {CODE}` statement is syntactic sugar on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean the for
-loop no longer supports continue
(i.e. you have to express it with a nested loop as with loop
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add it, but this is "proposed possibilities", as for
isn't a real WGSL thing yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK with me as long as the generalized break N
concept can translate to SPIR-V.
A super simple once { ...; }
sugar for loop { ...; break; }
could be appealing.
|
||
<div class='example' heading="General [SHORTNAME] Loop Form"> | ||
<xmp> | ||
A |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrap this whole thing in {}
to contain the scope of A
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yeah, that would be more precise.
AFAIK the
|
Hmm, suspicious. "a block branching to the construct’s merge block " satisfies some requirements, but I'll have to think it over. |
Co-Authored-By: Kai Ninomiya <kainino1@gmail.com>
The literal count is error prone. I'd rather label-name the loops, then have break label. The translation from this more general construct requires, in general, synthesis of extra state variables to track mulit-level escape. That adds complexity to translation, and is in conflict with the developer understanding (by counting) the register pressure on an invocation. |
Removing approval since it sounds like this can't translate to SPIR-V (directly). |
Ok, I agree that it would require non-zero-cost translation in the general case. SPIR-V structured control flow branching rules:
|
In particular it would be temping to write:
However, I believe there's no valid SPIR-V zero-cost equivalent. |
gpuweb#642) This test creates a texture and uses it as both sampled and storage. Storage textures cannot be multisampled, so that case is invalid. Bug: crbug.com/dawn/990
No description provided.