mirror of
https://github.com/sharkdp/bat.git
synced 2025-09-01 10:52:24 +01:00
Add support for WGSL
This commit is contained in:
20
tests/syntax-tests/highlighted/WGSL/test.wgsl
vendored
Normal file
20
tests/syntax-tests/highlighted/WGSL/test.wgsl
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
[3;38;2;102;217;239mstruct[0m[38;2;248;248;242m [0m[38;2;166;226;46mVertexOut[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m@[0m[38;2;166;226;46mbuiltin[0m[38;2;248;248;242m([0m[38;2;255;255;255mposition[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;255;255;255mposition[0m[38;2;248;248;242m : [0m[3;38;2;102;217;239mvec4f[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m@[0m[38;2;166;226;46mlocation[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;255;255;255mcolor[0m[38;2;248;248;242m : [0m[3;38;2;102;217;239mvec4f[0m
|
||||
[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;249;38;114m@[0m[38;2;166;226;46mvertex[0m
|
||||
[38;2;249;38;114mfn[0m[38;2;248;248;242m [0m[38;2;166;226;46mvertex_main[0m[38;2;248;248;242m([0m[38;2;249;38;114m@[0m[38;2;166;226;46mlocation[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;255;255;255mposition[0m[38;2;248;248;242m: [0m[3;38;2;102;217;239mvec4f[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m@[0m[38;2;166;226;46mlocation[0m[38;2;248;248;242m([0m[38;2;190;132;255m1[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;255;255;255mcolor[0m[38;2;248;248;242m: [0m[3;38;2;102;217;239mvec4f[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m->[0m[38;2;248;248;242m [0m[38;2;166;226;46mVertexOut[0m
|
||||
[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mvar[0m[38;2;248;248;242m [0m[38;2;255;255;255moutput[0m[38;2;248;248;242m : [0m[38;2;166;226;46mVertexOut[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;255;255;255moutput[0m[38;2;249;38;114m.[0m[38;2;248;248;242mposition [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;255;255;255mposition[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;255;255;255moutput[0m[38;2;249;38;114m.[0m[38;2;248;248;242mcolor [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;255;255;255mcolor[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;255;255;255moutput[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;249;38;114m@[0m[38;2;166;226;46mfragment[0m
|
||||
[38;2;249;38;114mfn[0m[38;2;248;248;242m [0m[38;2;166;226;46mfragment_main[0m[38;2;248;248;242m([0m[38;2;248;248;242mfragData: [0m[38;2;166;226;46mVertexOut[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m->[0m[38;2;248;248;242m [0m[38;2;249;38;114m@[0m[38;2;166;226;46mlocation[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mvec4f[0m
|
||||
[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m fragData[0m[38;2;249;38;114m.[0m[38;2;248;248;242mcolor[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m}[0m
|
5
tests/syntax-tests/source/WGSL/LICENSE.md
vendored
Normal file
5
tests/syntax-tests/source/WGSL/LICENSE.md
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
The `test.wgsl` file has been added from https://developer.mozilla.org/en-US/docs/Web/API/WebGPU_API under the following license:
|
||||
|
||||
```
|
||||
Any copyright is dedicated to the Public Domain: https://creativecommons.org/publicdomain/zero/1.0/
|
||||
```
|
20
tests/syntax-tests/source/WGSL/test.wgsl
vendored
Normal file
20
tests/syntax-tests/source/WGSL/test.wgsl
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
struct VertexOut {
|
||||
@builtin(position) position : vec4f,
|
||||
@location(0) color : vec4f
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main(@location(0) position: vec4f,
|
||||
@location(1) color: vec4f) -> VertexOut
|
||||
{
|
||||
var output : VertexOut;
|
||||
output.position = position;
|
||||
output.color = color;
|
||||
return output;
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main(fragData: VertexOut) -> @location(0) vec4f
|
||||
{
|
||||
return fragData.color;
|
||||
}
|
Reference in New Issue
Block a user