-
i found the following example from https://www.w3.org/TR/WGSL/#for-statement for(var i: i32 = 0; i < 4; i++) {
if a == 0 {
continue;
}
a = a + 2;
} this is the snippet im having trouble with // shader.wgsl
struct MarchOutput {
steps: i32;
depth: f32;
minimum_distance: f32;
hit: bool;
};
fn march(
point: vec3<f32>, direction: vec3<f32>,
max_steps: i32, max_shading_distance: f32, min_hit_distance: f32
) -> MarchOutput {
var out = MarchOutput ( 0, 0.0, max_shading_distance, false );
for (out.steps=0; out.depth < max_shading_distance && out.steps < max_steps; out.steps++) {
var current_position: vec3<f32> = point + direction * depth;
var current_distance: f32 = SDF(current_position);
if (abs(current_distance) < min_hit_distance) {
out.hit = true;
break;
}
out.minimum_distance = min(out.minimum_distance, current_distance);
out.depth += current_distance;
}
return out;
} the error i get:
|
Beta Was this translation helpful? Give feedback.
Answered by
kyoobey
Mar 27, 2022
Replies: 1 comment 1 reply
-
looks like support for for(var i: i32 = 0; i < 4; i=i+1) {
if a == 0 {
continue;
}
a = a + 2;
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
kyoobey
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
looks like support for
++
or+=
hasn't been added.this works: