Report flame import translation loss

This commit is contained in:
Meta Vens 2026-05-21 00:03:16 +01:00
commit c0e68a0b9e
6 changed files with 326 additions and 18 deletions

View file

@ -186,6 +186,21 @@ translation report, lower supported variation nodes into compact GPU op rows,
and carry persistent per-sample iteration state so zoom/movement can reuse
sample history instead of starting every splat from zero.
That import report now exists. GPU and histogram flame receipts emit a sibling
`fractal-flame-import-report-*.json` next to the numeric receipt. For the
JWildfire selftest flame, the first report says:
- accepted fields: `14`
- approximated fields: `3`
- ignored fields: `45`
- rejected fields: `12`
- rejected geometry/sampling losses: non-identity `post` on the julian xform
and `wfield_*` weighting-field attributes on the disc xform
This report is the next expansion gate. A flame may parse successfully and
still be a bad import; unsupported fields must stay visible until the DSL,
compiler, or renderer can actually own them.
## GPU Flame Receipt
The flame fixture can now drive the D3D12 reservoir receipt directly:

View file

@ -7,6 +7,11 @@ namespace Aquarium.Engine.Fractal.Grammar;
public static class FractalFlameFileParser
{
public static FractalFlameDefinition ParseFirst(string source, int seed = 0)
{
return ParseFirstWithReport(source, seed).Definition;
}
public static FractalFlameParseResult ParseFirstWithReport(string source, int seed = 0)
{
ArgumentNullException.ThrowIfNull(source);
@ -16,37 +21,74 @@ public static class FractalFlameFileParser
var name = ((string?)flame.Attribute("name")) ?? "flame";
var isJWildfireDialect = string.Equals(document.Root?.Name.LocalName, "Flames", StringComparison.Ordinal)
|| flame.Elements("xform").Any(xform => xform.Element("variationGroup") is not null);
var transforms = flame.Elements("xform").Select((xform, index) => ParseXform(xform, index, isJWildfireDialect)).ToArray();
return new FractalFlameDefinition(name, Vector2.Zero, seed, transforms);
var parsed = flame.Elements("xform").Select((xform, index) => ParseXform(xform, index, isJWildfireDialect)).ToArray();
var definition = new FractalFlameDefinition(name, Vector2.Zero, seed, parsed.Select(row => row.Transform).ToArray());
var report = new FractalFlameImportReport(
name,
isJWildfireDialect ? "JWildfire" : "Apophysis/FLAM3 subset",
parsed.Length,
BuildFlameFieldReports(flame),
parsed.Select(row => row.Report).ToArray());
return new FractalFlameParseResult(definition, report);
}
private static FractalFlameTransform2D ParseXform(XElement element, int index, bool isJWildfireDialect)
private static ParsedXform ParseXform(XElement element, int index, bool isJWildfireDialect)
{
var coefs = ParseFloatList((string?)element.Attribute("coefs"), expectedCount: 6, "xform coefs");
var variationGroup = element.Element("variationGroup");
var variationSource = variationGroup ?? element;
var accepted = new List<string> { "coefs", "weight", "color" };
var approximated = new List<string>();
var ignored = new List<string>();
var rejected = new List<string>();
if (element.Attribute("name") is not null)
{
accepted.Add("name");
}
if (isJWildfireDialect)
{
accepted.Add("coefs: JWildfire xy layout");
}
if (variationGroup is not null)
{
accepted.Add("variationGroup");
}
var matrix = isJWildfireDialect
? new Vector4(coefs[0], coefs[2], coefs[1], coefs[3])
: new Vector4(coefs[0], coefs[1], coefs[3], coefs[4]);
var translation = isJWildfireDialect
? new Vector2(coefs[4], coefs[5])
: new Vector2(coefs[2], coefs[5]);
var variations = new FractalFlameVariationWeights(
ParseOptionalFloat(variationSource, "linear", 0.0f) + ParseOptionalFloat(variationSource, "normal", 0.0f),
ParseOptionalFloat(variationSource, "spherical", 0.0f),
ParseOptionalFloat(variationSource, "bubble", 0.0f),
ParseOptionalFloat(variationSource, "disc", 0.0f) + ParseOptionalFloat(variationSource, "jwf_disc", 0.0f),
ParseOptionalFloat(variationSource, "julian", 0.0f) + ParseOptionalFloat(variationSource, "jwf_julian", 0.0f),
ParseOptionalFloat(variationSource, "julian_power", ParseOptionalFloat(variationSource, "jwf_julian_power", 2.0f)),
ParseOptionalFloat(variationSource, "julian_dist", ParseOptionalFloat(variationSource, "jwf_julian_dist", 1.0f)),
ParseOptionalFloat(variationSource, "gaussian_blur", 0.0f) + ParseOptionalFloat(variationSource, "jwf_gaussian_blur", 0.0f));
ClassifyVariationFields(variationSource, accepted, approximated, ignored, rejected);
ClassifyXformFields(element, variationGroup, accepted, ignored, rejected);
var transformName = ((string?)element.Attribute("name")) ?? $"xform/{index:0000}";
return new FractalFlameTransform2D(
((string?)element.Attribute("name")) ?? $"xform/{index:0000}",
var transform = new FractalFlameTransform2D(
transformName,
matrix,
translation,
ParseOptionalFloat(element, "weight", 1.0f),
ParseOptionalFloat(element, "color", 0.0f),
new FractalFlameVariationWeights(
ParseOptionalFloat(variationSource, "linear", 0.0f) + ParseOptionalFloat(variationSource, "normal", 0.0f),
ParseOptionalFloat(variationSource, "spherical", 0.0f),
ParseOptionalFloat(variationSource, "bubble", 0.0f),
ParseOptionalFloat(variationSource, "disc", 0.0f) + ParseOptionalFloat(variationSource, "jwf_disc", 0.0f),
ParseOptionalFloat(variationSource, "julian", 0.0f) + ParseOptionalFloat(variationSource, "jwf_julian", 0.0f),
ParseOptionalFloat(variationSource, "julian_power", ParseOptionalFloat(variationSource, "jwf_julian_power", 2.0f)),
ParseOptionalFloat(variationSource, "julian_dist", ParseOptionalFloat(variationSource, "jwf_julian_dist", 1.0f)),
ParseOptionalFloat(variationSource, "gaussian_blur", 0.0f) + ParseOptionalFloat(variationSource, "jwf_gaussian_blur", 0.0f)));
variations);
return new ParsedXform(transform, new FractalFlameTransformImportReport(
index,
transformName,
accepted.Distinct().OrderBy(value => value, StringComparer.Ordinal).ToArray(),
approximated.Distinct().OrderBy(value => value, StringComparer.Ordinal).ToArray(),
ignored.Distinct().OrderBy(value => value, StringComparer.Ordinal).ToArray(),
rejected.Distinct().OrderBy(value => value, StringComparer.Ordinal).ToArray()));
}
private static float ParseOptionalFloat(XElement element, string name, float fallback)
@ -73,4 +115,196 @@ public static class FractalFlameFileParser
return values;
}
private static IReadOnlyList<string> BuildFlameFieldReports(XElement flame)
{
var structural = new HashSet<string>(StringComparer.Ordinal)
{
"name",
"size",
"center",
"scale",
"rotate",
};
return flame.Attributes()
.Select(attribute => attribute.Name.LocalName)
.Where(name => !structural.Contains(name))
.OrderBy(name => name, StringComparer.Ordinal)
.ToArray();
}
private static void ClassifyVariationFields(
XElement variationSource,
List<string> accepted,
List<string> approximated,
List<string> ignored,
List<string> rejected)
{
var supported = new HashSet<string>(StringComparer.Ordinal)
{
"linear",
"spherical",
"bubble",
"disc",
"jwf_disc",
"julian",
"jwf_julian",
"julian_power",
"jwf_julian_power",
"julian_dist",
"jwf_julian_dist",
};
foreach (var attribute in variationSource.Attributes())
{
var name = attribute.Name.LocalName;
if (supported.Contains(name))
{
accepted.Add($"variation:{name}");
continue;
}
if (name is "normal")
{
approximated.Add("variation:normal -> linear");
continue;
}
if (name is "gaussian_blur" or "jwf_gaussian_blur")
{
approximated.Add($"variation:{name} -> stochastic gaussian_blur");
continue;
}
if (TryParseFloat(attribute.Value, out var value) && value == 0.0f)
{
ignored.Add($"variation:{name}=0");
continue;
}
rejected.Add($"variation:{name}");
}
}
private static void ClassifyXformFields(
XElement element,
XElement? variationGroup,
List<string> accepted,
List<string> ignored,
List<string> rejected)
{
var handled = new HashSet<string>(StringComparer.Ordinal)
{
"name",
"coefs",
"weight",
"color",
};
foreach (var attribute in element.Attributes())
{
var name = attribute.Name.LocalName;
if (handled.Contains(name))
{
continue;
}
if (name is "post")
{
if (IsIdentityPost(attribute.Value))
{
ignored.Add("post=identity");
}
else
{
rejected.Add("post");
}
continue;
}
if (name is "chaos")
{
if (IsNeutralFloatList(attribute.Value, 1.0f))
{
ignored.Add("chaos=all-ones");
}
else
{
rejected.Add("chaos");
}
continue;
}
if (name.StartsWith("wfield_", StringComparison.Ordinal))
{
rejected.Add(name);
continue;
}
ignored.Add(name);
}
if (variationGroup is not null)
{
foreach (var child in element.Elements())
{
if (child != variationGroup)
{
ignored.Add(child.Name.LocalName);
}
}
}
}
private static bool IsIdentityPost(string value)
{
var values = ParseFloatList(value, 6, "post");
return values[0] == 1.0f
&& values[1] == 0.0f
&& values[2] == 0.0f
&& values[3] == 1.0f
&& values[4] == 0.0f
&& values[5] == 0.0f;
}
private static bool IsNeutralFloatList(string value, float neutral)
{
var values = value.Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
return values.Length > 0 && values.All(item => TryParseFloat(item, out var parsed) && parsed == neutral);
}
private static bool TryParseFloat(string source, out float value)
{
return float.TryParse(source, NumberStyles.Float, CultureInfo.InvariantCulture, out value);
}
private readonly record struct ParsedXform(FractalFlameTransform2D Transform, FractalFlameTransformImportReport Report);
}
public sealed record FractalFlameParseResult(
FractalFlameDefinition Definition,
FractalFlameImportReport Report);
public sealed record FractalFlameImportReport(
string FlameName,
string Dialect,
int TransformCount,
IReadOnlyList<string> IgnoredFlameAttributes,
IReadOnlyList<FractalFlameTransformImportReport> Transforms)
{
public int AcceptedFieldCount => Transforms.Sum(transform => transform.AcceptedFields.Count);
public int ApproximatedFieldCount => Transforms.Sum(transform => transform.ApproximatedFields.Count);
public int IgnoredFieldCount => IgnoredFlameAttributes.Count + Transforms.Sum(transform => transform.IgnoredFields.Count);
public int RejectedFieldCount => Transforms.Sum(transform => transform.RejectedFields.Count);
}
public sealed record FractalFlameTransformImportReport(
int Index,
string Name,
IReadOnlyList<string> AcceptedFields,
IReadOnlyList<string> ApproximatedFields,
IReadOnlyList<string> IgnoredFields,
IReadOnlyList<string> RejectedFields);

View file

@ -155,6 +155,7 @@ renderer_state:
- High-reference flame contact sheets should use at least 20M CPU oracle samples for visual judgment. The current artifact is artifacts/fractal-contact-sheet-hq/flame-parity-contact-sheet-hq.png, comparing 20M CPU oracle histograms against 250k Aquarium GPU readback samples for global frame 1/10 and zoom frame 1/10. The 1M-sample oracle was too noisy and should be treated as a scalar smoke check only.
- External flame visual references are now reproducible from ignored local artifacts. scripts/install-flame-reference-tools.ps1 hydrates JWildfire 9.00 plus Temurin JRE 17 under artifacts/reference-tools; scripts/fractal-flame-jwildfire-reference.ps1 prefers JWildfire's bundled FARenderJWF GPU renderer for explicit PNG output. Local GTX 1070 smoke rendered FARender's selftest.flame at 1024x1024 quality 2000 in 7.69 sec to artifacts/fractal-flame-jwildfire-reference/selftest-farender-20260520-233638.png. JWildfire/FARender is a visual reference artifact lane, not Aquarium runtime code.
- JWildfire selftest flame is the current honest faceplant target. After adding a first dialect slice for JWildfire coefficient layout, variationGroup, disc, julian, and gaussian_blur, the depth-64 GTX 1070 receipt against artifacts/reference-tools/j-wildfire-9.00/lib/FARenderJWF/selftest.flame reaches only 5.01% visual score / 3.04% occupancy overlap at 66.446 ms/frame. This proves the renderer needs a richer flame AST/translation report and persistent GPU iteration-state reservoirs; brute replaying deep flame iteration from zero per splat is not the final hot path.
- FractalFlameFileParser now has ParseFirstWithReport for import accountability. Receipt runs emit fractal-flame-import-report-*.json beside flame histogram/GPU receipts. The JWildfire selftest report currently records 14 accepted fields, 3 approximations, 45 ignored render/presentation fields, and 12 rejected geometry/sampling fields: non-identity post plus wfield_* weighting-field attributes. Successful XML parsing is not successful translation.
- D3D12 capacity logging now reports active fractal reservoir resident MiB, splat count, visible debug splat count, updates/pass, and candidates/update so the GPU cache has a receipt in normal runtime logs, not just in the standalone benchmark.
- The consolidated fractal brush architecture plan defines the intended pipeline: client intent -> domain roots -> semantic IFS brush grammar -> ownership tree -> node summaries -> contribution cache/residency scheduler -> backend packets -> renderer passes -> debug/evidence, with explicit module boundaries and mockable unit-test seams.
- The Perfect Machine architecture lives in docs/perfect-machine-architecture.md. It is the current waterfall design authority for fast 2D SDF splats, 3D SDF splats, 2D-projected-to-3D surface splats, IFS `.aquageo` structural probes, Mimir-style camera/audio evidence candidates, ReSTIR/GRIS reservoir reuse, heuristic occupancy graph updates, resource-tier residency, and TAA guide-buffer integration.
@ -193,6 +194,7 @@ next_actions:
- Follow docs/perfect-machine-architecture.md before expanding SDF splat backends, sensor-fusion candidate adapters, reservoir guide buffers, occupancy graph state, or stochastic learned priority.
- Use research/rendering/fractal-brush-implementation-roadmap.md as the actionable execution checklist for fractal brush work.
- Next flame reference slice: build a JWildfire import/lowering report that separates supported, approximated, ignored, and rejected variation fields before expanding the GPU op set. Do not hide dialect loss behind successful XML parsing.
- Next flame renderer slice: lower non-identity post transforms and decide whether weighting fields become explicit DSL operator nodes or rejected importer-only diagnostics. Do not fold them into anonymous variation weights.
- Follow docs/zyphos-eusocial-sync.md and E:\Projects\Eusocial Interbeing\Eusocial Interbeing\World\Zyphos Simulation Brief.md before turning Zyphos visual choices into setting claims.
- Follow docs/tsr-inspired-taa-spec.md when changing current temporal diagnostics.
- Use docs/temporal-sdf-gaussian-field.md before wiring LocalCastBridge visual sensor fusion into Aquarium or scaling the temporal Gaussian renderer beyond the current bounded instanced pass.

View file

@ -113,6 +113,7 @@
"Do not use the quick 1M-sample flame oracle image for visual judgment; it is too noisy. The high-reference contact sheet uses 20,000,000 CPU oracle samples and 250,000 Aquarium GPU readback splats per panel at artifacts/fractal-contact-sheet-hq/flame-parity-contact-sheet-hq.png. It makes the zoom failure legible: the CPU oracle smooths out while Aquarium remains under-sampled after zoom because the current reservoir is not view-adaptive.",
"Aquarium's CPU flame histogram is a math oracle, not visual ground truth. The visual reference ladder is: Chaotica as gold market-quality reference when available/imported, JWildfire/FARender as scriptable visual reference, FLAM3/Apophysis as portable baseline compatibility, Aquarium CPU as deterministic unit-test/debug oracle only. On 2026-05-20 Chaotica and flam3-render were not on PATH, but scripts/install-flame-reference-tools.ps1 hydrated JWildfire 9.00 plus Temurin JRE 17 under ignored artifacts, and scripts/fractal-flame-jwildfire-reference.ps1 rendered JWildfire's bundled FARenderJWF selftest flame at 1024x1024 quality 2000 in 7.69 sec on the GTX 1070. JWildfire/FARender is an external visual reference artifact lane, not Aquarium runtime code. Do not claim best-in-market flame parity until imported Chaotica renders or fully matched JWildfire flame dialect metrics are wired into residual scoring.",
"JWildfire selftest is now the flame renderer faceplant target. A first dialect slice supports JWildfire coefficient layout, variationGroup, disc, julian, and gaussian_blur; the depth-64 GTX 1070 receipt still scores only 5.01% visual parity / 3.04% occupancy overlap at 66.446 ms/frame. This is a DSL/translation/hot-path failure, not just a sample-count problem: Aquarium needs a richer flame AST with explicit accepted/approximated/ignored/rejected field reports, GPU variation op rows, and persistent per-sample iteration-state reservoirs instead of replaying deep chaos-game ancestry from zero for every splat.",
"Flame imports must report translation loss. FractalFlameFileParser.ParseFirstWithReport returns accepted, approximated, ignored, and rejected fields per transform, and receipt runs write fractal-flame-import-report-*.json. The JWildfire selftest report currently shows 14 accepted fields, 3 approximations, 45 ignored render/presentation fields, and 12 rejected geometry/sampling fields: non-identity post plus wfield_* weighting-field attributes. Treat successful XML parsing as insufficient until rejected geometry fields are either implemented as DSL/operator nodes or explicitly accepted as out-of-scope diagnostics.",
"Zyphos' primary planetary terrain test path is now the fractal reservoir surface. The direct SDF planet and Umbros proxy shaders are removed from the render plan; only the parent star remains as a direct SDF body/light. If the planet looks wrong, fix the reservoir lowering/shading path instead of letting the old SDF terrain hide it.",
"The GPU splat receipt harness lives at tools/Aquarium.Fractal.Receipt and scripts/fractal-splat-receipt.ps1. The live receipt allocates one 80-byte packed SDF splat UAV plus three distinct 64-byte reservoir UAVs for SDF envelopes, PBR material envelopes, and radiosity; those reservoirs are sampled in independent compute passes under a stochastic update budget. On the local NVIDIA GTX 1070 it kept 2,000,000 splats and 2,000,000 reservoirs per layer resident. The fallback hash-fractal receipt updated 50,000 entries per layer with 2 candidates/update at 4.471 ms/frame, 223.7 FPS equivalent. The authored precomposed selected-cut receipt used depth 48, 4 compact transforms, and 15,000 updates per layer at 4.908 ms/frame, 203.7 FPS equivalent, with full reservoir coverage in 133.3 frames. D3D12FractalSplatRender consumes the raw splat, SDF, PBR, and radiosity buffers through separate graphics SRVs for the visible debug subset. This proves compute-side GPU residency, budgeted temporal convergence, authored-program splat population decoupled from domain ancestry depth, and first layered GPU consumption; final terrain/material/radiosity shading is still future work.",
"FractalProjectedSdfSplatCompiler is the Phase G 2D-projected-to-3D lowering seam: it converts resident SignedDistance2D page payload samples into compact 3D SDF splats through an explicit page-local Vector2 -> Vector3 mapping, surface normal, support radius, and splat budget. Zyphos caches a bounded first set with a flat local mapping until cube-sphere/torus mappers are added.",

View file

@ -113,10 +113,13 @@ public sealed class ApophysisReferenceParityTests
var root = FindRepoRoot();
var flamePath = Path.Combine(root, "tests", "Aquarium.Engine.Fractal.Tests", "Fixtures", "JWildfire", "julian-disc-minimal.flame");
var flame = FractalFlameFileParser.ParseFirst(File.ReadAllText(flamePath), seed: 91);
var result = FractalFlameFileParser.ParseFirstWithReport(File.ReadAllText(flamePath), seed: 91);
var flame = result.Definition;
Assert.Equal("julian-disc-minimal", flame.Name);
Assert.Equal(2, flame.Transforms.Count);
Assert.Equal("JWildfire", result.Report.Dialect);
Assert.Equal(2, result.Report.TransformCount);
Assert.Equal(new Vector4(1.0f, 0.0f, 0.0f, 1.0f), flame.Transforms[0].Matrix);
Assert.Equal(new Vector2(-0.1f, 0.2f), flame.Transforms[0].Translation);
Assert.Equal(1.0f, flame.Transforms[0].Variations.Linear);
@ -126,6 +129,9 @@ public sealed class ApophysisReferenceParityTests
Assert.Equal(0.02f, flame.Transforms[0].Variations.GaussianBlur);
Assert.Equal(new Vector4(0.25f, 0.75f, -0.75f, 0.25f), flame.Transforms[1].Matrix);
Assert.Equal(0.8f, flame.Transforms[1].Variations.Disc);
Assert.Contains("variation:normal -> linear", result.Report.Transforms[0].ApproximatedFields);
Assert.Contains("variation:jwf_gaussian_blur -> stochastic gaussian_blur", result.Report.Transforms[0].ApproximatedFields);
Assert.Contains("post", result.Report.Transforms[0].RejectedFields);
}
[Fact]
@ -144,6 +150,25 @@ public sealed class ApophysisReferenceParityTests
Assert.Equal(0.8f, rows[1].TileAddress.X);
}
[Fact]
public void JWildfireImportReportNamesUnsupportedLosses()
{
var root = FindRepoRoot();
var flamePath = Path.Combine(root, "artifacts", "reference-tools", "j-wildfire-9.00", "lib", "FARenderJWF", "selftest.flame");
if (!File.Exists(flamePath))
{
return;
}
var result = FractalFlameFileParser.ParseFirstWithReport(File.ReadAllText(flamePath), seed: 91);
Assert.True(result.Report.AcceptedFieldCount > 0);
Assert.True(result.Report.ApproximatedFieldCount > 0);
Assert.True(result.Report.RejectedFieldCount > 0);
Assert.Contains(result.Report.Transforms, transform => transform.RejectedFields.Contains("post"));
Assert.Contains(result.Report.Transforms, transform => transform.RejectedFields.Any(field => field.StartsWith("wfield_", StringComparison.Ordinal)));
}
[Fact]
public void PpmReferenceReceiptReadsExternalRendererOutputShape()
{

View file

@ -28,8 +28,10 @@ using var runner = new GpuFractalSplatReceiptRunner(shaderSource);
var receipt = runner.Run(options);
Directory.CreateDirectory(options.OutputDirectory);
var receiptPath = Path.Combine(options.OutputDirectory, $"fractal-gpu-splat-receipt-{DateTimeOffset.Now:yyyyMMdd-HHmmss}.json");
var receiptStamp = DateTimeOffset.Now.ToString("yyyyMMdd-HHmmss");
var receiptPath = Path.Combine(options.OutputDirectory, $"fractal-gpu-splat-receipt-{receiptStamp}.json");
File.WriteAllText(receiptPath, JsonSerializer.Serialize(receipt, new JsonSerializerOptions { WriteIndented = true }));
var importReportPath = WriteProgramFlameImportReport(options, receiptStamp);
Console.WriteLine("=== Aquarium Perfect Machine GPU Splat Receipt ===");
Console.WriteLine($"adapter: {receipt.Adapter}");
@ -53,6 +55,12 @@ Console.WriteLine($"gpu splats/sec: {receipt.GpuSplatsPerSecond:N0}");
Console.WriteLine($"gpu reservoir candidates/sec: {receipt.GpuReservoirCandidatesPerSecond:N0}");
Console.WriteLine($"cpu submit+wait ms/frame: {receipt.CpuSubmitAndWaitMillisecondsPerFrame:0.000}");
Console.WriteLine($"readback checksum: 0x{receipt.ReadbackChecksum:X16}");
if (importReportPath is not null)
{
var report = FractalFlameFileParser.ParseFirstWithReport(File.ReadAllText(options.ProgramFlamePath!), unchecked((int)options.Seed)).Report;
Console.WriteLine($"flame import: accepted {report.AcceptedFieldCount:N0}, approximated {report.ApproximatedFieldCount:N0}, ignored {report.IgnoredFieldCount:N0}, rejected {report.RejectedFieldCount:N0}");
Console.WriteLine($"flame import report: {importReportPath}");
}
if (receipt.VisualParity is not null)
{
Console.WriteLine($"visual parity samples: {receipt.VisualParity.ComparedSamples:N0}/{receipt.VisualParity.ReferenceSamples:N0}");
@ -111,7 +119,8 @@ static void RunReferencePpmReceipt(ReceiptOptions options)
static void RunFlameHistogramReceipt(ReceiptOptions options)
{
var flameSource = File.ReadAllText(options.FlamePath!);
var flame = FractalFlameFileParser.ParseFirst(flameSource, unchecked((int)options.Seed));
var parsed = FractalFlameFileParser.ParseFirstWithReport(flameSource, unchecked((int)options.Seed));
var flame = parsed.Definition;
var points = FractalFlameChaosGame.Generate(
flame,
options.HistogramSamples,
@ -143,8 +152,11 @@ static void RunFlameHistogramReceipt(ReceiptOptions options)
checksum);
Directory.CreateDirectory(options.OutputDirectory);
var receiptPath = Path.Combine(options.OutputDirectory, $"fractal-flame-histogram-receipt-{DateTimeOffset.Now:yyyyMMdd-HHmmss}.json");
var stamp = DateTimeOffset.Now.ToString("yyyyMMdd-HHmmss");
var receiptPath = Path.Combine(options.OutputDirectory, $"fractal-flame-histogram-receipt-{stamp}.json");
File.WriteAllText(receiptPath, JsonSerializer.Serialize(receipt, new JsonSerializerOptions { WriteIndented = true }));
var importReportPath = Path.Combine(options.OutputDirectory, $"fractal-flame-import-report-{stamp}.json");
File.WriteAllText(importReportPath, JsonSerializer.Serialize(new FlameImportReportReceipt(Path.GetFullPath(options.FlamePath!), parsed.Report), new JsonSerializerOptions { WriteIndented = true }));
Console.WriteLine("=== Aquarium Fractal Flame Histogram Receipt ===");
Console.WriteLine($"flame: {receipt.FlameName}");
@ -156,9 +168,24 @@ static void RunFlameHistogramReceipt(ReceiptOptions options)
Console.WriteLine($"hits: {receipt.HitCount:N0}");
Console.WriteLine($"occupied bins: {receipt.OccupiedBins:N0}");
Console.WriteLine($"histogram checksum: 0x{receipt.Checksum:X8}");
Console.WriteLine($"flame import: accepted {parsed.Report.AcceptedFieldCount:N0}, approximated {parsed.Report.ApproximatedFieldCount:N0}, ignored {parsed.Report.IgnoredFieldCount:N0}, rejected {parsed.Report.RejectedFieldCount:N0}");
Console.WriteLine($"flame import report: {importReportPath}");
Console.WriteLine($"receipt: {receiptPath}");
}
static string? WriteProgramFlameImportReport(ReceiptOptions options, string receiptStamp)
{
if (options.ProgramFlamePath is null)
{
return null;
}
var parsed = FractalFlameFileParser.ParseFirstWithReport(File.ReadAllText(options.ProgramFlamePath), unchecked((int)options.Seed));
var reportPath = Path.Combine(options.OutputDirectory, $"fractal-flame-import-report-{receiptStamp}.json");
File.WriteAllText(reportPath, JsonSerializer.Serialize(new FlameImportReportReceipt(Path.GetFullPath(options.ProgramFlamePath), parsed.Report), new JsonSerializerOptions { WriteIndented = true }));
return reportPath;
}
internal sealed class GpuFractalSplatReceiptRunner : IDisposable
{
private const int ThreadGroupSize = 256;
@ -925,6 +952,10 @@ internal sealed record ReferencePpmReceipt(
ulong RgbChecksum,
ulong LuminanceChecksum);
internal sealed record FlameImportReportReceipt(
string SourcePath,
FractalFlameImportReport Report);
internal readonly record struct VisualParityView(string Name, Vector4 Bounds);
internal sealed record VisualParityReceipt(