mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[wgsl] expect logical expressions, fix hex literals
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Naga
|
||||
|
||||
[](https://matrix.to/#/#gfx:matrix.org)
|
||||
[](https://matrix.to/#/#naga:matrix.org)
|
||||
[](https://crates.io/crates/naga)
|
||||
[](https://docs.rs/naga)
|
||||
[](https://travis-ci.org/gfx-rs/naga)
|
||||
|
||||
@@ -121,8 +121,8 @@ scalar_type = {
|
||||
| "u32"
|
||||
}
|
||||
|
||||
return_statement = { "return" ~ primary_expression? }
|
||||
assignment_statement = { ident ~ "=" ~ primary_expression }
|
||||
return_statement = { "return" ~ logical_or_expression? }
|
||||
assignment_statement = { ident ~ "=" ~ logical_or_expression }
|
||||
|
||||
statement = {
|
||||
";"
|
||||
@@ -179,8 +179,8 @@ typed_expression = { type_decl ~ "(" ~ argument_expression_list ~ ")" }
|
||||
argument_expression_list = _{ (logical_or_expression ~ ",")* ~ logical_or_expression }
|
||||
|
||||
ident = @{ ASCII_ALPHA ~ (ASCII_ALPHANUMERIC | "_")* }
|
||||
int_literal = @{ ("-"? ~ "0x"? ~ ASCII_HEX_DIGIT+) | "0" | ("-"? ~ ASCII_NONZERO_DIGIT ~ ASCII_DIGIT*) }
|
||||
uint_literal = @{ ("0x"? ~ ASCII_HEX_DIGIT+) | "0" | (ASCII_NONZERO_DIGIT ~ ASCII_DIGIT*) }
|
||||
int_literal = @{ ("-"? ~ "0x" ~ ASCII_HEX_DIGIT+) | "0" | ("-"? ~ ASCII_NONZERO_DIGIT ~ ASCII_DIGIT*) }
|
||||
uint_literal = @{ ("0x" ~ ASCII_HEX_DIGIT+) | "0" | (ASCII_NONZERO_DIGIT ~ ASCII_DIGIT*) }
|
||||
float_literal = @{ "-"? ~ ASCII_DIGIT+ ~ ("." ~ ASCII_DIGIT*)? }
|
||||
bool_literal = @{ "true" | "false" }
|
||||
string_literal = @{ "\"" ~ ( "\"\"" | (!"\"" ~ ANY) )* ~ "\"" }
|
||||
|
||||
@@ -6,7 +6,7 @@ const c_scale: f32 = 1.2;
|
||||
[[builtin position]] var<out> o_position : vec4<f32>;
|
||||
|
||||
fn main_vert() -> void {
|
||||
o_position = vec4<f32>(scale * a_pos, 0.0, 1.0);
|
||||
o_position = vec4<f32>(c_scale * a_pos, 0.0, 1.0);
|
||||
return;
|
||||
}
|
||||
entry_point vertex as "main" = main_vert;
|
||||
|
||||
Reference in New Issue
Block a user