18 lines
439 B
WebGPU Shading Language
18 lines
439 B
WebGPU Shading Language
@compute
|
|
@workgroup_size(16, 16)
|
|
fn computeMain(@builtin(global_invocation_id) id: vec3u)
|
|
{
|
|
let outSize = textureDimensions(out);
|
|
if (id.x >= outSize.x || id.y >= outSize.y) {
|
|
return;
|
|
}
|
|
|
|
let coordinate = vec2f(f32(id.x) + 0.5, f32(outSize.y - id.y) - 0.5);
|
|
let outSizef = vec2f(outSize);
|
|
let uv = (coordinate * 2.0 - outSizef) / outSizef.y;
|
|
|
|
let color = vec3f(uv.xy, 0);
|
|
|
|
textureStore(out, id.xy, vec4f(color, 1.0));
|
|
}
|