[wgsl-in] Update entry point stage attributes

This commit is contained in:
Igor Shaposhnik authored and João Capucho committed 2022-04-15 18:02:48 +01:00
1 parent c93a5ede71
commit fbb77aa0dc
28 files changed
+61 -83

No files matched your search

-9
View File
@@ -38,15 +38,6 @@ pub fn map_built_in(word: &str, span: Span) -> Result<crate::BuiltIn, Error<'_>>
})
}
pub fn map_shader_stage(word: &str, span: Span) -> Result<crate::ShaderStage, Error<'_>> {
match word {
"vertex" => Ok(crate::ShaderStage::Vertex),
"fragment" => Ok(crate::ShaderStage::Fragment),
"compute" => Ok(crate::ShaderStage::Compute),
_ => Err(Error::UnknownShaderStage(span)),
}
}
pub fn map_interpolation(word: &str, span: Span) -> Result<crate::Interpolation, Error<'_>> {
match word {
"linear" => Ok(crate::Interpolation::Linear),
+8 -5
View File
@@ -4210,11 +4210,14 @@ impl Parser {
bind_group = Some(parse_non_negative_sint_literal(lexer, 4)?);
lexer.expect(Token::Paren(')'))?;
}
("stage", _) => {
lexer.expect(Token::Paren('('))?;
let (ident, ident_span) = lexer.next_ident_with_span()?;
stage = Some(conv::map_shader_stage(ident, ident_span)?);
lexer.expect(Token::Paren(')'))?;
("vertex", _) => {
stage = Some(crate::ShaderStage::Vertex);
}
("fragment", _) => {
stage = Some(crate::ShaderStage::Fragment);
}
("compute", _) => {
stage = Some(crate::ShaderStage::Compute);
}
("workgroup_size", _) => {
lexer.expect(Token::Paren('('))?;
+1 -1
View File
@@ -463,7 +463,7 @@ fn parse_struct_instantiation() {
b: vec3<f32>,
}
@stage(fragment)
@fragment
fn fs_main() {
var foo: Foo = Foo(0.0, vec3<f32>(0.0, 1.0, 42.0));
}