Fix all 6 60 FPS Soul Pass findings and add permanent regression tests
This commit is contained in:
parent
0f36eed3a0
commit
f5d23ce49e
12 changed files with 1031 additions and 305 deletions
|
|
@ -198,6 +198,72 @@ public partial class Smoke : Node
|
|||
}
|
||||
}
|
||||
|
||||
// Regression check (Finding 4): 4-tile boundary crater at (0, 0) bakes all 4 tiles on Sync#1 (<= 0.20m error on all 4 quadrants)
|
||||
// and passive Track throttling preserves DirtyTileMask until all tiles are baked without skipping via _rebakeCursor.
|
||||
{
|
||||
// Flush any lingering track rebakes first so baseline is clean
|
||||
for (int flush = 0; flush < 32 && _main.Session.State.Terrain.DirtyTileMask != 0UL; flush++)
|
||||
{
|
||||
_main.Terrain.Sync(_main.Session.State.Terrain);
|
||||
}
|
||||
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
||||
|
||||
(float Qx, float Qz)[] quadrants = { (-1f, -1f), (1f, -1f), (-1f, 1f), (1f, 1f) };
|
||||
float[] qGpuBefore = new float[4];
|
||||
if (!isHeadless)
|
||||
{
|
||||
for (int q = 0; q < 4; q++)
|
||||
{
|
||||
Check(_main.Terrain.TrySampleBakedHeight(quadrants[q].Qx, quadrants[q].Qz, out qGpuBefore[q]),
|
||||
$"Expected GPU readback before 4-tile boundary crater at quadrant {q}");
|
||||
}
|
||||
}
|
||||
|
||||
int rebakes4Before = _main.Terrain.DirtyRebakes;
|
||||
_main.Session.State.Terrain.StampCrater(0f, 0f, radius: 6f, depth: 1.4f);
|
||||
_main.Terrain.Sync(_main.Session.State.Terrain); // Sync#1
|
||||
Check(_main.Terrain.DirtyRebakes == rebakes4Before + 4,
|
||||
$"Expected 4-tile boundary crater at (0,0) to bake all 4 tiles on Sync#1, got {_main.Terrain.DirtyRebakes - rebakes4Before}");
|
||||
Check(_main.Session.State.Terrain.StructuralDirtyTileMask == 0UL,
|
||||
"Expected StructuralDirtyTileMask == 0 after Sync#1 on 4-tile boundary crater");
|
||||
|
||||
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
||||
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
||||
|
||||
if (!isHeadless)
|
||||
{
|
||||
for (int q = 0; q < 4; q++)
|
||||
{
|
||||
float qCpu = _main.Session.State.Terrain.SampleHeight(quadrants[q].Qx, quadrants[q].Qz);
|
||||
bool ok = _main.Terrain.TrySampleBakedHeight(quadrants[q].Qx, quadrants[q].Qz, out float qGpu);
|
||||
Check(ok, $"Expected GPU readback on quadrant {q} after 4-tile boundary crater");
|
||||
if (ok)
|
||||
{
|
||||
float qErr = MathF.Abs(qGpu - qCpu);
|
||||
GD.Print($"SMOKE INFO: 4-tile crater Q{q} ({quadrants[q].Qx},{quadrants[q].Qz}) cpu={qCpu:F4}m gpu={qGpu:F4}m err={qErr:F4}m");
|
||||
Check(qErr <= 0.20f, $"4-tile crater quadrant {q} GPU error {qErr:F4}m > 0.20m");
|
||||
Check(qGpu < qGpuBefore[q] - 0.35f, $"4-tile crater quadrant {q} did not depress on Sync#1 (before={qGpuBefore[q]:F4}, after={qGpu:F4})");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Stamp 3 passive tracks in adjacent tiles so _rebakeCursor must advance across Sync#1 and Sync#2 without skipping
|
||||
int rebakesTrackBefore = _main.Terrain.DirtyRebakes;
|
||||
_main.Session.State.Terrain.StampTrack(-480f, -480f, 0f, 2f, 3f);
|
||||
_main.Session.State.Terrain.StampTrack(-288f, -480f, 0f, 2f, 3f);
|
||||
_main.Session.State.Terrain.StampTrack(-96f, -480f, 0f, 2f, 3f);
|
||||
_main.Terrain.Sync(_main.Session.State.Terrain);
|
||||
Check(_main.Terrain.DirtyRebakes == rebakesTrackBefore + 2,
|
||||
$"Expected Sync#1 to throttle 3 passive tracks to 2 rebakes, got {_main.Terrain.DirtyRebakes - rebakesTrackBefore}");
|
||||
Check(_main.Session.State.Terrain.DirtyTileMask != 0UL,
|
||||
"Expected DirtyTileMask to stay non-zero while 1 passive track tile remains dirty");
|
||||
_main.Terrain.Sync(_main.Session.State.Terrain);
|
||||
Check(_main.Terrain.DirtyRebakes == rebakesTrackBefore + 3,
|
||||
$"Expected Sync#2 to bake remaining 3rd passive track tile without _rebakeCursor skip, got {_main.Terrain.DirtyRebakes - rebakesTrackBefore}");
|
||||
Check(_main.Session.State.Terrain.DirtyTileMask == 0UL,
|
||||
"Expected DirtyTileMask == 0 after all passive track tiles baked");
|
||||
}
|
||||
|
||||
_main.SetPhysicsProcess(true);
|
||||
|
||||
await VerifyHudAndShadersAsync(isHeadless);
|
||||
|
|
@ -409,6 +475,46 @@ public partial class Smoke : Node
|
|||
Check(raptorHoleScanned > 1000, $"Expected > 1000 inactive hole pixels scanned on Raptor, got {raptorHoleScanned}");
|
||||
Check(raptorHoleLit == 0, $"Expected 0 lit/opaque pixels in inactive Raptor cell holes, got {raptorHoleLit}");
|
||||
|
||||
// Finding 5 GPU check: LabelsOverlay redraws on temp-only change & compatibility highlights update when Cargo[0] swaps at unchanged index 0
|
||||
{
|
||||
raptorGrid.Cargo.Clear();
|
||||
Check(raptorGrid.TryAddCargo(Catalog.Autocannon), "Expected Autocannon in Raptor Cargo[0]");
|
||||
vpGrid.SetGrid(raptorGrid, selectedCargoIndex: 0);
|
||||
vpGrid.SetThermalInstant(false);
|
||||
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
||||
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
||||
|
||||
int drawCountBeforeTemp = vpGrid.LabelsDrawCount;
|
||||
string? tagBeforeTemp = vpGrid.GetLastDrawnLabel("hp.engine.chest");
|
||||
var cargoImgWeapon = gridVp.GetTexture().GetImage();
|
||||
|
||||
// Temp-only change (no armor hit, no mount change)
|
||||
raptorGrid.InjectHardpointHeat("hp.engine.chest", 4200f);
|
||||
raptorGrid.StepHeat(0.1f);
|
||||
vpGrid.SetGrid(raptorGrid, selectedCargoIndex: 0);
|
||||
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
||||
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
||||
|
||||
int drawCountAfterTemp = vpGrid.LabelsDrawCount;
|
||||
string? tagAfterTemp = vpGrid.GetLastDrawnLabel("hp.engine.chest");
|
||||
Check(drawCountAfterTemp > drawCountBeforeTemp,
|
||||
$"Expected LabelsOverlay to redraw on temp-only change ({drawCountBeforeTemp} -> {drawCountAfterTemp})");
|
||||
Check(!string.Equals(tagBeforeTemp, tagAfterTemp, StringComparison.Ordinal),
|
||||
$"Expected engine temp label text to update on temp-only change ('{tagBeforeTemp}' -> '{tagAfterTemp}')");
|
||||
|
||||
// Cargo[0] replacement at unchanged selectedCargoIndex == 0 (Weapon -> Radiator)
|
||||
raptorGrid.Cargo[0] = Catalog.CopperRad;
|
||||
vpGrid.SetGrid(raptorGrid, selectedCargoIndex: 0);
|
||||
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
||||
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
||||
|
||||
var cargoImgRad = gridVp.GetTexture().GetImage();
|
||||
int cargoDiff = CountDifferentPixels(cargoImgWeapon, cargoImgRad, 0.05f);
|
||||
GD.Print($"SMOKE INFO: InventoryGrid Cargo[0] swap diff pixels={cargoDiff}, label '{tagBeforeTemp}'->'{tagAfterTemp}'");
|
||||
Check(cargoDiff > 50,
|
||||
$"Expected Cargo[0] replacement at unchanged index 0 to update compatibility highlight pixels (>50), got {cargoDiff}");
|
||||
}
|
||||
|
||||
gridVp.QueueFree();
|
||||
|
||||
// GPU verification for panel_chrome.gdshader
|
||||
|
|
@ -789,6 +895,27 @@ public partial class Smoke : Node
|
|||
}
|
||||
GD.Print($"SMOKE INFO: ChassisDrop max ground err={maxGroundErr:F4}m across {added.Count} chassis");
|
||||
|
||||
// Also verify far LOD (BakedLodFarMesh) ChassisDrop grounding stays <= 0.05m across all 15 chassis
|
||||
float maxFarGroundErr = 0f;
|
||||
for (int i = 0; i < added.Count; i++)
|
||||
{
|
||||
var d = added[i];
|
||||
Node3D? dropNode = _main.Arena.GetNodeOrNull<Node3D>($"GroundDrops/Drop_{d.Id}");
|
||||
Node3D? actorNode = dropNode?.GetNodeOrNull<Node3D>($"Actor_{d.Chassis!.Id}");
|
||||
MeshInstance3D? dropMesh = actorNode?.GetNodeOrNull<MeshInstance3D>($"Model_{d.Chassis!.Id}");
|
||||
if (dropNode is not null && actorNode is not null && dropMesh is not null)
|
||||
{
|
||||
dropMesh.Mesh = cache.GetOrLoadVehicle(d.Chassis!.Id).BakedLodFarMesh;
|
||||
float minFarWorldY = ComputeSubtreeMinWorldY(actorNode, dropNode.Position.Y);
|
||||
float terrainY = _main.Session.State.Terrain.SampleHeight(d.X, d.Z);
|
||||
float err = MathF.Abs(minFarWorldY - terrainY);
|
||||
if (err > maxFarGroundErr) maxFarGroundErr = err;
|
||||
Check(err <= 0.05f,
|
||||
$"Far LOD ChassisDrop '{d.Chassis!.Id}' buried/floating: minFarWorldY={minFarWorldY:F4}m terrainY={terrainY:F4}m err={err:F4}m");
|
||||
}
|
||||
}
|
||||
GD.Print($"SMOKE INFO: Far LOD ChassisDrop max ground err={maxFarGroundErr:F4}m across {added.Count} chassis");
|
||||
|
||||
for (int i = 0; i < added.Count; i++)
|
||||
{
|
||||
added[i].PickedUp = true;
|
||||
|
|
@ -929,6 +1056,49 @@ public partial class Smoke : Node
|
|||
Check(sawPatron, "Expected at least one alive Patron spectator in arena");
|
||||
}
|
||||
|
||||
// 9. Finding 3: Stripped distant rig (180m) detaches debris immediately without popping armor back on at far LOD
|
||||
{
|
||||
var debris = new DebrisSystem { Name = "SmokeDistantStripTest" };
|
||||
AddChild(debris);
|
||||
var specGrid = Catalog.CreateWithDefaultLoadout(Catalog.Anvil);
|
||||
var specVis = VehicleVisualInstance.Create(cache, "anvil", VehicleVisualRole.SpectatorPatron);
|
||||
specVis.Root.Position = new Vector3(0f, 0f, 180f);
|
||||
AddChild(specVis.Root);
|
||||
specVis.SyncMountedGear(specGrid);
|
||||
specVis.SetLodState(useStaticLod: true, castShadows: false);
|
||||
Check(specVis.IsStaticLod && !specVis.ModelRoot.Visible,
|
||||
"Expected intact distant rig at 180m to start in static far LOD");
|
||||
|
||||
int stripCx = -1, stripCy = -1;
|
||||
for (int cy = 0; cy < specGrid.Spec.Height && stripCx < 0; cy++)
|
||||
{
|
||||
for (int cx = 0; cx < specGrid.Spec.Width; cx++)
|
||||
{
|
||||
if (specVis.CountDetachablePartsForCell(cx, cy) > 0)
|
||||
{
|
||||
stripCx = cx;
|
||||
stripCy = cy;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Check(stripCx >= 0, "Expected Anvil distant rig to have detachable cell parts");
|
||||
if (stripCx >= 0)
|
||||
{
|
||||
specGrid.Armor[stripCx, stripCy] = 0f;
|
||||
}
|
||||
|
||||
specVis.SyncDamageAndHeat(specGrid, debris, Vector3.Zero);
|
||||
specVis.SetLodState(useStaticLod: true, castShadows: false);
|
||||
Check(debris.ActiveCount >= 1,
|
||||
$"Expected distant stripped rig at 180m to detach debris immediately, got {debris.ActiveCount}");
|
||||
Check(specVis.HasAnyStrippedCell && !specVis.IsStaticLod && specVis.ModelRoot.Visible,
|
||||
"Expected distant stripped rig to keep ModelRoot visible without popping armor back on at far LOD");
|
||||
|
||||
specVis.Root.QueueFree();
|
||||
debris.QueueFree();
|
||||
}
|
||||
|
||||
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue