WebGPU shader demo
initializing…
Apply shader
WGSL fragment shader
@vertex fn vs_main(@builtin(vertex_index) vertex_index: u32) -> @builtin(position) vec4f { let pos = array( vec2f(-1.0, -1.0), vec2f( 3.0, -1.0), vec2f(-1.0, 3.0) ); return vec4f(pos[vertex_index], 0.0, 1.0); } @fragment fn fs_main(@builtin(position) fragCoord: vec4f) -> @location(0) vec4f { let uv = fragCoord.xy / vec2f(800.0, 600.0); let g = 0.5 + 0.5 * sin(uv.x * 10.0) * cos(uv.y * 10.0); return vec4f(vec3f(g), 1.0); }