perf(bake): stream catalog and bound validation residency
This commit is contained in:
parent
b7b9aaa9dd
commit
90bf6bbf45
7 changed files with 217 additions and 84 deletions
|
|
@ -122,7 +122,7 @@ public sealed class BakeOutputTransactionTests : IDisposable
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void ArtifactValidator_RejectsWrongDatIterationAndCorruptBlob()
|
||||
public void ArtifactValidator_RejectsWrongDatIterationAndCorruptTocRange()
|
||||
{
|
||||
string pak = Path.Combine(_directory, "content.pak");
|
||||
var expected = Header();
|
||||
|
|
@ -139,16 +139,15 @@ public sealed class BakeOutputTransactionTests : IDisposable
|
|||
Assert.Throws<InvalidDataException>(
|
||||
() => BakeArtifactValidator.Validate(pak, wrongIteration, expectedTocCount: 1));
|
||||
|
||||
long offset;
|
||||
using (var reader = new PakReader(pak))
|
||||
offset = reader.GetBlobOffsetForTest(
|
||||
PakKey.Compose(PakAssetType.GfxObjMesh, 1));
|
||||
using (var stream = new FileStream(pak, FileMode.Open, FileAccess.ReadWrite))
|
||||
{
|
||||
stream.Position = offset;
|
||||
int value = stream.ReadByte();
|
||||
stream.Position = offset;
|
||||
stream.WriteByte((byte)(value ^ 0xFF));
|
||||
var header = PakHeader.ReadFrom(stream);
|
||||
stream.Position = checked((long)header.TocOffset + 16);
|
||||
Span<byte> invalidLength = stackalloc byte[4];
|
||||
System.Buffers.Binary.BinaryPrimitives.WriteUInt32LittleEndian(
|
||||
invalidLength,
|
||||
uint.MaxValue);
|
||||
stream.Write(invalidLength);
|
||||
}
|
||||
|
||||
Assert.Throws<InvalidDataException>(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue