Skip to content

Commit 36ada9d

Browse files
authored
Fix segfault with 2d gizmos (#8223)
# Objective - Don't segfault with gizmos in 2d - Fixes #8144, Fixes #8211 ## Solution - Don't use depth in 2d
1 parent 0859f67 commit 36ada9d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crates/bevy_gizmos/src/lines.wgsl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ struct VertexOutput {
1515
}
1616

1717
struct FragmentOutput {
18+
#ifdef GIZMO_LINES_3D
1819
@builtin(frag_depth) depth: f32,
20+
#endif
1921
@location(0) color: vec4<f32>,
2022
}
2123

@@ -33,10 +35,12 @@ fn vertex(in: VertexInput) -> VertexOutput {
3335
fn fragment(in: VertexOutput) -> FragmentOutput {
3436
var out: FragmentOutput;
3537

38+
#ifdef GIZMO_LINES_3D
3639
#ifdef DEPTH_TEST
3740
out.depth = in.pos.z;
3841
#else
3942
out.depth = 1.0;
43+
#endif
4044
#endif
4145

4246
out.color = in.color;

0 commit comments

Comments
 (0)