diff --git a/crates/fj-viewer/src/graphics/shader.wgsl b/crates/fj-viewer/src/graphics/shader.wgsl index 89588cf98..304205923 100644 --- a/crates/fj-viewer/src/graphics/shader.wgsl +++ b/crates/fj-viewer/src/graphics/shader.wgsl @@ -1,22 +1,22 @@ struct VertexOutput { - [[builtin(position)]] position: vec4; - [[location(0)]] normal: vec3; - [[location(1)]] color: vec4; + @builtin(position) position: vec4, + @location(0) normal: vec3, + @location(1) color: vec4, }; struct Uniforms { - transform: mat4x4; - transform_normals: mat4x4; + transform: mat4x4, + transform_normals: mat4x4, }; -[[group(0), binding(0)]] +@group(0) @binding(0) var uniforms: Uniforms; -[[stage(vertex)]] +@vertex fn vertex( - [[location(0)]] position: vec3, - [[location(1)]] normal: vec3, - [[location(2)]] color: vec4, + @location(0) position: vec3, + @location(1) normal: vec3, + @location(2) color: vec4, ) -> VertexOutput { @@ -31,8 +31,8 @@ fn vertex( let pi: f32 = 3.14159265359; -[[stage(fragment)]] -fn frag_model(in: VertexOutput) -> [[location(0)]] vec4 { +@fragment +fn frag_model(in: VertexOutput) -> @location(0) vec4 { let light = vec3(0.0, 0.0, -1.0); let angle = acos(dot(light, -in.normal)); @@ -45,12 +45,12 @@ fn frag_model(in: VertexOutput) -> [[location(0)]] vec4 { return color; } -[[stage(fragment)]] -fn frag_mesh(in: VertexOutput) -> [[location(0)]] vec4 { +@fragment +fn frag_mesh(in: VertexOutput) -> @location(0) vec4 { return vec4(1.0 - in.color.rgb, in.color.a); } -[[stage(fragment)]] -fn frag_lines(in: VertexOutput) -> [[location(0)]] vec4 { +@fragment +fn frag_lines(in: VertexOutput) -> @location(0) vec4 { return vec4(in.color.rgb, in.color.a); }