diff options
author | 2021-05-24 20:26:56 +0700 | |
---|---|---|
committer | 2021-05-24 20:26:56 +0700 | |
commit | df971ac99beedb41537763f95f7b14d8bf7475a8 (patch) | |
tree | 70bf9d7aac84ae05f841b51dca6eb66c1769de93 /wgpu/src/shader/blit.wgsl | |
parent | 3918257883dba3cf260bd9764cb7b34101c435e6 (diff) | |
parent | 4cbc34524598756ce18cb25a664bc6f256d42851 (diff) | |
download | iced-df971ac99beedb41537763f95f7b14d8bf7475a8.tar.gz iced-df971ac99beedb41537763f95f7b14d8bf7475a8.tar.bz2 iced-df971ac99beedb41537763f95f7b14d8bf7475a8.zip |
Merge pull request #830 from Dispersia/upgrade-wgpu
Upgrade wgpu
Diffstat (limited to 'wgpu/src/shader/blit.wgsl')
-rw-r--r-- | wgpu/src/shader/blit.wgsl | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/wgpu/src/shader/blit.wgsl b/wgpu/src/shader/blit.wgsl new file mode 100644 index 00000000..694f192e --- /dev/null +++ b/wgpu/src/shader/blit.wgsl @@ -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); +} |