fix(naga): Allow a trailing comma in WGSL attributes (#9127)

* fix(naga): Allow trailing comma in WGSL attributes

Allow trailing comma token in WGSL attributes such as '@location(1,)'

CTS change
* webgpu:shader,validation,shader_io,*
 - Pass ratio: 2369/2891 (81.94%) -> 2380/2891 (82.32%)

* Update CTS list related to #8892
This commit is contained in:
ecoricemon authored and GitHub committed 2026-03-03 18:06:06 +01:00
1 parent b6c605603f
commit 0d166c51a8
3 files changed
+21 -3

No files matched your search

+1 -1
View File
@@ -179,7 +179,7 @@ webgpu:shader,validation,shader_io,group:* // 95%, https://github.com/gfx-rs/wgp
webgpu:shader,validation,shader_io,id:* // 94%, https://github.com/gfx-rs/wgpu/issues/8892, @id on const
webgpu:shader,validation,shader_io,interpolate:* // 91%, https://github.com/gfx-rs/wgpu/issues/8892
webgpu:shader,validation,shader_io,layout_constraints:* // 99%, struct alignment not inferred from @align on members
webgpu:shader,validation,shader_io,locations:* // 98%, https://github.com/gfx-rs/wgpu/issues/8892
webgpu:shader,validation,shader_io,locations:stage_inout:* // 66%, invalid usage @location in compute shaders
webgpu:shader,validation,shader_io,pipeline_stage:* // 92%, stage attributes incorrectly accepted on var<private> and var<storage>
webgpu:shader,validation,shader_io,size:* // 92%, https://github.com/gfx-rs/wgpu/issues/8892, large size validation, runtime-sized array
webgpu:shader,validation,shader_io,workgroup_size:* // 83%, https://github.com/gfx-rs/wgpu/issues/8892, type mixing, attribute placement
+6
View File
@@ -425,6 +425,12 @@ webgpu:shader,validation,shader_io,entry_point:*
// Uses external texture bindings
fails-if(vulkan) webgpu:shader,validation,shader_io,group_and_binding:*
webgpu:shader,validation,shader_io,invariant:*
webgpu:shader,validation,shader_io,locations:duplicates:*
webgpu:shader,validation,shader_io,locations:location_fp16:*
webgpu:shader,validation,shader_io,locations:nesting:*
webgpu:shader,validation,shader_io,locations:out_of_order:*
webgpu:shader,validation,shader_io,locations:type:*
webgpu:shader,validation,shader_io,locations:validation:*
webgpu:shader,validation,statement,break_if:*
webgpu:shader,validation,statement,break:*
webgpu:shader,validation,statement,compound:*
+14 -2
View File
@@ -183,6 +183,7 @@ impl<'a> BindingParser<'a> {
lexer.expect(Token::Paren('('))?;
self.location
.set(parser.expression(lexer, ctx)?, name_span)?;
lexer.next_if(Token::Separator(','));
lexer.expect(Token::Paren(')'))?;
}
"builtin" => {
@@ -192,6 +193,7 @@ impl<'a> BindingParser<'a> {
conv::map_built_in(&lexer.enable_extensions, raw, span)?,
name_span,
)?;
lexer.next_if(Token::Separator(','));
lexer.expect(Token::Paren(')'))?;
}
"interpolate" => {
@@ -204,6 +206,7 @@ impl<'a> BindingParser<'a> {
self.sampling
.set(conv::map_sampling(raw, span)?, name_span)?;
}
lexer.next_if(Token::Separator(','));
lexer.expect(Token::Paren(')'))?;
}
@@ -919,12 +922,14 @@ impl Parser {
("size", name_span) => {
lexer.expect(Token::Paren('('))?;
let expr = self.expression(lexer, ctx)?;
lexer.next_if(Token::Separator(','));
lexer.expect(Token::Paren(')'))?;
size.set(expr, name_span)?;
}
("align", name_span) => {
lexer.expect(Token::Paren('('))?;
let expr = self.expression(lexer, ctx)?;
lexer.next_if(Token::Separator(','));
lexer.expect(Token::Paren(')'))?;
align.set(expr, name_span)?;
}
@@ -1879,16 +1884,19 @@ impl Parser {
"binding" => {
lexer.expect(Token::Paren('('))?;
bind_index.set(self.expression(lexer, &mut ctx)?, name_span)?;
lexer.next_if(Token::Separator(','));
lexer.expect(Token::Paren(')'))?;
}
"group" => {
lexer.expect(Token::Paren('('))?;
bind_group.set(self.expression(lexer, &mut ctx)?, name_span)?;
lexer.next_if(Token::Separator(','));
lexer.expect(Token::Paren(')'))?;
}
"id" => {
lexer.expect(Token::Paren('('))?;
id.set(self.expression(lexer, &mut ctx)?, name_span)?;
lexer.next_if(Token::Separator(','));
lexer.expect(Token::Paren(')'))?;
}
"vertex" => {
@@ -1974,11 +1982,15 @@ impl Parser {
"workgroup_size" => {
lexer.expect(Token::Paren('('))?;
let mut new_workgroup_size = [None; 3];
for (i, size) in new_workgroup_size.iter_mut().enumerate() {
for size in new_workgroup_size.iter_mut() {
*size = Some(self.expression(lexer, &mut ctx)?);
match lexer.next() {
(Token::Paren(')'), _) => break,
(Token::Separator(','), _) if i != 2 => (),
(Token::Separator(','), _) => {
if lexer.next_if(Token::Paren(')')) {
break;
}
}
other => {
return Err(Box::new(Error::Unexpected(
other.1,