mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-02-25 21:33:48 +00:00
[wgsl] update builtin names, have implicit function return type
This commit is contained in:
parent
0d81b1f78c
commit
92de5851d0
@ -15,8 +15,8 @@ pub fn map_built_in(word: &str) -> Result<crate::BuiltIn, Error<'_>> {
|
||||
Ok(match word {
|
||||
// vertex
|
||||
"position" => crate::BuiltIn::Position,
|
||||
"vertex_idx" => crate::BuiltIn::VertexIndex,
|
||||
"instance_idx" => crate::BuiltIn::InstanceIndex,
|
||||
"vertex_index" => crate::BuiltIn::VertexIndex,
|
||||
"instance_index" => crate::BuiltIn::InstanceIndex,
|
||||
// fragment
|
||||
"front_facing" => crate::BuiltIn::FrontFacing,
|
||||
"frag_coord" => crate::BuiltIn::FragCoord,
|
||||
@ -24,7 +24,7 @@ pub fn map_built_in(word: &str) -> Result<crate::BuiltIn, Error<'_>> {
|
||||
// compute
|
||||
"global_invocation_id" => crate::BuiltIn::GlobalInvocationId,
|
||||
"local_invocation_id" => crate::BuiltIn::LocalInvocationId,
|
||||
"local_invocation_idx" => crate::BuiltIn::LocalInvocationIndex,
|
||||
"local_invocation_index" => crate::BuiltIn::LocalInvocationIndex,
|
||||
_ => return Err(Error::UnknownBuiltin(word)),
|
||||
})
|
||||
}
|
||||
|
@ -1563,11 +1563,10 @@ impl Parser {
|
||||
});
|
||||
}
|
||||
// read return type
|
||||
lexer.expect(Token::Arrow)?;
|
||||
let return_type = if lexer.skip(Token::Word("void")) {
|
||||
None
|
||||
} else {
|
||||
let return_type = if lexer.skip(Token::Arrow) && !lexer.skip(Token::Word("void")) {
|
||||
Some(self.parse_type_decl(lexer, None, &mut module.types, &mut module.constants)?)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let mut fun = crate::Function {
|
||||
|
Loading…
Reference in New Issue
Block a user