From 0772310c4f6ab1ff4b9771011c04b6ece0b84df3 Mon Sep 17 00:00:00 2001 From: Dispersia Date: Thu, 20 May 2021 23:10:22 -0700 Subject: [PATCH] Fix duplicating fragment position --- wgpu/src/shader/quad.wgsl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/wgpu/src/shader/quad.wgsl b/wgpu/src/shader/quad.wgsl index bae05a0c..80d733ab 100644 --- a/wgpu/src/shader/quad.wgsl +++ b/wgpu/src/shader/quad.wgsl @@ -80,8 +80,7 @@ fn distance_alg( [[stage(fragment)]] fn fs_main( - input: VertexOutput, - [[builtin(position)]] coord: vec4 + input: VertexOutput ) -> [[location(0)]] vec4 { var mixed_color: vec4 = input.color; @@ -92,7 +91,7 @@ fn fs_main( ); var internal_distance: f32 = distance_alg( - vec2(coord.x, coord.y), + vec2(input.position.x, input.position.y), input.pos + vec2(input.border_width, input.border_width), input.scale - vec2(input.border_width * 2.0, input.border_width * 2.0), internal_border @@ -108,7 +107,7 @@ fn fs_main( } var dist: f32 = distance_alg( - vec2(coord.x, coord.y), + vec2(input.position.x, input.position.y), input.pos, input.scale, input.border_radius