Skip to content

Commit 958528f

Browse files
fix(wgsl-in): increase brace limit to 127 (#7412)
1 parent 97dbdc7 commit 958528f

File tree

2 files changed

+63
-15
lines changed

2 files changed

+63
-15
lines changed

naga/src/front/wgsl/parse/mod.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3120,12 +3120,7 @@ impl Parser {
31203120
// > …
31213121
// >
31223122
// > Maximum nesting depth of brace-enclosed statements in a function[:] 127
3123-
//
3124-
// _However_, we choose 64 instead because (a) it avoids stack overflows in CI and
3125-
// (b) we expect the limit to be decreased to 63 based on this conversation in
3126-
// WebGPU CTS upstream:
3127-
// <https://github.com/gpuweb/cts/pull/3389#discussion_r1543742701>
3128-
const BRACE_NESTING_MAXIMUM: u8 = 64;
3123+
const BRACE_NESTING_MAXIMUM: u8 = 127;
31293124
if brace_nesting_level + 1 > BRACE_NESTING_MAXIMUM {
31303125
return Err(Box::new(Error::ExceededLimitForNestedBraces {
31313126
span: brace_span,

naga/tests/wgsl_errors.rs

Lines changed: 62 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2699,12 +2699,12 @@ fn limit_braced_statement_nesting() {
26992699
let too_many_braces = "fn f() {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{";
27002700

27012701
let expected_diagnostic = r###"error: brace nesting limit reached
2702-
┌─ wgsl:1:72
2702+
┌─ wgsl:1:135
27032703
27042704
1 │ fn f() {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
2705-
│ ^ limit reached at this brace
2705+
^ limit reached at this brace
27062706
2707-
= note: nesting limit is currently set to 64
2707+
= note: nesting limit is currently set to 127
27082708
27092709
"###;
27102710

@@ -2796,16 +2796,69 @@ fn too_many_unclosed_loops() {
27962796
loop {
27972797
loop {
27982798
loop {
2799+
loop {
2800+
loop {
2801+
loop {
2802+
loop {
2803+
loop {
2804+
loop {
2805+
loop {
2806+
loop {
2807+
loop {
2808+
loop {
2809+
loop {
2810+
loop {
2811+
loop {
2812+
loop {
2813+
loop {
2814+
loop {
2815+
loop {
2816+
loop {
2817+
loop {
2818+
loop {
2819+
loop {
2820+
loop {
2821+
loop {
2822+
loop {
2823+
loop {
2824+
loop {
2825+
loop {
2826+
loop {
2827+
loop {
2828+
loop {
2829+
loop {
2830+
loop {
2831+
loop {
2832+
loop {
2833+
loop {
2834+
loop {
2835+
loop {
2836+
loop {
2837+
loop {
2838+
loop {
2839+
loop {
2840+
loop {
2841+
loop {
2842+
loop {
2843+
loop {
2844+
loop {
2845+
loop {
2846+
loop {
2847+
loop {
2848+
loop {
2849+
loop {
2850+
loop {
2851+
loop {
27992852
loop {
28002853
";
28012854

28022855
let expected_diagnostic = r###"error: brace nesting limit reached
2803-
┌─ wgsl:65:13
2804-
2805-
65 │ loop {
2806-
│ ^ limit reached at this brace
2807-
2808-
= note: nesting limit is currently set to 64
2856+
┌─ wgsl:128:13
2857+
2858+
128 │ loop {
2859+
│ ^ limit reached at this brace
2860+
2861+
= note: nesting limit is currently set to 127
28092862
28102863
"###;
28112864

0 commit comments

Comments
 (0)