Compare commits

...
Author SHA1 Message Date
poli0981andClaude Fable 5.2 29c3644c07 release: 0.1.0-beta.42 - no new patch site: the session's upscaler label, the patch registry, a native log that outlives the game, FSR's plane at infinity (D119-D122): its changelog file, HANDOFF's beta.42 section, owner-only item 40, the release lines
docs/changelog/0.1.0-beta.42.md takes [Unreleased]; HANDOFF's beta.41 section moves verbatim to docs/handoff/history/0.1.0-beta.41.md and a new START HERE says what the release decided, what to read in the Cyberpunk log and the design of beta.43's two hooks; owner-only item 40; the release lines in README, LIMITATIONS, ACCESSIBILITY and the accuracy block's copies. No legal version, schema, rules or layout change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 08:52:46 +07:00
poli0981andClaude Fable 5.2 c74de2cc12 feat(advanced): FSR's depth plane at infinity is stored as +infinity and shown as an infinity sign - FLT_MAX or +infinity in cameraNear / cameraFar is a plane for FSR, where for Streamline it is 'not set' (beta.42 PR-4, D119) (#409)
FL_ADV_FLOAT_INFINITE (0x7F800000) in ffxNearBits / ffxFarBits only; fl::adv::FfxDepthPlaneBits on the ffx route only; InGameAdvancedSampler shows the row as the infinity sign. No field moved, the layout version is unchanged. The layout's comments carry the release numbers of D118 and D122.

Measured on fl_adv_fields.h with the Overlay's flags, old header beside new: no difference beyond the run-to-run spread (+25.0 to +25.4 ns per UPSCALE dispatch with Advanced on, +25.2 to +25.8 before; off unchanged).

Qodana's native report: six false 'never used' on the registry test's stand-in engines switched off for that file with the reason; one vector reserve fixed.

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 01:51:25 +00:00
poli0981andClaude Fable 5.2 72ee9964b0 feat(overlay): the native log is whole after a game that simply exits, and says which module was patched and which descriptor types each ffx module was handed - the watchdog flushes when something new was logged (beta.42 PR-3, D121) (#408)
The log held the first half second of a session unless the Agent asked for it or a stop ran, and a game that exits does neither. FlushLogIfNew on the watchdog's tick; the init flush moved before the watchdog exists. Install lines name module!symbol from the inventory row (fl::inventory::NameOfRow; the event's text is 72 characters). fl_ffx_types.h keeps each descriptor type a hooked ffx-api module was handed, per entry point, and the watchdog logs it once (FFX_DISPATCH / FFX_QUERY), with UPSCALE_ROUTE and RUNTIME_CENSUS from words the detours already kept. A diagnostic: the log file and nothing else.

Measured on the header with the Overlay's flags: +3.8 ns per dispatch for a frame's three types; +0.9 ns first slot, +8.4 ns eighth.

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 01:36:55 +00:00
27 changed files with 1125 additions and 204 deletions

No files matched your search

+6
View File
@@ -263,6 +263,12 @@ resharper_cpp_if_can_be_replaced_by_constexpr_if_highlighting = none
[src/native/{FrameLedger.Injector/src/fl_guard_sources.cpp,FrameLedger.ProcessStats/src/fl_process_stats.cpp,tools/fl-probe-guard/main.cpp,tests/vklayer_test.cpp}]
resharper_cpp_declarator_never_used_highlighting = none
# fl::patch::Install takes its hook engine as a template parameter and calls Create / Enable / Disable on it. The
# test's two stand-in engines are used that way and no other, which ReSharper's "never used" does not follow through a
# dependent call: six reports, one per member (Qodana, 2026-11-12). The members are the test.
[src/native/tests/unhook_inline_test.cpp]
resharper_cpp_declarator_never_used_highlighting = none
# The linter's compiler, not the build's: NVAPI's header makes NvU32 `unsigned int` under clang and `unsigned long`
# under MSVC, which is the compiler that builds this probe - and `%lu` is right for it.
[src/native/tools/fl-probe-nvapi/main.cpp]
+1 -1
View File
@@ -9,7 +9,7 @@ barrier. It is written for the person who has just met one; the details for deve
FrameLedger is a desktop program: its own window, its dialogs, its document windows, the icon by the clock and the
notices Windows shows for it. It draws nothing inside a game, so it cannot make a game itself any easier to use.
*Beta software: this page describes version 0.1.0-beta.41. In the app: Help ▸ Accessibility.*
*Beta software: this page describes version 0.1.0-beta.42. In the app: Help ▸ Accessibility.*
## What FrameLedger aims for
+1 -17
View File
@@ -35,29 +35,13 @@ numeric core and does not move; the heading is the full version — corrected 20
## [Unreleased]
### Fixed
- **The part inside the game can no longer leave a hook in after it has stopped.** Two gaps in how the Overlay keeps
track of its own patches, found by reading the code and not by a failure: a patch made while the table of patches
was full would have been made anyway and never taken out, and a stop that arrived at the exact moment a hook was
going in could miss it. A patch now takes its place in the table before it is made — no place, no patch — and is
recorded before it can run, so the stop either removes it or the installer does. A patch that could not be made
is written to the Overlay's log with the reason, where it used to be silent. No hook's own code changed.
- **A session that saw two upscalers is named after the one it ran, with that one's quality and render size.** The
session's upscaler used to be the first one FrameLedger saw named, while the quality mode and the render size
came from whichever frames carried them. A game that evaluated DLSS briefly and then ran FSR was stored as "DLSS"
with FSR's quality and FSR's render size. The name is now the technology named on the most frames, the quality
and the size are read from that technology's frames only, and such a session is marked "settings changed during
session". What that technology did not say reads N/A rather than borrowing the other's value. Sessions already
stored are not rewritten.
## Releases
Newest first. Each file holds that release's section exactly as it stood here.
| Version | Date | Notes |
|---|---|---|
| `0.1.0-beta.42` | 2026-11-12 | [`docs/changelog/0.1.0-beta.42.md`](docs/changelog/0.1.0-beta.42.md) |
| `0.1.0-beta.41` | 2026-11-12 | [`docs/changelog/0.1.0-beta.41.md`](docs/changelog/0.1.0-beta.41.md) |
| `0.1.0-beta.40` | 2026-11-12 | [`docs/changelog/0.1.0-beta.40.md`](docs/changelog/0.1.0-beta.40.md) |
| `0.1.0-beta.39` | 2026-11-11 | [`docs/changelog/0.1.0-beta.39.md`](docs/changelog/0.1.0-beta.39.md) |
+1 -1
View File
@@ -5,7 +5,7 @@ hooking on for — and reading the graphics calls the game makes. That is why it
resolution, the upscaler, frame generation and ray tracing apart. It is also where its limits come from. This
page lists them in plain words; each item links to the document that has the details.
*Beta software: this page describes version 0.1.0-beta.41.*
*Beta software: this page describes version 0.1.0-beta.42.*
## Games it will not measure
+2 -2
View File
@@ -13,7 +13,7 @@ app too (Help ▸ User guide, Help ▸ Limitations, Help ▸ Accessibility), and
<!-- accuracy-block:begin -->
> ⚠ **What FrameLedger actually measures today — 2026-11-11.** The software is a beta; its latest
> **beta is `0.1.0-beta.41`** (2026-11-12), an unsigned installer built from that tag with its
> **beta is `0.1.0-beta.42`** (2026-11-12), an unsigned installer built from that tag with its
> checksums published beside it (alphas — experimental builds that try a newer .NET — are published apart). The source holds the desktop app
> (library, store import, charts, settings) and the background Agent, which records a session when a
> game in the library runs (unless you switched its recording off), injects only into games you enabled
@@ -191,7 +191,7 @@ Elevation is **optional — for everything.** Hooked capture is the normal path
## Install
> **The latest beta is `v0.1.0-beta.41` (2026-11-12); before it `v0.1.0-beta.40` (2026-11-12), `v0.1.0-beta.39` (2026-11-11), `v0.1.0-beta.38` (2026-11-11), `v0.1.0-beta.37` (2026-11-11), `v0.1.0-beta.36` (2026-11-10), `v0.1.0-beta.35` (2026-11-09), `v0.1.0-beta.34` (2026-11-06), `v0.1.0-beta.33` (2026-11-03), `v0.1.0-beta.32` (2026-10-31), `v0.1.0-beta.31` (2026-10-26), `v0.1.0-beta.30` (2026-10-26), `v0.1.0-beta.29` (2026-10-25), `v0.1.0-beta.28` (2026-10-20), `v0.1.0-beta.27` (2026-10-20), `v0.1.0-beta.26` (2026-10-19), `v0.1.0-beta.25` (2026-10-19), `v0.1.0-beta.24` (2026-10-19), `v0.1.0-beta.23` (2026-10-14), `v0.1.0-beta.22` (2026-10-13), `v0.1.0-beta.21` (2026-10-13), `v0.1.0-beta.20` (2026-10-12), `v0.1.0-beta.19` (2026-10-12), `v0.1.0-beta.18` (2026-10-07), `v0.1.0-beta.17` (2026-10-07), `v0.1.0-beta.16` (2026-10-06), `v0.1.0-beta.15` (2026-10-06), `v0.1.0-beta.14` (2026-10-06), `v0.1.0-beta.13` (2026-10-04), `v0.1.0-beta.12` (2026-10-04), `v0.1.0-beta.11` (2026-10-03), `v0.1.0-beta.10` (2026-09-28), `v0.1.0-beta.9` (2026-09-26), `v0.1.0-beta.8` (2026-09-25), `v0.1.0-beta.7` (2026-09-23), `v0.1.0-beta.6` (2026-09-23), `v0.1.0-beta.5` (2026-09-22), `v0.1.0-beta.4` (2026-09-21), `v0.1.0-beta.3` (2026-09-21), `v0.1.0-beta.2` (2026-09-17) and `v0.1.0-beta.1` (2026-09-16).** They are pre-releases: read the notes of the one you install — `CHANGELOG.md` links each release's own file under `docs/changelog/` — for what it measures, what it does not yet, and how to update, before installing. A source build is `docs/12_BUILD.md`.
> **The latest beta is `v0.1.0-beta.42` (2026-11-12); before it `v0.1.0-beta.41` (2026-11-12), `v0.1.0-beta.40` (2026-11-12), `v0.1.0-beta.39` (2026-11-11), `v0.1.0-beta.38` (2026-11-11), `v0.1.0-beta.37` (2026-11-11), `v0.1.0-beta.36` (2026-11-10), `v0.1.0-beta.35` (2026-11-09), `v0.1.0-beta.34` (2026-11-06), `v0.1.0-beta.33` (2026-11-03), `v0.1.0-beta.32` (2026-10-31), `v0.1.0-beta.31` (2026-10-26), `v0.1.0-beta.30` (2026-10-26), `v0.1.0-beta.29` (2026-10-25), `v0.1.0-beta.28` (2026-10-20), `v0.1.0-beta.27` (2026-10-20), `v0.1.0-beta.26` (2026-10-19), `v0.1.0-beta.25` (2026-10-19), `v0.1.0-beta.24` (2026-10-19), `v0.1.0-beta.23` (2026-10-14), `v0.1.0-beta.22` (2026-10-13), `v0.1.0-beta.21` (2026-10-13), `v0.1.0-beta.20` (2026-10-12), `v0.1.0-beta.19` (2026-10-12), `v0.1.0-beta.18` (2026-10-07), `v0.1.0-beta.17` (2026-10-07), `v0.1.0-beta.16` (2026-10-06), `v0.1.0-beta.15` (2026-10-06), `v0.1.0-beta.14` (2026-10-06), `v0.1.0-beta.13` (2026-10-04), `v0.1.0-beta.12` (2026-10-04), `v0.1.0-beta.11` (2026-10-03), `v0.1.0-beta.10` (2026-09-28), `v0.1.0-beta.9` (2026-09-26), `v0.1.0-beta.8` (2026-09-25), `v0.1.0-beta.7` (2026-09-23), `v0.1.0-beta.6` (2026-09-23), `v0.1.0-beta.5` (2026-09-22), `v0.1.0-beta.4` (2026-09-21), `v0.1.0-beta.3` (2026-09-21), `v0.1.0-beta.2` (2026-09-17) and `v0.1.0-beta.1` (2026-09-16).** They are pre-releases: read the notes of the one you install — `CHANGELOG.md` links each release's own file under `docs/changelog/` — for what it measures, what it does not yet, and how to update, before installing. A source build is `docs/12_BUILD.md`.
1. Download the latest `FrameLedger.App-win-Setup.exe` from [Releases](https://github.com/poli0981/frameledger/releases). It installs into `%LOCALAPPDATA%\FrameLedger.App`; your data stays in `%LOCALAPPDATA%\FrameLedger`, and uninstalling asks before touching it.
2. SmartScreen may warn — releases are not code-signed (free, open-source project). Verify the SHA-256 checksum published with each release, then **More info → Run anyway**.
+5 -4
View File
@@ -125,13 +125,14 @@ What the region is, as a contract between the two sides:
inside on every attempt — a watchdog killed with its process leaves `seq` odd for good, and what it published
before is still what the game said.
- **Zero is "not read", never a value.** A Streamline `Boolean` and a DLSS preset are stored as the vendor's value
plus one; a float as its bits, with `FL_ADV_FLOAT_NONE` for "none seen" — the vendors' own sentinels are refused in
plus one; a float as its bits, with `FL_ADV_FLOAT_NONE` for "none seen" — and, in `ffxNearBits` / `ffxFarBits` alone, `FL_ADV_FLOAT_INFINITE` (`0x7F800000`, +infinity's own bits) for a plane at infinity *(0.1.0-beta.42, owner decision D119: an engine with an infinite depth hands FSR `FLT_MAX` or +infinity for one plane; for Streamline `FLT_MAX` is "not set" and stays refused)* — the vendors' own sentinels are refused in
the detour and never reach the region; a size of 0 is "not given".
- **A per-frame value is summarised where it is seen**: a flag is an "ever seen" mask, a jitter the largest magnitude,
a field of view its lowest and highest (D114), the reported frame time a count and a sum the watchdog drains.
- **Sized once for the train's three releases.** The members ~~0.1.0-beta.41 and beta.42~~ 0.1.0-beta.42 and
beta.43 fill *(renumbered 2026-11-12, D118: a fix release took beta.41; the comments in `fl_shm.h` and
`ShmLayout.cs` still carry the old numbers until the release that fills each member rewrites them)* (`ffxFg*`,
- **Sized once for the train's three releases.** The members ~~0.1.0-beta.41 and beta.42~~ ~~0.1.0-beta.42 and
beta.43~~ 0.1.0-beta.43 and beta.44 fill *(renumbered twice on 2026-11-12 — D118: a fix release took beta.41;
D122: the second step became two releases, and beta.42 fills none of them. The comments in `fl_shm.h` and
`ShmLayout.cs` carry the new numbers since beta.42)* (`ffxFg*`,
`sl*`, `features`) are declared now and stay zero until then, so those releases bump no layout.
- The Vulkan layer never writes it. `ShmLayoutMirrorTests.TheAdvancedStateMirrorMatches` checks every member's
offset against `fl-layout-dump`; `ShmRingReaderTests` the three reads and that the request is stored either way.
+1 -1
View File
@@ -93,7 +93,7 @@ Tails the active files (shared read), level filter, text search, pause autoscrol
2. **Bundle builder** creates `FrameLedger-bugreport-YYYYMMDD-HHmm.zip` in a user-chosen location:
- `logs/` (last 7 days, redacted copies)
- `sysinfo.json` (app + agent + **overlay build id**, OS build, CPU/GPU name, driver version, telemetry source, Vulkan layer state, PawnIO present?, elevation state, locale)
- `overlay-<pid>-*.log` for the last hooked sessions, plus hook fault details and the ring's dropped/fault counters — these are what make injection bugs diagnosable at all. *(The file exists since 2026-09-06 — `17_HOOK_ENGINE` §Native logging: written at init, on the Agent's request at session end, and on the stop; `FAULT` lines carry the exception code and the hook's name, `UNHOOK_*` lines say per patch whether it was restored or left to a later hooker.)*
- `overlay-<pid>-*.log` for the last hooked sessions, plus hook fault details and the ring's dropped/fault counters — these are what make injection bugs diagnosable at all. *(The file exists since 2026-09-06 — `17_HOOK_ENGINE` §Native logging: written at init, on the Agent's request at session end, and on the stop — and since 0.1.0-beta.42 by the Overlay's watchdog whenever something new was logged, so it is whole after a game that simply exits, with each install named by module and symbol and each descriptor type an ffx module was handed; `FAULT` lines carry the exception code and the hook's name, `UNHOOK_*` lines say per patch whether it was restored or left to a later hooker.)*
- `settings.json` (sanitized — no paths)
- optional checkbox: last session metadata + aggregates JSON (never raw blobs by default)
- crash dumps included only when the user ticks the checkbox (size warning shown)
+50 -4
View File
@@ -780,14 +780,16 @@ compare-and-restore that never restores is not a fix.
No logging in hook bodies. A small fixed-size in-memory ring of structured events (hook installed, symbol missing, fault, unhook) is flushed to `logs\overlay-<pid>-*.log` by the init thread at session end, on unhook, or on Agent request — never mid-frame.
> **Built 2026-09-06 (P1 item 4), as specified, with the details a bug report needs.** A ring of 256 ×
> 64-byte events (`qpc`, code, two operands, a 40-char name) appended with one `fetch_add` from init and
> ~~64-byte events (`qpc`, code, two operands, a 40-char name)~~ 96-byte events (`qpc`, code, two operands, a
> 72-char name — 64 bytes and 40 characters until beta.42) appended with one `fetch_add` from init and
> watchdog paths and from a hook's **SEH handler** — `NoteFault` records the exception code and the hook's
> `__func__` — never from a hook body. Codes: `RING_CREATED`, `PRESENT_HOOKS`, `HOOK_INSTALLED` (one per
> patch, with the target address), `SYMBOL_MISSING` (once per pair, and only when the module IS mapped),
> `FAULT`, `STOP` (the reason), `UNHOOK_RESTORED` / `UNHOOK_DECLINED` (one per patch), `LOADER_DETOUR`,
> `SUPERVISION_LOST`, since beta.24 `STOP_FLUSHED` (the last line after a stop: `a=1` when the stop had finished
> writing), and since beta.42 `PATCH_FAILED` (a patch that did not go in, once per target and reason — §Unhooking).
> **Three flush points, none on a present path:** the end of `InitThread` (so the
> writing), and since beta.42 `PATCH_FAILED` (a patch that did not go in, once per target and reason — §Unhooking)
> and `FFX_DISPATCH`, `FFX_QUERY`, `UPSCALE_ROUTE`, `RUNTIME_CENSUS` (the note at the end of this section).
> **Three flush points — four since beta.42, the same note —, none on a present path:** the end of `InitThread` (so the
> file exists from the start of the session and a crash mid-session still leaves it), the watchdog when
> `FlControlBlock.logFlushRequested` changes (a counter the Agent bumps at session end; nothing clears it),
> and the watchdog on its way out after any stop. Appended, never recreated; events overwritten before a
@@ -805,8 +807,52 @@ No logging in hook bodies. A small fixed-size in-memory ring of structured event
> line. Nothing on a present path changed. Path: `%LOCALAPPDATA%\FrameLedger\logs\overlay-<pid>-<yyyymmdd-hhmmss>.log`,
> resolved by `SHGetKnownFolderPath` (§S21's rule, not the environment). No allocation: static ring,
> static 64 KiB format buffer, static path. The CaptureHost prints the file and its `FAULT` / `STOP` /
> `UNHOOK_*` / `SYMBOL_MISSING` / `SUPERVISION_LOST` lines at the end of every session
> `UNHOOK_*` / `SYMBOL_MISSING` / `PATCH_FAILED` / `SUPERVISION_LOST` lines at the end of every session
> (`Consume/OverlayLog.cs`).
>
> **The log outlives the game, and says what each ffx module was handed (0.1.0-beta.42, owner decision D121).**
> Cyberpunk 2077, set to FSR upscaling with FSR frame generation, was recorded with frame generation measured and
> the upscaler "unknown": PREPARE and FRAMEGENERATION dispatches arrived and no UPSCALE ever did. The log could
> not say why. **It ended half a second into the session** — written at the end of init, then only when the Agent
> asked or a stop ran, and a game that exits does neither: the watchdog dies with the process. And **it could not
> have said much**: the two one-target rows logged their symbol and every other row the word `hook`, so four ffx
> modules were one indistinguishable line each. Four changes, none of them a new patch site:
>
> 1. **A fourth flush point: the watchdog, on any tick that finds something new in the ring** (`FlushLogIfNew`:
> one load on an uneventful tick, no file opened). Events are few and bounded — installs, first sights, three
> faults at most — so this is a handful of appends a session. The init thread's flush moved to **before** the
> watchdog is created: `FlushLog`'s state belongs to one thread at a time, and with the watchdog flushing on its
> first tick the old order could run two at once.
> 2. **Every install line names its module and its symbol** — `amd_fidelityfx_dx12.dll!ffxDispatch` — built at
> compile time from the inventory row's own two spellings (`fl::inventory::NameOfRow`), so no second list of
> names exists. The same name is on the `UNHOOK_*` and `PATCH_FAILED` lines. The event's text grew from 40 to
> 72 characters for it (an event is 96 bytes; the ring 24 KiB, static), and `PatchTarget` lost its default
> name, so a new call site cannot log `hook`.
> 3. **`FFX_DISPATCH` / `FFX_QUERY`: each descriptor type a hooked ffx-api module was handed, once**
> (`fl_ffx_types.h`). Text = the module, `b` = the type (`0x10001` UPSCALE, `0x20004` / `0x2000c` PREPARE,
> `0x20003` FRAMEGENERATION, …); `a` ≠ 0 with `b=0` says what did not fit (`1` a ninth distinct type, `2` a
> type of zero). The detour keeps the value of `type` — the member it reads already to choose an arm — in the
> first free of eight slots per module and entry point; the watchdog writes it. A query's type is kept whatever
> the vendor answered. `UPSCALE_ROUTE` names each source an UPSCALE came from, once (the FSR 3.0 host has no
> descriptor type, so this is the only line that says its export was called), and `RUNTIME_CENSUS` repeats the
> census word (`b`) whenever it gains a bit — both from words the detours kept before, at no cost to a hook.
> 4. **`PATCH_FAILED`** (§Unhooking) is the fourth: a patch that did not go in used to leave no line at all.
>
> **This is a diagnostic, not a measurement, and it is not behind the Advanced-metrics switch** — like
> `HOOK_INSTALLED`, it reaches the log file and nothing else: no record, no region of the shared memory, no session.
> Rule 4: the only thing read is `type`, of a descriptor handed to a hooked call. Rule 5: no allocation, no lock,
> no logging in the body; a type already kept costs loads and no write.
>
> **Measured overhead** (on `fl_ffx_types.h` itself with the Overlay's compile flags — `/O2 /GS /guard:cf
> /Qspectre`, 50 million calls a run, three runs, i7-14700KF): a frame's three dispatch types in turn, **+3.8 ns a
> dispatch** (3.79 / 3.87 / 3.81); a type in the first slot +0.9 to +1.0 ns; in the eighth, the worst steady
> state, +8.1 to +8.4 ns. A new type costs one compare-exchange, once per type and module.
>
> ctest `fl_ffx_types` (the header, including eight threads meeting the same six types at once: each kept exactly
> once) and `fl_guard` `[log]`: a harness on the 1.1.x monolith, generating frames and asking a ratio query, is
> supervised and told **nothing else** — no flush request, no stop — and its log holds the two install lines by
> module and symbol, the three dispatch types and the query type once each, the route and the census; the process
> is then killed and the file is as it was, one header, no `STOP`.
> **Tests and the real logs folder (2026-09-15).** The injection tests use the shipped Overlay, so their harness
> logs land in the user's real `logs\` too: measured that day, 2506 overlay logs, **2492 of them hook-harness's**,
+83 -114
View File
@@ -80,6 +80,7 @@ owner-only items stay below; the history of every train, the passed owner-only i
| `§beta.38`, `§NEXT` (the owner's request of 2026-11-11, the four trains) | [`handoff/history/0.1.0-beta.38.md`](handoff/history/0.1.0-beta.38.md) |
| `§beta.39`, train B's plan as approved (its `§NEXT`) | [`handoff/history/0.1.0-beta.39.md`](handoff/history/0.1.0-beta.39.md) |
| `§beta.40`, what the owner's first sessions with it showed, train B's traps | [`handoff/history/0.1.0-beta.40.md`](handoff/history/0.1.0-beta.40.md) |
| `§beta.41`, what the owner's sessions on beta.40 and beta.41 showed, the plan of 2026-11-12 (D119–D122) | [`handoff/history/0.1.0-beta.41.md`](handoff/history/0.1.0-beta.41.md) |
| `§Owner-only`, an open item | [§Owner-only](#owner-only--no-pr-can-close-these) below |
| `§Owner-only`, a passed item (3, 12, 14–19, 38, 39) | [`handoff/owner-only-passed.md`](handoff/owner-only-passed.md) |
| `§Traps`, `§Two corrections carried forward` | [`handoff/traps.md`](handoff/traps.md) |
@@ -87,131 +88,84 @@ owner-only items stay below; the history of every train, the passed owner-only i
---
## **START HERE** — 2026-11-12, 0.1.0-beta.41: one fix — the sensor library is no longer closed under its other users
## **START HERE** — 2026-11-12, 0.1.0-beta.42: no new patch site — the label, the registry, a log that outlives the game, the plane at infinity
*Status is `docs/changelog/0.1.0-beta.41.md`; this is what no other file carries.* 0.1.0-beta.40 was released in the
small hours of 2026-11-12 and the owner ran it that same night on eight games, as administrator with PawnIO — the
first elevated run there has been. A copy of the ledger and the Agent's log showed the in-game readings working
(Lies of P, the first real game read) and **a defect of train A that only that elevation can show**: three
LibreHardwareMonitor `Computer`s in one Agent, and the library's per-process state closed by one under the others.
This release is that fix and nothing else: #400 (0.1.0-beta.40's release facts; two comparisons SonarCloud flagged),
#401 (`LhmLibrary`), and this one. **Everything about train B — what was built, what the owner's sessions showed,
the traps — is [`handoff/history/0.1.0-beta.40.md`](handoff/history/0.1.0-beta.40.md)**; the fix is
[`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §Advanced metrics and [`20_OPEN_QUESTIONS.md`](20_OPEN_QUESTIONS.md)
§M13.
*Status is `docs/changelog/0.1.0-beta.42.md`; this is what no other file carries.* The owner marked items 38 and 39
passed on 2026-11-12 and train B's second step was planned the same morning. A review of the draft against the code
changed it, and the owner split it (D122): **this release adds no patch site**, and the two new hooks are
0.1.0-beta.43. Four pull requests and this one: #406 (the session's upscaler label, D120; the decisions D119–D122),
#407 (the patch registry), #408 (the native log and the descriptor-type census, D121), #409 (FSR's plane at
infinity, D119; Qodana's native report). **What the owner's sessions on beta.40 and beta.41 showed, and the plan as
approved, are [`handoff/history/0.1.0-beta.41.md`](handoff/history/0.1.0-beta.41.md)**; what each pull request built
is [`17_HOOK_ENGINE.md`](17_HOOK_ENGINE.md) §Unhooking and §Native logging, [`03_METRICS.md`](03_METRICS.md)
§Upscaling and [`07_IPC.md`](07_IPC.md) §Region 5.
### What this release decided
### What this release decided, beyond D119–D122
- **D118 — the fix is released at once as 0.1.0-beta.41, and train B's numbers move by one.** D113 had named
beta.41 for the train's second release. Told so, the owner chose to release the fix now. The train's second
release is **beta.42**, its third **beta.43**, train C **beta.44**, train D **beta.45**. Released changelogs and
moved HANDOFF sections keep the numbers of their day; so do the comments in `fl_shm.h` and `ShmLayout.cs` (the
members "0.1.0-beta.41" and "beta.42" fill), **deliberately**: touching them would have changed source that is
loaded into a game in a release that says the game-side code is beta.40's line for line. The release that fills
a member rewrites its comment.
- **The reads of the sensor library are not put under one lock**, only its opens and closes. A lock around every
read would have put a session's once-a-second poll behind the Advanced reader's, undoing the separate threads
that keep a hanging sensor from holding up the other reader.
- **The descriptor-type census is not behind the Advanced-metrics switch.** It is a diagnostic that reaches the log
file and nothing else — no record, no shared memory, no session — like `HOOK_INSTALLED`. Behind the switch it
could not answer D121 for a session recorded with the switch off, which is most of them. Its cost was measured
and stated instead (+3.8 ns a dispatch).
- **The log's text grew to 72 characters; nothing else about the ring did.** 256 events, static, 24 KiB.
- **A slot of the patch registry that was ever live is never reused**, and a failed create or enable leaves the
hook created in MinHook as it always did. Both are the smaller change: the first keeps the stop's walk lock-free
without a second word per slot, the second changes no failure path that has never been seen to run.
- **The live card still names the first upscaler a session saw** (`FgLadder.UpscalerIdentity`). The stored
session's name is the modal one (D120); for a session in progress the question is a different one.
- **Qodana's "never used" on the registry test's stand-in engines is switched off for that file**, not answered by
turning the template into function pointers: the header is loaded into a game, and D100 changes such code only
for a defect.
### NEXT
1. ~~**The owner runs item 39** (this fix, on the PC that showed the fault) **and the rest of item 38** (an FSR 3.1+
title; two sessions of one running game; the cost; the values of Lies of P against the game's own settings).~~
**Both passed on 2026-11-12, on the owner's word** ("Bạn có thể đánh dấu là pass và tiếp tục") after the thirteen
sessions below; [`handoff/owner-only-passed.md`](handoff/owner-only-passed.md) says what those sessions covered and
what they did not.
2. **Planned and approved 2026-11-12 (D119–D122): the second step is two releases.** **0.1.0-beta.42 has no new
patch site** — five pull requests: (1) the session's upscaler label (D120); (2) the Overlay's patch registry
refuses a patch it cannot register, and registers before it enables; (3) the native log is flushed whenever
something new was logged, every inventory row's install line names its module and symbol, a failed patch says
why, and the first sight of each ffx descriptor type on each module is logged — so that one Cyberpunk session on
beta.42 says where its upscale goes (D121); (4) FSR's infinite depth plane (D119); (5) the release, owner-only
item 40. **0.1.0-beta.43 is the two new hooks** and begins only when that log was read; its design — reviewed
against the code, which changed it — is in the plan of that day and below. What the review found that the first
draft had wrong: there is no "dominant segment" (segments split on output size only), so the label is the modal
name over the dominant stream; the patch table drops a patch silently when full; the init thread's flush runs
after the watchdog starts; a second NaN pattern for "infinite" would have been dropped by the Agent — real
+infinity is stored instead; the new rows must be gated before `ResolveScoped`, which takes a module reference a
call; `slSetConstants` needs the struct's GUID checked on every call; `ffxConfigure` needs an owner slot of its
own; summaries across viewports must come from the first viewport seen.
~~**0.1.0-beta.42 — train B's second release — when the owner says item 38 passed begins now, with its plan**~~: `slSetConstants` and
`ffxConfigure`. A plan of its own first. What it must settle, beside what
[`handoff/history/0.1.0-beta.40.md`](handoff/history/0.1.0-beta.40.md) §NEXT lists (`kMaxPatches = 48`, the window
of `sl::Constants` pinned outside the camera members, the per-call overhead, the gate's list for the two new
structs):
- **`FLT_MAX` in an FSR depth plane.** Lies of P gave `cameraFar = 10` and no `cameraNear`; most likely the
plane at infinity is `FLT_MAX`, which the Overlay refuses as "nobody set this". Decide whether it is stored as
"infinite" — an Overlay change, with its overhead stated.
- ~~**Valor Mortis.** One exit by access violation 51 seconds after injection under beta.40, none under an earlier
build, not attributed. Its crash count is 1; a second such end switches its hooking off. Before adding a hook
to that game's process, ask the owner whether it happened again.~~ **Answered by the owner, 2026-11-12: it was
the game's own — a shader-compilation error on entering the game, shown in the game's own crash dialog.** Not
FrameLedger's. It ran normally under beta.41 afterwards. Its crash count still stands at 1, because the crash
policy counts an abnormal end within 60 seconds of injection whoever caused it: a second one, from any cause,
switches its hooking off, and the owner then switches it on again from the game's page.
- **The release numbers in the comments** of `fl_shm.h`, `ShmLayout.cs`, `hook-harness` and `guard_test.cpp` for
the members that release fills (D118).
3. **0.1.0-beta.43 — the third — when the owner says the one before passed**: `slGetFeatureVersion` and
`slGetFeatureRequirements`.
4. **Trains C and D** (beta.44, beta.45) each begin with a spike and end in the owner's go or no.
1. **The owner runs item 40** — above all **one session of Cyberpunk 2077 with FSR upscaling** on beta.42, then
quits the game the ordinary way. Its `logs\overlay-<pid>-….log` is what beta.43 waits for.
2. **Read that log, then plan 0.1.0-beta.43** — `slSetConstants` and `ffxConfigure`, and the fix for D121 if the
log shows the route. What to look for: which `HOOK_INSTALLED` lines there are (which of the four ffx modules and
the FSR 3.0 host were patched); the `FFX_DISPATCH` lines — is `b=0x10001` (UPSCALE) on any module, or only
`0x20004` / `0x2000c` / `0x20003`; an `UPSCALE_ROUTE` line; `PATCH_FAILED`; the last `RUNTIME_CENSUS` word.
**No UPSCALE type anywhere and no route line means the upscale does not come through any export the Overlay
patches** — statically linked, or a module the inventory does not name — and then the fix is not a new arm in
a detour. The design for the two hooks, as the review left it, is the plan of 2026-11-12 (moved with the
section above) and these points: the new rows are gated at the top of `InstallByFamily`, **before**
`ResolveScoped`, and installed only once the process was ever asked; hook families 13 and 14 with latches of
their own; `slSetConstants` checks the struct's GUID and `structVersion ≥ 1` on every call and reads only
`jitterOffset`, `mvecScale`, `cameraNear` … `cameraAspectRatio` and the seven Booleans — never bytes 368..423,
pinned by `offsetof` of the allowed members; summaries from the first viewport seen; `ffxConfigure` has an
owner slot of its own and reads `frameGenerationEnabled`, `allowAsyncWorkloads`, `flags`,
`onlyPresentGenerated`, `generationRect` and nothing else; the detours also consult `MayObserve()`;
`overlay-fields-check` gains three parameter names, `structType` among the shared members and an `offsetof` per
listed `sl::Constants` member. The registry holds 48 and the worst case becomes 25
(`kPatchSitesOutsideTheInventory` stays 7; the inventory's row count goes from 13 to 18 and its
`static_assert` says so).
3. **0.1.0-beta.44** — `slGetFeatureVersion` and `slGetFeatureRequirements` — when the owner says beta.43 passed.
4. **Trains C and D** (beta.45, beta.46) each begin with a spike and end in the owner's go or no.
### Left open by this session
- ~~**This release's own facts** — the tag's run, the digests, the delta — are not in any file yet: the release is cut
after this text. Record them in the next pull request.~~ **Recorded 2026-11-12: 0.1.0-beta.41 was released
2026-11-11T22:38:39Z** (05:38 on the 12th in the owner's time zone) from the signed tag on `a6b95e8` (#402), by
run 43111028661 — green at the first attempt, one run for the one tag push. Eight assets; the seven digests of
`SHA256SUMS.txt` equal the ones GitHub computed; the shipped natives carry `FL_BUILD_ID v0.1.0-beta.41`. The delta
from beta.40 is 807,692 bytes beside a full package of 110,708,416 — "Delta processed 0452 files. 0022 patched,
0430 unchanged". The wiki was published by run 43113525941. The rehearsal on the release branch (run 43108189693)
had made a delta of 841,038 bytes with the same file counts.
- ~~**The fix has not been seen to work.** It was written from the log's timing; the fault needs an elevated Agent with
PawnIO. Item 39 is the check, and `20_OPEN_QUESTIONS` §M13 stays open until then.~~ **The owner's first seven
sessions on beta.41 show no fault** (2026-11-12, 06:38–07:01, read from the Agent's log and a copy of the ledger):
not one `advanced:` line, and every session with the option on stored its 212 or 213 series, the processor's 119
among them. On beta.40 the same morning the processor device faulted out after **each** of the six sessions
recorded between 04:34 and 05:07. The rarer fault — the reader failing to open — was one session in sixteen, so
seven clean ones do not yet say it is gone. ~~Whether item 39 has passed is the owner's to say.~~ The owner
marked it passed the same day.
- **What those sessions say of train B's first release** (the same log and ledger; the owner named which games are
first-person — Kingdom Come: Deliverance II, Cyberpunk 2077, Dying Light: The Beast, Valor Mortis — the rest
third-person, and Psycho-Sleuth 2D):
- **The first FSR 3.1 title read: Kingdom Come: Deliverance II** (FSR 3.1 chosen in the game;
`amd_fidelityfx_upscaler_dx12.dll` 4.0.2 behind the loader). Performance mode, 1280×720 to 2560×1440;
sharpening on at 0.5; `cameraNear` 0.05 and `cameraFar` 8000 — **both planes, the only title that gives both**;
one vertical field of view for the whole session, 63.1°; a reported frame time of 16.67 ms. A 41-second session
of the same game that never left its menu read nothing and says so.
- **Dying Light: The Beast** upscaling with FSR: sharpening off, 75.4°–78° vertical, 7.5 ms. **Clair Obscur**:
sharpening off, 5.7°–90.7° over four minutes. So far the two first-person titles hold a narrow range and the
two third-person ones a wide one (Lies of P 21.6°–73.7°) — what one would expect of cutscene and aiming
cameras, and no more than that: four titles.
- **Three engines give `cameraFar` alone, as a small number** — 10 (Lies of P), 1 (Clair Obscur), 0.1 (Dying
Light) — which is the near plane of an inverted, infinite depth with the other plane at `FLT_MAX`. That is the
case beta.42's plan has to decide.
- **Clair Obscur reports a frame time of 0.001 ms in some seconds.** It is what the game hands FSR, stored as it
was said; the lowest value of that series is not a frame time anyone saw.
- **Cyberpunk 2077 read nothing**, with FSR frame generation running and the render size known: its upscaling did
not come through an ffx-api upscale dispatch in those sessions. Which upscaler it was set to is the owner's to
say; `ffxConfigure` (beta.42) is where its frame generation would be read.
- **One session of Dying Light names DLSS as its upscaler and carries FSR's quality byte and render size** (81
seconds, both an FSR dispatch and a DLSS evaluation seen, "settings changed" not set). Not this train's code —
the session summary's choice between two upscalers seen in one session — and not looked into. **The owner,
2026-11-12: Dying Light and Expedition 33 were set, in the game, to FSR upscaling with DLSS frame generation.**
So "FSR beside DLSS frame generation" in their other sessions is the setting, not a misreading; in this one the
summary picked the wrong one of the two for its upscaler line, which is still to be looked at.
- **A session without consent says so**: two Cyberpunk sessions before its consent dialog was accepted are
Tier 2, and their Advanced row says *not measured inside the game*. **The option off stored nothing** again,
this time on a title that upscales with FSR 3.1 (Dying Light, beta.41).
- **This release's own facts** — the tag's run, the digests, the delta — are not in any file yet: the release is cut
after this text. Record them in the next pull request.
- **No real game was run on this build.** The four changes were tested with the harness and the cost measured on
the headers. Item 40 is the first real session.
- **Whether the missing plane of Lies of P, Clair Obscur and Dying Light is `FLT_MAX`** is still the reading their
small `cameraFar` values point to, not a measurement. Item 40 (c).
- **A flake with a cause now, and a question in it for the owner.**
`ShmDrainIntegrationTests.TheGuardInjectsTheOverlayAndTheReaderDrainsRealFrames` was red once in this release's
local gate (and once on 2026-11-11, when the assertion did not yet print the verdict): the supervisor's first
re-scan, 0.8 s after the injection, came back `ModuleScanFailed` — *a module list came back incomplete* — while
the harness was still loading modules. The same gate was green on the same code before and after. In the test
it is a re-run. **In a real session the same answer is a safety unhook**: a re-scan that cannot read the module
list of a game that is still running stops the session (`19_SAFETY` §During a session; D48 covers only a game
that has exited). Whether the guard should read the list a second time before refusing is a change to rule 2's
checks and is the owner's to decide; nothing was changed.
- **SonarCloud has not answered for #406–#409**: `main`'s `sonarcloud` job was cancelled by the next merge each
time. It runs to its end on this release's commit; read it then.
- **`LIMITATIONS.md` and the accuracy statement still say the processor's, the memory's and the motherboard's
sensors "have never been read on real hardware".** They have been read on one PC and compared with nothing. The
owner's to reword.
- **SonarCloud's `csharpsquid:S3869` on `ParentDump.cs`** is open on `main` until the owner accepts it again (it was item
38 (j), the one part of that item not done; the owner said on 2026-11-12 that they will). Until then `main`'s `sonarcloud` job is red on that one line.
- **Items 36 (d) (`LogNoteW`) and 37 are still open**; the ledger shows part of 37 (e) happened — the elevated
groups opened and read — and nothing of it was compared with another tool. The alpha line still rests (D98).
sensors "have never been read on real hardware"** — the owner's to reword. **SonarCloud's `csharpsquid:S3869` on
`ParentDump.cs`** is the owner's to accept. **Items 36 (d) and 37 are still open.** The alpha line still rests
(D98).
**Owner-only:** ~~item 39~~ passed 2026-11-12, with item 38. Nothing new is open from this release; items 36 (d)
and 37 still are.
**Owner-only:** item 40.
## Owner-only — no PR can close these
@@ -514,6 +468,21 @@ and 37 still are.
answered on 2026-11-11; what is left for a real game is the hooked session and the elevated one. (g) **The words**: the `vi` strings read as a Vietnamese
speaker would write them; the `ja` strings marked `review`. (h) **A copy of the ledger** (`--data-dir`) that holds
such a session: the page is there, opens on *Session*, and *This PC* says it is a copy.
40. **beta.42 — the log that answers D121, the label, the plane at infinity** (D119–D122). (a) **The update from
beta.41**: Help ▸ Check for updates, *Restart to update* with no game running; no terms window. (b) **Cyberpunk
2077 with FSR upscaling** (FSR 3 or 4, with or without FSR frame generation — as it was when the upscaler read
"unknown"): one session of a few minutes of play, then **quit the game from its own menu**. Nothing else is
needed: `%LOCALAPPDATA%\FrameLedger\logs\overlay-<pid>-….log` of that session is what is read. If the session
now names FSR, say so — nothing in this release should have changed that. (c) **A game that gave one depth
plane** — Lies of P, Clair Obscur or Dying Light: The Beast, FSR upscaling, **Advanced metrics on**: the
session's Advanced page shows both planes, one of them "∞". If it still shows one, the missing plane is not
`FLT_MAX` and the log of (b)'s kind says nothing about it — say so. (d) **A session that changes upscaler** —
Dying Light: The Beast as it was (DLSS evaluated, then FSR), or any game switched between DLSS and FSR in its
menu during one session: the summary names the one that ran longest, with that one's quality and render size,
and says *settings changed during session*. (e) **Any hooked game, ended by quitting it**: its overlay log has
lines after the first second — `HOOK_INSTALLED` with a module and a function, `RUNTIME_CENSUS` — and no
`PATCH_FAILED`; if there is one, its `a=` number is the reason.
**Answered 2026-08-05, do not re-ask:** remove `gameguard` and keep `guard` (approved
over a red `Rules` gate, with the reasoning recorded in the merge commit); vendor NVAPI
headers **and** `amd64/nvapi64.lib`; Windows 11 is the **measurement scope** only —
+62
View File
@@ -0,0 +1,62 @@
<!-- Moved from CHANGELOG.md's [Unreleased] when 0.1.0-beta.42 was cut, 2026-11-12 (D66). CHANGELOG.md lists every release. -->
## [0.1.0-beta.42] - 2026-11-12
**The forty-second pre-release: groundwork, and a log that can answer a question.** Four changes, none of which
adds a hook to a game. A session that saw two upscalers is now named after the one it ran — one real session had
been stored as "DLSS" with FSR's quality mode and FSR's render size. The part of FrameLedger inside the game can no
longer leave a hook in after it has stopped. Its log is now written during the session rather than only at the
start and the end, so it is whole after a game that simply exits, and it says which module each hook went into and
what kinds of call each AMD FidelityFX module received. And with **Advanced metrics** on, an FSR depth plane at
infinity is shown as "∞" where it used to be missing. The same unsigned installer: verify its hash against
`SHA256SUMS.txt`, then *More info → Run anyway*.
**What it is not, yet.** It does not fix a game whose upscaler reads "unknown" — Cyberpunk 2077 set to FSR is the
one known — it makes the next session of such a game say why, in `logs\overlay-<pid>-….log`. The two new readings
planned for Advanced metrics (the frame-generation settings a game gives FSR, and what a game tells Streamline
about each frame) are the next pre-release, after that log has been read. No real game has been run on this
build: the changes inside the game were tested with FrameLedger's own test program, and their cost was measured
on the code itself (about 4 billionths of a second per FidelityFX call for the log's new lines; nothing measurable
for the rest). Everything 0.1.0-beta.41's notes say is not yet done still stands.
**Updating from `0.1.0-beta.41`:** Help ▸ Check for updates, then *Restart to update* with no game running. No
terms to read again, no change to the ledger (schema 23), the detection rules stay at `2026.11.2`. **The code
loaded into a game changed in this release** — the first time since 0.1.0-beta.40 — so a game that was running
during the update keeps the old part until it is started again. Sessions already stored are not rewritten: one
that was named after the wrong upscaler keeps that name.
### Added
- **Advanced metrics: FSR's depth plane at infinity is shown as "∞".** Engines with an infinite depth range tell
FSR that one of the two camera planes is at infinity, and FrameLedger took that value for "not set" — so a
session's depth range showed one plane where the game had given two. The plane at infinity is now stored and
shown as such. Only for FSR, and only while Advanced metrics is on; nothing else about what is read changed.
### Changed
- **The Overlay's log is whole after a game exits, and says more.** The log FrameLedger's part inside the game
writes (`logs\overlay-<pid>-….log`) used to hold only the first half second of a session unless the session
ended while the game was still running: a game that exits takes the thread that writes the log with it. It is
now written during the session, whenever something new was noted. Each hook that went in is named by its module
and function (four AMD modules used to be four identical lines), a hook that could not go in says why, and the
log lists which kinds of call each AMD FidelityFX module received and which upscaling and frame-generation
modules the game loaded, and when. This is for finding out why a game's upscaler reads "unknown" — nothing in
it is a measurement, and nothing from it is stored in a session. Measured cost: about 4 billionths of a second
per FidelityFX call.
### Fixed
- **The part inside the game can no longer leave a hook in after it has stopped.** Two gaps in how the Overlay keeps
track of its own patches, found by reading the code and not by a failure: a patch made while the table of patches
was full would have been made anyway and never taken out, and a stop that arrived at the exact moment a hook was
going in could miss it. A patch now takes its place in the table before it is made — no place, no patch — and is
recorded before it can run, so the stop either removes it or the installer does. A patch that could not be made
is written to the Overlay's log with the reason, where it used to be silent. No hook's own code changed.
- **A session that saw two upscalers is named after the one it ran, with that one's quality and render size.** The
session's upscaler used to be the first one FrameLedger saw named, while the quality mode and the render size
came from whichever frames carried them. A game that evaluated DLSS briefly and then ran FSR was stored as "DLSS"
with FSR's quality and FSR's render size. The name is now the technology named on the most frames, the quality
and the size are read from that technology's frames only, and such a session is marked "settings changed during
session". What that technology did not say reads N/A rather than borrowing the other's value. Sessions already
stored are not rewritten.
+131
View File
@@ -0,0 +1,131 @@
# HANDOFF history — 0.1.0-beta.41
*Moved verbatim from `docs/HANDOFF.md` when 0.1.0-beta.42 was cut, 2026-11-12 (owner decision D66); `docs/HANDOFF.md` §How this file is split lists every part. Nothing below was edited, so its "below" and "above" mean HANDOFF.md as it stood then, and a path it writes is relative to `docs/`. **Its release numbers are those of the hour it was written**: its item 3 calls train B's third step beta.43 and its item 4 calls trains C and D beta.44 and beta.45 — since D122, later the same day, they are beta.44, beta.45 and beta.46, and beta.43 is the two new hooks.*
## **START HERE** — 2026-11-12, 0.1.0-beta.41: one fix — the sensor library is no longer closed under its other users
*Status is `docs/changelog/0.1.0-beta.41.md`; this is what no other file carries.* 0.1.0-beta.40 was released in the
small hours of 2026-11-12 and the owner ran it that same night on eight games, as administrator with PawnIO — the
first elevated run there has been. A copy of the ledger and the Agent's log showed the in-game readings working
(Lies of P, the first real game read) and **a defect of train A that only that elevation can show**: three
LibreHardwareMonitor `Computer`s in one Agent, and the library's per-process state closed by one under the others.
This release is that fix and nothing else: #400 (0.1.0-beta.40's release facts; two comparisons SonarCloud flagged),
#401 (`LhmLibrary`), and this one. **Everything about train B — what was built, what the owner's sessions showed,
the traps — is [`handoff/history/0.1.0-beta.40.md`](handoff/history/0.1.0-beta.40.md)**; the fix is
[`18_GPU_VENDOR_APIS.md`](18_GPU_VENDOR_APIS.md) §Advanced metrics and [`20_OPEN_QUESTIONS.md`](20_OPEN_QUESTIONS.md)
§M13.
### What this release decided
- **D118 — the fix is released at once as 0.1.0-beta.41, and train B's numbers move by one.** D113 had named
beta.41 for the train's second release. Told so, the owner chose to release the fix now. The train's second
release is **beta.42**, its third **beta.43**, train C **beta.44**, train D **beta.45**. Released changelogs and
moved HANDOFF sections keep the numbers of their day; so do the comments in `fl_shm.h` and `ShmLayout.cs` (the
members "0.1.0-beta.41" and "beta.42" fill), **deliberately**: touching them would have changed source that is
loaded into a game in a release that says the game-side code is beta.40's line for line. The release that fills
a member rewrites its comment.
- **The reads of the sensor library are not put under one lock**, only its opens and closes. A lock around every
read would have put a session's once-a-second poll behind the Advanced reader's, undoing the separate threads
that keep a hanging sensor from holding up the other reader.
### NEXT
1. ~~**The owner runs item 39** (this fix, on the PC that showed the fault) **and the rest of item 38** (an FSR 3.1+
title; two sessions of one running game; the cost; the values of Lies of P against the game's own settings).~~
**Both passed on 2026-11-12, on the owner's word** ("Bạn có thể đánh dấu là pass và tiếp tục") after the thirteen
sessions below; [`handoff/owner-only-passed.md`](handoff/owner-only-passed.md) says what those sessions covered and
what they did not.
2. **Planned and approved 2026-11-12 (D119–D122): the second step is two releases.** **0.1.0-beta.42 has no new
patch site** — five pull requests: (1) the session's upscaler label (D120); (2) the Overlay's patch registry
refuses a patch it cannot register, and registers before it enables; (3) the native log is flushed whenever
something new was logged, every inventory row's install line names its module and symbol, a failed patch says
why, and the first sight of each ffx descriptor type on each module is logged — so that one Cyberpunk session on
beta.42 says where its upscale goes (D121); (4) FSR's infinite depth plane (D119); (5) the release, owner-only
item 40. **0.1.0-beta.43 is the two new hooks** and begins only when that log was read; its design — reviewed
against the code, which changed it — is in the plan of that day and below. What the review found that the first
draft had wrong: there is no "dominant segment" (segments split on output size only), so the label is the modal
name over the dominant stream; the patch table drops a patch silently when full; the init thread's flush runs
after the watchdog starts; a second NaN pattern for "infinite" would have been dropped by the Agent — real
+infinity is stored instead; the new rows must be gated before `ResolveScoped`, which takes a module reference a
call; `slSetConstants` needs the struct's GUID checked on every call; `ffxConfigure` needs an owner slot of its
own; summaries across viewports must come from the first viewport seen.
~~**0.1.0-beta.42 — train B's second release — when the owner says item 38 passed begins now, with its plan**~~: `slSetConstants` and
`ffxConfigure`. A plan of its own first. What it must settle, beside what
[`handoff/history/0.1.0-beta.40.md`](handoff/history/0.1.0-beta.40.md) §NEXT lists (`kMaxPatches = 48`, the window
of `sl::Constants` pinned outside the camera members, the per-call overhead, the gate's list for the two new
structs):
- ~~**`FLT_MAX` in an FSR depth plane.** Lies of P gave `cameraFar = 10` and no `cameraNear`; most likely the
plane at infinity is `FLT_MAX`, which the Overlay refuses as "nobody set this". Decide whether it is stored as
"infinite" — an Overlay change, with its overhead stated.~~ *(Decided, D119, and built in beta.42:
`FL_ADV_FLOAT_INFINITE`, shown "∞". Whether Lies of P's missing plane IS `FLT_MAX` is still the hypothesis it
was — item 40 reads it.)*
- ~~**Valor Mortis.** One exit by access violation 51 seconds after injection under beta.40, none under an earlier
build, not attributed. Its crash count is 1; a second such end switches its hooking off. Before adding a hook
to that game's process, ask the owner whether it happened again.~~ **Answered by the owner, 2026-11-12: it was
the game's own — a shader-compilation error on entering the game, shown in the game's own crash dialog.** Not
FrameLedger's. It ran normally under beta.41 afterwards. Its crash count still stands at 1, because the crash
policy counts an abnormal end within 60 seconds of injection whoever caused it: a second one, from any cause,
switches its hooking off, and the owner then switches it on again from the game's page.
- **The release numbers in the comments** of `fl_shm.h`, `ShmLayout.cs`, `hook-harness` and `guard_test.cpp` for
the members that release fills (D118).
3. **0.1.0-beta.43 — the third — when the owner says the one before passed**: `slGetFeatureVersion` and
`slGetFeatureRequirements`.
4. **Trains C and D** (beta.44, beta.45) each begin with a spike and end in the owner's go or no.
### Left open by this session
- ~~**This release's own facts** — the tag's run, the digests, the delta — are not in any file yet: the release is cut
after this text. Record them in the next pull request.~~ **Recorded 2026-11-12: 0.1.0-beta.41 was released
2026-11-11T22:38:39Z** (05:38 on the 12th in the owner's time zone) from the signed tag on `a6b95e8` (#402), by
run 43111028661 — green at the first attempt, one run for the one tag push. Eight assets; the seven digests of
`SHA256SUMS.txt` equal the ones GitHub computed; the shipped natives carry `FL_BUILD_ID v0.1.0-beta.41`. The delta
from beta.40 is 807,692 bytes beside a full package of 110,708,416 — "Delta processed 0452 files. 0022 patched,
0430 unchanged". The wiki was published by run 43113525941. The rehearsal on the release branch (run 43108189693)
had made a delta of 841,038 bytes with the same file counts.
- ~~**The fix has not been seen to work.** It was written from the log's timing; the fault needs an elevated Agent with
PawnIO. Item 39 is the check, and `20_OPEN_QUESTIONS` §M13 stays open until then.~~ **The owner's first seven
sessions on beta.41 show no fault** (2026-11-12, 06:38–07:01, read from the Agent's log and a copy of the ledger):
not one `advanced:` line, and every session with the option on stored its 212 or 213 series, the processor's 119
among them. On beta.40 the same morning the processor device faulted out after **each** of the six sessions
recorded between 04:34 and 05:07. The rarer fault — the reader failing to open — was one session in sixteen, so
seven clean ones do not yet say it is gone. ~~Whether item 39 has passed is the owner's to say.~~ The owner
marked it passed the same day.
- **What those sessions say of train B's first release** (the same log and ledger; the owner named which games are
first-person — Kingdom Come: Deliverance II, Cyberpunk 2077, Dying Light: The Beast, Valor Mortis — the rest
third-person, and Psycho-Sleuth 2D):
- **The first FSR 3.1 title read: Kingdom Come: Deliverance II** (FSR 3.1 chosen in the game;
`amd_fidelityfx_upscaler_dx12.dll` 4.0.2 behind the loader). Performance mode, 1280×720 to 2560×1440;
sharpening on at 0.5; `cameraNear` 0.05 and `cameraFar` 8000 — **both planes, the only title that gives both**;
one vertical field of view for the whole session, 63.1°; a reported frame time of 16.67 ms. A 41-second session
of the same game that never left its menu read nothing and says so.
- **Dying Light: The Beast** upscaling with FSR: sharpening off, 75.4°–78° vertical, 7.5 ms. **Clair Obscur**:
sharpening off, 5.7°–90.7° over four minutes. So far the two first-person titles hold a narrow range and the
two third-person ones a wide one (Lies of P 21.6°–73.7°) — what one would expect of cutscene and aiming
cameras, and no more than that: four titles.
- **Three engines give `cameraFar` alone, as a small number** — 10 (Lies of P), 1 (Clair Obscur), 0.1 (Dying
Light) — which is the near plane of an inverted, infinite depth with the other plane at `FLT_MAX`. That is the
case beta.42's plan has to decide.
- **Clair Obscur reports a frame time of 0.001 ms in some seconds.** It is what the game hands FSR, stored as it
was said; the lowest value of that series is not a frame time anyone saw.
- **Cyberpunk 2077 read nothing**, with FSR frame generation running and the render size known: its upscaling did
not come through an ffx-api upscale dispatch in those sessions. Which upscaler it was set to is the owner's to
say; `ffxConfigure` (beta.42) is where its frame generation would be read.
- **One session of Dying Light names DLSS as its upscaler and carries FSR's quality byte and render size** (81
seconds, both an FSR dispatch and a DLSS evaluation seen, "settings changed" not set). Not this train's code —
the session summary's choice between two upscalers seen in one session — and not looked into. **The owner,
2026-11-12: Dying Light and Expedition 33 were set, in the game, to FSR upscaling with DLSS frame generation.**
So "FSR beside DLSS frame generation" in their other sessions is the setting, not a misreading; in this one the
summary picked the wrong one of the two for its upscaler line, which is still to be looked at.
- **A session without consent says so**: two Cyberpunk sessions before its consent dialog was accepted are
Tier 2, and their Advanced row says *not measured inside the game*. **The option off stored nothing** again,
this time on a title that upscales with FSR 3.1 (Dying Light, beta.41).
- **`LIMITATIONS.md` and the accuracy statement still say the processor's, the memory's and the motherboard's
sensors "have never been read on real hardware".** They have been read on one PC and compared with nothing. The
owner's to reword.
- **SonarCloud's `csharpsquid:S3869` on `ParentDump.cs`** is open on `main` until the owner accepts it again (it was item
38 (j), the one part of that item not done; the owner said on 2026-11-12 that they will). Until then `main`'s `sonarcloud` job is red on that one line.
- **Items 36 (d) (`LogNoteW`) and 37 are still open**; the ledger shows part of 37 (e) happened — the elevated
groups opened and read — and nothing of it was compared with another tool. The alpha line still rests (D98).
**Owner-only:** ~~item 39~~ passed 2026-11-12, with item 38. Nothing new is open from this release; items 36 (d)
and 37 still are.
+1 -1
View File
@@ -12,7 +12,7 @@
HTML comments are not part of the block.
-->
> ⚠ **What FrameLedger actually measures today — 2026-11-11.** The software is a beta; its latest
> **beta is `0.1.0-beta.41`** (2026-11-12), an unsigned installer built from that tag with its
> **beta is `0.1.0-beta.42`** (2026-11-12), an unsigned installer built from that tag with its
> checksums published beside it (alphas — experimental builds that try a newer .NET — are published apart). The source holds the desktop app
> (library, store import, charts, settings) and the background Agent, which records a session when a
> game in the library runs (unless you switched its recording off), injects only into games you enabled
+1 -1
View File
@@ -121,7 +121,7 @@ Frame timing is derived from high-resolution timestamps taken at the moment the
<!-- accuracy-block:begin -->
> ⚠ **What FrameLedger actually measures today — 2026-11-11.** The software is a beta; its latest
> **beta is `0.1.0-beta.41`** (2026-11-12), an unsigned installer built from that tag with its
> **beta is `0.1.0-beta.42`** (2026-11-12), an unsigned installer built from that tag with its
> checksums published beside it (alphas — experimental builds that try a newer .NET — are published apart). The source holds the desktop app
> (library, store import, charts, settings) and the background Agent, which records a session when a
> game in the library runs (unless you switched its recording off), injects only into games you enabled
@@ -193,8 +193,8 @@ public sealed class InGameAdvancedSampler
}
var depth = new List<AdvancedRow>(3);
AddNumber(depth, "cameraNear", s.FfxNearBits);
AddNumber(depth, "cameraFar", s.FfxFarBits);
AddDepthPlane(depth, "cameraNear", s.FfxNearBits);
AddDepthPlane(depth, "cameraFar", s.FfxFarBits);
// A range, lowest to highest - never a series, which would say when the player aimed (D114).
if (Number(s.FfxFovMinBits) is double low && Number(s.FfxFovMaxBits) is double high)
{
@@ -232,6 +232,19 @@ public sealed class InGameAdvancedSampler
}
}
// A depth plane of FSR's: a number, or the plane at infinity (owner decision D119) - which Number, rightly for every
// other field, takes for no value at all.
private static void AddDepthPlane(List<AdvancedRow> rows, string member, uint bits)
{
if (bits == FlAdvancedState.FloatInfinite)
{
rows.Add(new AdvancedRow(member, "∞"));
return;
}
AddNumber(rows, member, bits);
}
private static void AddNumber(List<AdvancedRow> rows, string member, uint bits)
{
if (Number(bits) is double value)
@@ -75,12 +75,16 @@ internal static class OverlayLog
}
}
/// <summary>Faults, the stop, unhook decisions, a missing symbol, supervision loss — never the routine installs.</summary>
/// <summary>
/// Faults, the stop, unhook decisions, a missing symbol, a patch that did not go in, supervision loss — never the
/// routine installs.
/// </summary>
private static bool IsWorthPrinting(string line) =>
line.StartsWith('+', StringComparison.Ordinal)
&& (line.Contains(" FAULT ", StringComparison.Ordinal)
|| line.Contains(" STOP ", StringComparison.Ordinal)
|| line.Contains(" UNHOOK_", StringComparison.Ordinal)
|| line.Contains(" SYMBOL_MISSING ", StringComparison.Ordinal)
|| line.Contains(" PATCH_FAILED ", StringComparison.Ordinal)
|| line.Contains(" SUPERVISION_LOST ", StringComparison.Ordinal));
}
+12 -4
View File
@@ -755,13 +755,13 @@ public enum FlAdvancedValid : uint
/// <summary>The game asked <c>ffxQuery</c> for the upscaler's memory, and it answered.</summary>
FfxMemory = 1u << 2,
/// <summary>0.1.0-beta.41: <c>ffxConfigure</c> with a frame-generation descriptor was seen.</summary>
/// <summary>0.1.0-beta.43 (D118, D122): <c>ffxConfigure</c> with a frame-generation descriptor was seen.</summary>
FfxFgConfig = 1u << 3,
/// <summary>0.1.0-beta.41: <c>slSetConstants</c> was seen.</summary>
/// <summary>0.1.0-beta.43 (D118, D122): <c>slSetConstants</c> was seen.</summary>
SlConstants = 1u << 4,
/// <summary>0.1.0-beta.42: at least one feature slot is filled.</summary>
/// <summary>0.1.0-beta.44 (D118, D122): at least one feature slot is filled.</summary>
SlFeatures = 1u << 5,
}
@@ -788,6 +788,14 @@ public unsafe struct FlAdvancedState
/// <summary>A float nobody saw: the bits no detour stores.</summary>
public const uint FloatNone = 0xFFFFFFFFu;
/// <summary>
/// The plane at infinity (0.1.0-beta.42, owner decision D119): +infinity's own bits, in <see cref="FfxNearBits"/>
/// or <see cref="FfxFarBits"/> and in no other field. An engine with an infinite depth hands FSR
/// <c>FLT_MAX</c> or +infinity for one plane; the Overlay stores either as this. Never from Streamline, whose
/// <c>FLT_MAX</c> is "not set".
/// </summary>
public const uint FloatInfinite = 0x7F800000u;
/// <summary>How many feature slots <see cref="Features"/> holds.</summary>
public const int FeatureSlots = 12;
@@ -942,7 +950,7 @@ public unsafe struct FlAdvancedState
/// <summary>Must be zero.</summary>
public fixed uint ReservedSl[3];
/// <summary><see cref="FeatureSlots"/> slots of <see cref="FeatureWords"/> words each (0.1.0-beta.42).</summary>
/// <summary><see cref="FeatureSlots"/> slots of <see cref="FeatureWords"/> words each (0.1.0-beta.44).</summary>
public fixed uint Features[FeatureSlots * FeatureWords];
}
@@ -57,6 +57,18 @@ inline bool Usable(float v) noexcept {
return (std::bit_cast<uint32_t>(v) & 0x7FFFFFFFu) < 0x7F7FFFFFu;
}
// A depth plane as FSR is handed one (owner decision D119): an ordinary value as its bits; FLT_MAX or +infinity --
// how an engine with an infinite depth says "this plane is at infinity" -- as FL_ADV_FLOAT_INFINITE; anything else
// (a NaN, a negative infinity, -FLT_MAX) as "no value". FOR THE ffx ROUTE ONLY: Streamline's INVALID_FLOAT is
// FLT_MAX and means nobody set it, which is why Usable refuses it everywhere else.
inline uint32_t FfxDepthPlaneBits(float v) noexcept {
const uint32_t bits = std::bit_cast<uint32_t>(v);
if (Usable(v)) {
return bits;
}
return bits == 0x7F7FFFFFu || bits == FL_ADV_FLOAT_INFINITE ? FL_ADV_FLOAT_INFINITE : FL_ADV_FLOAT_NONE;
}
inline float Magnitude(float v) noexcept {
return std::bit_cast<float>(std::bit_cast<uint32_t>(v) & 0x7FFFFFFFu);
}
@@ -237,11 +249,12 @@ inline void ObserveFfxUpscale(uint32_t leaf, const ffxDispatchDescUpscale& d, Ac
KeepMax(a.ffxPreExposureMaxBits, d.preExposure);
}
if (Usable(d.cameraNear)) {
a.ffxNearBits.store(std::bit_cast<uint32_t>(d.cameraNear), std::memory_order_relaxed);
// The two depth planes, the last of each; one of them may be at infinity (D119).
if (const uint32_t nearBits = FfxDepthPlaneBits(d.cameraNear); nearBits != FL_ADV_FLOAT_NONE) {
a.ffxNearBits.store(nearBits, std::memory_order_relaxed);
}
if (Usable(d.cameraFar)) {
a.ffxFarBits.store(std::bit_cast<uint32_t>(d.cameraFar), std::memory_order_relaxed);
if (const uint32_t farBits = FfxDepthPlaneBits(d.cameraFar); farBits != FL_ADV_FLOAT_NONE) {
a.ffxFarBits.store(farBits, std::memory_order_relaxed);
}
// The field of view as a range (owner decision D114): the lowest and the highest, never a series.
if (Usable(d.cameraFovAngleVertical) && d.cameraFovAngleVertical > 0.0f) {
@@ -0,0 +1,119 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
// Which descriptor types an ffx-api module was handed, for the native log
// (17_HOOK_ENGINE §Native logging; 0.1.0-beta.42, owner decision D121).
//
// WHY. Cyberpunk 2077, set to FSR upscaling with FSR frame generation, was
// recorded with frame generation measured and the upscaler "unknown": the
// PREPARE and FRAMEGENERATION dispatches arrived and no UPSCALE dispatch ever
// did. Nothing in the field could say where the upscale went -- the record
// carries what was decoded, never what was not. This keeps, per hooked module
// and per entry point, the distinct values of the one member every ffx-api
// descriptor starts with -- its `type`, which the detours read already to choose
// an arm -- and the watchdog writes each to the log the first time it is seen.
// One session's log then says which module was called with what.
//
// NOT A MEASUREMENT AND NOT GATED BY ADVANCED METRICS: it is a diagnostic, like
// HOOK_INSTALLED. It reaches the log file and nothing else -- no record, no
// region of the shared memory, no session.
//
// THE HOOK'S SHARE IS A FEW LOADS. A type already kept costs one relaxed load
// per slot up to its own and no write; a title sends two to four distinct types
// per module, so that is two to four loads a call. A NEW type costs one
// compare-exchange, once. Slots fill in order and are never cleared, so the
// watchdog's "how many have I logged" is a prefix length. No allocation, no
// lock, no logging here (rule 5); nothing is read but the value passed in
// (rule 4).
//
// Header-only so the cost is measured on this code itself and ctest fl_ffx_types
// drives it without the Overlay.
#ifndef FRAMELEDGER_FL_FFX_TYPES_H
#define FRAMELEDGER_FL_FFX_TYPES_H
#include <atomic>
#include <cstdint>
namespace fl::ffxtypes {
inline constexpr std::uint32_t kSlots = 8;
// What did not fit, OR'd into Seen::more.
enum More : std::uint32_t {
kMoreTypes = 1u << 0, // a ninth distinct type arrived: the eight kept are not all there were
kMoreZero = 1u << 1, // a descriptor whose type was 0 arrived (0 is the empty slot, so it has no slot)
};
struct alignas(64) Seen {
std::atomic<std::uint64_t> types[kSlots]{};
std::atomic<std::uint32_t> more{0};
// Filled out to two cache lines by hand, so that the words another module's detour reads are never on a line
// this one writes -- and so that the padding is stated rather than left to the compiler (C4324).
std::uint8_t reserved[60]{};
};
static_assert(sizeof(Seen) == 128, "two cache lines: eight types, the More word, and the stated padding");
namespace detail {
inline void NoteMore(Seen& seen, std::uint32_t bit) noexcept {
// Read first: once the bit is set, a title that sends such a descriptor every frame writes nothing.
if ((seen.more.load(std::memory_order_relaxed) & bit) == 0u) {
seen.more.fetch_or(bit, std::memory_order_relaxed);
}
}
} // namespace detail
// Hook path. Keep `type` if it is new.
inline void Note(Seen& seen, std::uint64_t type) noexcept {
if (type == 0u) {
detail::NoteMore(seen, kMoreZero);
return;
}
for (std::atomic<std::uint64_t>& slot : seen.types) {
std::uint64_t kept = slot.load(std::memory_order_relaxed);
if (kept == type) {
return;
}
if (kept == 0u) {
if (slot.compare_exchange_strong(kept, type, std::memory_order_relaxed)) {
return;
}
if (kept == type) {
return; // another thread kept the same type in this slot first
}
// ...or a different one: this slot is taken, the next is tried.
}
}
detail::NoteMore(seen, kMoreTypes);
}
// Watchdog side: how far one Seen has been written to the log.
struct Reported {
std::uint32_t types = 0; // slots [0, types) are in the log
std::uint32_t more = 0; // More bits already in the log
};
// Calls onType(type) for every kept type not reported yet, in the order they were kept, and onMore(bits) for More
// bits not reported yet. One thread per Reported.
template <class OnType, class OnMore>
void ReportNew(const Seen& seen, Reported& reported, OnType&& onType, OnMore&& onMore) noexcept {
while (reported.types < kSlots) {
const std::uint64_t type = seen.types[reported.types].load(std::memory_order_relaxed);
if (type == 0u) {
break;
}
onType(type);
++reported.types;
}
const std::uint32_t more = seen.more.load(std::memory_order_relaxed);
if (const std::uint32_t fresh = more & ~reported.more; fresh != 0u) {
onMore(fresh);
reported.more |= fresh;
}
}
} // namespace fl::ffxtypes
#endif // FRAMELEDGER_FL_FFX_TYPES_H
@@ -383,6 +383,52 @@ inline constexpr uint32_t kRowCount = 0u FL_HOOK_INVENTORY(FL_COUNT_ROW);
#undef FL_COUNT_ROW
static_assert(kRowCount == 13u, "a row was added or removed: say so here, and in 17_HOOK_ENGINE §Hook inventory");
// A row's "module!symbol", for the native log, built at compile time from the row's own two spellings -- so an
// install line names the module it patched, and no second list of names exists to drift from the table
// (0.1.0-beta.42). The module names are ASCII by the table's own spelling; the assert below keeps every row inside
// the text, so no two rows can log the same truncated name.
struct RowName {
char text[72]{};
};
constexpr RowName NameOfRow(const wchar_t* moduleName, const char* symbol) noexcept {
RowName name{};
size_t i = 0;
for (; *moduleName != L'\0' && i + 1 < sizeof(name.text); ++moduleName) {
name.text[i++] = static_cast<char>(*moduleName);
}
if (i + 1 < sizeof(name.text)) {
name.text[i++] = '!';
}
for (; *symbol != '\0' && i + 1 < sizeof(name.text); ++symbol) {
name.text[i++] = *symbol;
}
return name;
}
constexpr size_t LengthW(const wchar_t* text) noexcept {
size_t n = 0;
while (text[n] != L'\0') {
++n;
}
return n;
}
constexpr size_t LengthA(const char* text) noexcept {
size_t n = 0;
while (text[n] != '\0') {
++n;
}
return n;
}
constexpr bool EveryRowNameFits() noexcept {
#define FL_ROW_NAME_FITS(mod, sym, family) \
if (LengthW(mod) + 1 + LengthA(sym) + 1 > sizeof(RowName::text)) { \
return false; \
}
FL_HOOK_INVENTORY(FL_ROW_NAME_FITS)
#undef FL_ROW_NAME_FITS
return true;
}
static_assert(EveryRowNameFits(), "a row's module!symbol does not fit RowName::text -- widen it, and the log event's");
// The FSR 3.0 host module and the one symbol dllmain's ffx arm keys on for it. Named
// constants HERE, for the reason kModuleSlInterposer gives below, and bound to the
// table so the row and the arm cannot drift apart.
+127 -21
View File
@@ -50,6 +50,7 @@
#include <fl_d3d12_vtable.h>
#include <fl_dxgi_count.h>
#include <fl_dxgi_vtable.h>
#include <fl_ffx_types.h>
#include <fl_hook_inventory.h>
#include <fl_patch_check.h>
#include <fl_patch_registry.h>
@@ -134,6 +135,15 @@ void PublishHandshake() noexcept {
// present path. No allocation anywhere: the ring, the format buffer and the path
// are static; the one system call that could allocate (SHGetKnownFolderPath)
// runs on the init/watchdog thread and is freed at once.
//
// AND, SINCE 0.1.0-beta.42, BY THE WATCHDOG WHENEVER SOMETHING NEW WAS LOGGED. A
// game that exits takes the watchdog with it: nothing asks for a flush and no
// stop runs, so the file held what init wrote and nothing after -- the first
// half second of a session. Cyberpunk 2077's upscaler read "unknown" (D121) and
// the log that should have said which hooks went in and what they were handed
// ended before the game had loaded its upscaler. Events are few and bounded
// (installs, a handful of first sights, three faults at most), so this is a few
// appends per session, on the watchdog's own tick.
// ---------------------------------------------------------------------------
enum FlLogCode : uint32_t {
kLogRingCreated = 1,
@@ -149,6 +159,10 @@ enum FlLogCode : uint32_t {
kLogTolerance,
kLogStopFlushed,
kLogPatchFailed,
kLogFfxDispatchType,
kLogFfxQueryType,
kLogUpscaleRoute,
kLogRuntimeCensus,
};
const char* LogCodeName(uint32_t code) noexcept {
@@ -179,18 +193,31 @@ const char* LogCodeName(uint32_t code) noexcept {
return "STOP_FLUSHED";
case kLogPatchFailed:
return "PATCH_FAILED";
case kLogFfxDispatchType:
return "FFX_DISPATCH";
case kLogFfxQueryType:
return "FFX_QUERY";
case kLogUpscaleRoute:
return "UPSCALE_ROUTE";
case kLogRuntimeCensus:
return "RUNTIME_CENSUS";
default:
return "?";
}
}
// 72 characters of text since 0.1.0-beta.42 (40 until then): an install line names its module AND its symbol, and
// "amd_fidelityfx_framegeneration_dx12.dll!ffxDispatch" is 51.
struct FlLogEvent {
uint64_t qpc;
uint32_t code;
uint32_t a;
uint64_t b;
char text[40];
char text[72];
};
static_assert(sizeof(FlLogEvent) == 96, "the native log's event: 256 of them are static storage in a game's process");
static_assert(sizeof(fl::inventory::RowName::text) <= sizeof(FlLogEvent::text),
"a row's module!symbol name must fit an event's text, or two rows could log the same truncated name");
constexpr uint32_t kLogCapacity = 256;
FlLogEvent g_log[kLogCapacity]{};
@@ -228,7 +255,7 @@ void LogNote(uint32_t code, const char* text, uint32_t a = 0, uint64_t b = 0) no
// Narrow ASCII copy of a module name for the log; anything outside ASCII is '?'.
void LogNoteW(uint32_t code, const wchar_t* text, uint32_t a = 0, uint64_t b = 0) noexcept {
char narrow[40]{};
char narrow[sizeof(FlLogEvent::text)]{};
size_t i = 0;
for (; text != nullptr && i + 1 < sizeof(narrow) && text[i] != L'\0'; ++i) {
narrow[i] = (text[i] < 128) ? static_cast<char>(text[i]) : '?';
@@ -333,6 +360,14 @@ void FlushLog(bool lastFlush = false) noexcept {
CloseHandle(h);
}
// The watchdog's own flush: only when something was logged since the last one, so an uneventful second costs one
// load and opens no file. Watchdog thread only -- see FlushLog.
void FlushLogIfNew() noexcept {
if (g_logNext.load(std::memory_order_acquire) != g_logFlushed) {
FlushLog();
}
}
// ---------------------------------------------------------------------------
// The patch registry (17_HOOK_ENGINE §Unhooking; P1 item 4). Every MinHook
// patch this DLL installs is recorded here so the stop can ask, per patch,
@@ -935,7 +970,7 @@ void StopObserving(uint32_t reason) noexcept {
// cannot reuse InstallRow because its targets come from a VTABLE rather than from a
// name; the LoadLibrary detour was the third, and until 0.1.0-beta.42 it carried a
// copy of the sequence with the re-check left out.
bool PatchTarget(void* target, void* detour, void** original, const char* name = "hook") noexcept {
bool PatchTarget(void* target, void* detour, void** original, const char* name) noexcept {
const fl::patch::InstallResult result =
fl::patch::Install(g_patches, g_observing, MinHookEngine{}, target, detour, original, name);
if (result == fl::patch::InstallResult::Installed) {
@@ -1878,6 +1913,14 @@ void NoteFfxExtent(const FfxApiDimensions2D& size) noexcept {
NoteFfxExtent(size.width, size.height);
}
// Which descriptor types each hooked ffx-api module was handed, per entry point, for the native log (fl_ffx_types.h;
// D121). The detours keep a type the first time it is seen; the watchdog writes it. A diagnostic: nothing here reaches
// a record or the shared memory.
fl::ffxtypes::Seen g_ffxDispatchTypes[fl::inventory::kFfxLeafCount];
fl::ffxtypes::Seen g_ffxQueryTypes[fl::inventory::kFfxLeafCount];
fl::ffxtypes::Reported g_ffxDispatchTypesLogged[fl::inventory::kFfxLeafCount]; // watchdog only
fl::ffxtypes::Reported g_ffxQueryTypesLogged[fl::inventory::kFfxLeafCount]; // watchdog only
// The answer one query returned, kept for the dispatch arm. Read only after the vendor answered OK; a mode, a size or a
// ratio the byte or the match cannot carry is not kept.
void ObserveFfxQuery(uint32_t leaf, const ffxQueryDescHeader* desc) noexcept {
@@ -1962,6 +2005,7 @@ void ObserveFfxDispatch(uint32_t leaf, const ffxDispatchDescHeader* desc) noexce
if (desc == nullptr) {
return;
}
fl::ffxtypes::Note(g_ffxDispatchTypes[leaf], desc->type);
switch (desc->type) {
case FFX_API_DISPATCH_DESC_TYPE_UPSCALE: {
const auto* up = reinterpret_cast<const ffxDispatchDescUpscale*>(desc);
@@ -2065,8 +2109,14 @@ ffxReturnCode_t Hook_FfxQueryT(ffxContext* context, ffxQueryDescHeader* desc) {
static_assert(Leaf < fl::inventory::kFfxLeafCount, "a trampoline per leaf, and no more");
const ffxReturnCode_t rc = g_origFfxQuery[Leaf](context, desc);
FL_HOOK_GUARD({
if (rc == FFX_API_RETURN_OK && MayObserve()) {
ObserveFfxQuery(Leaf, desc);
if (MayObserve()) {
// The type is kept whatever the vendor answered: a query that was refused is still a query that was made.
if (desc != nullptr) {
fl::ffxtypes::Note(g_ffxQueryTypes[Leaf], desc->type);
}
if (rc == FFX_API_RETURN_OK) {
ObserveFfxQuery(Leaf, desc);
}
}
})
return rc;
@@ -2220,6 +2270,8 @@ void PublishHookFamily(uint32_t family, std::atomic<uint32_t>& live) noexcept {
// upscaler runtime in this process" -- which is not the same question as "did the
// title generate frames", and fl_shm.h spends a section on why it must not be
// read as one.
uint32_t g_runtimeCensusLogged = 0; // watchdog only
void PublishRuntimeCensus() noexcept {
if (g_state == nullptr) {
return;
@@ -2227,6 +2279,42 @@ void PublishRuntimeCensus() noexcept {
const uint32_t seen = fl::inventory::ObserveRuntimeModules();
std::atomic_ref<uint32_t> census{g_state->runtimeCensus};
census.fetch_or(seen, std::memory_order_relaxed);
// The same word in the log whenever it gains a bit (0.1.0-beta.42): `b` is the whole census so far, so the last
// such line of a session's log is the census the session ended with, and the time of each line is when a
// runtime appeared.
if ((seen & ~g_runtimeCensusLogged) != 0u) {
g_runtimeCensusLogged |= seen;
LogNote(kLogRuntimeCensus, "FlRuntimeCensus bits (fl_shm.h)", 0u, g_runtimeCensusLogged);
}
}
// The diagnostics the watchdog writes from what the detours kept (0.1.0-beta.42, D121): each descriptor type a hooked
// ffx-api module was handed, once -- FFX_DISPATCH / FFX_QUERY, the module, b = the type; a = More bits and b = 0 for
// what did not fit -- and each source an UPSCALE came from, once. Watchdog only; nothing here is on a hook path.
uint32_t g_upscaleRoutesLogged = 0;
void LogFfxObservations() noexcept {
for (uint32_t leaf = 0; leaf < fl::inventory::kFfxLeafCount; ++leaf) {
const wchar_t* moduleName = fl::inventory::kFfxLeafModules[leaf];
fl::ffxtypes::ReportNew(
g_ffxDispatchTypes[leaf], g_ffxDispatchTypesLogged[leaf],
[moduleName](uint64_t type) noexcept { LogNoteW(kLogFfxDispatchType, moduleName, 0u, type); },
[moduleName](uint32_t more) noexcept { LogNoteW(kLogFfxDispatchType, moduleName, more, 0u); });
fl::ffxtypes::ReportNew(
g_ffxQueryTypes[leaf], g_ffxQueryTypesLogged[leaf],
[moduleName](uint64_t type) noexcept { LogNoteW(kLogFfxQueryType, moduleName, 0u, type); },
[moduleName](uint32_t more) noexcept { LogNoteW(kLogFfxQueryType, moduleName, more, 0u); });
}
// g_ffxUpscaleLeaf: leaf + 1 for an ffx-api leaf, kFfxUpscaleSourceFsr3Host for the 3.0 host's own export, 0 for
// none yet. The host has no descriptor type, so this is the only line that says its export was called.
const uint32_t route = g_ffxUpscaleLeaf.load(std::memory_order_relaxed);
if (route != 0u && route <= kFfxUpscaleSourceFsr3Host && (g_upscaleRoutesLogged & (1u << route)) == 0u) {
g_upscaleRoutesLogged |= 1u << route;
LogNoteW(kLogUpscaleRoute,
route == kFfxUpscaleSourceFsr3Host ? fl::inventory::kModuleFfxFsr3Host
: fl::inventory::kFfxLeafModules[route - 1u],
route);
}
}
// The tag census, on the same tick and by the same rule: OR-only, from the
@@ -2278,7 +2366,7 @@ void NoteSymbolMissingOnce(const wchar_t* moduleName, const char* symbol)
}
bool InstallRow(const wchar_t* moduleName, const char* symbol, uint32_t family, void* detour, void** original,
std::atomic<uint32_t>& live) noexcept {
std::atomic<uint32_t>& live, const char* name) noexcept {
if (live.load(std::memory_order_acquire) != 0) {
return true;
}
@@ -2292,7 +2380,7 @@ bool InstallRow(const wchar_t* moduleName, const char* symbol, uint32_t family,
return false;
}
if (!PatchTarget(target, detour, original, symbol)) {
if (!PatchTarget(target, detour, original, name)) {
return false;
}
@@ -2306,14 +2394,17 @@ bool InstallRow(const wchar_t* moduleName, const char* symbol, uint32_t family,
// is the safe direction: an unbound row is a table entry somebody added without
// writing its hook, and hooking it with a neighbour's body is exactly what this
// function exists to stop.
bool InstallByFamily(const wchar_t* moduleName, const char* symbol, uint32_t family) noexcept {
//
// `name` is the row's "module!symbol", for the log (0.1.0-beta.42): until then the two one-target rows logged their
// symbol and every other row logged the word "hook", so a log could not say WHICH of four ffx modules was patched.
bool InstallByFamily(const wchar_t* moduleName, const char* symbol, uint32_t family, const char* name) noexcept {
// EQUALITY AGAINST THE COMPOUND CONSTANT, not `& FL_HOOK_UPSCALER_IDENTITY`. A
// bit test would bind any future row that happens to include identity to THIS
// detour -- which is the neighbour's-body defect this function exists to stop,
// and it would arrive silently because the row would still install.
if (family == fl::inventory::kFamilyEvaluateFeature) {
return InstallRow(moduleName, symbol, family, reinterpret_cast<void*>(&Hook_SlEvaluateFeature),
reinterpret_cast<void**>(&g_origSlEvaluateFeature), g_upscalerIdentityLive);
reinterpret_cast<void**>(&g_origSlEvaluateFeature), g_upscalerIdentityLive, name);
}
if (family == static_cast<uint32_t>(fl::FL_HOOK_UPSCALER_PARAMS)) {
// TWO ROWS IN THIS FAMILY WITH DIFFERENT SIGNATURES, so the family alone would
@@ -2338,7 +2429,7 @@ bool InstallByFamily(const wchar_t* moduleName, const char* symbol, uint32_t fam
frameRow ? reinterpret_cast<void*>(&Hook_SlSetTagForFrame) : reinterpret_cast<void*>(&Hook_SlSetTag);
void** original =
frameRow ? reinterpret_cast<void**>(&g_origSlSetTagForFrame) : reinterpret_cast<void**>(&g_origSlSetTag);
if (!PatchTarget(target, detour, original)) {
if (!PatchTarget(target, detour, original, name)) {
return false;
}
patched.store(1, std::memory_order_release);
@@ -2346,7 +2437,7 @@ bool InstallByFamily(const wchar_t* moduleName, const char* symbol, uint32_t fam
}
if (family == static_cast<uint32_t>(fl::FL_HOOK_FG_EVALUATIONS)) {
return InstallRow(moduleName, symbol, family, reinterpret_cast<void*>(&Hook_SlGetNewFrameToken),
reinterpret_cast<void**>(&g_origSlGetNewFrameToken), g_frameTokensLive);
reinterpret_cast<void**>(&g_origSlGetNewFrameToken), g_frameTokensLive, name);
}
if (family == fl::inventory::kFamilyFfxDispatch) {
// FOUR ROWS, ONE ARM: the row's MODULE picks the trampoline and the latch slot,
@@ -2379,7 +2470,7 @@ bool InstallByFamily(const wchar_t* moduleName, const char* symbol, uint32_t fam
return false; // not loaded, or a module of the name that does not speak the 3.0 host ABI
}
if (!PatchTarget(target, reinterpret_cast<void*>(&Hook_FfxFsr3ContextDispatchUpscale),
reinterpret_cast<void**>(&g_origFfxFsr3DispatchUpscale))) {
reinterpret_cast<void**>(&g_origFfxFsr3DispatchUpscale), name)) {
return false;
}
g_fsr3HostPatched.store(1, std::memory_order_release);
@@ -2393,7 +2484,7 @@ bool InstallByFamily(const wchar_t* moduleName, const char* symbol, uint32_t fam
if (target == nullptr) {
return false; // not loaded, or a module of the name that does not speak ffx-api
}
if (!PatchTarget(target, FfxDispatchDetour(slot), reinterpret_cast<void**>(&g_origFfxDispatch[slot]))) {
if (!PatchTarget(target, FfxDispatchDetour(slot), reinterpret_cast<void**>(&g_origFfxDispatch[slot]), name)) {
return false;
}
g_ffxPatched[slot].store(1, std::memory_order_release);
@@ -2414,7 +2505,7 @@ bool InstallByFamily(const wchar_t* moduleName, const char* symbol, uint32_t fam
if (target == nullptr) {
return false; // not loaded, or a module of the name that does not speak ffx-api
}
if (!PatchTarget(target, FfxQueryDetour(slot), reinterpret_cast<void**>(&g_origFfxQuery[slot]))) {
if (!PatchTarget(target, FfxQueryDetour(slot), reinterpret_cast<void**>(&g_origFfxQuery[slot]), name)) {
return false;
}
g_ffxQueryPatched[slot].store(1, std::memory_order_release);
@@ -2514,7 +2605,11 @@ void PublishParamsFamilyIfWhole() noexcept {
bool InstallUpscalerHooks() noexcept {
bool any = false;
#define FL_INSTALL_ROW(mod, sym, family) any = InstallByFamily(mod, sym, static_cast<uint32_t>(family)) || any;
#define FL_INSTALL_ROW(mod, sym, family) \
{ \
static constexpr fl::inventory::RowName kRowName = fl::inventory::NameOfRow(mod, sym); \
any = InstallByFamily(mod, sym, static_cast<uint32_t>(family), kRowName.text) || any; \
}
FL_HOOK_INVENTORY(FL_INSTALL_ROW)
#undef FL_INSTALL_ROW
PublishParamsFamilyIfWhole();
@@ -2649,13 +2744,15 @@ bool InstallRtHooks() noexcept {
if (dispatchAgrees && g_rtDispatchLive.load(std::memory_order_acquire) == 0 &&
PatchTarget(directVtbl[fl::d3d12::kDispatchRaysIndex], reinterpret_cast<void*>(&Hook_DispatchRays),
reinterpret_cast<void**>(&g_origDispatchRays))) {
reinterpret_cast<void**>(&g_origDispatchRays),
"d3d12!ID3D12GraphicsCommandList4::DispatchRays")) {
PublishHookFamily(static_cast<uint32_t>(fl::FL_HOOK_RT_DISPATCH), g_rtDispatchLive);
installed = true;
}
if (buildAgrees && g_rtAsBuildLive.load(std::memory_order_acquire) == 0 &&
PatchTarget(directVtbl[fl::d3d12::kBuildRaytracingAccelerationStructureIndex],
reinterpret_cast<void*>(&Hook_BuildRtAs), reinterpret_cast<void**>(&g_origBuildRtAs))) {
reinterpret_cast<void*>(&Hook_BuildRtAs), reinterpret_cast<void**>(&g_origBuildRtAs),
"d3d12!ID3D12GraphicsCommandList4::BuildRaytracingAccelerationStructure")) {
PublishHookFamily(static_cast<uint32_t>(fl::FL_HOOK_RT_AS_BUILD), g_rtAsBuildLive);
installed = true;
}
@@ -2779,6 +2876,11 @@ DWORD WatchdogLoop() noexcept {
PublishDxgiPresentCounters();
PublishLoaderWords();
// What the detours kept for the log, then the log itself when this tick -- or a fault in a hook since the
// last one -- added to it. BEFORE the supervision check: its healthy branch continues the loop.
LogFfxObservations();
FlushLogIfNew();
// Supervision loss. guardTicks counts COMPLETED guard evaluations, not
// seconds, so a stalled guard loop stops it advancing even while the
// Agent process is alive -- which is exactly the case a timer-driven
@@ -3743,6 +3845,14 @@ DWORD WINAPI InitThread(LPVOID) noexcept {
// fatal: the present-path checks still work, and an Overlay that reacts only
// while the game presents is strictly better than none. It is recorded in the
// fault counter so the Agent can see it rather than inferring it.
//
// The first flush: init is over, on the init thread, never mid-frame. The
// file therefore exists from the start of the session, which is what makes a
// crash mid-session diagnosable at all (10_LOGGING). BEFORE THE WATCHDOG
// EXISTS since 0.1.0-beta.42: FlushLog's state belongs to one thread at a
// time, and the watchdog now flushes on its own first tick -- placed after
// CreateThread, as it was, this flush could run beside that one.
FlushLog();
HANDLE watchdog = CreateThread(nullptr, 0, WatchdogThread, nullptr, 0, nullptr);
if (watchdog == nullptr) {
std::atomic_ref<uint32_t> faults{g_state->faultCount};
@@ -3750,10 +3860,6 @@ DWORD WINAPI InitThread(LPVOID) noexcept {
} else {
CloseHandle(watchdog); // fire and forget; it exits on its own once stopped
}
// The first flush: init is over, on the init thread, never mid-frame. The
// file therefore exists from the start of the session, which is what makes a
// crash mid-session diagnosable at all (10_LOGGING).
FlushLog();
return 0;
}
+29 -17
View File
@@ -932,18 +932,30 @@ struct alignas(64) FlDisplayState {
// FlAdvancedState.validMask: which groups below were ever read. Additive: a reader ignores a bit it does not know.
enum FlAdvancedValid : uint32_t {
FL_ADV_VALID_DLSS_OPTIONS = 1u << 0, // sl::DLSSOptions seen chained into slEvaluateFeature's inputs
FL_ADV_VALID_FFX_UPSCALE = 1u << 1, // an ffx upscale dispatch's extra fields were read
FL_ADV_VALID_FFX_MEMORY = 1u << 2, // the game asked ffxQuery for the upscaler's memory, and it answered
FL_ADV_VALID_FFX_FG_CONFIG = 1u << 3, // (0.1.0-beta.41) ffxConfigure with a frame-generation descriptor seen
FL_ADV_VALID_SL_CONSTANTS = 1u << 4, // (0.1.0-beta.41) slSetConstants seen
FL_ADV_VALID_SL_FEATURES = 1u << 5, // (0.1.0-beta.42) at least one feature slot filled
FL_ADV_VALID_DLSS_OPTIONS = 1u << 0, // sl::DLSSOptions seen chained into slEvaluateFeature's inputs
FL_ADV_VALID_FFX_UPSCALE = 1u << 1, // an ffx upscale dispatch's extra fields were read
FL_ADV_VALID_FFX_MEMORY = 1u << 2, // the game asked ffxQuery for the upscaler's memory, and it answered
// The release numbers on the three groups below moved twice (owner decisions D118 and D122, 2026-11-12): beta.41
// was a fix release and the second step became two. They are declared here and written by nothing until then.
FL_ADV_VALID_FFX_FG_CONFIG = 1u << 3, // (0.1.0-beta.43) ffxConfigure with a frame-generation descriptor seen
FL_ADV_VALID_SL_CONSTANTS = 1u << 4, // (0.1.0-beta.43) slSetConstants seen
FL_ADV_VALID_SL_FEATURES = 1u << 5, // (0.1.0-beta.44) at least one feature slot filled
};
// A float nobody saw. An all-ones pattern is a NaN no detour stores: every value is checked finite first.
// A float nobody saw. An all-ones pattern is a NaN no detour stores: every value is checked finite first -- with the
// one exception below.
#define FL_ADV_FLOAT_NONE 0xFFFFFFFFu
// Feature slots (0.1.0-beta.42): FL_ADV_FEATURE_SLOTS slots of FL_ADV_FEATURE_WORDS uint32 each, in `features`.
// THE PLANE AT INFINITY (0.1.0-beta.42, owner decision D119): +infinity's own bits, in ffxNearBits or ffxFarBits and
// in no other field. An engine with an inverted, infinite depth hands FSR one finite plane and FLT_MAX -- or
// +infinity -- for the other; three of the first four FSR titles read gave `cameraFar` alone (10, 1, 0.1), the other
// plane having been refused as "nobody set this". For FSR that reading is wrong: its FLT_MAX is a plane, not a
// sentinel. For Streamline it is right -- INVALID_FLOAT is FLT_MAX -- so this is the ffx route's alone. Stored as
// the real +infinity rather than as a second all-ones-like pattern, so that a reader which knows nothing of this
// constant still decodes a float that means what it says.
#define FL_ADV_FLOAT_INFINITE 0x7F800000u
// Feature slots (0.1.0-beta.44): FL_ADV_FEATURE_SLOTS slots of FL_ADV_FEATURE_WORDS uint32 each, in `features`.
// [0] sl::Feature id PLUS ONE; 0 = an empty slot
// [1] bit 0: slGetFeatureVersion answered; bit 1: slGetFeatureRequirements answered
// [2..4] versionSL major, minor, build [5..7] versionNGX
@@ -988,7 +1000,7 @@ struct alignas(64) FlAdvancedState {
uint32_t ffxJitterMaxYBits; // @148
uint32_t ffxPreExposureMinBits; // @152
uint32_t ffxPreExposureMaxBits; // @156
uint32_t ffxNearBits; // @160 cameraNear, the last one seen
uint32_t ffxNearBits; // @160 cameraNear, the last one seen; FL_ADV_FLOAT_INFINITE = at infinity
uint32_t ffxFarBits; // @164
uint32_t ffxFovMinBits; // @168 cameraFovAngleVertical, radians: the lowest and the highest (D114)
uint32_t ffxFovMaxBits; // @172
@@ -1001,15 +1013,15 @@ struct alignas(64) FlAdvancedState {
uint64_t ffxMemoryTotalBytes; // @192 FfxApiEffectMemoryUsage, as the last answered query gave it
uint64_t ffxMemoryAliasableBytes; // @200
uint32_t ffxMemoryQueries; // @208 answered memory queries (wraps)
uint32_t ffxFgConfigures; // @212 (beta.41) ffxConfigure calls with a frame-generation descriptor
uint32_t ffxFgEnabledSeen; // @216 (beta.41) bit 0: seen off; bit 1: seen on
uint32_t ffxFgAsyncSeen; // @220 (beta.41) allowAsyncWorkloads, the same two bits
uint32_t ffxFgOnlyGeneratedSeen; // @224 (beta.41) onlyPresentGenerated, the same two bits
uint32_t ffxFgFlagsSeen; // @228 (beta.41) every dispatch flag any configure carried
int32_t ffxFgRect[4]; // @232..247 (beta.41) generationRect: left, top, width, height - the last
uint32_t ffxFgConfigures; // @212 (beta.43) ffxConfigure calls with a frame-generation descriptor
uint32_t ffxFgEnabledSeen; // @216 (beta.43) bit 0: seen off; bit 1: seen on
uint32_t ffxFgAsyncSeen; // @220 (beta.43) allowAsyncWorkloads, the same two bits
uint32_t ffxFgOnlyGeneratedSeen; // @224 (beta.43) onlyPresentGenerated, the same two bits
uint32_t ffxFgFlagsSeen; // @228 (beta.43) every dispatch flag any configure carried
int32_t ffxFgRect[4]; // @232..247 (beta.43) generationRect: left, top, width, height - the last
uint32_t reservedFfx[2]; // @248..255 must be zero
// ---- line 4: sl::Constants, summarised (beta.41) - never the camera's position, axes or matrices -----------
// ---- line 4: sl::Constants, summarised (beta.43) - never the camera's position, axes or matrices -----------
uint32_t slConstantsCalls; // @256 slSetConstants calls, every viewport together (wraps)
uint32_t slResets; // @260 calls with `reset` true
uint32_t slJitterMaxXBits; // @264
@@ -1027,7 +1039,7 @@ struct alignas(64) FlAdvancedState {
uint32_t slFlagsSeenFalse; // @304
uint32_t reservedSl[3]; // @308..319 must be zero
// ---- lines 5..22: Streamline's features (beta.42) --------------------------------------------------------------
// ---- lines 5..22: Streamline's features (beta.44) --------------------------------------------------------------
uint32_t features[FL_ADV_FEATURE_SLOTS * FL_ADV_FEATURE_WORDS]; // @320..1471
};
+9
View File
@@ -178,6 +178,15 @@ target_compile_options(fl_unhook_inline_test PRIVATE /EHsc)
target_compile_definitions(fl_unhook_inline_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
add_test(NAME fl_unhook_inline COMMAND fl_unhook_inline_test)
# fl_ffx_types.h (0.1.0-beta.42, D121): the descriptor types an ffx-api module was handed, kept by the detours for
# the native log. The header the Overlay compiles, driven without the Overlay -- including from eight threads.
add_executable(fl_ffx_types_test ffx_types_test.cpp)
target_include_directories(fl_ffx_types_test PRIVATE "${CMAKE_SOURCE_DIR}/FrameLedger.Overlay/include")
target_link_libraries(fl_ffx_types_test PRIVATE fl_native_flags Catch2::Catch2WithMain)
target_compile_options(fl_ffx_types_test PRIVATE /EHsc)
target_compile_definitions(fl_ffx_types_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
add_test(NAME fl_ffx_types COMMAND fl_ffx_types_test)
add_test(NAME fl_vklayer COMMAND fl_vklayer_test "[vklayer]")
add_test(NAME fl_vklayer_supervision COMMAND fl_vklayer_test "[vklayer-deadline]")
# The real-loader leg SKIPS (Catch2 exit 4) where there is no Vulkan loader or no
+139
View File
@@ -0,0 +1,139 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
// fl_ffx_types.h: the descriptor types an ffx-api module was handed, kept by the
// detours and written to the native log by the watchdog (0.1.0-beta.42, D121).
// The header is what the Overlay compiles, so these cases are about the shipped
// code: each type once, in the order it arrived, nothing lost when two threads
// meet a new type at the same moment, and what does not fit SAID rather than
// dropped.
#include <catch2/catch_test_macros.hpp>
#include <cstdint>
#include <fl_ffx_types.h>
#include <thread>
#include <vector>
namespace {
std::vector<std::uint64_t> Kept(const fl::ffxtypes::Seen& seen) {
std::vector<std::uint64_t> out;
for (const auto& slot : seen.types) {
if (const std::uint64_t v = slot.load(); v != 0u) {
out.push_back(v);
}
}
return out;
}
} // namespace
TEST_CASE("a type is kept once, in the order it first arrived", "[ffxtypes]") {
fl::ffxtypes::Seen seen;
for (int frame = 0; frame < 1000; ++frame) {
fl::ffxtypes::Note(seen, 0x00020004u); // PREPARE
fl::ffxtypes::Note(seen, 0x00020003u); // FRAMEGENERATION
if (frame >= 10) {
fl::ffxtypes::Note(seen, 0x00010001u); // UPSCALE, from the eleventh frame on
}
}
const std::vector<std::uint64_t> expected{0x00020004u, 0x00020003u, 0x00010001u};
CHECK(Kept(seen) == expected);
CHECK(seen.more.load() == 0u);
}
TEST_CASE("what does not fit is said: a ninth type, and a type of zero", "[ffxtypes]") {
fl::ffxtypes::Seen seen;
for (std::uint64_t type = 1; type <= fl::ffxtypes::kSlots; ++type) {
fl::ffxtypes::Note(seen, type);
}
CHECK(Kept(seen).size() == fl::ffxtypes::kSlots);
CHECK(seen.more.load() == 0u);
fl::ffxtypes::Note(seen, 3u); // already kept: still nothing to say
CHECK(seen.more.load() == 0u);
fl::ffxtypes::Note(seen, 99u);
CHECK(seen.more.load() == fl::ffxtypes::kMoreTypes);
CHECK(Kept(seen).size() == fl::ffxtypes::kSlots); // and none of the eight was displaced
fl::ffxtypes::Note(seen, 0u);
const std::uint32_t both = fl::ffxtypes::kMoreTypes | fl::ffxtypes::kMoreZero;
CHECK(seen.more.load() == both);
fl::ffxtypes::Seen zeroOnly;
fl::ffxtypes::Note(zeroOnly, 0u);
CHECK(Kept(zeroOnly).empty()); // zero is the empty slot: it takes none
CHECK(zeroOnly.more.load() == fl::ffxtypes::kMoreZero);
}
TEST_CASE("the watchdog's report: each kept type once, new ones on a later pass, the rest untouched", "[ffxtypes]") {
fl::ffxtypes::Seen seen;
fl::ffxtypes::Reported reported;
std::vector<std::uint64_t> types;
std::vector<std::uint32_t> more;
const auto report = [&] {
fl::ffxtypes::ReportNew(
seen, reported, [&types](std::uint64_t t) noexcept { types.push_back(t); },
[&more](std::uint32_t m) noexcept { more.push_back(m); });
};
report();
CHECK(types.empty());
CHECK(more.empty());
fl::ffxtypes::Note(seen, 0x20004u);
fl::ffxtypes::Note(seen, 0x20003u);
report();
report(); // nothing new: nothing said again
const std::vector<std::uint64_t> firstTwo{0x20004u, 0x20003u};
CHECK(types == firstTwo);
fl::ffxtypes::Note(seen, 0x10001u);
fl::ffxtypes::Note(seen, 0u);
report();
const std::vector<std::uint64_t> allThree{0x20004u, 0x20003u, 0x10001u};
CHECK(types == allThree);
const std::vector<std::uint32_t> zeroSaid{fl::ffxtypes::kMoreZero};
CHECK(more == zeroSaid);
for (std::uint64_t t = 100; t < 110; ++t) {
fl::ffxtypes::Note(seen, t);
}
report();
report();
CHECK(types.size() == fl::ffxtypes::kSlots);
const std::vector<std::uint32_t> bothSaid{fl::ffxtypes::kMoreZero, fl::ffxtypes::kMoreTypes};
CHECK(more == bothSaid);
}
TEST_CASE("threads that meet the same new types at once keep each exactly once", "[ffxtypes]") {
// The detours run on whatever threads the game dispatches from. Six types, eight threads, each noting all six in
// its own order, many times over: six slots filled, no type twice, none lost, nothing said to be missing.
for (int round = 0; round < 200; ++round) {
fl::ffxtypes::Seen seen;
std::vector<std::thread> threads;
threads.reserve(8);
for (int t = 0; t < 8; ++t) {
threads.emplace_back([&seen, t] {
for (int i = 0; i < 6; ++i) {
fl::ffxtypes::Note(seen, 0x10000u + static_cast<std::uint64_t>((i + t) % 6) + 1u);
}
});
}
for (std::thread& th : threads) {
th.join();
}
std::vector<std::uint64_t> kept = Kept(seen);
REQUIRE(kept.size() == 6u);
std::uint64_t sum = 0;
for (std::size_t i = 0; i < kept.size(); ++i) {
sum += kept[i] - 0x10000u;
for (std::size_t j = i + 1; j < kept.size(); ++j) {
REQUIRE(kept[i] != kept[j]);
}
}
REQUIRE(sum == 21u); // 1 + 2 + ... + 6: every one of the six, once
REQUIRE(seen.more.load() == 0u);
}
}
+148 -1
View File
@@ -5985,6 +5985,117 @@ TEST_CASE("the FSR 3.0 host facade: Fsr3 identity and the count from its upscale
}
}
namespace {
// Whether the log has a line of this code whose text starts with `name` and which ends in `tail`.
bool LogHasLine(const std::string& text, const char* code, const char* name, const char* tail) {
const std::string head = std::string("s ") + code + " ";
std::size_t at = 0;
while (at < text.size()) {
std::size_t end = text.find('\n', at);
if (end == std::string::npos) {
end = text.size();
}
const std::string line = text.substr(at, end - at);
const std::size_t h = line.find(head);
if (h != std::string::npos) {
std::size_t n = h + head.size();
while (n < line.size() && line[n] == ' ') {
++n;
}
const std::string tailText = tail;
if (line.compare(n, std::strlen(name), name) == 0 && line.size() >= tailText.size() &&
line.compare(line.size() - tailText.size(), tailText.size(), tailText) == 0) {
return true;
}
}
at = end + 1;
}
return false;
}
std::size_t CountOf(const std::string& text, const char* needle) {
std::size_t n = 0;
for (std::size_t at = text.find(needle); at != std::string::npos; at = text.find(needle, at + 1)) {
++n;
}
return n;
}
} // namespace
TEST_CASE("the native log outlives a game that just exits (beta.42, D121): the watchdog writes it unasked -- installs "
"by module and symbol, the descriptor types each ffx module was handed, the census",
"[guard][inject][shm][ffx][log]") {
// WHAT A REAL SESSION LOOKED LIKE UNTIL NOW. The log was written at the end of init, when the Agent asked, and on
// a stop. A game that exits asks for nothing and stops nothing: the file held the first half second -- before
// the title had loaded its upscaler -- and Cyberpunk 2077's "unknown" upscaler (FSR set, frame generation
// measured) could not be read back from anywhere. Here nobody asks and nothing stops; the process is then killed.
Child child;
REQUIRE(StartHarness(
child, L"--real --presents-per-eval 4 --ffx-topology 1x --ffx-query ratios --hold-presenting-ffx 14"));
ResetFake();
g.modules = {"kernel32.dll"};
g.scanSet = {child.pi.dwProcessId};
REQUIRE(GuardedInjectWithSources(child.pi.dwProcessId, FL_OVERLAY_DLL, FakeSources()).Allowed());
MappedRing r;
REQUIRE(OpenRingFor(child.pi.dwProcessId, r));
// The monolith's three dispatch types of an SDK 1.1.x title generating frames, and the ratio query, by value:
// UPSCALE 0x10001, FRAMEGENERATION_PREPARE 0x20004, FRAMEGENERATION 0x20003, GETUPSCALERATIOFROMQUALITYMODE
// 0x10002 (the vendored ffx_upscale.h / ffx_framegeneration.h).
const char* mono = "amd_fidelityfx_dx12.dll";
std::wstring log;
std::string text;
bool complete = false;
for (int i = 0; i < 150 && !complete; ++i) {
++r.ctl->guardTicks; // supervised, as a session is -- and that is ALL this test tells the Overlay
Sleep(100);
if (log.empty() && !FindOverlayLog(child.pi.dwProcessId, child.pi.hProcess, log)) {
continue;
}
text = ReadWholeFile(log);
complete = LogHasLine(text, "FFX_DISPATCH", mono, " b=0x10001") &&
LogHasLine(text, "FFX_DISPATCH", mono, " b=0x20004") &&
LogHasLine(text, "FFX_DISPATCH", mono, " b=0x20003") &&
LogHasLine(text, "FFX_QUERY", mono, " b=0x10002") &&
LogHasLine(text, "UPSCALE_ROUTE", mono, " a=1 b=0x0");
}
INFO("log " << Narrow(log) << ":\n" << text);
REQUIRE(complete);
CHECK(r.ctl->logFlushRequested == 0u);
CHECK(r.ctl->unhookRequested == 0u);
CHECK(r.st->status == fl::FL_STATUS_READY);
CHECK(r.st->faultCount == 0u);
// The game exits. No stop, no last flush, no watchdog left to make one.
REQUIRE(TerminateProcess(child.pi.hProcess, 0));
WaitForSingleObject(child.pi.hProcess, 5000);
text = ReadWholeFile(log);
INFO("after the exit:\n" << text);
CHECK(CountOf(text, "# FrameLedger.Overlay build ") == 1u); // one file, one header, however many flushes
CHECK(CountOf(text, "RING_CREATED") == 1u);
// Every row that went in says which module and which symbol -- these two read "hook" until now.
CHECK(LogHasLine(text, "HOOK_INSTALLED", "amd_fidelityfx_dx12.dll!ffxDispatch", ""));
CHECK(LogHasLine(text, "HOOK_INSTALLED", "amd_fidelityfx_dx12.dll!ffxQuery", ""));
CHECK(text.find(" hook ") == std::string::npos);
// Each type once, however many thousand dispatches carried it.
CHECK(CountOf(text, "FFX_DISPATCH") == 3u);
CHECK(CountOf(text, "FFX_QUERY") == 1u);
CHECK(CountOf(text, "UPSCALE_ROUTE") == 1u);
// The census, with the monolith's bit in the word it carries.
CHECK(text.find("RUNTIME_CENSUS") != std::string::npos);
// And nothing that did not happen.
CHECK(text.find(" STOP ") == std::string::npos);
CHECK(text.find("STOP_FLUSHED") == std::string::npos);
CHECK(text.find("PATCH_FAILED") == std::string::npos);
CHECK(text.find("FAULT") == std::string::npos);
CHECK(text.find("overwritten before") == std::string::npos);
}
TEST_CASE("FSR's quality mode (beta.25, D65): the mode the title asked for names the dispatch, by its size and by "
"its ratio",
"[guard][inject][shm][ffx]") {
@@ -6724,7 +6835,7 @@ uint32_t BitsOf(float v) {
return std::bit_cast<uint32_t>(v);
}
// What 0.1.0-beta.41 and beta.42 fill: declared now, written by nothing in this release.
// What 0.1.0-beta.43 and beta.44 fill (beta.41 and beta.42 until D118 and D122): declared, written by nothing yet.
bool LaterGroupsAreZero(const fl::FlAdvancedState& a) {
bool zero = a.ffxFgConfigures == 0u && a.ffxFgEnabledSeen == 0u && a.ffxFgFlagsSeen == 0u &&
a.slConstantsCalls == 0u && a.slResets == 0u && a.slFlagsSeenTrue == 0u && a.slFlagsSeenFalse == 0u;
@@ -6831,6 +6942,42 @@ TEST_CASE("region 5 stays empty until the Agent asks, then carries what an FSR t
CHECK(r.st->status == fl::FL_STATUS_READY);
}
TEST_CASE("FSR's plane at infinity (beta.42, D119): a far plane of FLT_MAX reaches region 5 as +infinity, beside "
"the finite near plane",
"[guard][inject][shm][advanced]") {
// An engine with an infinite depth hands FSR FLT_MAX for one plane. The Overlay took that for Streamline's "not
// set" and dropped it, so three real titles showed one plane of two. Through the shipped DLL, on the SDK 1.1.x
// monolith: the same target as the case above, with the far plane at infinity.
Child child;
REQUIRE(StartHarness(child, L"--real --ffx-topology 1x --advanced --ffx-infinite-far --hold-presenting-ffx 30"));
ResetFake();
g.modules = {"kernel32.dll"};
g.scanSet = {child.pi.dwProcessId};
REQUIRE(GuardedInjectWithSources(child.pi.dwProcessId, FL_OVERLAY_DLL, FakeSources()).Allowed());
MappedRing r;
REQUIRE(OpenRingFor(child.pi.dwProcessId, r));
if (r.st == nullptr || r.ctl == nullptr) {
return; // not reached after the REQUIRE; said in the form a static analyser follows (cpp:S2259)
}
REQUIRE(WaitForIdentityHook(r.st));
SetAdvancedRequest(r, 11u);
fl::FlAdvancedState a{};
REQUIRE(ReadAdvanced(r, 11u, a, 0u, fl::FL_ADV_VALID_FFX_UPSCALE));
INFO("near 0x" << std::hex << a.ffxNearBits << " far 0x" << a.ffxFarBits);
CHECK(a.ffxFarBits == FL_ADV_FLOAT_INFINITE);
CHECK(std::bit_cast<float>(a.ffxFarBits) > 3.0e38f); // the float it decodes to IS infinity
CHECK(a.ffxNearBits == BitsOf(kAdvFfxNear));
// And nothing else of the descriptor took the pattern.
CHECK(a.ffxPreExposureMaxBits == BitsOf(kAdvFfxPreExposure));
CHECK(a.ffxFovMaxBits == BitsOf(kAdvFfxFovHigh));
CHECK(a.ffxSharpnessMaxBits == BitsOf(kAdvFfxSharpness));
CHECK(r.st->faultCount == 0u);
CHECK(r.st->status == fl::FL_STATUS_READY);
}
TEST_CASE("region 5 carries the DLSS options a title chains into its evaluation, and only while asked",
"[guard][inject][shm][advanced]") {
Child child;
+65 -2
View File
@@ -116,6 +116,9 @@
// sl::DLSSOptions into slEvaluateFeature's inputs, --hold-presenting-ffx fills the rest of the
// UPSCALE descriptor (sharpening, jitter, exposure, depth range, field of view, flags, frame time).
// The values are the kAdv* constants below; the injected fl_guard cases assert them
// --ffx-infinite-far
// with --advanced: the UPSCALE descriptor's cameraFar is FLT_MAX, as an engine with an infinite
// depth states the plane at infinity (0.1.0-beta.42, D119), instead of kAdvFfxFar
// --ffx-memory-query v1|v2
// before every UPSCALE, ask the entry module ffxQuery how much memory the upscaler holds, in
// the descriptor of ffx-api 1.1.2 (v1) or 2.0 (v2); the stub answers kAdvMemory*
@@ -2159,6 +2162,60 @@ bool ProbeAdvFields() {
Check(off.ffxFlagsSeen.load() == 0u && off.ffxResets.load() == 0u, "nothing is invented");
}
// --- FSR's plane at infinity (0.1.0-beta.42, owner decision D119)
// -------------------------------------------------
{
const float flatMax = std::bit_cast<float>(0x7F7FFFFFu);
const float plusInf = std::bit_cast<float>(0x7F800000u);
Check(fl::adv::FfxDepthPlaneBits(0.1f) == bitsOf(0.1f) && fl::adv::FfxDepthPlaneBits(0.0f) == bitsOf(0.0f),
"an ordinary plane is its own bits");
Check(fl::adv::FfxDepthPlaneBits(flatMax) == FL_ADV_FLOAT_INFINITE &&
fl::adv::FfxDepthPlaneBits(plusInf) == FL_ADV_FLOAT_INFINITE,
"FLT_MAX and +infinity are the plane at infinity");
Check(fl::adv::FfxDepthPlaneBits(std::bit_cast<float>(0x7FC00000u)) == FL_ADV_FLOAT_NONE &&
fl::adv::FfxDepthPlaneBits(std::bit_cast<float>(0xFF800000u)) == FL_ADV_FLOAT_NONE &&
fl::adv::FfxDepthPlaneBits(std::bit_cast<float>(0xFF7FFFFFu)) == FL_ADV_FLOAT_NONE,
"a NaN, a negative infinity and -FLT_MAX are no plane");
Check(std::bit_cast<float>(static_cast<uint32_t>(FL_ADV_FLOAT_INFINITE)) > flatMax,
"the stored pattern IS +infinity, so a reader that never heard of it still reads a float that means it");
// Lies of P's shape: an inverted, infinite depth -- the far plane a small number, the near one FLT_MAX.
fl::adv::Accumulators a;
ffxDispatchDescUpscale d{};
d.cameraNear = flatMax;
d.cameraFar = 10.0f;
fl::adv::ObserveFfxUpscale(0u, d, a);
Check(a.ffxNearBits.load() == FL_ADV_FLOAT_INFINITE && a.ffxFarBits.load() == bitsOf(10.0f),
"the plane at infinity is kept beside the finite one -- it used to be dropped");
// ...and the other way round, as +infinity; then a NaN changes nothing that was kept.
d.cameraNear = 0.05f;
d.cameraFar = plusInf;
fl::adv::ObserveFfxUpscale(0u, d, a);
Check(a.ffxNearBits.load() == bitsOf(0.05f) && a.ffxFarBits.load() == FL_ADV_FLOAT_INFINITE,
"either plane may be the infinite one, and the last value of each is what is kept");
d.cameraNear = std::bit_cast<float>(0x7FC00000u);
d.cameraFar = std::bit_cast<float>(0xFF800000u);
fl::adv::ObserveFfxUpscale(0u, d, a);
Check(a.ffxNearBits.load() == bitsOf(0.05f) && a.ffxFarBits.load() == FL_ADV_FLOAT_INFINITE,
"a plane that is no plane leaves the last one in place");
// THE STREAMLINE ROUTE IS UNCHANGED: there FLT_MAX is INVALID_FLOAT, nobody's value.
fl::adv::Accumulators s;
sl::DLSSOptions o;
o.preExposure = sl::INVALID_FLOAT;
o.exposureScale = plusInf;
fl::adv::ObserveDlssOptions(o, s);
Check(s.dlssPreExposureBits.load() == FL_ADV_FLOAT_NONE && s.dlssExposureScaleBits.load() == FL_ADV_FLOAT_NONE,
"for Streamline FLT_MAX stays 'not set' and an infinity stays no value: the rule is the ffx route's");
d.preExposure = flatMax;
d.cameraFovAngleVertical = plusInf;
fl::adv::Accumulators other;
fl::adv::ObserveFfxUpscale(0u, d, other);
Check(other.ffxPreExposureMaxBits.load() == FL_ADV_FLOAT_NONE &&
other.ffxFovMaxBits.load() == FL_ADV_FLOAT_NONE,
"an exposure or a field of view of FLT_MAX or infinity is still no value");
}
// --- the ffx upscaler's memory, both query versions
// ------------------------------------------------------------------
{
@@ -3021,6 +3078,9 @@ void AskQuality(PfnFfxQuery query, FfxQuery what) {
}
}
// --ffx-infinite-far (with --advanced): cameraFar is FLT_MAX rather than kAdvFfxFar.
bool g_ffxInfiniteFar = false;
int HoldPresentingFfx(Gfx& g, int seconds, bool real, int presentsPerEval, FfxTopology topology, bool prepare,
FfxQuery ask, bool advanced, FfxMemoryQuery askMemory) {
if (!HaveD3D11(g, "--hold-presenting-ffx")) {
@@ -3143,7 +3203,8 @@ int HoldPresentingFfx(Gfx& g, int seconds, bool real, int presentsPerEval, FfxTo
up.sharpness = kAdvFfxSharpness;
up.preExposure = kAdvFfxPreExposure;
up.cameraNear = kAdvFfxNear;
up.cameraFar = kAdvFfxFar;
// --ffx-infinite-far: the plane at infinity as an engine with an infinite depth states it (D119).
up.cameraFar = g_ffxInfiniteFar ? std::bit_cast<float>(0x7F7FFFFFu) : kAdvFfxFar;
up.frameTimeDelta = kAdvFfxFrameTimeMs;
up.flags = FFX_UPSCALE_FLAG_NON_LINEAR_COLOR_PQ;
}
@@ -3418,6 +3479,8 @@ int main(int argc, char** argv) {
ffxQuery = std::strcmp(q, "sizes") == 0 ? FfxQuery::Sizes
: std::strcmp(q, "ratios") == 0 ? FfxQuery::Ratios
: FfxQuery::None;
} else if (std::strcmp(argv[i], "--ffx-infinite-far") == 0) {
g_ffxInfiniteFar = true;
} else if (std::strcmp(argv[i], "--advanced") == 0) {
advancedInputs = true;
} else if (std::strcmp(argv[i], "--ffx-memory-query") == 0 && i + 1 < argc) {
@@ -3464,7 +3527,7 @@ int main(int argc, char** argv) {
std::strcmp(argv[i], "--ffx-topology") == 0 || std::strcmp(argv[i], "--ffx-no-prepare") == 0 ||
std::strcmp(argv[i], "--ffx-query") == 0 || std::strcmp(argv[i], "--sl-tag-for-frame") == 0 ||
std::strcmp(argv[i], "--advanced") == 0 || std::strcmp(argv[i], "--ffx-memory-query") == 0 ||
std::strcmp(argv[i], "--sl-tag-whole-resource") == 0 ||
std::strcmp(argv[i], "--ffx-infinite-far") == 0 || std::strcmp(argv[i], "--sl-tag-whole-resource") == 0 ||
std::strcmp(argv[i], "--sl-tag-dlssg-inputs") == 0 || std::strcmp(argv[i], "--load") == 0 ||
std::strcmp(argv[i], "--load-after-ms") == 0) {
if (std::strcmp(argv[i], "--plus-ui") == 0 || std::strcmp(argv[i], "--present-interval-ms") == 0 ||
@@ -96,6 +96,46 @@ public sealed class InGameAdvancedSamplerTests
sampler.Facts.Should().NotContain(static f => f.Id.StartsWith("sl.", StringComparison.Ordinal));
}
[Fact]
public void AnFsrDepthPlaneAtInfinityIsShownAsInfiniteAndInNoOtherFieldIsInfinityAValue()
{
// Owner decision D119: an engine with an infinite depth hands FSR FLT_MAX for one plane, and the Overlay
// stores that as +infinity's own bits. Lies of P's shape: the far plane a small number, the near one at
// infinity.
var sampler = new InGameAdvancedSampler();
sampler.Take(new InGameAdvanced(InGameStates.Ffx() with
{
FfxNearBits = FlAdvancedState.FloatInfinite,
FfxFarBits = BitConverter.SingleToUInt32Bits(10f),
}));
Rows(Fact(sampler, "ffx.upscale.depth")).Should().StartWith(["cameraNear=∞", "cameraFar=10"]);
// The other way round, in the same session: the fact follows what the game says now.
sampler.Take(new InGameAdvanced(InGameStates.Ffx(2) with
{
FfxNearBits = BitConverter.SingleToUInt32Bits(0.05f),
FfxFarBits = FlAdvancedState.FloatInfinite,
}));
Rows(Fact(sampler, "ffx.upscale.depth")).Should().StartWith(["cameraNear=0.05", "cameraFar=∞"]);
// Infinity is a depth plane's value and nobody else's: an exposure or a jitter carrying the pattern is, as
// before, no value - the Overlay never stores it there, and a reader does not invent a meaning for it.
var other = new InGameAdvancedSampler();
other.Take(new InGameAdvanced(InGameStates.Ffx() with
{
FfxPreExposureMinBits = FlAdvancedState.FloatInfinite,
FfxPreExposureMaxBits = FlAdvancedState.FloatInfinite,
FfxJitterMaxXBits = FlAdvancedState.FloatInfinite,
FfxJitterMaxYBits = FlAdvancedState.FloatInfinite,
FfxNearBits = FlAdvancedState.FloatNone,
FfxFarBits = 0xFF800000u,
}));
other.Facts.Should().NotContain(static f => f.Id == "ffx.upscale.exposure" || f.Id == "ffx.upscale.jitter");
Rows(Fact(other, "ffx.upscale.depth")).Should().OnlyContain(static row => row.StartsWith("cameraFov", StringComparison.Ordinal),
"a plane nobody gave and a negative infinity are not planes");
}
[Fact]
public void SharpeningSeenBothWaysARangeAndAFlagNobodyNamedAreSaidAsTheyAre()
{
@@ -33,6 +33,8 @@ public sealed class OverlayLogTests : IDisposable
"# FrameLedger.Overlay build abc pid 4242 layout v3 image game.exe",
"+ 0.001s RING_CREATED Local\\FrameLedger.Ring.<pid> a=8192 b=0x0",
"+ 0.020s HOOK_INSTALLED dxgi!IDXGISwapChain::Present a=0 b=0x7ff0",
"+ 1.020s PATCH_FAILED amd_fidelityfx_dx12.dll!ffxDispatch a=4 b=0x7ff8",
"+ 2.020s FFX_DISPATCH amd_fidelityfx_dx12.dll a=0 b=0x10001",
"+ 3.400s FAULT Hook_Present a=3221225477 b=0x0",
"+ 9.000s STOP observing stopped a=3 b=0x0",
"+ 9.001s UNHOOK_RESTORED dxgi!IDXGISwapChain::Present a=1 b=0x7ff0",
@@ -44,12 +46,13 @@ public sealed class OverlayLogTests : IDisposable
OverlayLog.Find(4242, _dir).Should().Be(newer);
List<string> lines = [.. OverlayLog.Describe(4242, _dir)];
lines[0].Should().Contain(newer).And.Contain("(6 event(s))");
lines.Should().HaveCount(5, "the header, then FAULT, STOP and the two unhook decisions; the installs stay in the file");
lines[1].Should().Contain("FAULT");
lines[2].Should().Contain("STOP");
lines[3].Should().Contain("UNHOOK_RESTORED");
lines[4].Should().Contain("UNHOOK_DECLINED");
lines[0].Should().Contain(newer).And.Contain("(8 event(s))");
lines.Should().HaveCount(6, "the header, then the patch that failed, FAULT, STOP and the two unhook decisions; the installs and what was seen stay in the file");
lines[1].Should().Contain("PATCH_FAILED");
lines[2].Should().Contain("FAULT");
lines[3].Should().Contain("STOP");
lines[4].Should().Contain("UNHOOK_RESTORED");
lines[5].Should().Contain("UNHOOK_DECLINED");
}
[Fact]