Files
wgpu/examples/boids/draw.wgsl
T
Dzmitry Malyshau 74eed253d8 Convert cube, skybox, msaa-line, and mipmap, to WGSL
Validate example shaders in tests

Support WGSL on the Web via Naga

Port the shadow WGSL partially

Convert hello-compute and boids to WGSL

Conver the shadow's fragment shader to WGSL

Shader entry point refactor
2021-01-30 01:02:04 -05:00

27 lines
677 B
WebGPU Shading Language

[[location(0)]]
var<in> in_particle_pos: vec2<f32>;
[[location(1)]]
var<in> in_particle_vel: vec2<f32>;
[[location(2)]]
var<in> in_position: vec2<f32>;
[[builtin(position)]]
var<out> out_position: vec4<f32>;
[[stage(vertex)]]
fn main() {
const angle: f32 = -atan2(in_particle_vel.x, in_particle_vel.y);
const pos: vec2<f32> = vec2<f32>(
in_position.x * cos(angle) - in_position.y * sin(angle),
in_position.x * sin(angle) + in_position.y * cos(angle)
);
out_position = vec4<f32>(pos + in_particle_pos, 0.0, 1.0);
}
[[location(0)]]
var<out> out_color: vec4<f32>;
[[stage(fragment)]]
fn main() {
out_color = vec4<f32>(1.0, 1.0, 1.0, 1.0);
}