Skip to content

Commit

Permalink
Fix segfault with 2d gizmos (#8223)
Browse files Browse the repository at this point in the history
# Objective

- Don't segfault with gizmos in 2d
- Fixes #8144, Fixes #8211 

## Solution

- Don't use depth in 2d
  • Loading branch information
mockersf authored Mar 29, 2023
1 parent 0859f67 commit 36ada9d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/bevy_gizmos/src/lines.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ struct VertexOutput {
}

struct FragmentOutput {
#ifdef GIZMO_LINES_3D
@builtin(frag_depth) depth: f32,
#endif
@location(0) color: vec4<f32>,
}

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

#ifdef GIZMO_LINES_3D
#ifdef DEPTH_TEST
out.depth = in.pos.z;
#else
out.depth = 1.0;
#endif
#endif

out.color = in.color;
Expand Down

0 comments on commit 36ada9d

Please sign in to comment.