From 3f467d121229142177ef1b2f417fe87c7bf7fdf2 Mon Sep 17 00:00:00 2001 From: Jim Eckerlein Date: Sun, 24 Sep 2023 15:10:19 +0200 Subject: Compute vertex position in shader --- wgpu/src/shader/quad/gradient.wgsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'wgpu/src/shader/quad/gradient.wgsl') diff --git a/wgpu/src/shader/quad/gradient.wgsl b/wgpu/src/shader/quad/gradient.wgsl index 0754e97f..36cae61c 100644 --- a/wgpu/src/shader/quad/gradient.wgsl +++ b/wgpu/src/shader/quad/gradient.wgsl @@ -1,5 +1,5 @@ struct GradientVertexInput { - @location(0) v_pos: vec2, + @builtin(vertex_index) vertex_index: u32, @location(1) @interpolate(flat) colors_1: vec4, @location(2) @interpolate(flat) colors_2: vec4, @location(3) @interpolate(flat) colors_3: vec4, @@ -48,7 +48,7 @@ fn gradient_vs_main(input: GradientVertexInput) -> GradientVertexOutput { vec4(pos - vec2(0.5, 0.5), 0.0, 1.0) ); - out.position = globals.transform * transform * vec4(input.v_pos, 0.0, 1.0); + out.position = globals.transform * transform * vec4(vertex_position(input.vertex_index), 0.0, 1.0); out.colors_1 = input.colors_1; out.colors_2 = input.colors_2; out.colors_3 = input.colors_3; -- cgit