Skip to content

Commit

Permalink
Replace for loop with while in shader
Browse files Browse the repository at this point in the history
  • Loading branch information
nicopap committed Mar 8, 2023
1 parent 5617da6 commit b8e9292
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/bevy_pbr/src/render/parallax_mapping.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ fn parallaxed_uv(
var current_layer_height = 0.0;
var current_height = sample_depth_map(uv);

let int_max_layer_count = i32(max_layer_count);
for (var i: i32 = 0; i <= int_max_layer_count; i++) {
// This at most runs layer_count times
while true {
if (current_height <= current_layer_height) {
break;
}
Expand Down

0 comments on commit b8e9292

Please sign in to comment.