Compare commits

...
Author SHA1 Message Date
poli0981andClaude Opus 5 1b632c324b fix(capture): a quality the hook could not tell and an unmeasured Reflex are no longer stored as values
The quality byte's 0xFF is the Overlay's "a hook ran and could not tell" (fl_shm.h upscalerQuality), and every
AMD dispatch carries it. SessionAggregator (row and segments) and SessionProgressCalculator took it as a number,
so a session and the live card carried the text "255", which the game page and the Dashboard append to the
upscaler's name: an FSR title would read "FSR 255". Frames that did not tell are now left out, and a quality
nobody told is null (FrameSample.QualityNotTold).

reflex_active was written false on every hooked row with no latency sample, although nothing measures Reflex
today; it is null there now, so an export no longer says "off" for a thing never measured.

Found while checking legal/ACCURACY.md against the code.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 21:12:04 +07:00
6 changed files with 60 additions and 6 deletions

No files matched your search

+10
View File
@@ -253,6 +253,16 @@ under a `## [x.y.z] - date` heading in the same commit that bumps `VERSION`, the
sentence is now true without a word of it changing. Tests: `LogRedactorTests`, `BugBundleBuilderTests`. Docs:
`10_LOGGING` §Serilog configuration (the enricher claim struck, with where the rule is enforced) and §Bug report
flow step 2.
- **Two unmeasured facts were stored as values (2026-09-15).** The quality byte's `0xFF`, the Overlay's "a hook ran
and could not tell" (`fl_shm.h` `upscalerQuality`), was aggregated as a number, so a session and the live card
carried the text `255`, which the game page and the Dashboard append to the upscaler's name: every AMD dispatch
carries `0xFF`, so an FSR title would read "FSR 255". `SessionAggregator` (row and segments) and
`SessionProgressCalculator` now leave those frames out, and a quality nobody told is null (`FrameSample.QualityNotTold`).
And `reflex_active` was written `false` on every hooked row with no latency sample, although nothing measures Reflex
today; it is null there now, so an export no longer says "off" for a thing never measured. Tests:
`SessionAggregatorTests` (not told is null, told frames still count; Reflex null), `SessionProgressCalculatorTests`.
Found while checking `legal/ACCURACY.md` against the code. Not done: naming a preset the hook did read, which
`03_METRICS` assigns to a `Domain.UpscalerNames` that does not exist; no measured title has produced one.
- **Test runs stop filling the real data folder with hook-harness logs (2026-09-15).** The injection tests inject the
shipped Overlay, whose log goes to `%LOCALAPPDATA%\FrameLedger\logs` by design (§S21: not the environment, and no
switch in the injected DLL), so the owner's folder held 2506 overlay logs, 2492 of them hook-harness's from test
@@ -60,7 +60,7 @@ public static class SessionProgressCalculator
FgRefusal = usable ? null : fg?.Refusal is { } refusal ? Vocabulary.FgRefusal(refusal.Kind) : null,
FgRuntimeCensus = progress.WriterState.RuntimeCensus,
Upscaler = upscaler is { } u ? Vocabulary.Upscaler(u) : FgLadder.UpscalerHookRan(progress.Records) ? "unknown" : null,
UpscalerQuality = Modal(withParams)?.ToString(CultureInfo.InvariantCulture),
UpscalerQuality = Modal([.. withParams.Where(static s => s.UpscalerQuality != FrameSample.QualityNotTold)])?.ToString(CultureInfo.InvariantCulture),
RenderW = extent?.RenderW,
RenderH = extent?.RenderH,
OutputW = extent?.OutputW,
@@ -66,7 +66,8 @@ public static class SessionAggregator
StutterCount = stutter?.Count,
StutterTimePct = stutter?.TimePct,
PsoStutterPct = stutter is null || c.Series is null ? null : StutterDetector.PsoStutterPct(stutter, c.Series, c.Dominant),
ReflexActive = latency.Count > 0,
// Null, not false, when no latency sample exists: nothing measures Reflex today, and a false is an answer nobody gave.
ReflexActive = latency.Count > 0 ? true : null,
LatencyAvgUs = latency.AverageUs is { } a ? (long)Math.Round(a) : null,
LatencyP95Us = latency.P95Us is { } p ? (long)Math.Round(p) : null,
GapCount = c.Input.TotalGaps,
@@ -109,10 +110,11 @@ public static class SessionAggregator
FlUpscaler? identity = FgLadder.UpscalerIdentity(c.Input.Records);
bool hookRan = FgLadder.UpscalerHookRan(c.Input.Records);
IReadOnlyList<FrameSample> withParams = [.. c.Dominant.Where(static s => s.Claims(MeasuredFields.UpscalerParams))];
IReadOnlyList<FrameSample> withQuality = [.. withParams.Where(static s => s.UpscalerQuality != FrameSample.QualityNotTold)];
return row with
{
Upscaler = identity is { } u ? Vocabulary.Upscaler(u) : hookRan ? "unknown" : null,
UpscalerQuality = Modal(withParams, static s => s.UpscalerQuality)?.ToString(CultureInfo.InvariantCulture),
UpscalerQuality = Modal(withQuality, static s => s.UpscalerQuality)?.ToString(CultureInfo.InvariantCulture),
UpscalerSharpness = Modal(withParams, static s => s.UpscalerSharpness),
UpscalerDriverReported = c.Input.Ngx.SrCreatedAndEvaluated ? "dlss" : null,
RenderW = extent?.RenderW,
@@ -238,7 +240,7 @@ public static class SessionAggregator
OutputW = seg.OutputW == 0 ? null : seg.OutputW,
OutputH = seg.OutputH == 0 ? null : seg.OutputH,
Upscaler = upscaler is { } u && u != UpscalerKind.NotReported ? Vocabulary.Upscaler(u) : null,
UpscalerQuality = Modal([.. seg.Samples.Where(static s => s.Claims(MeasuredFields.UpscalerParams))], static s => s.UpscalerQuality)
UpscalerQuality = Modal([.. seg.Samples.Where(static s => s.Claims(MeasuredFields.UpscalerParams) && s.UpscalerQuality != FrameSample.QualityNotTold)], static s => s.UpscalerQuality)
?.ToString(CultureInfo.InvariantCulture),
FgMode = null,
NativeFps = null,
@@ -48,7 +48,13 @@ public readonly record struct FrameSample
public UpscalerKind Upscaler { get; init; }
/// <summary>Vendor enum; <c>0xFF</c> unknown.</summary>
/// <summary>
/// <see cref="UpscalerQuality"/>'s "a hook ran and could not tell" (<c>fl_shm.h</c> <c>upscalerQuality</c>): not a preset,
/// so it is never a value in a row. Every AMD dispatch carries it, because that call has no preset.
/// </summary>
public const byte QualityNotTold = 0xFF;
/// <summary>Vendor enum; <see cref="QualityNotTold"/> when the hook could not tell.</summary>
public byte UpscalerQuality { get; init; }
/// <summary>Percent, 0-100; <c>0xFF</c> means the API reports no sharpness.</summary>
@@ -56,6 +56,18 @@ public sealed class SessionProgressCalculatorTests
e.CpuTempC.Should().BeNull();
}
[Fact]
public void TheLiveCardNeverShowsAQualityTheHookCouldNotTell()
{
FlMeasured claims = FlMeasured.OutputRes | FlMeasured.PresentArgs | FlMeasured.Upscaler | FlMeasured.UpscalerParams;
List<FlFrameRecord> records = [.. SessionFixtures.Stream(1000, claims, upscaler: FlUpscaler.Dlss).Select(static r => r with { UpscalerQuality = 0xFF })];
SessionProgressEvent e = SessionProgressCalculator.Compute(_guid, Progress(records), SessionFixtures.QpcFrequency, 12.5, gpu: null);
e.Upscaler.Should().Be("dlss");
e.UpscalerQuality.Should().BeNull("0xFF is the hook's 'could not tell', which the card would print as 'DLSS 255'");
}
[Fact]
public void AMeasuredFrameGenerationFactorSplitsNativeFromDisplayed()
{
@@ -38,7 +38,7 @@ public sealed class SessionAggregatorTests
row.RtFlag.Should().Be("na");
row.HdrFlag.Should().Be("na");
row.VramProcAvgMb.Should().BeNull();
row.ReflexActive.Should().BeFalse();
row.ReflexActive.Should().BeNull("no latency sample was measured: not measured, not 'off'");
row.LatencyAvgUs.Should().BeNull();
row.StutterCount.Should().Be(0);
row.AvgGpuTemp.Should().BeNull("no sensors");
@@ -129,6 +129,30 @@ public sealed class SessionAggregatorTests
r.Segments[0].OutputW.Should().Be(2560);
}
/// <summary>
/// <c>0xFF</c> is the Overlay's "a hook ran and could not tell" for the quality byte, and every AMD dispatch carries it.
/// Aggregated as a number it became the text "255", which the game page appends to the upscaler's name ("FSR 255").
/// </summary>
[Fact]
public void AQualityTheHookCouldNotTellIsNoValueWhileAToldOneStillIs()
{
FlMeasured claims = _presentOnly | FlMeasured.Upscaler | FlMeasured.UpscalerParams;
var writer = new FlWriterState { Status = 1, HooksInstalledMask = 0x7 };
List<FlFrameRecord> notTold = [.. SessionFixtures.Stream(500, claims, upscaler: FlUpscaler.Dlss).Select(static r => r with { UpscalerQuality = 0xFF })];
AggregationResult r = SessionAggregator.Aggregate(SessionFixtures.Skeleton(), SessionFixtures.Hooked(notTold, writer));
r.Row.Upscaler.Should().Be("dlss");
r.Row.UpscalerQuality.Should().BeNull("0xFF is not a preset");
r.Segments.Should().ContainSingle().Which.UpscalerQuality.Should().BeNull();
List<FlFrameRecord> mixed = [.. SessionFixtures.Stream(500, claims, upscaler: FlUpscaler.Dlss).Select(static (r, i) => r with { UpscalerQuality = (byte)(i % 5 == 0 ? 3 : 0xFF) })];
AggregationResult m = SessionAggregator.Aggregate(SessionFixtures.Skeleton(), SessionFixtures.Hooked(mixed, writer));
m.Row.UpscalerQuality.Should().Be("3", "the frames that told are the only ones that count");
m.Segments[0].UpscalerQuality.Should().Be("3");
}
[Fact]
public void AnUpscalerHookThatSawOnlyUnknownIsUnknownNotNull()
{