diff options
author | 2024-01-19 20:54:09 +0100 | |
---|---|---|
committer | 2024-01-19 20:54:09 +0100 | |
commit | b3e3f6e3c9fc6879e6681810f54d7eaa7c0f3d30 (patch) | |
tree | ef1a846a756fadce7df07732538192ee4f4ce6cf /wgpu/src/shader/quad/gradient.wgsl | |
parent | 7ae7fcb89855002519bab752fd3686106ce448db (diff) | |
parent | 0c7f6e4b34391c709aa4c333c4a9cc10e607f6c4 (diff) | |
download | iced-b3e3f6e3c9fc6879e6681810f54d7eaa7c0f3d30.tar.gz iced-b3e3f6e3c9fc6879e6681810f54d7eaa7c0f3d30.tar.bz2 iced-b3e3f6e3c9fc6879e6681810f54d7eaa7c0f3d30.zip |
Merge pull request #2099 from jim-ec/master
Compute vertex positions in the shader
Diffstat (limited to 'wgpu/src/shader/quad/gradient.wgsl')
-rw-r--r-- | wgpu/src/shader/quad/gradient.wgsl | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/wgpu/src/shader/quad/gradient.wgsl b/wgpu/src/shader/quad/gradient.wgsl index 0754e97f..4ad2fea8 100644 --- a/wgpu/src/shader/quad/gradient.wgsl +++ b/wgpu/src/shader/quad/gradient.wgsl @@ -1,15 +1,15 @@ struct GradientVertexInput { - @location(0) v_pos: vec2<f32>, - @location(1) @interpolate(flat) colors_1: vec4<u32>, - @location(2) @interpolate(flat) colors_2: vec4<u32>, - @location(3) @interpolate(flat) colors_3: vec4<u32>, - @location(4) @interpolate(flat) colors_4: vec4<u32>, - @location(5) @interpolate(flat) offsets: vec4<u32>, - @location(6) direction: vec4<f32>, - @location(7) position_and_scale: vec4<f32>, - @location(8) border_color: vec4<f32>, - @location(9) border_radius: vec4<f32>, - @location(10) border_width: f32, + @builtin(vertex_index) vertex_index: u32, + @location(0) @interpolate(flat) colors_1: vec4<u32>, + @location(1) @interpolate(flat) colors_2: vec4<u32>, + @location(2) @interpolate(flat) colors_3: vec4<u32>, + @location(3) @interpolate(flat) colors_4: vec4<u32>, + @location(4) @interpolate(flat) offsets: vec4<u32>, + @location(5) direction: vec4<f32>, + @location(6) position_and_scale: vec4<f32>, + @location(7) border_color: vec4<f32>, + @location(8) border_radius: vec4<f32>, + @location(9) border_width: f32, } struct GradientVertexOutput { @@ -48,7 +48,7 @@ fn gradient_vs_main(input: GradientVertexInput) -> GradientVertexOutput { vec4<f32>(pos - vec2<f32>(0.5, 0.5), 0.0, 1.0) ); - out.position = globals.transform * transform * vec4<f32>(input.v_pos, 0.0, 1.0); + out.position = globals.transform * transform * vec4<f32>(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; |