Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wgsl: Fix typo for texel format rgba16float #779

Merged
merged 1 commit into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lexers/embedded/wgsl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<rule pattern="(var|let|const|override)\b"><token type="KeywordDeclaration"/></rule>
<rule pattern="(alias|break|case|const_assert|continue|continuing|default|diagnostic|discard|else|enable|false|fn|for|if|loop|requires|return|struct|switch|true|while)\b"><token type="Keyword"/></rule>
<rule pattern="(NULL|Self|abstract|active|alignas|alignof|as|asm|asm_fragment|async|attribute|auto|await|become|binding_array|cast|catch|class|co_await|co_return|co_yield|coherent|column_major|common|compile|compile_fragment|concept|const_cast|consteval|constexpr|constinit|crate|debugger|decltype|delete|demote|demote_to_helper|do|dynamic_cast|enum|explicit|export|extends|extern|external|fallthrough|filter|final|finally|friend|from|fxgroup|get|goto|groupshared|highp|impl|implements|import|inline|instanceof|interface|layout|lowp|macro|macro_rules|match|mediump|meta|mod|module|move|mut|mutable|namespace|new|nil|noexcept|noinline|nointerpolation|noperspective|null|nullptr|of|operator|package|packoffset|partition|pass|patch|pixelfragment|precise|precision|premerge|priv|protected|pub|public|readonly|ref|regardless|register|reinterpret_cast|require|resource|restrict|self|set|shared|sizeof|smooth|snorm|static|static_assert|static_cast|std|subroutine|super|target|template|this|thread_local|throw|trait|try|type|typedef|typeid|typename|typeof|union|unless|unorm|unsafe|unsized|use|using|varying|virtual|volatile|wgsl|where|with|writeonly|yield)\b"><token type="KeywordReserved"/></rule>
<rule pattern="(read|write|read_write|function|private|workgroup|uniform|storage|perspective|linear|flat|center|centroid|sample|vertex_index|instance_index|position|front_facing|frag_depth|local_invocation_id|local_invocation_index|global_invocation_id|workgroup_id|num_workgroups|sample_index|sample_mask|rgba8unorm|rgba8snorm|rgba8uint|rgba8sint|rgba16uint|rgba16sint|rgba16flot|r32uint|r32sint|r32float|rg32uint|rg32sint|rg32float|rgba32uint|rgba32sint|rgba32float|bgra8unorm)\b"><token type="NameBuiltin"/></rule>
<rule pattern="(read|write|read_write|function|private|workgroup|uniform|storage|perspective|linear|flat|center|centroid|sample|vertex_index|instance_index|position|front_facing|frag_depth|local_invocation_id|local_invocation_index|global_invocation_id|workgroup_id|num_workgroups|sample_index|sample_mask|rgba8unorm|rgba8snorm|rgba8uint|rgba8sint|rgba16uint|rgba16sint|rgba16float|r32uint|r32sint|r32float|rg32uint|rg32sint|rg32float|rgba32uint|rgba32sint|rgba32float|bgra8unorm)\b"><token type="NameBuiltin"/></rule>
<rule pattern="(bool|f16|f32|i32|sampler|sampler_comparison|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d|texture_external|texture_external|u32)\b"><token type="NameBuiltin"/></rule>
<rule pattern="(array|atomic|mat2x2|mat2x3|mat2x4|mat3x2|mat3x3|mat3x4|mat4x2|mat4x3|mat4x4|ptr|texture_1d|texture_2d|texture_2d_array|texture_3d|texture_cube|texture_cube_array|texture_multisampled_2d|texture_storage_1d|texture_storage_2d|texture_storage_2d_array|texture_storage_3d|vec2|vec3|vec4)\b"><token type="NameBuiltin"/></rule>
<rule pattern="(vec2i|vec3i|vec4i|vec2u|vec3u|vec4u|vec2f|vec3f|vec4f|vec2h|vec3h|vec4h)\b"><token type="NameBuiltin"/></rule>
Expand Down
5 changes: 5 additions & 0 deletions lexers/testdata/wgsl.address.space.actual
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alias a=ptr<function,i32>;
alias b=ptr<private,i32>;
alias c=ptr<workgroup,i32>;
alias d=ptr<uniform,i32>;
alias e=ptr<storage,i32>;
62 changes: 62 additions & 0 deletions lexers/testdata/wgsl.address.space.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[
{"type":"Keyword","value":"alias"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"a"},
{"type":"Operator","value":"="},
{"type":"NameBuiltin","value":"ptr"},
{"type":"Operator","value":"\u003c"},
{"type":"NameBuiltin","value":"function"},
{"type":"Punctuation","value":","},
{"type":"NameBuiltin","value":"i32"},
{"type":"Operator","value":"\u003e"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n"},
{"type":"Keyword","value":"alias"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"b"},
{"type":"Operator","value":"="},
{"type":"NameBuiltin","value":"ptr"},
{"type":"Operator","value":"\u003c"},
{"type":"NameBuiltin","value":"private"},
{"type":"Punctuation","value":","},
{"type":"NameBuiltin","value":"i32"},
{"type":"Operator","value":"\u003e"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n"},
{"type":"Keyword","value":"alias"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"c"},
{"type":"Operator","value":"="},
{"type":"NameBuiltin","value":"ptr"},
{"type":"Operator","value":"\u003c"},
{"type":"NameBuiltin","value":"workgroup"},
{"type":"Punctuation","value":","},
{"type":"NameBuiltin","value":"i32"},
{"type":"Operator","value":"\u003e"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n"},
{"type":"Keyword","value":"alias"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"d"},
{"type":"Operator","value":"="},
{"type":"NameBuiltin","value":"ptr"},
{"type":"Operator","value":"\u003c"},
{"type":"NameBuiltin","value":"uniform"},
{"type":"Punctuation","value":","},
{"type":"NameBuiltin","value":"i32"},
{"type":"Operator","value":"\u003e"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n"},
{"type":"Keyword","value":"alias"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"e"},
{"type":"Operator","value":"="},
{"type":"NameBuiltin","value":"ptr"},
{"type":"Operator","value":"\u003c"},
{"type":"NameBuiltin","value":"storage"},
{"type":"Punctuation","value":","},
{"type":"NameBuiltin","value":"i32"},
{"type":"Operator","value":"\u003e"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n"}
]
4 changes: 4 additions & 0 deletions lexers/testdata/wgsl.bool.types.actual
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
alias boolean=bool;
alias bvec2=vec2<bool>;
alias bvec3=vec3<bool>;
alias bvec4=vec4<bool>;
39 changes: 39 additions & 0 deletions lexers/testdata/wgsl.bool.types.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[
{"type":"Keyword","value":"alias"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"boolean"},
{"type":"Operator","value":"="},
{"type":"NameBuiltin","value":"bool"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n"},
{"type":"Keyword","value":"alias"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"bvec2"},
{"type":"Operator","value":"="},
{"type":"NameBuiltin","value":"vec2"},
{"type":"Operator","value":"\u003c"},
{"type":"NameBuiltin","value":"bool"},
{"type":"Operator","value":"\u003e"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n"},
{"type":"Keyword","value":"alias"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"bvec3"},
{"type":"Operator","value":"="},
{"type":"NameBuiltin","value":"vec3"},
{"type":"Operator","value":"\u003c"},
{"type":"NameBuiltin","value":"bool"},
{"type":"Operator","value":"\u003e"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n"},
{"type":"Keyword","value":"alias"},
{"type":"TextWhitespace","value":" "},
{"type":"Name","value":"bvec4"},
{"type":"Operator","value":"="},
{"type":"NameBuiltin","value":"vec4"},
{"type":"Operator","value":"\u003c"},
{"type":"NameBuiltin","value":"bool"},
{"type":"Operator","value":"\u003e"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n"}
]
5 changes: 5 additions & 0 deletions lexers/testdata/wgsl.depth.texture.actual
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@group(0) @binding(1) var texture_depth_2d;
@group(0) @binding(2) var texture_depth_2d_array;
@group(0) @binding(4) var texture_depth_cube;
@group(0) @binding(5) var texture_depth_cube_array;
@group(0) @binding(5) var texture_depth_multisampled_2d;
77 changes: 77 additions & 0 deletions lexers/testdata/wgsl.depth.texture.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
[
{"type":"NameDecorator","value":"@group"},
{"type":"Punctuation","value":"("},
{"type":"LiteralNumberInteger","value":"0"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"NameDecorator","value":"@binding"},
{"type":"Punctuation","value":"("},
{"type":"LiteralNumberInteger","value":"1"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"KeywordDeclaration","value":"var"},
{"type":"TextWhitespace","value":" "},
{"type":"NameBuiltin","value":"texture_depth_2d"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n"},
{"type":"NameDecorator","value":"@group"},
{"type":"Punctuation","value":"("},
{"type":"LiteralNumberInteger","value":"0"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"NameDecorator","value":"@binding"},
{"type":"Punctuation","value":"("},
{"type":"LiteralNumberInteger","value":"2"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"KeywordDeclaration","value":"var"},
{"type":"TextWhitespace","value":" "},
{"type":"NameBuiltin","value":"texture_depth_2d_array"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n"},
{"type":"NameDecorator","value":"@group"},
{"type":"Punctuation","value":"("},
{"type":"LiteralNumberInteger","value":"0"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"NameDecorator","value":"@binding"},
{"type":"Punctuation","value":"("},
{"type":"LiteralNumberInteger","value":"4"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"KeywordDeclaration","value":"var"},
{"type":"TextWhitespace","value":" "},
{"type":"NameBuiltin","value":"texture_depth_cube"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n"},
{"type":"NameDecorator","value":"@group"},
{"type":"Punctuation","value":"("},
{"type":"LiteralNumberInteger","value":"0"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"NameDecorator","value":"@binding"},
{"type":"Punctuation","value":"("},
{"type":"LiteralNumberInteger","value":"5"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"KeywordDeclaration","value":"var"},
{"type":"TextWhitespace","value":" "},
{"type":"NameBuiltin","value":"texture_depth_cube_array"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n"},
{"type":"NameDecorator","value":"@group"},
{"type":"Punctuation","value":"("},
{"type":"LiteralNumberInteger","value":"0"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"NameDecorator","value":"@binding"},
{"type":"Punctuation","value":"("},
{"type":"LiteralNumberInteger","value":"5"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"KeywordDeclaration","value":"var"},
{"type":"TextWhitespace","value":" "},
{"type":"NameBuiltin","value":"texture_depth_multisampled_2d"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n"}
]
1 change: 1 addition & 0 deletions lexers/testdata/wgsl.external.texture.actual
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@group(0) @binding(5) var texture_external;
17 changes: 17 additions & 0 deletions lexers/testdata/wgsl.external.texture.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
{"type":"NameDecorator","value":"@group"},
{"type":"Punctuation","value":"("},
{"type":"LiteralNumberInteger","value":"0"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"NameDecorator","value":"@binding"},
{"type":"Punctuation","value":"("},
{"type":"LiteralNumberInteger","value":"5"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"KeywordDeclaration","value":"var"},
{"type":"TextWhitespace","value":" "},
{"type":"NameBuiltin","value":"texture_external"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n"}
]
2 changes: 1 addition & 1 deletion lexers/testdata/wgsl.line.comment.actual
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// this is a line-ending comment
//* embed a bock comment start, after gap of space
//* embed a bock comment start, after a space
// /* embed a bock comment start, v2
2 changes: 1 addition & 1 deletion lexers/testdata/wgsl.line.comment.expected
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
{"type":"TextWhitespace","value":" "},
{"type":"CommentSingle","value":"// this is a line-ending comment\n"},
{"type":"TextWhitespace","value":" "},
{"type":"CommentSingle","value":"//* embed a bock comment start, after gap of space\n// /* embed a bock comment start, v2\n"}
{"type":"CommentSingle","value":"//* embed a bock comment start, after a space\n// /* embed a bock comment start, v2\n"}
]
1 change: 1 addition & 0 deletions lexers/testdata/wgsl.multisampled.texture.actual
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@group(0) @binding(5) var texture_multisampled_2d<f32>;
20 changes: 20 additions & 0 deletions lexers/testdata/wgsl.multisampled.texture.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[
{"type":"NameDecorator","value":"@group"},
{"type":"Punctuation","value":"("},
{"type":"LiteralNumberInteger","value":"0"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"NameDecorator","value":"@binding"},
{"type":"Punctuation","value":"("},
{"type":"LiteralNumberInteger","value":"5"},
{"type":"Punctuation","value":")"},
{"type":"TextWhitespace","value":" "},
{"type":"KeywordDeclaration","value":"var"},
{"type":"TextWhitespace","value":" "},
{"type":"NameBuiltin","value":"texture_multisampled_2d"},
{"type":"Operator","value":"\u003c"},
{"type":"NameBuiltin","value":"f32"},
{"type":"Operator","value":"\u003e"},
{"type":"Punctuation","value":";"},
{"type":"TextWhitespace","value":"\n"}
]
62 changes: 62 additions & 0 deletions lexers/testdata/wgsl.numeric.types.actual
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
enable f16;
alias int=i32;
alias uint=u32;
alias float=f32;
alias half=f16;
alias ivec2=vec2i;
alias uvec2=vec2u;
alias vec2=vec2f;
alias ivec3=vec3i;
alias uvec3=vec3u;
alias vec3=vec3f;
alias ivec4=vec4i;
alias uvec4=vec4u;
alias ivec2_=vec2<i32>;
alias uvec2_=vec2<u32>;
alias vec2_=vec2<f32>;
alias ivec3_=vec3<i32>;
alias uvec3_=vec3<u32>;
alias vec3_=vec3<f32>;
alias ivec4_=vec4<i32>;
alias uvec4_=vec4<u32>;
alias vec4_=vec4<f32>;
alias hvec2=vec2h;
alias hvec3=vec3h;
alias hvec4=vec4h;
alias hvec4_=vec4<f16>;
alias m22=mat2x2f;
alias m23=mat2x3f;
alias m24=mat2x4f;
alias m32=mat3x2f;
alias m33=mat3x3f;
alias m34=mat3x4f;
alias m42=mat4x2f;
alias m43=mat4x3f;
alias m44=mat4x4f;
alias m22_=mat2x2<f32>;
alias m23_=mat2x3<f32>;
alias m24_=mat2x4<f32>;
alias m32_=mat3x2<f32>;
alias m33_=mat3x3<f32>;
alias m34_=mat3x4<f32>;
alias m42_=mat4x2<f32>;
alias m43_=mat4x3<f32>;
alias m44_=mat4x4<f32>;
alias m22=mat2x2h;
alias m23=mat2x3h;
alias h24=mat2x4h;
alias h32=mat3x2h;
alias h33=mat3x3h;
alias h34=mat3x4h;
alias h42=mat4x2h;
alias h43=mat4x3h;
alias h44=mat4x4h;
alias h22_=mat2x2<f16>;
alias h23_=mat2x3<f16>;
alias h24_=mat2x4<f16>;
alias h32_=mat3x2<f16>;
alias h33_=mat3x3<f16>;
alias h34_=mat3x4<f16>;
alias h42_=mat4x2<f16>;
alias h43_=mat4x3<f16>;
alias h44_=mat4x4<f16>;