Skip to content

Commit 1b20671

Browse files
committed
Fix jump-flood outlines when using Metal backend.
1 parent 5a91f27 commit 1b20671

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/fragment.wgsl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
struct FragmentOutput {
44
@location(0) colour: vec4<f32>,
55
#ifdef FLAT_DEPTH
6+
#ifndef FLOOD_INIT
67
@builtin(frag_depth) frag_depth: f32,
78
#endif
9+
#endif
810
};
911

1012
#ifdef ALPHA_MASK_TEXTURE
@@ -24,13 +26,15 @@ fn fragment(vertex: VertexOutput) -> FragmentOutput {
2426
#endif
2527

2628
#ifdef FLAT_DEPTH
29+
#ifndef FLOOD_INIT
2730
out.frag_depth = vertex.flat_depth;
2831
#endif
32+
#endif
2933
#ifdef VOLUME
3034
out.colour = vertex.volume_colour;
3135
#endif
3236
#ifdef FLOOD_INIT
33-
out.colour = vec4<f32>(vertex.position.xy, out.frag_depth, 0.0);
37+
out.colour = vec4<f32>(vertex.position.xy, vertex.flat_depth, 0.0);
3438
#endif
3539
return out;
3640
}

0 commit comments

Comments
 (0)