summaryrefslogtreecommitdiffstats
path: root/wgpu/src/shader
diff options
context:
space:
mode:
authorLibravatar Gigas002 <24297712+Gigas002@users.noreply.github.com>2024-04-16 00:08:17 +0900
committerLibravatar GitHub <noreply@github.com>2024-04-16 00:08:17 +0900
commit0ebe0629cef37aee5c48b9409fc36618a3a3e60d (patch)
tree909d9ecf28e7c491bae3afc81928c118517fa7a9 /wgpu/src/shader
parent13bd106fc585034a7aba17b9c17589113274aaf5 (diff)
parent105b8bd5ad6ade1f203a0d8b0b93bd06f61f621a (diff)
downloadiced-0ebe0629cef37aee5c48b9409fc36618a3a3e60d.tar.gz
iced-0ebe0629cef37aee5c48b9409fc36618a3a3e60d.tar.bz2
iced-0ebe0629cef37aee5c48b9409fc36618a3a3e60d.zip
Merge branch 'iced-rs:master' into viewer_content_fit
Diffstat (limited to 'wgpu/src/shader')
-rw-r--r--wgpu/src/shader/blit.wgsl20
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;
}