Upgrade wgpu
This commit is contained in:
parent
4b8ba8309f
commit
9a2c78c405
28 changed files with 386 additions and 353 deletions
43
wgpu/src/shader/blit.wgsl
Normal file
43
wgpu/src/shader/blit.wgsl
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
var positions: array<vec2<f32>, 6> = array<vec2<f32>, 6>(
|
||||
vec2<f32>(-1.0, 1.0),
|
||||
vec2<f32>(-1.0, -1.0),
|
||||
vec2<f32>(1.0, -1.0),
|
||||
vec2<f32>(-1.0, 1.0),
|
||||
vec2<f32>(1.0, 1.0),
|
||||
vec2<f32>(1.0, -1.0)
|
||||
);
|
||||
|
||||
var uvs: array<vec2<f32>, 6> = array<vec2<f32>, 6>(
|
||||
vec2<f32>(0.0, 0.0),
|
||||
vec2<f32>(0.0, 1.0),
|
||||
vec2<f32>(1.0, 1.0),
|
||||
vec2<f32>(0.0, 0.0),
|
||||
vec2<f32>(1.0, 0.0),
|
||||
vec2<f32>(1.0, 1.0)
|
||||
);
|
||||
|
||||
[[group(0), binding(0)]] var u_sampler: sampler;
|
||||
[[group(1), binding(0)]] var u_texture: texture_2d<f32>;
|
||||
|
||||
struct VertexInput {
|
||||
[[builtin(vertex_index)]] vertex_index: u32;
|
||||
};
|
||||
|
||||
struct VertexOutput {
|
||||
[[builtin(position)]] position: vec4<f32>;
|
||||
[[location(0)]] uv: vec2<f32>;
|
||||
};
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vs_main(input: VertexInput) -> VertexOutput {
|
||||
var out: VertexOutput;
|
||||
out.uv = uvs[input.vertex_index];
|
||||
out.position = vec4<f32>(positions[input.vertex_index], 0.0, 1.0);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fs_main(input: VertexOutput) -> [[location(0)]] vec4<f32> {
|
||||
return textureSample(u_texture, u_sampler, input.uv);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue