-
Notifications
You must be signed in to change notification settings - Fork 342
Closed
Labels
wgslWebGPU Shading Language IssuesWebGPU Shading Language Issues
Description
- Remove trailing
;
for struct declaration. Current syntax is awful.
struct Data {
a: i32;
b: vec<f32>;
} 🠔 no semicolon here!
- Remove parentheses from
if
,switch
, etc. Example:
if alpha < 0.5 {
discard;
}
- Use separate syntax for
struct
,block
,uniform
, etc. Examples:
struct Data {
a: i32;
b: vec<f32>;
}
block Data {
a: i32;
b: vec<f32>;
}
uniform viewport: Viewport {
size: vec2<f32>;
ivn_size: vec2<f32>;
}
- Remove
:
from variable, struct members and function arguments declaration. Examples:
var foo f32 = 1.234;
struct Data {
a i32 🠔 makes sense without semicolon here
a vec<f32> after all, there is an end-of-line character
}
fn foo(a f32, b f32) -> bool { .. }
fn foo(a, b f32) -> bool { .. } 🠔 optional variant
- Remove
->
from function declaration (between args and body):fn foo(a: f32, b: f32) bool { .. }
. - In addition to simd-types from vec4<f32> is too hard to type on the keyboard #736. New syntax for arrays and pointers:
[f32] 🠔 array without size
[f32; 4] 🠔 array with size
[[f32; 3]; 4] 🠔 nested array
*f32 🠔 without storage class
*private f32 🠔 with storage class
- To eliminate ambiguity with (5) a new syntax for attributes:
#[location(0), input, read_only] var position f32x4; 🠔 use attributes instead of pseudo-generics
#[group(2), binding(0)]
uniform viewport Viewport {
size f32x2
ivn_size f32x2
}
- In addition to (3) it is possible to make
;
optional.
var foo i32 = 42
foo = 3 * 7
Metadata
Metadata
Assignees
Labels
wgslWebGPU Shading Language IssuesWebGPU Shading Language Issues