mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-10 05:57:51 +00:00
writer/msl: Fix continuing block emission
Inline the `continuing` block in the places where `continue` is called. Simplifies the emission, and fixes emission of `let` statements in the loop. This fix matches the same approach in writer/hlsl. See: https://dawn-review.googlesource.com/c/tint/+/51784 Fixed: tint:833 Fixed: tint:914 Change-Id: If4d8cde62dfaf8efa24272854ca7ff5edc0a8234 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/55341 Commit-Queue: Ben Clayton <bclayton@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
c15baf695d
commit
663271dca4
@@ -63,33 +63,31 @@ kernel void comp_main(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], c
|
||||
float2 vel = 0.0f;
|
||||
{
|
||||
uint i = 0u;
|
||||
{
|
||||
bool tint_msl_is_first_1 = true;
|
||||
for(;;) {
|
||||
if (!tint_msl_is_first_1) {
|
||||
while (true) {
|
||||
if (!((i < 5u))) {
|
||||
break;
|
||||
}
|
||||
if ((i == index)) {
|
||||
{
|
||||
i = (i + 1u);
|
||||
}
|
||||
tint_msl_is_first_1 = false;
|
||||
|
||||
if (!((i < 5u))) {
|
||||
break;
|
||||
}
|
||||
if ((i == index)) {
|
||||
continue;
|
||||
}
|
||||
pos = particlesA.particles.arr[i].pos.xy;
|
||||
vel = particlesA.particles.arr[i].vel.xy;
|
||||
if (( distance(pos, vPos) < params.rule1Distance)) {
|
||||
cMass = (cMass + pos);
|
||||
cMassCount = (cMassCount + 1);
|
||||
}
|
||||
if (( distance(pos, vPos) < params.rule2Distance)) {
|
||||
colVel = (colVel - (pos - vPos));
|
||||
}
|
||||
if (( distance(pos, vPos) < params.rule3Distance)) {
|
||||
cVel = (cVel + vel);
|
||||
cVelCount = (cVelCount + 1);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
pos = particlesA.particles.arr[i].pos.xy;
|
||||
vel = particlesA.particles.arr[i].vel.xy;
|
||||
if (( distance(pos, vPos) < params.rule1Distance)) {
|
||||
cMass = (cMass + pos);
|
||||
cMassCount = (cMassCount + 1);
|
||||
}
|
||||
if (( distance(pos, vPos) < params.rule2Distance)) {
|
||||
colVel = (colVel - (pos - vPos));
|
||||
}
|
||||
if (( distance(pos, vPos) < params.rule3Distance)) {
|
||||
cVel = (cVel + vel);
|
||||
cVelCount = (cVelCount + 1);
|
||||
}
|
||||
{
|
||||
i = (i + 1u);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user