diff options
author | 2024-05-23 13:29:45 +0200 | |
---|---|---|
committer | 2024-05-23 13:29:45 +0200 | |
commit | d8ba6b0673a33724a177f3a1ba59705527280142 (patch) | |
tree | 89482c8d1e3a03e00b3a8151abbb81e30ae5898c /wgpu/src/shader/blit.wgsl | |
parent | 72ed8bcc8def9956e25f3720a3095fc96bb2eef0 (diff) | |
parent | 468794d918eb06c1dbebb33c32b10017ad335f05 (diff) | |
download | iced-d8ba6b0673a33724a177f3a1ba59705527280142.tar.gz iced-d8ba6b0673a33724a177f3a1ba59705527280142.tar.bz2 iced-d8ba6b0673a33724a177f3a1ba59705527280142.zip |
Merge branch 'master' into feat/text-macro
Diffstat (limited to 'wgpu/src/shader/blit.wgsl')
-rw-r--r-- | wgpu/src/shader/blit.wgsl | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/wgpu/src/shader/blit.wgsl b/wgpu/src/shader/blit.wgsl index c2ea223f..d7633808 100644 --- a/wgpu/src/shader/blit.wgsl +++ b/wgpu/src/shader/blit.wgsl @@ -1,22 +1,14 @@ -var<private> 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<private> 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, 0.0), vec2<f32>(1.0, 1.0), vec2<f32>(0.0, 0.0), - vec2<f32>(1.0, 0.0), + vec2<f32>(0.0, 1.0), vec2<f32>(1.0, 1.0) ); @group(0) @binding(0) var u_sampler: sampler; +@group(0) @binding(1) var<uniform> u_ratio: vec2<f32>; @group(1) @binding(0) var u_texture: texture_2d<f32>; struct VertexInput { @@ -30,9 +22,11 @@ struct VertexOutput { @vertex fn vs_main(input: VertexInput) -> VertexOutput { + let uv = uvs[input.vertex_index]; + var out: VertexOutput; - out.uv = uvs[input.vertex_index]; - out.position = vec4<f32>(positions[input.vertex_index], 0.0, 1.0); + out.uv = uv * u_ratio; + out.position = vec4<f32>(uv * vec2(2.0, -2.0) + vec2(-1.0, 1.0), 0.0, 1.0); return out; } |