mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 21:47:47 +00:00
writer/msl: Rework string printing
Add `out` parameters to expression and type generators. Use the new helper classes in TextGenerator. Cleans up bad formatting. Prepares the writer generating 'pre' statements, required for atomics. If-else statements are generated slightly differently. This is done so that 'pre' statements for the else conditions are scoped correctly. This is identical to the HLSL writer. Bug tint:892 Change-Id: I4c6e96c90673ba30898b3682bf3198497d63a2d4 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56067 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: James Price <jrprice@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
a5715e3320
commit
f24b37e122
@@ -36,8 +36,8 @@ vertex tint_symbol_2 vert_main(tint_symbol_1 tint_symbol [[stage_in]]) {
|
||||
float2 const a_particlePos = tint_symbol.a_particlePos;
|
||||
float2 const a_particleVel = tint_symbol.a_particleVel;
|
||||
float2 const a_pos = tint_symbol.a_pos;
|
||||
float angle = -( atan2(a_particleVel.x, a_particleVel.y));
|
||||
float2 pos = float2(((a_pos.x * cos(angle)) - (a_pos.y * sin(angle))), ((a_pos.x * sin(angle)) + (a_pos.y * cos(angle))));
|
||||
float angle = -(atan2(a_particleVel.x, a_particleVel.y));
|
||||
float2 pos = float2(((a_pos.x * cos(angle)) - (a_pos.y * sin(angle))), ((a_pos.x * sin(angle)) + (a_pos.y * cos(angle))));
|
||||
tint_symbol_2 const tint_symbol_5 = {.value=float4((pos + a_particlePos), 0.0f, 1.0f)};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
@@ -75,14 +75,14 @@ kernel void comp_main(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], c
|
||||
}
|
||||
pos = particlesA.particles.arr[i].pos.xy;
|
||||
vel = particlesA.particles.arr[i].vel.xy;
|
||||
if (( distance(pos, vPos) < params.rule1Distance)) {
|
||||
if ((distance(pos, vPos) < params.rule1Distance)) {
|
||||
cMass = (cMass + pos);
|
||||
cMassCount = (cMassCount + 1);
|
||||
}
|
||||
if (( distance(pos, vPos) < params.rule2Distance)) {
|
||||
if ((distance(pos, vPos) < params.rule2Distance)) {
|
||||
colVel = (colVel - (pos - vPos));
|
||||
}
|
||||
if (( distance(pos, vPos) < params.rule3Distance)) {
|
||||
if ((distance(pos, vPos) < params.rule3Distance)) {
|
||||
cVel = (cVel + vel);
|
||||
cVelCount = (cVelCount + 1);
|
||||
}
|
||||
@@ -98,7 +98,7 @@ kernel void comp_main(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], c
|
||||
cVel = (cVel / float2(float(cVelCount), float(cVelCount)));
|
||||
}
|
||||
vVel = (((vVel + (cMass * params.rule1Scale)) + (colVel * params.rule2Scale)) + (cVel * params.rule3Scale));
|
||||
vVel = ( normalize(vVel) * clamp( length(vVel), 0.0f, 0.100000001f));
|
||||
vVel = (normalize(vVel) * clamp(length(vVel), 0.0f, 0.100000001f));
|
||||
vPos = (vPos + (vVel * params.deltaT));
|
||||
if ((vPos.x < -1.0f)) {
|
||||
vPos.x = 1.0f;
|
||||
|
||||
Reference in New Issue
Block a user