diff --git a/src/keywords/wgsl.rs b/src/keywords/wgsl.rs index 8d077c099..0a2abbfd2 100644 --- a/src/keywords/wgsl.rs +++ b/src/keywords/wgsl.rs @@ -5,8 +5,9 @@ Keywords for [WGSL][wgsl] (WebGPU Shading Language). */ // https://gpuweb.github.io/gpuweb/wgsl/#keyword-summary +// last sync: https://github.com/gpuweb/gpuweb/blob/39f2321f547c8f0b7f473cf1d47fba30b1691303/wgsl/index.bs pub const RESERVED: &[&str] = &[ - // type-defining + // Type-defining Keywords "array", "atomic", "bool", @@ -22,11 +23,9 @@ pub const RESERVED: &[&str] = &[ "mat4x2", "mat4x3", "mat4x4", - "override", "ptr", "sampler", "sampler_comparison", - "struct", "texture_1d", "texture_2d", "texture_2d_array", @@ -47,7 +46,7 @@ pub const RESERVED: &[&str] = &[ "vec2", "vec3", "vec4", - // other + // Other Keywords "bitcast", "break", "case", @@ -58,68 +57,29 @@ pub const RESERVED: &[&str] = &[ "discard", "else", "enable", - "fallthrough", "false", "fn", "for", - "function", "if", "let", "loop", - "private", + "override", "return", - "storage", + "static_assert", + "struct", "switch", "true", "type", - "uniform", "var", "while", - "workgroup", - // reserved - "AppendStructuredBuffer", - "BlendState", - "Buffer", - "ByteAddressBuffer", + // Reserved Words "CompileShader", "ComputeShader", - "ConsumeStructuredBuffer", - "DepthStencilState", - "DepthStencilView", "DomainShader", "GeometryShader", "Hullshader", - "InputPatch", - "LineStream", "NULL", - "OutputPatch", - "PixelShader", - "PointStream", - "RWBuffer", - "RWByteAddressBuffer", - "RWStructuredBuffer", - "RWTexture1D", - "RWTexture1DArray", - "RWTexture2D", - "RWTexture2DArray", - "RWTexture3D", - "RasterizerState", - "RenderTargetView", - "SamplerComparisonState", - "SamplerState", "Self", - "StructuredBuffer", - "Texture1D", - "Texture1DArray", - "Texture2D", - "Texture2DArray", - "Texture2DMS", - "Texture2DMSArray", - "Texture3D", - "TextureCube", - "TextureCubeArray", - "TriangleStream", - "VertexShader", "abstract", "active", "alignas", @@ -128,17 +88,13 @@ pub const RESERVED: &[&str] = &[ "asm", "asm_fragment", "async", - "atomic_uint", "attribute", "auto", "await", "become", - "bf16", "binding_array", "cast", "catch", - "cbuffer", - "char", "class", "co_await", "co_return", @@ -160,7 +116,6 @@ pub const RESERVED: &[&str] = &[ "demote", "demote_to_helper", "do", - "dword", "dynamic_cast", "enum", "explicit", @@ -168,50 +123,18 @@ pub const RESERVED: &[&str] = &[ "extends", "extern", "external", - "f64", + "fallthrough", "filter", "final", "finally", - "fixed", "friend", "from", - "fvec2", - "fvec3", - "fvec4", "fxgroup", "get", "goto", "groupshared", "handle", "highp", - "hvec2", - "hvec3", - "hvec4", - "i16", - "i64", - "i8", - "iimage1D", - "iimage1DArray", - "iimage2D", - "iimage2DArray", - "iimage2DMS", - "iimage2DMSArray", - "iimage2DRect", - "iimage3D", - "iimageBuffer", - "iimageCube", - "iimageCubeArray", - "image1D", - "image1DArray", - "image2D", - "image2DArray", - "image2DMS", - "image2DMSArray", - "image2DRect", - "image3D", - "imageBuffer", - "imageCube", - "imageCubeArray", "impl", "implements", "import", @@ -219,40 +142,11 @@ pub const RESERVED: &[&str] = &[ "inout", "instanceof", "interface", - "invariant", - "isampler1D", - "isampler1DArray", - "isampler2D", - "isampler2DArray", - "isampler2DMS", - "isampler2DMSArray", - "isampler2DRect", - "isampler3D", - "isamplerBuffer", - "isamplerCube", - "isamplerCubeArray", - "isubpassInput", - "isubpassInputMS", - "itexture1D", - "itexture1DArray", - "itexture2D", - "itexture2DArray", - "itexture2DMS", - "itexture2DMSArray", - "itexture2DRect", - "itexture3D", - "itextureBuffer", - "itextureCube", - "itextureCubeArray", "layout", - "line", - "lineadj", "lowp", "macro", "macro_rules", - "mat", "match", - "matrix", "mediump", "meta", "mod", @@ -277,7 +171,6 @@ pub const RESERVED: &[&str] = &[ "pass", "patch", "pixelfragment", - "point", "precise", "precision", "premerge", @@ -293,28 +186,6 @@ pub const RESERVED: &[&str] = &[ "requires", "resource", "restrict", - "row_major", - "samper", - "sampler1D", - "sampler1DArray", - "sampler1DArrayShadow", - "sampler1DShadow", - "sampler2D", - "sampler2DArray", - "sampler2DArrayShadow", - "sampler2DMS", - "sampler2DMSArray", - "sampler2DRect", - "sampler2DRectShadow", - "sampler2DShadow", - "sampler3D", - "sampler3DRect", - "samplerBuffer", - "samplerCube", - "samplerCubeArray", - "samplerCubeArrayShadow", - "samplerCubeShadow", - "samplerShadow", "self", "set", "shared", @@ -322,100 +193,33 @@ pub const RESERVED: &[&str] = &[ "sizeof", "smooth", "snorm", - "stateblock", - "stateblock_state", "static", "static_assert", "static_cast", "std", - "string", - "subpassInput", - "subpassInputMS", "subroutine", "super", - "superp", "target", - "tbuffer", - "technique", - "technique10", - "technique11", "template", - "texture1D", - "texture1DArray", - "texture2D", - "texture2DArray", - "texture2DMS", - "texture2DMSArray", - "texture2DRect", - "texture3D", - "textureBuffer", - "textureCube", - "textureCubeArray", "this", "thread_local", "throw", "trait", - "triangle", - "triangleadj", "try", "typedef", "typeid", "typename", "typeof", - "u16", - "u64", - "u8", - "uimage1D", - "uimage1DArray", - "uimage2D", - "uimage2DArray", - "uimage2DMS", - "uimage2DMSArray", - "uimage2DRect", - "uimage3D", - "uimageBuffer", - "uimageCube", - "uimageCubeArray", "union", "unless", "unorm", "unsafe", - "unsigned", "unsized", - "usampler1D", - "usampler1DArray", - "usampler2D", - "usampler2DArray", - "usampler2DMS", - "usampler2DMSArray", - "usampler2DRect", - "usampler3D", - "usamplerBuffer", - "usamplerCube", - "usamplerCubeArray", "use", "using", - "usubpassInput", - "usubpassInputMS", - "utexture1D", - "utexture1DArray", - "utexture2D", - "utexture2DArray", - "utexture2DMS", - "utexture2DMSArray", - "utexture2DRect", - "utexture3D", - "utextureBuffer", - "utextureCube", - "utextureCubeArray", "varying", - "vec", - "vector", - "vertexfragment", "virtual", - "void", "volatile", - "wchar_t", "wgsl", "where", "with", diff --git a/tests/out/wgsl/931-constant-emitting-vert.wgsl b/tests/out/wgsl/931-constant-emitting-vert.wgsl index 8634d13d6..dfb5a38a0 100644 --- a/tests/out/wgsl/931-constant-emitting-vert.wgsl +++ b/tests/out/wgsl/931-constant-emitting-vert.wgsl @@ -1,4 +1,4 @@ -fn function_() -> f32 { +fn function() -> f32 { return 0.0; } diff --git a/tests/out/wgsl/constant-array-size-vert.wgsl b/tests/out/wgsl/constant-array-size-vert.wgsl index f2f7f9d24..15018270f 100644 --- a/tests/out/wgsl/constant-array-size-vert.wgsl +++ b/tests/out/wgsl/constant-array-size-vert.wgsl @@ -5,7 +5,7 @@ struct Data { @group(1) @binding(0) var global: Data; -fn function_() -> vec4 { +fn function() -> vec4 { var sum: vec4; var i: i32; diff --git a/tests/out/wgsl/empty-global-name.wgsl b/tests/out/wgsl/empty-global-name.wgsl index 7229ea2f4..c84e56ad8 100644 --- a/tests/out/wgsl/empty-global-name.wgsl +++ b/tests/out/wgsl/empty-global-name.wgsl @@ -5,7 +5,7 @@ struct type_1 { @group(0) @binding(0) var unnamed: type_1; -fn function_() { +fn function() { let _e8 = unnamed.member; unnamed.member = (_e8 + 1); return; @@ -13,5 +13,5 @@ fn function_() { @compute @workgroup_size(1, 1, 1) fn main() { - function_(); + function(); } diff --git a/tests/out/wgsl/prepostfix-frag.wgsl b/tests/out/wgsl/prepostfix-frag.wgsl index 72347bfd6..5515f9827 100644 --- a/tests/out/wgsl/prepostfix-frag.wgsl +++ b/tests/out/wgsl/prepostfix-frag.wgsl @@ -2,9 +2,9 @@ fn main_1() { var scalar_target: i32; var scalar: i32; var vec_target: vec2; - var vec_: vec2; + var vec: vec2; var mat_target: mat4x3; - var mat_: mat4x3; + var mat: mat4x3; scalar = 1; let _e3 = scalar; @@ -14,24 +14,24 @@ fn main_1() { let _e8 = (_e6 - 1); scalar = _e8; scalar_target = _e8; - vec_ = vec2(u32(1)); - let _e14 = vec_; - vec_ = (_e14 - vec2(1u)); + vec = vec2(u32(1)); + let _e14 = vec; + vec = (_e14 - vec2(1u)); vec_target = _e14; - let _e18 = vec_; + let _e18 = vec; let _e21 = (_e18 + vec2(1u)); - vec_ = _e21; + vec = _e21; vec_target = _e21; let _e24 = f32(1); - mat_ = mat4x3(vec3(_e24, 0.0, 0.0), vec3(0.0, _e24, 0.0), vec3(0.0, 0.0, _e24), vec3(0.0, 0.0, 0.0)); - let _e32 = mat_; + mat = mat4x3(vec3(_e24, 0.0, 0.0), vec3(0.0, _e24, 0.0), vec3(0.0, 0.0, _e24), vec3(0.0, 0.0, 0.0)); + let _e32 = mat; let _e34 = vec3(1.0); - mat_ = (_e32 + mat4x3(_e34, _e34, _e34, _e34)); + mat = (_e32 + mat4x3(_e34, _e34, _e34, _e34)); mat_target = _e32; - let _e37 = mat_; + let _e37 = mat; let _e39 = vec3(1.0); let _e41 = (_e37 - mat4x3(_e39, _e39, _e39, _e39)); - mat_ = _e41; + mat = _e41; mat_target = _e41; return; }