mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-02-25 21:33:48 +00:00
[wgsl] ignore offset decorations on struct fields
naga does not require offset decorations on struct fields in WGSL source, and automatically adds them to spv output. The `tint` compiler does not automatically add them, and requires that they be present in the WGSL source. A potential confusion is that an spv binary missing required `OpMemberDecorate` instructions that set the field's offset will fail validation when run through `spirv-val`. But since naga automatically produces these offsets, the same spv binary passed through naga will be successfully validated. This change is to ignore these decorations in naga's WGSL front end so that the same WGSL source can be used with naga and tint to produce valid spv.
This commit is contained in:
parent
f3cab651bb
commit
141d2e7661
@ -1197,6 +1197,12 @@ impl Parser {
|
||||
lexer.expect(Token::Paren(')'))?;
|
||||
ready = false;
|
||||
}
|
||||
Token::Word("offset") if ready => {
|
||||
lexer.expect(Token::Paren('('))?;
|
||||
let _offset = lexer.next_uint_literal()?;
|
||||
lexer.expect(Token::Paren(')'))?;
|
||||
ready = false;
|
||||
}
|
||||
other => return Err(Error::Unexpected(other, "decoration separator")),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user