alaingalvan / webgpu-seed

🔺🌱 An example on how to render a hello triangle with WebGPU.

Home Page:https://alain.xyz/blog/raw-webgpu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shaders haven't been updated for new @ syntax

rjkilpatrick opened this issue · comments

In your blog post, you've updated the shaders for the new WGSL @attribute syntax, but in this repo, the vertex and fragment shaders still follow the old-style double square-brackets syntax.

[[stage(fragment)]]
fn main([[location(0)]] inColor: vec3<f32>) -> [[location(0)]] vec4<f32> {
return vec4<f32>(inColor, 1.0);
}

struct VSOut {
[[builtin(position)]] Position: vec4<f32>;
[[location(0)]] color: vec3<f32>;
};
[[stage(vertex)]]
fn main([[location(0)]] inPos: vec3<f32>,
[[location(1)]] inColor: vec3<f32>) -> VSOut {
var vsOut: VSOut;
vsOut.Position = vec4<f32>(inPos, 1.0);
vsOut.color = inColor;
return vsOut;
}

P.S. Thank you for the excellent posts 👏