Test fix: hoist warmHit and Assert.True outside GC loop in VectorPathsAndAtlasBudgetResetWork
This commit is contained in:
parent
3b06b5c8ca
commit
e8ced37385
1 changed files with 8 additions and 1 deletions
|
|
@ -173,13 +173,20 @@ public sealed class HbGpuNativeTests
|
||||||
Assert.True(staticArc.AtlasOffset < HbGpuAtlasAllocator.DynamicBase);
|
Assert.True(staticArc.AtlasOffset < HbGpuAtlasAllocator.DynamicBase);
|
||||||
atlas.ClearPending();
|
atlas.ClearPending();
|
||||||
|
|
||||||
|
// Warm up cache-hit path once before measuring GC allocations
|
||||||
|
CachedBlob warmHit = HbGpuVectorShapes.GetStaticArcStroke(blobs, staticArcKey, -2.356f, 0.785f, 500f, 30f);
|
||||||
|
Assert.Equal(staticArc.AtlasOffset, warmHit.AtlasOffset);
|
||||||
|
|
||||||
|
uint expectedOffset = staticArc.AtlasOffset;
|
||||||
|
bool allMatched = true;
|
||||||
long arcGcBefore = GC.GetAllocatedBytesForCurrentThread();
|
long arcGcBefore = GC.GetAllocatedBytesForCurrentThread();
|
||||||
for (int i = 0; i < 64; i++)
|
for (int i = 0; i < 64; i++)
|
||||||
{
|
{
|
||||||
CachedBlob hit = HbGpuVectorShapes.GetStaticArcStroke(blobs, staticArcKey, -2.356f, 0.785f, 500f, 30f);
|
CachedBlob hit = HbGpuVectorShapes.GetStaticArcStroke(blobs, staticArcKey, -2.356f, 0.785f, 500f, 30f);
|
||||||
Assert.Equal(staticArc.AtlasOffset, hit.AtlasOffset);
|
if (hit.AtlasOffset != expectedOffset) allMatched = false;
|
||||||
}
|
}
|
||||||
long arcGcAfter = GC.GetAllocatedBytesForCurrentThread();
|
long arcGcAfter = GC.GetAllocatedBytesForCurrentThread();
|
||||||
|
Assert.True(allMatched);
|
||||||
Assert.Equal(0, arcGcAfter - arcGcBefore);
|
Assert.Equal(0, arcGcAfter - arcGcBefore);
|
||||||
Assert.Equal(0, atlas.PendingChunkCount);
|
Assert.Equal(0, atlas.PendingChunkCount);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue