Compare commits
20
Commits
No files matched your search
+243
-2
@@ -19,6 +19,237 @@ GitHub release body, so a missing section will mean an empty release note.
|
||||
|
||||
### Added
|
||||
|
||||
- **The super-resolution identity from the NVIDIA driver, where no hook can see it — the driver-reported
|
||||
rung (owner decision 2026-09-06).** Three NGX-direct titles printed `upscaler: N/A` on every capture
|
||||
while the driver's per-process NGX word (`NvAPI_NGX_GetNGXOverrideState`, R570+, MIT NVAPI) reads
|
||||
`CREATED | EVALUATE` for them — measured 2026-09-06 without an NVIDIA-app override. The capture host now
|
||||
spawns `fl-probe-nvapi --ngx-state <pid>` beside every module snapshot (the probe gained one machine line,
|
||||
`NGXSTATE status=… sr=0x… …`, and is staged beside the host), merges the readings (`NgxDriverState`: the
|
||||
last answered word is the state, a change between readings is printed), prints `NVIDIA driver NGX state:`
|
||||
in the runtime block, and the `upscaler:` line reads `Dlss (driver-reported: … not counted by this hook)`
|
||||
when no hook named one. Identity only, each limit measured: no quality or preset (override fields), no
|
||||
ratio (`scalingRatio` is 0 even under an override), no frame-generation multiplier (`FG_MODE` /
|
||||
`FG_MULTI_FRAME` stay clear at ×4). **The FG word follows DLSS-G too, corrected on the first run's own
|
||||
readings:** `CREATED | EVALUATE` on every ×4 session, changing between readings as the feature came up, so
|
||||
it is printed beside `frame generation:` as agreement or a printed disagreement, and promoted to
|
||||
`DlssG (driver-reported …)` only where the count is active and no tag named the technology — the count is
|
||||
never the driver's. Owner's run (§H5 rows N1–N4): the negative held (`CREATED` clear with upscaling off),
|
||||
four NGX-direct titles now print `Dlss (driver-reported …)`, two hooked titles print agreement, and an
|
||||
FSR + DLSS-G session read `SR 0x205` (created, not evaluated) and correctly claimed nothing. Beside a hook's `Dlss` the driver's word prints as agreement or as a
|
||||
disagreement printed rather than resolved; beside an `N/A` with the bit clear it prints the driver's
|
||||
negative. `20_OPEN_QUESTIONS` §H5 pre-commits rows N1–N4, and N3 — DLSS switched off — withdraws the rung
|
||||
if the bit stays set. `03_METRICS` §Upscaling, `05_DETECTION`, `18_GPU_VENDOR_APIS` carry it.
|
||||
|
||||
### Changed
|
||||
|
||||
- **A counted session whose factor was refused no longer reads "no evaluation was observed".** DL:TB at FSR
|
||||
upscaling + DLSS Frame Generation (2026-09-06): 4,415 tokens, 8,174 DXGI-counted presents, `DlssG` from
|
||||
the tags, factor refused because bucket 8 of 8 read 1.96 against 2.85 — and the Presented qualifier said
|
||||
a runtime was loaded and nothing was seen. It now says frame generation was counted and its factor
|
||||
refused, that DXGI counted presents this hook never saw so the Displayed rate is above the printed
|
||||
number, and that the number is neither Native nor Displayed.
|
||||
|
||||
- **The withheld `none` is narrowed to sessions where DXGI's counter was not read (§H5 Leg 0 landed).**
|
||||
The owner's morning run on the DXGI-counted build printed the rule-6 trio on Dying Light: The Beast
|
||||
(`Native 70.52 -> Displayed 282.08 (x4 FG)`, 12,387 presents DXGI-counted, `DlssG`) and then ran the
|
||||
title twice with frame generation OFF: census unchanged (`sl.dlss_g.dll` is a startup-time load),
|
||||
presents = tokens, `unseen=0` over thousands of samples, and the report withheld `none` exactly as the
|
||||
gate's cost paragraph pre-committed. The counter is the discriminator the gate lacked — on that shape
|
||||
the pacer's presents are DXGI presents on the hooked chain — so a counted `none` beside a READ counter
|
||||
with zero unseen now prints as `none`, with *"DXGI's own present counter agrees: 0 unseen over N hooked
|
||||
present(s)"* on the line; it is withheld only when the counter was not read, with the reason saying so.
|
||||
A writer state that counted unseen presents the records do not carry is refused as a contradiction.
|
||||
On every other title the counter is printed beside `none` as a second witness. CLAUDE.md rule 6 carries
|
||||
the amendment; three cases changed sides and four are new.
|
||||
|
||||
### Added
|
||||
|
||||
- **Displayed FPS counted by DXGI where the hook cannot count it — the 2.8.0 pacer's presents.** The
|
||||
owner's run on the DXGI counter landed `20_OPEN_QUESTIONS` §H5 row P1-DXGI twice: Dying Light: The
|
||||
Beast at DLSS Frame Generation ×4 on Streamline 2.8.0 reads 2.90 and 2.95 presents per hooked present
|
||||
that DXGI counted on the same chain and the inline patches never saw, while Streamline 2.7.3 (Hell Is
|
||||
Us, ×3.86) and 2.10.3 (the Onimusha: Way of the Sword demo, ×3.67) read 0.00 — their generated frames
|
||||
come through the patched bodies. So the record now carries `dxgiUnseen` (@52, from the reserved word,
|
||||
under `FL_MEASURED_DXGI_PRESENTS`, no layout bump; mirror and `fl-layout-dump` follow), and the
|
||||
consumer's window counts `Displayed = hooked + Σ dxgiUnseen` — in the rule-6 trio, in `presents/batch`
|
||||
and in the uniformity buckets, never in a frame-time distribution — printing *"Displayed is
|
||||
DXGI-COUNTED"* on its own line whenever the sum is above zero, because that number is a count DXGI
|
||||
made rather than this hook. `none` withdraws on that title by count; a saturated byte is refused like
|
||||
a saturated `fgEvaluations`; a byte under a clear bit is an honesty violation. A present the hook SAW and
|
||||
declined — a paused session — is not an unseen present: every declined present bumps an epoch that
|
||||
invalidates the chain's last reading, which the paused-session integration case caught (the first record
|
||||
after a resume claimed the whole pause, 0x55, before the guard). On every other title
|
||||
the window is byte-identical (five cases pin it; the injected `[fg]` case checks the byte is claimed
|
||||
and zero on the harness). `03_METRICS` §Displayed may be DXGI-COUNTED carries the rule.
|
||||
|
||||
- **DXGI's own present counter against the hook's, in the writer state and the report.** On the one shape
|
||||
where `none` is withheld (Streamline ≥ 2.8 with `sl.dlss_g.dll` loaded, Dying Light: The Beast), the
|
||||
open question was whether the closed pacer's generated presents reach DXGI through a body the inline
|
||||
patches miss or are displayed below DXGI. The Overlay now reads `IDXGISwapChain::GetLastPresentCount`
|
||||
on every hooked present of the chain it just saw (rule 4: the same object `GetDesc` is already read
|
||||
from) and publishes `dxgiPresentSamples` and `dxgiPresentsUnseen` (`FlWriterState @48/@52`, from
|
||||
`reserved[]`, no layout bump; mirror, `fl-layout-dump` and the offset asserts updated). The report prints
|
||||
`DXGI present counter: unseen=M over samples=N (r unseen per hooked present)` with the reading, and the
|
||||
withheld qualifier says which side of DXGI the generated presents fall on. `20_OPEN_QUESTIONS` §H5
|
||||
carries the rows written before the run: r ≈ 3 at ×4 means the generated presents ARE DXGI presents
|
||||
and the next PR labels a DXGI-counted Displayed rate; r ≈ 0 means below DXGI and only the kernel and
|
||||
vendor reads remain. The harness's presents are the negative control (`fl_guard` `[fg]`: zero unseen);
|
||||
the positive cannot be fixtured. `hook-harness --probe-frames` now prints the call's cost.
|
||||
|
||||
- **A stall diagnostic in the report, placed against FrameLedger's own touches on the target.** The
|
||||
owner saw Cyberpunk 2077 fall to 1 FPS for about a second under capture (2026-09-05) and the report
|
||||
could say nothing about whose it was. The capture host now records the QPC moment of every guard scan
|
||||
and module snapshot (`CaptureResult.TouchQpc`, the records' own clock), and `StallReport` prints the
|
||||
three longest present-to-present intervals with their session time and the nearest host touch: a
|
||||
touch inside or within 1 s names FrameLedger a SUSPECT and asks for a longer run on the 30 s cadence;
|
||||
a far one says *not ours*. It counts intervals at or over 100 ms and calls itself a diagnostic — it is
|
||||
not `03_METRICS`' stutter, which P2's calculators own. Four cases pin the placement.
|
||||
|
||||
- **DLSS Frame Generation is NAMED, from the tags the title already sends.** On every NVIDIA title measured
|
||||
the count was right and the technology unnamed — `Active (technology not identified)` on Cyberpunk at
|
||||
MFG ×3 and on the three UE titles at ×4 — because `kFeatureDLSS_G` is never evaluated through the export
|
||||
the identity hook owns. Streamline's DLSS-G programming guide §5.0 requires a title running frame
|
||||
generation to tag the HUD-less colour and UI buffers every frame through `slSetTag` /
|
||||
`slSetTagForFrame` / `slEvaluateFeature`'s inputs — the three tag routes this build already hooks and
|
||||
read one tag type from. The detours now record every tag's TYPE (rule 4: the same argument), a
|
||||
HUD-less or UI tag drained by a present marks it `FL_FG_DLSS_G`, and `FlWriterState.slTagCensus` (took
|
||||
`reserved[0]`, no layout bump) says which types arrived on which route for the session; the report
|
||||
prints it as `Streamline tag census: global=[…] frame=[…] local=[…]`. **Identity only:** the consumer's
|
||||
rule is the count decides `none`, identity decides the name — an active count beside the mark prints
|
||||
`frame generation: DlssG`; a counted 1.0 beside it prints `none` with the inputs noted; the withheld
|
||||
shape (§H5) keeps its N/A and says the title is feeding frame generation. Two injected cases send the
|
||||
DLSS-G list through each global export with no `kFeatureDLSS_G` evaluation and assert the mark on every
|
||||
record and the census on the right route; the existing tag cases assert its absence. `slDLSSGGetState`
|
||||
— the API the guide names for the presented count — is refused and the reason recorded in `03_METRICS`:
|
||||
the call resets the plugin's counter a title may read for its own FPS display, and the header marks it
|
||||
not thread safe.
|
||||
|
||||
### Changed
|
||||
|
||||
- **The tag route is measured on real titles** (docs): the owner's evening run on #121 read `frame generation:
|
||||
DlssG` on Hell Is Us, Expedition 33, Wukong, Rune Factory and Cyberpunk — every Streamline title tags the
|
||||
DLSS-G inputs through a route this build hooks — and Dying Light: The Beast's census shows the title tags its
|
||||
scaling input through `slSetTagForFrame` with no size, which closes HANDOFF 7a's last question without a
|
||||
layout bump. `spike-notes` §9 carries the table; §H5 records the pre-commitment as landed.
|
||||
|
||||
### Fixed
|
||||
|
||||
- **`render -> output` prints under frame generation.** `UpscaleExtent` keyed its window on the
|
||||
params bit, which the writer publishes only on the present that drained a dispatch or tag — one
|
||||
in N under frame generation — so `ClaimedSuffixStart`'s clean-suffix rule found no window and every
|
||||
FG-on capture since 2026-08-16 read `N/A` two lines under its own raw `render WxH` block
|
||||
(Cyberpunk at FSR 3 + FG, 2026-09-05, was the one that made it visible; the earlier "not computed
|
||||
yet" wording had hidden it). The window is now the identity suffix, which is per-record once the
|
||||
family is live, and every record inside it carrying both sizes counts. Two cases pin the FG shape
|
||||
and the refused intermittent-identity shape; the Cyberpunk FSR 3 consumer case now asserts the line.
|
||||
|
||||
### Added
|
||||
|
||||
- **`fl-probe-nvapi --ngx-state <pid>`: what the NVIDIA driver says about one process's DLSS
|
||||
features.** The owner's eleven-capture run on 2026-09-05 (`spike-notes` §9) left one NVIDIA gap in
|
||||
one sentence — the count is right on every title and the identity is what this build cannot say:
|
||||
DLSS on the four NGX-direct UE titles, DLSS-G everywhere, and the hidden presents on Streamline
|
||||
2.8. The NGX SDK is licence-blocked; `NvAPI_NGX_GetNGXOverrideState` (NVAPI, MIT, vendored, R570+)
|
||||
takes a process id and returns the driver's own feedback bits for SR / RR / FG plus the scaling
|
||||
ratio, quality mode and frame-generation count, out of process. The probe prints the raw words and
|
||||
every decoded bit so the owner's run against a running title measures whether the bits are
|
||||
populated without an NVIDIA-app override, before any report line is built on it. §H5 carries the
|
||||
decision that answer opens (a *driver-reported* rung in `03_METRICS`, the owner's call).
|
||||
|
||||
- **The FSR 3.0 host route: a fifth AMD target, `ffx_fsr3_x64.dll!ffxFsr3ContextDispatchUpscale`.**
|
||||
Cyberpunk 2077 at FSR 3 upscales through the FSR 3.0 **host** DLL's named export while its frame
|
||||
generation goes through the 1.1.x monolith's `ffxDispatch`, so the leaf-only build printed
|
||||
`upscaler: N/A` beside `FsrFg` (§H11, 2026-09-04). The host is hooked at its own export with its own
|
||||
trampoline and latch, keyed by module in the installer, under the same family and publish point as
|
||||
the four ffx-api rows (`PublishFfxFamilyIfWhole` waits for a loaded host as it waits for a loaded
|
||||
leaf); its UPSCALE feeds the same drain word — identity `FSR3` as a fact, `renderSize` as the
|
||||
extent, the count when neither Streamline nor a PREPARE has spoken. Rule 4: `renderSize` of the
|
||||
descriptor the title passed and nothing else; the offset is pinned to a literal (1256).
|
||||
`ffxFsr3DispatchFrameGeneration` is deliberately not a row, with the reversal condition
|
||||
pre-committed in §H11. **The headers are vendored from tag `fsr3-v3.0.4`, not the `v1.1.4` three
|
||||
documents named**: the shipped module's twelve `ffxFsr3*` exports match 3.0.4 exactly, 1.1.4
|
||||
declares fifteen and appends fields after `renderSize`, and at 3.0.4 `ffx_types.h` reaches no
|
||||
`<mutex>` at all (ten files, no `ffx_message.h`; `src/native/third_party/fidelityfx-fsr3/`, root
|
||||
`LICENSE.txt` MIT verbatim, `license-check.ps1` §2e per file, blob shas checked against upstream).
|
||||
The two FidelityFX trees share one struct name, so the 3.0.4 header is included inside a
|
||||
namespace. Fixtures: the `ffx_fsr3_x64.dll` stub (Pass C's second positive control), harness
|
||||
topologies `fsr3host` / `fsr3host+mono`, an `[ffx]` injected case at K = 1 (the row's double-count
|
||||
control) and K ∈ {1, 4} beside the monolith, and a consumer case for Cyberpunk's shape. Owed: the
|
||||
owner's acceptance run, rows B1–B4 in §H11.
|
||||
- **The report names the loaded vendor runtimes with their FILE versions, and a counted `none` is
|
||||
WITHHELD on the one shape measured to be wrong.** Dying Light: The Beast (Streamline 2.8.0) read
|
||||
`presents = tokens` five times with DLSS Frame Generation ON, and the owner's reading on 2026-09-05
|
||||
settled which way to read it: the title runs at DLSS ×4, the frames this hook records are the
|
||||
native ones, and the generated presents never reach the `Present` bodies the Overlay patches
|
||||
(`20_OPEN_QUESTIONS` §H5 case 3, realised). The census could not have said so — it records module
|
||||
NAMES, and Cyberpunk 2077 on 2.7.1 reads ×3.99 through the same hook — so the capture host now takes
|
||||
an out-of-process module snapshot beside every guard scan (`Process.Modules` + the file's version
|
||||
resource, the same documented module list the guard already enumerates; no game memory, no layout
|
||||
change, nothing on the present path) and prints one `module:` line per census-named module with
|
||||
version and path. `MeasuredFacts` withholds `none` when `sl.dlss_g.dll` — the Streamline plugin that
|
||||
would be doing the presenting, NOT `nvngx_dlssg.dll`, which every validated `none` also has loaded —
|
||||
is in the census beside an interposer at or above 2.8.0 (or one whose version could not be read), and
|
||||
the report falls through to `Presented FPS` with a qualifier that says the number counts APPLICATION
|
||||
frames and that the Displayed rate is unknown. Every validated `none` (Cyberpunk off / ×3 / ×4,
|
||||
Expedition 33 and Lies of P with frame generation off) is byte-identical, and eight cases pin that.
|
||||
The gate is interim: §H5 pre-commits the owner's session (DL:TB FG off / FG ×4, Cyberpunk MFG ×4,
|
||||
PresentMon elevated beside each) and the row on which it is withdrawn.
|
||||
|
||||
- **A whole-resource tag now yields the size the tagged `sl::Resource` declares.** Streamline
|
||||
documents a zero `extent` as "use the entire resource"; a title tagging that way stated the
|
||||
render size nowhere the Overlay read, and Dying Light: The Beast (SL 2.8.0) still published no
|
||||
extent on the `slSetTagForFrame` build with both tag rows live. `TagSize` in `fl_sl_inputs.h`
|
||||
reads the extent first and, when it is zero, the Resource's own `width/height` — GUID-checked,
|
||||
from the argument the hooked API received, on the local walk and both global-tag detours alike,
|
||||
so the three routes cannot disagree about what a tag says. A Resource declaring no size is
|
||||
still the honest unknown. Unit cases cover the shape, precedence of a non-zero extent over the
|
||||
Resource, a Resource that fails the GUID check and a half-declared size; the harness tags in
|
||||
that shape under `--sl-tag-whole-resource` and an injected case asserts the exact size arrives
|
||||
on every record through the 2.8 export.
|
||||
|
||||
### Changed
|
||||
|
||||
- **7a on Dying Light: The Beast closes as measured `N/A`** (docs): the 00:53 capture on the
|
||||
whole-resource build still carried no render size on either global-tag route, so the quality
|
||||
byte and the render size are `N/A` on this title, honestly, and the derived-label decision
|
||||
applies to the titles that print the line. The DLSS-FG-on `presents = tokens` result is now
|
||||
five for five; by owner decision it is handled in its own session and PR (`HANDOFF` 7a, §H5).
|
||||
- **`20_OPEN_QUESTIONS` §H5 has a candidate title for case 3.** Dying Light: The Beast at DLSS
|
||||
with DLSS Frame Generation on read `presents = tokens` on four captures (the same title with
|
||||
FSR FG read ×2; Cyberpunk on Streamline 2.7.1 read ×3.99), so the report printed `frame
|
||||
generation: none` on a generating title. The two readings the record cannot separate and the
|
||||
discriminator — the owner's counter — are pre-committed there.
|
||||
|
||||
- **A row for `sl.interposer.dll!slSetTagForFrame`, Streamline 2.8's frame-based tag entry
|
||||
point.** Dying Light: The Beast ships Streamline 2.8.0, which deprecates `slSetTag` in favour of
|
||||
`slSetTagForFrame` (the frame token first, then the same tag list); the title published `Dlss`
|
||||
identity on every batch across three captures and the params bit on none, because the only
|
||||
params row hooked the deprecated export. The new detour hands the list to the same tag walk, has
|
||||
its own trampoline, and is selected by SYMBOL
|
||||
through a constant the inventory header binds to its row with a `static_assert` — Pass B forbids
|
||||
the literal anywhere else. **The params family is published when whole**, once every tag export
|
||||
the loaded interposer has is patched — a 2.7 interposer is whole with `slSetTag` alone, a 2.8 one
|
||||
needs both — because the first cut published it on the first row and the frame-based fixture
|
||||
measured 38 of 41 records claiming params, the ffx leaves' install-window defect from #110
|
||||
again. The stub exports it, the harness tags through it under `--sl-tag-for-frame`, and a Catch2
|
||||
case asserts the exact tagged extent arrives on every record with `slSetTag` never called.
|
||||
- **`tools/vendor-exports.ps1` unions exports across every copy of a module name** and lists every
|
||||
distinct version seen, instead of recording the first copy the walk reached. With `sl.interposer.dll`
|
||||
installed as 2.7.1 and 2.8.0 side by side, whether the oracle contained `slSetTagForFrame`
|
||||
depended on directory order; `docs/vendor-exports.json` is regenerated (ten interposer copies,
|
||||
eight versions from 1.5.6 to 2.10.3).
|
||||
|
||||
- **The report's `render -> output` line is computed, not "not computed yet".** Every real-title
|
||||
run since 2026-08-15 printed the raw sizes two lines above an N/A. `UpscaleExtent` takes the
|
||||
MODAL (render, output) tuple over the records that claim both `FL_MEASURED_UPSCALER_PARAMS` and
|
||||
`FL_MEASURED_OUTPUT_RES`, and the line prints the two measured sizes, `03_METRICS` §Upscaling's
|
||||
`sqrt((outW×outH)/(renW×renH))`, the reciprocal as a render-scale percentage, the record counts,
|
||||
and a **SETTINGS MOVED** flag when the window held more than one tuple — modal rather than mean,
|
||||
because averaging across a settings change is the classic way a benchmark number stops meaning
|
||||
anything. Cyberpunk's 1485×835 at 2560×1440 reads `1.72x (58% render scale)`. **No preset name is
|
||||
derived from it**: whether a label such as "≈ Balanced" may appear beside a measured field is
|
||||
HANDOFF item 7a's owner decision, and the quality byte stays what the writer measured.
|
||||
|
||||
- **The SDK 2.x loader is the fourth AMD row, because three loader-shipping titles read silent
|
||||
behind the leaf-only build.** The owner's run on #110 (thirteen captures, nine titles, one launch
|
||||
each) landed rows A1–A3 exactly as pre-committed — Lies of P `Fsr3` / `FsrFg` / `118.98 → 238.02
|
||||
@@ -41,8 +272,16 @@ GitHub release body, so a missing section will mean an empty release note.
|
||||
3.0 route; and **Rune Factory: Guardians of Azuma is HANDOFF 7b's statically linked title** — the
|
||||
monolith ships beside it and is never loaded, yet the Streamline token count still read
|
||||
`59.99 → 119.95 (×2 FG)`, so the ceiling for such a title is the trio with the vendor missing, not
|
||||
Presented FPS alone. Owed: the three loader titles against §H11 row R6. `20_OPEN_QUESTIONS` §H11
|
||||
carries the run table; `HANDOFF` 7b/7c and `spike-notes` §9 carry the corrections.
|
||||
Presented FPS alone. **Row R6 ran the same night on this build:** Dying Light: The Beast at FSR +
|
||||
FSR FG printed `FSR (3.1 or 4 …)` / `FsrFg` / `70.49 → 140.9 (×2 FG)` with `frames/upscale-drained`
|
||||
1.01, and KCD2 at FSR the identity with `none` at 1.00 — the loader row carries both, once, which
|
||||
is the K = 1 control confirmed on a real title. Wukong at FSR with FG off read silent at the
|
||||
monolith and the loader alike with the monolith loaded, and offers no FSR frame generation at
|
||||
all: FSR upscaling compiled into its UE plugin (Rune Factory's shape), the monolith shipped and
|
||||
loaded for nothing this hook sees — the second static title, and nothing more is owed on AMD
|
||||
identity beyond the FSR 3.0 host route.
|
||||
`20_OPEN_QUESTIONS` §H11 carries the run tables; `HANDOFF` 7b/7c and `spike-notes` §9 carry the
|
||||
corrections.
|
||||
|
||||
- **AMD identity is measured through the ffx-api leaves, and the first non-NVIDIA vendor
|
||||
reaches the record.** HANDOFF item 7c. Lies of P at FSR 3.1 + frame generation printed
|
||||
@@ -260,6 +499,8 @@ GitHub release body, so a missing section will mean an empty release note.
|
||||
|
||||
### Fixed
|
||||
|
||||
- **A candidate with no main module yet is counted as unreadable, not dropped as absent.** `TargetResolverTests.OneInstanceResolves` went red on the hosted runner twice in one hour on 2026-09-04 with `TargetNotRunning` about a process the test had just shown was enumerable: a freshly started process can be in the snapshot before its image is mapped, `Process.MainModule` is then null, and the resolver skipped it without counting it — narrowing the set exactly the way its own comment says "could not look" must not. It is now counted like a process we lack the rights to read (so the answer is `TargetAmbiguous`, never a false `TargetNotRunning`), and the test's "visible" wait means readable, not merely enumerated.
|
||||
|
||||
- **Two review checklists were boxes that could not fail**, in `19_SAFETY` §Review checklist and in
|
||||
the pull-request template: *"Is there a Tier-2 degradation path if the hook is unavailable?"*
|
||||
Under a two-rung ladder the answer is always yes. Replaced with something falsifiable — does the
|
||||
|
||||
@@ -18,6 +18,10 @@ A C++ DLL (`FrameLedger.Overlay.dll`) is injected into games the user explicitly
|
||||
6. **FPS display rule (product requirement):** wherever FPS is shown and Frame Generation is active, show *Native FPS*, *Displayed FPS*, and the FG factor together (`62 → 118 FPS (×1.9 FG)`). Never a single inflated number. See `docs/03_METRICS.md`.
|
||||
|
||||
> **Amended 2026-09-03 (owner decision).** When frame generation is *not measured* — `FL_MEASURED_FG` clear, which is every title on today's writer — the one number that may stand alone is **Presented FPS** (`presents / D`), with a mandatory qualifier from the **runtime census** (`FlWriterState.runtimeCensus`): "no frame-generation runtime was loaded, so this cannot include in-process generated frames" or "a frame-generation runtime is loaded and nothing was observed — this MAY include generated frames". The word "Native" never appears alone. **The census never produces `none`**: a statically linked FSR has no module to see, and a census-`none` there would be exactly the inflated number this rule forbids.
|
||||
>
|
||||
> **Amended 2026-09-05.** A counted `none` (`presents = application frames`) is **withheld** — Presented FPS with a third qualifier, "this number counts application frames; the Displayed rate is unknown" — on the one shape measured to produce a false `none`: Streamline ≥ 2.8.0 with `sl.dlss_g.dll` loaded (Dying Light: The Beast, five captures, DLSS FG ×4 per the owner). `docs/03_METRICS.md` §Frame Generation carries the key and why it is the Streamline plugin rather than `nvngx_dlssg.dll`; `20_OPEN_QUESTIONS` §H5 carries the session that keeps or withdraws it.
|
||||
>
|
||||
> **Amended 2026-09-06 (Leg 0 landed): narrowed, not withdrawn.** `sl.dlss_g.dll` is a startup-time load on that title (frame generation off, census unchanged, twice), and the same morning's ×4 capture measured the discriminator the gate lacked: the 2.8.0 pacer's generated presents are DXGI presents on the hooked chain (§H5 row P1-DXGI), counted through `dxgiUnseen` into `Native 70.52 → Displayed 282.08 (×4 FG)`. So a counted `none` beside a READ `IDXGISwapChain::GetLastPresentCount` with zero unseen is `none`, printed with DXGI's agreement; it is withheld only when the counter was not read.
|
||||
7. **RT / PT / RR are tri-state** (`Yes` / `No` / `N/A`) with manual override. They are now *measured*, not guessed — but where measurement is genuinely impossible, the honest answer is still `N/A`. Never fabricate `Yes`.
|
||||
|
||||
> **Amended 2026-08-20 with the PR that wrote the hooks, per the owner ruling of 2026-08-14.** This rule named *"inline RayQuery without DXIL scan"* as one of the impossible cases, and that conflated two questions. **Whether rays are being traced is measurable** — `BuildRaytracingAccelerationStructure` is called by RayQuery titles and by `DispatchRays` titles alike, which is why both hooks exist and why the `No` branch requires the AS-build hook to have been *installed*. What needs a DXIL scan is **classifying the technique as RayQuery**, and that stays `N/A`. So the impossible cases are: naming the technique, and path-tracing classification, which has no API-level signature at all (`03_METRICS` §RT/PT/RR — a confidence score that may only ever *suggest*).
|
||||
|
||||
+109
-3
@@ -77,6 +77,41 @@ This is the metric the rewrite exists for. Resolution ladder, highest confidence
|
||||
published `presents / tokens` at or below 1.05 over a uniform window (§The source, below).
|
||||
Never from a hook that merely saw nothing (rung 0), and never from the census.
|
||||
|
||||
> ### Displayed may be DXGI-COUNTED — measured 2026-09-05 on Dying Light: The Beast
|
||||
>
|
||||
> `F_disp = presents observed by the hook` (§Counting, below) assumed every present reaches the
|
||||
> `Present` / `Present1` bodies the Overlay inline-patches. On Streamline 2.8.0 with DLSS Frame
|
||||
> Generation ×4 it does not: the hook timed 4,392 presents while `IDXGISwapChain::GetLastPresentCount`,
|
||||
> read on the same chain at every hooked present, moved by 17,133 — **2.90 unseen presents per hooked
|
||||
> one** (2.95 on the second capture) — against **0.00** on Streamline 2.7.3 (Hell Is Us, ×3.86) and
|
||||
> 2.10.3 (the Onimusha demo, ×3.67), where the generated presents come through the patched bodies. So
|
||||
> the record carries `dxgiUnseen` (@52, under `FL_MEASURED_DXGI_PRESENTS`) and the consumer's window
|
||||
> counts
|
||||
>
|
||||
> ```
|
||||
> F_disp = hooked presents + Σ dxgiUnseen (DXGI-COUNTED when the sum is > 0)
|
||||
> ```
|
||||
>
|
||||
> **When the sum is above zero the report says so on its own line — "Displayed is DXGI-COUNTED" —
|
||||
> because the number is then a count DXGI made, on the hooked chain, of presents this hook never
|
||||
> timed.** It may stand in the rule-6 trio and in `presents/batch`; it may NOT stand in a frame-time
|
||||
> distribution, which has no timestamps for those presents. The uniformity buckets take the same
|
||||
> numerator, so a session whose pacer stopped mid-way refuses exactly as one whose tokens stopped. A
|
||||
> saturated byte (255) is refused like a saturated `fgEvaluations`, and a present the hook saw and
|
||||
> declined (a paused session) is not unseen — the resume's first record differences nothing.
|
||||
>
|
||||
> **Landed 2026-09-06 (`spike-notes` §9): `Native FPS: 70.52 -> Displayed FPS: 282.08 (x4 FG) over 16516
|
||||
> present(s)` on Dying Light: The Beast, 12,387 of them DXGI-counted, `frame generation: DlssG`** — the
|
||||
> rule-6 trio on the title that could not print it. **And the counter decides `none` on that shape.**
|
||||
> Leg 0 the same morning (frame generation off, twice) read presents = tokens with `unseen=0` over 3,659
|
||||
> and 4,519 samples, census unchanged (`sl.dlss_g.dll` is a startup-time load), so the withheld gate is
|
||||
> narrowed rather than withdrawn: a counted `none` beside a READ counter with zero unseen prints as
|
||||
> `none` with DXGI's agreement on the line; only a session where the counter was not read withholds.
|
||||
> A writer state that counted unseen presents the records do not carry is a contradiction and is
|
||||
> refused as neither. `20_OPEN_QUESTIONS` §H5 keeps the
|
||||
> rows this landed on; which body the 2.8.0 pacer presents through is unlocalised and does not need
|
||||
> to be for the count.
|
||||
>
|
||||
> **RUNG 2 IS CONDITIONAL ON THE VENDOR, measured 2026-08-20, and this list read as
|
||||
> though it were not.** `--track_frame_type` is a **beta** option in PresentMon 2.5.1
|
||||
> and its own help says it *"requires application and/or driver instrumentation using
|
||||
@@ -234,8 +269,42 @@ F_app = Σ fgEvaluations (APPLICATION frames, counted at the
|
||||
> Streamline batch is an application frame on that title — with a second count rather than an
|
||||
> oracle.
|
||||
>
|
||||
> **And one shape on which the counted `none` is WITHHELD, measured 2026-09-04/05.** Dying Light:
|
||||
> The Beast ships Streamline **2.8.0**; five captures at DLSS with DLSS Frame Generation ON read
|
||||
> `presents = tokens` (1.00), and the owner's reading settled it: the title runs at ×4, the frames
|
||||
> this hook records are the native ones, the generated presents never reach the `Present` bodies
|
||||
> the Overlay patches (`20_OPEN_QUESTIONS` §H5 case 3). On that shape the count is right about the
|
||||
> application frames and wrong about the presents, and a `none` computed from it is the affirmative
|
||||
> negative this document forbids. So the consumer withholds `none` — and prints **Presented FPS** with
|
||||
> a qualifier saying the number counts *application* frames and the Displayed rate is unknown — when
|
||||
> `sl.dlss_g.dll` is in the census beside an interposer whose **file version** (read out of process by
|
||||
> the capture host, never by the hook) is ≥ 2.8.0 or unreadable. **The key is the Streamline plugin,
|
||||
> not `nvngx_dlssg.dll`:** every validated `none` above has the NGX module loaded and the plugin bit
|
||||
> clear, so the gate leaves each of them byte-identical. It is interim: §H5 pre-commits the session
|
||||
> that keeps, narrows or withdraws it.
|
||||
>
|
||||
> **What `fgMode` still is.** Identity — `DLSS_G` when a `kFeatureDLSS_G` evaluation drained,
|
||||
> `UNKNOWN` otherwise — from the evaluate detour, unchanged. A factor ≥ 1.5 with `UNKNOWN`
|
||||
> `UNKNOWN` otherwise — from the evaluate detour, unchanged. **And since 2026-09-05, `DLSS_G` when the
|
||||
> present drained a HUD-less or UI tag** (`kBufferTypeHUDLessColor`, `kBufferTypeUIColorAndAlpha`,
|
||||
> `kBufferTypeUIAlpha`) on any of the three tag routes the Overlay already hooks: Streamline's DLSS-G
|
||||
> programming guide §5.0 requires a title running frame generation to tag those buffers every frame, and
|
||||
> nothing else a title evaluates through Streamline that generates frames consumes them. Read off the
|
||||
> argument of an API already hooked (rule 4), zero new hooks — the identity `kFeatureDLSS_G` evaluations
|
||||
> were supposed to give and gave on no measured title. **Identity only.** A title may tag the inputs with
|
||||
> frame generation switched off in its menu, so the consumer's rule is: **the count decides `none`,
|
||||
> identity decides the name** — an active count beside the mark prints `DlssG`; a counted 1.0 beside it
|
||||
> prints `none` with the inputs noted; the withheld shape (§H5) keeps its N/A with the tags reported in
|
||||
> the census line — narrowed 2026-09-06 to sessions where DXGI's counter was not read (§Displayed may be
|
||||
> DXGI-COUNTED). `FsrFg` keeps precedence over the count, because a drained FRAMEGENERATION dispatch
|
||||
> is a generated batch. `FlWriterState.slTagCensus` carries which types arrived on which route for the
|
||||
> session (`fl_shm.h` §slTagCensus).
|
||||
>
|
||||
> **Refused, with the reason written:** `slDLSSGGetState`, the API the DLSS-G guide §14.0 names for
|
||||
> "the actual number of frames presented". Its `numFramesActuallyPresented` is *"the number of frames
|
||||
> presented since the last `slDLSSGGetState` call"* — the call RESETS the plugin's counter, so a
|
||||
> measurement tool calling it would corrupt the very number a title reads for its own FPS display; and
|
||||
> `sl_dlss_g.h` marks it *"NOT thread safe"*. Observing is the whole posture; a query with a side
|
||||
> effect on the host is not observing. A factor ≥ 1.5 with `UNKNOWN`
|
||||
> identity is *frame generation active, technology not identified*, which on a UE5 title with
|
||||
> both Streamline and FidelityFX loaded is the honest answer.
|
||||
|
||||
@@ -269,8 +338,13 @@ F_app = Σ fgEvaluations (APPLICATION frames, counted at the
|
||||
> the first** is 7c's own rule, and this is it.
|
||||
>
|
||||
> The acceptance table for the owner's three launches is pre-committed in `20_OPEN_QUESTIONS` §H11.
|
||||
> What this route does NOT reach: the FSR 3.0 host DLLs (`ffx_fsr3_x64.dll`, named exports, deferred
|
||||
> to their own PR), statically linked FSR (§Scope decisions), and Intel (closed at the census).
|
||||
> What this route does NOT reach: statically linked FSR (§Scope decisions) and Intel (closed at the
|
||||
> census). **The FSR 3.0 host DLL is reached since 2026-09-05** — a fifth AMD target,
|
||||
> `ffx_fsr3_x64.dll!ffxFsr3ContextDispatchUpscale` (Cyberpunk 2077's copy; named export, its own
|
||||
> descriptor, tag `fsr3-v3.0.4`), whose UPSCALE feeds the same drain word: identity `FSR3` as a
|
||||
> fact, `renderSize` as the extent, and the count from its upscales when neither Streamline nor a
|
||||
> PREPARE has ever spoken. On Cyberpunk the count stays Streamline's and `FsrFg` stays the
|
||||
> monolith's; the host adds the identity the leaf-only build printed as `N/A`.
|
||||
|
||||
> **MEASURED 2026-08-15, AND IT CHANGES WHAT THIS SECTION CAN PROMISE.** On the one title
|
||||
> measured — Cyberpunk 2077, SL 2.7.1 — `slEvaluateFeature(kFeatureDLSS_G)` is **never
|
||||
@@ -393,6 +467,38 @@ From the upscaler hooks we get, per frame:
|
||||
|
||||
Tier 2 has none of this: `upscaler = unknown`, ratio `N/A`.
|
||||
|
||||
> ### The driver-reported rung — owner decision 2026-09-06, identity only
|
||||
>
|
||||
> Three NGX-direct titles (Lies of P, Hell Is Us, Expedition 33) evaluate DLSS super resolution through
|
||||
> a path no hook of this build sees, and printed `upscaler: N/A` on every capture. The NVIDIA driver
|
||||
> keeps per-process bookkeeping of the feature — `NvAPI_NGX_GetNGXOverrideState` (R570+, MIT NVAPI,
|
||||
> `18_GPU_VENDOR_APIS` L3) returns a feedback word per feature — and **measured 2026-09-06 (driver
|
||||
> 616.64) its `CREATED | EVALUATE` bits are set for a process with NO NVIDIA-app override** on both
|
||||
> no-override titles (`20_OPEN_QUESTIONS` §H5). So the capture host probes it out of process beside
|
||||
> each module snapshot (`fl-probe-nvapi --ngx-state <pid>`, no injection, no consent), and the
|
||||
> `upscaler:` line has a rung between the hooks and `N/A`:
|
||||
>
|
||||
> ```
|
||||
> upscaler: Dlss (driver-reported: the NVIDIA driver reports an NGX super-resolution feature created
|
||||
> and evaluated in this process - not counted by this hook)
|
||||
> ```
|
||||
>
|
||||
> **What it may claim: the vendor and the feature, attributed to the driver.** What it may NOT claim,
|
||||
> each one measured: a quality (`performanceMode` / `renderPreset` are populated only under an
|
||||
> NVIDIA-app override and are then the OVERRIDE's values), a ratio or render size (`scalingRatio` is
|
||||
> 0 even under the override), a frame-generation multiplier (`FG_MODE` / `FG_MULTI_FRAME` stay clear
|
||||
> and `frameGenerationCount` is 0 at ×4 — it is the override target). **Corrected the same day, on the
|
||||
> loop's own readings:** the FG word DOES follow DLSS-G once the feature exists — `CREATED | EVALUATE`
|
||||
> on Hell Is Us, Onimusha and DL:TB at ×4, the word CHANGING between the session's readings; the
|
||||
> morning's `INITIALIZED | DLL_EXISTS` was read before creation. So the FG word is a second witness
|
||||
> for the DLSS-G IDENTITY, printed beside `frame generation:` as agreement or a printed disagreement,
|
||||
> and promoted to `DlssG (driver-reported: …)` only where the count is active and no tag named the
|
||||
> technology. The COUNT is never the driver's. A hook's name always outranks it, and
|
||||
> beside a hook's name the driver's word is printed as agreement, or as a disagreement *printed rather
|
||||
> than resolved*. Beside an `N/A` with the bit clear it prints the driver's negative, attributed, which
|
||||
> says nothing about FSR or XeSS. **The negative is owed** (§H5): a title with DLSS switched off should
|
||||
> read the bit clear; if it does not, the rung is withdrawn.
|
||||
|
||||
## RT / PT / RR — evidence-based tri-state
|
||||
|
||||
Tri-state `Yes | No | N/A` per session with `source` (`measured | manual | inherited`).
|
||||
|
||||
@@ -18,7 +18,7 @@ Derived in the Agent from the record stream; the mapping is in `03_METRICS`. Sum
|
||||
| Graphics API + swapchain format, buffer count, swap effect, flags | `CreateSwapChain*` / present hooks |
|
||||
| Present mode (flip / blt / independent flip) | swapchain desc + `presentFlags` + `syncInterval` |
|
||||
| HDR output | `SetColorSpace1` |
|
||||
| Upscaler identity + quality preset | NGX / Streamline / FFX / XeSS create+evaluate calls |
|
||||
| Upscaler identity + quality preset | NGX / Streamline / FFX / XeSS create+evaluate calls — **or, when no hook saw one, the NVIDIA driver's per-process NGX word, out of process and attributed (`03_METRICS` §Upscaling, the driver-reported rung, 2026-09-06): identity only, never the preset** |
|
||||
| Render resolution vs output resolution (incl. mid-session changes) | upscaler parameter reads + `ResizeBuffers` |
|
||||
| Frame Generation mode + factor | NGX/SL/FFX FG feature evaluation, then cadence — **Tier 1 only**. ~~then (Tier 2 only) PresentMon `FrameType`~~ retired (§S31 row P2), and Tier 2 no longer produces frames to run cadence over either |
|
||||
| Ray Tracing active | AS builds + `DispatchRays` (both, to catch inline RayQuery) |
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ Targets:
|
||||
- `fl-probe-hookprofile` → build-profile probes for `/guard:cf` and `-D_HAS_EXCEPTIONS=0` (`20_OPEN_QUESTIONS` §H1/§H3)
|
||||
- `fl-probe-guard` → measures the Windows APIs the guard is built on, unelevated (`spike-notes.md` §1). Not the guard, and takes no injection rights.
|
||||
- `fl_stub_sl_interposer` → `sl.interposer.dll`, and `fl_stub_sl_common` → `sl.common.dll` (`src/native/tools/vendor-stubs/`). **Fixtures, never shipped**, built under `FL_BUILD_TOOLS`; nothing `12_BUILD` publishes references them. They export the **measured** vendor names from `docs/vendor-exports.json` so the Overlay's symbol resolution is observable, and the second is a **decoy** exporting the same name from a different module — without it, "we resolve module-scoped" is a property no test can falsify. Their **output filenames are the vendor's and their version blocks are ours**: `fl_add_version_resource` takes the real filename so a file called `sl.interposer.dll` in our build tree still says plainly that it is FrameLedger's, which `19_SAFETY` requires of everything we build.
|
||||
- `fl_stub_ffx_dx12` → `amd_fidelityfx_dx12.dll`, `fl_stub_ffx_upscaler` → `amd_fidelityfx_upscaler_dx12.dll`, `fl_stub_ffx_fg` → `amd_fidelityfx_framegeneration_dx12.dll` — the three AMD **leaves** — and `fl_stub_ffx_loader` → `amd_fidelityfx_loader_dx12.dll`, a **forwarding stand-in** bound to the two 2.x leaves through their FrameLedger-named *direct* entry — the way the real loader was measured to bypass the leaves' exports — so `--hold-presenting-ffx` can push every dispatch through a loader that is hooked along with the leaves and prove the count reads 1× (2026-09-04). Same rules as the Streamline stubs: fixtures, never shipped, vendor filenames with our version blocks.
|
||||
- `fl_stub_ffx_dx12` → `amd_fidelityfx_dx12.dll`, `fl_stub_ffx_upscaler` → `amd_fidelityfx_upscaler_dx12.dll`, `fl_stub_ffx_fg` → `amd_fidelityfx_framegeneration_dx12.dll` — the three AMD **leaves** — and `fl_stub_ffx_loader` → `amd_fidelityfx_loader_dx12.dll`, a **forwarding stand-in** bound to the two 2.x leaves through their FrameLedger-named *direct* entry — the way the real loader was measured to bypass the leaves' exports — so `--hold-presenting-ffx` can push every dispatch through a loader that is hooked along with the leaves and prove the count reads 1× (2026-09-04). Same rules as the Streamline stubs: fixtures, never shipped, vendor filenames with our version blocks. `fl_stub_ffx_fsr3_host` → `ffx_fsr3_x64.dll` (2026-09-05): the FSR 3.0 **host** facade, exporting the four names `SpeaksFsr3Host` probes for through the vendored `fsr3-v3.0.4` header's own `FFX_API`; `--ffx-topology fsr3host|fsr3host+mono` drives it, and `hookinventory-check` Pass C reads it as the export parser's second positive control.
|
||||
- **`fl_fidelityfx_headers`** → an INTERFACE target over the five vendored FidelityFX ffx-api headers (`src/native/third_party/fidelityfx/`, tag v2.3.0, MIT by exception). Three include directories because upstream's headers include each other by relative path; include directories only and nothing to link — no `.lib` is vendored — and `hookinventory-check` Pass C reads the Overlay's export table because `ffx_api.h` declares its entry points `__declspec(dllexport)` unconditionally.
|
||||
- **`fl_streamline_headers`** → an INTERFACE target over the vendored MIT Streamline headers (`src/native/third_party/streamline/`). Include directories only, **never linked**: `SL_API` entry points are `extern "C"` imports, and linking one would make `sl.interposer.dll` a load-time dependency of `FrameLedger.Overlay.dll`, which would stop the Overlay loading in every game that ships no Streamline — in the loader, before any of our code runs, with no message anywhere.
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ Every hook must be listed here with a purpose. Anything not on this list is not
|
||||
### Presentation
|
||||
| Hook | Purpose |
|
||||
|---|---|
|
||||
| ✅ `IDXGISwapChain::Present`, `Present1` | Frame boundary, QPC, sync interval, present flags. **`DXGI_PRESENT_TEST` calls are dropped without a record** — the occlusion probe submits nothing, and a minimised game emits a stream of them (`07_IPC` §Protocol rules) |
|
||||
| ✅ `IDXGISwapChain::Present`, `Present1` | Frame boundary, QPC, sync interval, present flags. **`DXGI_PRESENT_TEST` calls are dropped without a record** — the occlusion probe submits nothing, and a minimised game emits a stream of them (`07_IPC` §Protocol rules). **Since 2026-09-05 the hook also reads `IDXGISwapChain::GetLastPresentCount` on the chain it just saw** (rule 4: the same COM object `FindOrAdd` already calls `GetDesc` on, no new hook) and publishes `dxgiPresentSamples` / `dxgiPresentsUnseen` — DXGI's count of presents on that chain that this hook never saw, the in-process half of `20_OPEN_QUESTIONS` §H5 Leg 1. One virtual call per hooked present, costed by `hook-harness --probe-frames`. **And per record since the same night: `dxgiUnseen` @52 under `FL_MEASURED_DXGI_PRESENTS`**, so the consumer's window counts `Displayed = hooked + unseen` per bucket (`03_METRICS` §Displayed may be DXGI-COUNTED) — measured 2.90 / 2.95 on DL:TB at Streamline 2.8.0, 0 on 2.7.3 and 2.10.3 |
|
||||
| ✅ `IDXGISwapChain::ResizeBuffers` · ⏳ `ResizeTarget` | Output resolution changes mid-session. `ResizeBuffers` re-reads the swapchain description *after* the original returns; `ResizeTarget` is not hooked |
|
||||
| ⏳ `IDXGISwapChain::SetFullscreenState` | Fullscreen ↔ borderless transitions |
|
||||
| ⏳ `IDXGISwapChain3::SetColorSpace1` | HDR output detection. **`IDXGISwapChain3`, not 4** — 4 adds only `SetHDRMetaData` (`20_OPEN_QUESTIONS` §H9). Unbuilt, which is why `colorSpace` reads `NOT_REPORTED` and `FL_MEASURED_HDR` stays clear. **When it is built, the writer must initialise `colorSpace = FL_COLOR_SPACE_SDR` at swapchain identification** — an SDR title never calls `SetColorSpace1`, so "hook live, no call" would otherwise sit at `NOT_REPORTED` forever and HDR's definite `No` would be unreachable. DXGI documents G22/Rec.709 as the default, which makes SDR a *measured* default rather than an affirmative negative |
|
||||
@@ -149,10 +149,11 @@ Every hook must be listed here with a purpose. Anything not on this list is not
|
||||
| NGX: `NVSDK_NGX_D3D11/D3D12/VULKAN_CreateFeature`, `EvaluateFeature`, `ReleaseFeature` | Which NGX feature is *actually created and evaluated per frame*: SuperSampling (DLSS), RayReconstruction (DLSS-D), FrameGeneration (DLSS-G) |
|
||||
| NGX parameter accessors (`NVSDK_NGX_Parameter_SetI/GetI/SetUI`) — **exported by `sl.common.dll` only; see below** | `Width`/`Height` (render) vs `OutWidth`/`OutHeight` (output), `PerfQualityValue` (quality preset), sharpness |
|
||||
| ✅ Streamline: `slEvaluateFeature` · ⏳ `slInit`, `slSetFeatureLoaded`, `slSetConstants`, `slGetFeatureRequirements` | Feature set actually active when the game goes through SL rather than NGX directly (`kFeatureDLSS`, `DLSS_G`, `DLSS_RR`, `Reflex`, `NIS`). **Built 2026-08-09**, identity only: one MinHook detour on `sl.interposer.dll!slEvaluateFeature`, resolved **module-scoped** and installed lazily by the watchdog. Sets `FL_MEASURED_UPSCALER` + `FL_HOOK_UPSCALER_IDENTITY`; decodes `kFeatureDLSS`/`kFeatureNIS` and reports `FL_UPSCALER_UNKNOWN` for anything else. **Never `FL_UPSCALER_NONE`** — a Streamline-only writer cannot see FFX, XeSS or NGX-direct, and `NONE` is the only one of the three states that may be aggregated as a negative |
|
||||
| ✅ Streamline: `slSetTag` | The **global** resource tags, where a title states the size of the buffer it is upscaling *from*: `kBufferTypeScalingInputColor`'s extent → `renderW/H`. **Built 2026-08-15** (`FL_HOOK_UPSCALER_PARAMS`), and it is an ALTERNATIVE to the local tags in `slEvaluateFeature`'s `inputs`, not a layer over them — `sl_core_api.h:258` says global and local tags "do NOT interact", so a title using one yields nothing from the other and both are read. Published only on a frame where an evaluation was also seen, because a tag is viewport state that outlives any one frame. This row was MISSING from this table while the hook shipped, which is the gap the banner above now names |
|
||||
| ✅ **FidelityFX ffx-api: `ffxDispatch` on the FOUR modules a game calls** — `amd_fidelityfx_dx12.dll` (SDK 1.1.x monolith), `amd_fidelityfx_upscaler_dx12.dll`, `amd_fidelityfx_framegeneration_dx12.dll`, **and `amd_fidelityfx_loader_dx12.dll`** (added the evening of 2026-09-04: three loader-shipping titles at FSR produced zero dispatches at any leaf export, so the loader is where their calls arrive) · ⏳ FSR 3.0 host route `ffx_fsr3_x64.dll!ffxFsr3ContextDispatchUpscale` / `ffxFsr3DispatchFrameGeneration` · ~~`ffxFsr2ContextCreate`~~ · ~~`ffxCreateContext`~~ | **Built 2026-09-04** (`HANDOFF` item 7c). One observer behind three trampolines reads the DESCRIPTOR the title passed — head type first, body only after the type matched a constant from the vendored MIT headers (`third_party/fidelityfx/`, tag v2.3.0): **UPSCALE** → identity (`FSR3` from the monolith, `FSR_UNVERSIONED` from the 2.x upscaler DLL, which hosts FSR 3.1 and FSR 4 behind one type) + `renderSize` → `renderW/H` (quality and sharpness `0xFF`: the dispatch carries neither) + one COUNT; **PREPARE / PREPARE_V2** → `frameID` counted on a *new* index only — this vendor's `slGetNewFrameToken`, the `fgEvaluations` producer once a title has ever prepared, with the UPSCALE count as the fallback for a title that never does; **FRAMEGENERATION** → `fgMode = FSR_FG` on that present. Rule 4: the argument of the API we hooked, never `context`, `pNext`, a command list or a resource. **Why all four:** a UE5 title ships the two leaves with no loader and calls their exports; a loader-shipping title calls the loader's export and the signed loader reaches its providers through an object, not the leaves' exports (measured: Dying Light: The Beast, KCD2, Wukong). The morning's "never the loader" rested on the export tables alone and was reversed by the run. What guards against a loader that DID re-enter a leaf's export is the K = 1 control with all four hooked and the consumer's `frames/upscale-drained`, both of which read 2× in that case. `ffxCreateContext` is deliberately NOT a row — nothing it carries fills a field the dispatch does not, and its honest family would collide with `slEvaluateFeature`'s under the installer's equality binding. The family is compound (`IDENTITY \| PARAMS \| FG_EVALUATIONS`), pinned by `static_assert`s that also bind the leaf table to the rows both ways and refuse the loader as a row. Streamline keeps precedence for the count once it has ever issued a token, so every §S31-validated title is byte-identical. Second count: the consumer prints `frames/upscale-drained`, the AMD `tokens/batch`. **FSR 3.0** (Cyberpunk's `ffx_fsr3_x64.dll`, named exports) is its own later PR — ten host headers from tag v1.1.4, and one title here to test on |
|
||||
| ✅ Streamline: `slSetTag` — **and, since 2026-09-05, every tag's TYPE** (`slTagCensus`; a HUD-less / UI tag marks the present `FL_FG_DLSS_G`, rule 4: the same argument) | The **global** resource tags, where a title states the size of the buffer it is upscaling *from*: `kBufferTypeScalingInputColor`'s extent → `renderW/H` — **or, since 2026-09-05, the size the tagged `sl::Resource` declares when the extent is zero** (`TagSize` in `fl_sl_inputs.h`, shared by all three tag routes; GUID-checked; a Resource declaring no size is still the honest unknown). **Built 2026-08-15** (`FL_HOOK_UPSCALER_PARAMS`), and it is an ALTERNATIVE to the local tags in `slEvaluateFeature`'s `inputs`, not a layer over them — `sl_core_api.h:258` says global and local tags "do NOT interact", so a title using one yields nothing from the other and both are read. Published only on a frame where an evaluation was also seen, because a tag is viewport state that outlives any one frame. This row was MISSING from this table while the hook shipped, which is the gap the banner above now names |
|
||||
| ✅ Streamline: `slSetTagForFrame` — **and every tag's TYPE, as above** | The same global tags through **Streamline 2.8's frame-based entry point**, which deprecates `slSetTag`: `(const FrameToken&, const ViewportHandle&, const ResourceTag*, uint32_t, CommandBuffer*)` — the token first, then exactly `slSetTag`'s list, handed to the same tag walk. **Built 2026-09-04** (`FL_HOOK_UPSCALER_PARAMS`, its own trampoline; the family is now **published when whole** — once every tag export the loaded interposer has is patched — because publishing on the first row entitled records the second was not yet producing, 38 of 41 on the fixture: the ffx leaves' #110 defect again, fixed the same way). Measured need: Dying Light: The Beast (SL 2.8.0) published `Dlss` identity on every batch and the params bit on none across three captures, because a 2.8 title that tags per frame never calls the deprecated export. The token is not read; the frame count stays with `slGetNewFrameToken`. The installer picks this detour by SYMBOL (`kSymbolSlSetTagForFrame`, bound to the row by `static_assert`), not by family, since the two rows share a family bit and differ in signature |
|
||||
| ✅ **FidelityFX ffx-api: `ffxDispatch` on the FOUR modules a game calls** — `amd_fidelityfx_dx12.dll` (SDK 1.1.x monolith), `amd_fidelityfx_upscaler_dx12.dll`, `amd_fidelityfx_framegeneration_dx12.dll`, **and `amd_fidelityfx_loader_dx12.dll`** (added the evening of 2026-09-04: three loader-shipping titles at FSR produced zero dispatches at any leaf export, so the loader is where their calls arrive) · ⏳ FSR 3.0 host route `ffx_fsr3_x64.dll!ffxFsr3ContextDispatchUpscale` / `ffxFsr3DispatchFrameGeneration` · ~~`ffxFsr2ContextCreate`~~ · ~~`ffxCreateContext`~~ | **Built 2026-09-04** (`HANDOFF` item 7c). One observer behind three trampolines reads the DESCRIPTOR the title passed — head type first, body only after the type matched a constant from the vendored MIT headers (`third_party/fidelityfx/`, tag v2.3.0): **UPSCALE** → identity (`FSR3` from the monolith, `FSR_UNVERSIONED` from the 2.x upscaler DLL, which hosts FSR 3.1 and FSR 4 behind one type) + `renderSize` → `renderW/H` (quality and sharpness `0xFF`: the dispatch carries neither) + one COUNT; **PREPARE / PREPARE_V2** → `frameID` counted on a *new* index only — this vendor's `slGetNewFrameToken`, the `fgEvaluations` producer once a title has ever prepared, with the UPSCALE count as the fallback for a title that never does; **FRAMEGENERATION** → `fgMode = FSR_FG` on that present. Rule 4: the argument of the API we hooked, never `context`, `pNext`, a command list or a resource. **Why all four:** a UE5 title ships the two leaves with no loader and calls their exports; a loader-shipping title calls the loader's export and the signed loader reaches its providers through an object, not the leaves' exports (measured: Dying Light: The Beast, KCD2, Wukong). The morning's "never the loader" rested on the export tables alone and was reversed by the run. What guards against a loader that DID re-enter a leaf's export is the K = 1 control with all four hooked and the consumer's `frames/upscale-drained`, both of which read 2× in that case. `ffxCreateContext` is deliberately NOT a row — nothing it carries fills a field the dispatch does not, and its honest family would collide with `slEvaluateFeature`'s under the installer's equality binding. The family is compound (`IDENTITY \| PARAMS \| FG_EVALUATIONS`), pinned by `static_assert`s that also bind the leaf table to the rows both ways and refuse the loader as a row. Streamline keeps precedence for the count once it has ever issued a token, so every §S31-validated title is byte-identical. Second count: the consumer prints `frames/upscale-drained`, the AMD `tokens/batch`. **FSR 3.0 — BUILT 2026-09-05 as a fifth AMD target:** `ffx_fsr3_x64.dll!ffxFsr3ContextDispatchUpscale` (Cyberpunk's copy; named export, its own descriptor, vendored from tag **`fsr3-v3.0.4`** — the tag whose twelve `ffxFsr3*` declarations match the shipped module, not the `v1.1.4` first named). Rule 4: the detour reads `renderSize` of the descriptor the title passed and nothing else — never the context, a resource or the command list; the offset is pinned to a literal (1256) so a re-vendoring that moved it fails to compile. Same family and publish point as the four rows (`PublishFfxFamilyIfWhole` waits for a loaded host too), keyed by module in the installer; identity `FSR3` as a fact. `ffxFsr3DispatchFrameGeneration` is deliberately not a row (§H11 carries the reversal condition); the `ffx_fsr3upscaler_x64.dll` leaf is the pre-committed alternative if the facade reads silent (row B2) — never both, or `frames/upscale-drained` reads 2.00 |
|
||||
| XeSS: `xessD3D12CreateContext`, `xessD3D12Init`, `xessD3D12Execute` | `outputResolution`, `qualitySetting`, XeSS version; `xess_fg` variants for XeFG |
|
||||
| ✅ **Application frames per present** (`fgEvaluations`) — **`sl.interposer.dll!slGetNewFrameToken` since 2026-09-03** | Native vs Displayed frame counts at Tier 1 — see `03_METRICS` §Frame Generation. **The producer is the frame-token export**: Streamline hands a title one token per application frame and the title must ask; the detour counts distinct tokens between two presents (pointer changes, nothing dereferenced), `FL_HOOK_FG_EVALUATIONS` is its family, and it installs on every Streamline 2 title including the ones that evaluate nothing through `slEvaluateFeature`. Rule 4: the out-parameter of an API we hooked. Premise and its gate in `03_METRICS`; pre-committed table in `20_OPEN_QUESTIONS` §S31. *The row as it stood before:* ~~NGX/SL/FFX/XeSS FG feature evaluations per present. **Built 2026-08-15 for Streamline, and MEASURED TO YIELD NOTHING ON THAT ROUTE**~~ — `slEvaluateFeature(kFeatureDLSS_G)` is never called by Cyberpunk 2077 (0 across ~14,000 batches, four FG settings), so this row installs, is honest, and counts zero; see `docs/HANDOFF.md` item 3. Built on the detour that was already there: `kFeatureDLSS_G` contributes to a saturating COUNT in the same word the feature bits live in (`fl_sl_seen.h`) rather than to a bit, because a bit collapses several evaluations between two presents into one — and under multi-frame generation that is the common case, not the edge. The row's family is therefore compound (`FL_HOOK_UPSCALER_IDENTITY \| FL_HOOK_FG_EVALUATIONS`), pinned by a `static_assert` because `hookinventory-check` reads that column as an opaque identifier. **Counts EVALUATIONS, not generated frames** — the 2026-08-14 owner ruling; the multiplier lives in `sl::DLSSGOptions`, which is only reachable by the route §2b refused. ~~Non-NVIDIA FG vendors are **deferred with a written rationale**: `amd_fidelityfx_framegeneration_dx12.dll` 3.1.5 exports only the five generic `ffx*` entry points, identical to five sibling modules, so identity is in the arguments and we have no headers~~ — **AMD has a producer since 2026-09-04** (the FidelityFX row above: the PREPARE dispatch's `frameID`, or the UPSCALE count on a title that never prepares, feeds `fgEvaluations` when Streamline has never issued a token); Intel stays at the census (`20_OPEN_QUESTIONS` §Scope decisions, by licence); the FSR 3.0 host DLLs are deferred to their own PR |
|
||||
| ✅ **Application frames per present** (`fgEvaluations`) — **`sl.interposer.dll!slGetNewFrameToken` since 2026-09-03** | Native vs Displayed frame counts at Tier 1 — see `03_METRICS` §Frame Generation. **The producer is the frame-token export**: Streamline hands a title one token per application frame and the title must ask; the detour counts distinct tokens between two presents (pointer changes, nothing dereferenced), `FL_HOOK_FG_EVALUATIONS` is its family, and it installs on every Streamline 2 title including the ones that evaluate nothing through `slEvaluateFeature`. Rule 4: the out-parameter of an API we hooked. Premise and its gate in `03_METRICS`; pre-committed table in `20_OPEN_QUESTIONS` §S31. *The row as it stood before:* ~~NGX/SL/FFX/XeSS FG feature evaluations per present. **Built 2026-08-15 for Streamline, and MEASURED TO YIELD NOTHING ON THAT ROUTE**~~ — `slEvaluateFeature(kFeatureDLSS_G)` is never called by Cyberpunk 2077 (0 across ~14,000 batches, four FG settings), so this row installs, is honest, and counts zero; see `docs/HANDOFF.md` item 3. Built on the detour that was already there: `kFeatureDLSS_G` contributes to a saturating COUNT in the same word the feature bits live in (`fl_sl_seen.h`) rather than to a bit, because a bit collapses several evaluations between two presents into one — and under multi-frame generation that is the common case, not the edge. The row's family is therefore compound (`FL_HOOK_UPSCALER_IDENTITY \| FL_HOOK_FG_EVALUATIONS`), pinned by a `static_assert` because `hookinventory-check` reads that column as an opaque identifier. **Counts EVALUATIONS, not generated frames** — the 2026-08-14 owner ruling; the multiplier lives in `sl::DLSSGOptions`, which is only reachable by the route §2b refused. ~~Non-NVIDIA FG vendors are **deferred with a written rationale**: `amd_fidelityfx_framegeneration_dx12.dll` 3.1.5 exports only the five generic `ffx*` entry points, identical to five sibling modules, so identity is in the arguments and we have no headers~~ — **AMD has a producer since 2026-09-04** (the FidelityFX row above: the PREPARE dispatch's `frameID`, or the UPSCALE count on a title that never prepares, feeds `fgEvaluations` when Streamline has never issued a token); Intel stays at the census (`20_OPEN_QUESTIONS` §Scope decisions, by licence); the FSR 3.0 host DLL's UPSCALE (`ffxFsr3ContextDispatchUpscale`, since 2026-09-05) counts like an ffx-api UPSCALE when neither Streamline nor a PREPARE has spoken |
|
||||
|
||||
> `GetFrameStatistics().PresentCount` is **not** in this inventory and must not be
|
||||
> re-added as an FG signal. It counts presents the application submitted through
|
||||
|
||||
@@ -105,6 +105,7 @@ Still resolve **entry points defensively at runtime**: `nvapi64.dll` may be abse
|
||||
| Memory | `NvAPI_GPU_GetMemoryInfoEx` — **not `NvAPI_GPU_GetMemoryInfo`**, which this table named until 2026-08-05. The vendored headers mark it `__nvapi_deprecated_function` ("deprecated in release 520"), so under `/W4 /WX` a call to it fails the native build |
|
||||
| **Throttle reasons** | `NvAPI_GPU_GetPerfDecreaseInfo` — not available from L1 or L2 |
|
||||
| Driver version | `NvAPI_SYS_GetDriverAndBranchVersion` |
|
||||
| **NGX per-process state** | `NvAPI_NGX_GetNGXOverrideState` (R570+) — the driver's feedback word per DLSS feature for a PID, read OUT OF PROCESS by `fl-probe-nvapi --ngx-state` and, since 2026-09-06, by the capture host beside each module snapshot. Measured: the SR word's `CREATED \| EVALUATE` is set without an NVIDIA-app override; the FG word follows DLSS-G once created (`CREATED \| EVALUATE` at ×4, corrected the same day — the first reading was blind because it was early), the multiplier bits stay clear; `scalingRatio` is 0 even under an override. Identity only, SR and FG (`03_METRICS` §Upscaling) |
|
||||
| **Reflex / PC latency** | `NvAPI_D3D_GetLatency` → per-frame sim/render/present/driver/GPU timestamps; hooking `NvAPI_D3D_SetSleepMode` / `SetLatencyMarker` in the Overlay tells us the game enabled Reflex (`17_HOOK_ENGINE`) |
|
||||
|
||||
Reflex latency is the single strongest reason L3 exists — it is genuinely unavailable anywhere else.
|
||||
@@ -135,10 +136,21 @@ Read off the upstream repository through the GitHub API, not from memory:
|
||||
header of interest carries the same grant inline — the `ffx-api/include/ffx_api/` set and the
|
||||
FSR 3.0 host API under `sdk/include/FidelityFX/host/`. None of step 2's needles appear. **This
|
||||
paragraph said "vendor from this tag", and its own reversal condition fired the same day** —
|
||||
see the third bullet. The host API is still only here: `main` dropped `ffx_fsr3.h`, so the FSR
|
||||
see the third bullet. ~~The host API is still only here: `main` dropped `ffx_fsr3.h`, so the FSR
|
||||
3.0 route (Cyberpunk's `ffx_fsr3_x64.dll`, named exports) vendors from `v1.1.4` when it is built,
|
||||
and its closure is **ten** files, not the nine first listed — `ffx_interface.h` includes
|
||||
`ffx_message.h` — with `<mutex>`/`<shared_mutex>` reached through `ffx_types.h`.
|
||||
`ffx_message.h` — with `<mutex>`/`<shared_mutex>` reached through `ffx_types.h`.~~ **Wrong tag,
|
||||
corrected 2026-09-05 when the route was built.** Cyberpunk's `ffx_fsr3_x64.dll` exports twelve
|
||||
`ffxFsr3*` names (`vendor-exports.json`), which is exactly tag **`fsr3-v3.0.4`**'s declaration
|
||||
list; `v1.1.4` declares fifteen and appends `upscaleSize`, `flags` and `frameID` to
|
||||
`FfxFsr3DispatchUpscaleDescription` *after* `renderSize` — a detour typed against it would read
|
||||
the wrong bytes off the module the title ships. At `fsr3-v3.0.4` the root `LICENSE.txt` is MIT
|
||||
verbatim, every header carries the grant inline, and **`ffx_types.h` includes `<stdint.h>` and
|
||||
nothing else** — the `<mutex>` block exists only from 1.1.x behind `#ifndef FFX_MUTEX`. The
|
||||
closure is ten files with **no `ffx_message.h`** (nine host headers plus
|
||||
`gpu/fsr3upscaler/ffx_fsr3upscaler_resources.h`). Vendored at
|
||||
`src/native/third_party/fidelityfx-fsr3/` in its own directory because the licence *shape*
|
||||
differs from `v2.3.0`'s exception list; `license-check.ps1` §2e asserts it per file.
|
||||
- **`main` == tag `v2.3.0`** (`60f4ea81`, "AMD FSR SDK 2.3.0", 2026-06-24) is a different shape:
|
||||
its `docs/license.md` is a **binary-only, no-reverse-engineering** default licence that
|
||||
"applies to all files except as noted below", followed by an MIT exception list of 845 paths.
|
||||
@@ -187,7 +199,11 @@ refused the same day (delegated by the owner, decided 2026-09-04).** It declares
|
||||
reads no argument, but installing it inline-patches Intel's code inside the game process, and
|
||||
the same licence forbids *"any modification"*; the census is the answer NGX got and Intel gets
|
||||
the same one. Reversal condition: Intel publishing the headers under a licence that clears the
|
||||
checklist, at which point this paragraph is re-run, not argued around.
|
||||
checklist, at which point this paragraph is re-run, not argued around. **Re-run 2026-09-06 against
|
||||
<https://raw.githubusercontent.com/intel/xess/main/LICENSE.txt> and `inc/xess/xess.h`: unchanged** —
|
||||
the same licence, the same three needles, the same header banner. Not fired. Intel's README does
|
||||
state that XeSS-FG runs on *"non-Intel GPUs with SM 6.4 support"*, so an XeFG session is measurable
|
||||
on the NVIDIA dev box even though nothing in it may be hooked or declared.
|
||||
|
||||
### Checklist before adding any vendor SDK
|
||||
|
||||
|
||||
+439
-8
@@ -30,7 +30,7 @@ Rules for this document:
|
||||
| — | **No `v1 → v2` migration** | Nothing shipped, so no such database exists. `0001_init.sql` creates the current schema |
|
||||
| — | ~~**Multi-process titles are refused as `TargetAmbiguous` in v1**~~ — **the Chromium case is RESOLVED the same day (2026-09-03), by the vendor's own label** | Chromium-based runtimes — NW.js, Electron, RPG Maker MV/MZ, a large share of the VN catalogue — run several processes from ONE image path (browser, renderer, GPU), and *Flower in Us* refused as `TargetAmbiguous`. The presenting process is Chromium's GPU process, which owns no window, so "the one with the window" and "the parent" were both wrong picks. **What resolves it:** Chromium marks that process with `--type=gpu-process` on its own command line. `TargetResolver` now reads each candidate's command line through `NtQueryInformationProcess(ProcessCommandLineInformation)` — **served by the kernel, no `ReadProcessMemory`, no PEB walk, `PROCESS_QUERY_LIMITED_INFORMATION` only**, which is the rule-4 line `HeldProcessHandle` already draws — and resolves only when **exactly one** readable candidate carries the flag as a whole argument. Two GPU processes (two instances), none, or any unreadable candidate still refuse. §S27 is untouched: consent is keyed on the path, every candidate is that path, the guard scans the pid chosen, and `--pid` stays forbidden. **Measured the same evening, and the first rule did not fire:** *Flower in Us* runs **six** processes — browser, `crashpad-handler`, three `utility`, `renderer` — and **no `--type=gpu-process` at all**. NW.js runs the GPU **in-process, in the browser**, which is the one process Chromium leaves untyped. Second rule added: exactly one untyped candidate, every other candidate typed, no GPU process ⇒ the browser is the target; two untyped candidates are two instances and refuse. The refusal line now prints the tree (`browser=1, renderer=1, utility=3, …`) so the next unknown shape is data rather than a bare `TargetAmbiguous`. **Still unmeasured:** whether the Overlay loads and sees presents inside that browser process |
|
||||
| — | **Intel XeSS / XeFG identity is closed at the census — no hook on any `libxess*.dll` export** (decided 2026-09-04, delegated by the owner) | The XeSS SDK failed `18_GPU_VENDOR_APIS` §Checklist (Intel Simplified Software License: binary-only grant, no reverse engineering, termination; headers forbid copying), so no declaration may be vendored or re-declared. The signature-free counter that seemed to survive that — an assembly thunk on a named export — still inline-patches Intel's code inside the game process, which the same licence forbids as *modification*; it would also be the only entry outside `FL_HOOK_GUARD` and a second build language, for identity alone. An Intel title therefore reports upscaler `NOT_REPORTED` and, with `libxess_fg.dll` in the census, Presented FPS under rule 6's *"MAY include generated frames"* qualifier — honest, and the same answer NGX-direct got. **Reversal condition:** Intel relicenses the headers so the checklist clears; then §H11's AMD route applies to Intel verbatim |
|
||||
| — | **A title whose upscaler or frame generation is compiled into its executable is Presented FPS + the census's qualifier, in attach mode, and that is the ceiling for IDENTITY** (recorded 2026-09-04; **one such title found the same evening**) | No module for the census, no export for the inventory: nothing by name. What survives static linking is behaviour on interfaces we hook — the FSR3 frame-generation proxy swapchain at *creation* (launch mode only, §S1 deferred) and queue-side cadence with no vendor name on it. ~~**No installed title has this shape**~~ — **Rune Factory: Guardians of Azuma has it**: `amd_fidelityfx_dx12.dll` ships beside the executable and is never loaded (the census has no AMD module), FSR frame generation is on, and the report read `59.99 → 119.95 (×2 FG)`, *technology not identified* — because on a UE5 title **Streamline's frame token is requested whether or not NVIDIA's features are the ones running**, so the application-frame COUNT survives static linking even though the identity cannot. The ceiling is therefore lower than this row first said: the trio with an unidentified technology, not Presented FPS alone (§H11's run table). Identity for such a title stays out of reach by name |
|
||||
| — | **A title whose upscaler or frame generation is compiled into its executable is Presented FPS + the census's qualifier, in attach mode, and that is the ceiling for IDENTITY** (recorded 2026-09-04; **two such titles found the same night — Rune Factory, and Black Myth: Wukong for its upscaling, which ships and loads the 1.1.x monolith and never dispatches to it**) | No module for the census, no export for the inventory: nothing by name. What survives static linking is behaviour on interfaces we hook — the FSR3 frame-generation proxy swapchain at *creation* (launch mode only, §S1 deferred) and queue-side cadence with no vendor name on it. ~~**No installed title has this shape**~~ — **Rune Factory: Guardians of Azuma has it**: `amd_fidelityfx_dx12.dll` ships beside the executable and is never loaded (the census has no AMD module), FSR frame generation is on, and the report read `59.99 → 119.95 (×2 FG)`, *technology not identified* — because on a UE5 title **Streamline's frame token is requested whether or not NVIDIA's features are the ones running**, so the application-frame COUNT survives static linking even though the identity cannot. The ceiling is therefore lower than this row first said: the trio with an unidentified technology, not Presented FPS alone (§H11's run table). Identity for such a title stays out of reach by name |
|
||||
| — | ~~**Tier 2 requires an elevated Agent**~~ | **CLOSED 2026-08-28 by the two-rung ladder.** The requirement came from Windows restricting ETW trace sessions; there is no ETW rung, so **no capture tier needs elevation**. Elevation is optional everywhere and buys exactly two things (CPU temperatures via PawnIO, attaching to elevated targets — ADR-9). An unelevated Agent whose Tier-1 attempt fails lands on Tier 2, which is what every unhooked session lands on regardless of privilege |
|
||||
|
||||
---
|
||||
@@ -94,7 +94,7 @@ or it becomes the next stale status claim this file exists to record.
|
||||
| **S29** | 🔴 **open, new 2026-08-05 — five ✅ and two ◐, counted off the glyphs below on 2026-08-20** | (a) ◐ **CORRECTED**: the honesty assertion *is* in the merge gate, natively (`fl_guard`, 20.58 s on CI); only the **managed** drain is ungated, and §S19(b) is **not** a prerequisite of the feature hooks — the original claim was wrong and had been used to re-order the work. **Sharpened 2026-08-06:** fixing §S19(b) alone would still gate nothing, because `build.ps1`'s `-SkipIntegration` applies `--filter 'Category!=Integration'` and excludes the class *before* the guard is ever asked. Two independent mechanisms produce one absence, and `ci.yml` must drop the switch too; (b) ✅ `fl_vtable_indices` now pins the Overlay's indices through a shared header; (c) ✅ **closed 2026-08-06 by deleting `ShouldUnhookAsync`** — zero production callers, strictly weaker than `ScanOnceAsync`, and inverted in polarity; the gate's public instance surface is now pinned to `{StartAsync}`; (d) ◐ `vklayer-blastradius` case 3 is now an assertion, but the script still runs only by hand; (e) ✅ **closed 2026-08-06 host-side**, with a held process handle and a classifier that takes no elapsed-time parameter, so a frozen `writeIndex` can never end a session; (f) ✅ **closed 2026-08-20**: the normative contradiction between CLAUDE.md rule 7 and `03_METRICS` about inline RayQuery is settled the way the entry proposed — AS-build activity proves ray tracing is happening, *naming the technique* is what needs a DXIL scan — and rule 7 is amended in the PR that wrote the hooks. Its second half closes with it: `FL_MEASURED_RT` now has a producer (both command-list detours, installed off the game's own device), so all three conjuncts of the `No` branch are live and **`Yes` and `No` are both reachable for the first time**, proved by injection in both directions; (g) ✅ the present-only writer claimed `FL_MEASURED_OUTPUT_RES` unconditionally, including on records with no size |
|
||||
| **S30** | ✅ **closed 2026-08-15** | Answered on the title that raised it: with Ray Reconstruction on, Cyberpunk 2077 evaluates `kFeatureDLSS_RR` on every application frame and `kFeatureDLSS` **not once**, so RR was doing the upscaling and the decode had no arm for it. Evidence rather than inference: `renderW/H` are published only on a frame that drained an evaluation and read 1485×835 = 0.58 × 2560×1440, so the scaling-input tag arrives ON the RR evaluation. Two further defects fell out — the pre-committed decision table had two holes, and the fix contaminated the census that found it (it derived the id from the decoded byte) |
|
||||
| **S31** | ✅ **resolved 2026-09-04 — row P1, and `tokens/batch = 1.00`** | Is a drained Streamline batch an application frame? **Yes.** The `slGetNewFrameToken` count (#103, #105) reads 1.00 / 2.99 / 3.99 against Cyberpunk's own off / ×3 / ×4 and 4.00 on Hell Is Us, and on every leg with batches the two counts agree to the frame. Two independent per-frame API counts are the oracle four instruments could not be. `fg_factor` is published; `none` is reachable by counting. *(The row as it stood while open:)* ◐ **row P2, 2026-08-27 — the ORACLE is retired, the QUESTION is not** | Is a drained Streamline batch an application frame? The PresentMon 2.x `FrameType` test, with its decision table pre-committed BEFORE the run and `tools/frametype-oracle.ps1` producing the input as two dimensionless ratios. **Two obstacles measured before it could be run**: the console binary will not start a trace session unelevated on the dev box (exit 6; the account is in neither Administrators nor Performance Log Users, and the running shared service does not help), and `--track_frame_type` is a **beta** option whose own help says it needs application or driver instrumentation of the Intel-PresentMon provider — so it may be as unavailable as `fl-baseline-probe` proved to be. Two of the table's six rows retire it outright. Blocks HANDOFF item 3's producer decision |
|
||||
| **H11** | ◐ **AMD ffx-api BUILT and RUN 2026-09-04 (A1–A3 accepted; the loader row added the same evening after three loader titles read silent); Intel closed at the census by licence; FSR 3.0 host route deferred to its own PR** | XeFG and FSR3-FG identity. The AMD half is measured on nine titles: the three ffx-api leaves AND the SDK 2.x loader are hooked (the loader turned out to be the game's entry on loader-shipping titles, with the leaves silent behind it), the vendored MIT headers (tag v2.3.0) decode the dispatch descriptor, and rows A1–A3 landed as pre-committed. Owed: the three loader titles again, against row R6. Intel's SDK failed the licence checklist, so XeSS/XeFG stay at the census (§Scope decisions). `ffx_fsr3_x64.dll` (FSR 3.0, Cyberpunk only here) needs ten host headers from tag v1.1.4 and is deferred with that costing written |
|
||||
| **H11** | ◐ **AMD ffx-api BUILT and RUN 2026-09-04 (A1–A3 accepted; the loader row added the same evening after three loader titles read silent); Intel closed at the census by licence; FSR 3.0 host route deferred to its own PR** | XeFG and FSR3-FG identity. The AMD half is measured on nine titles: the three ffx-api leaves AND the SDK 2.x loader are hooked (the loader turned out to be the game's entry on loader-shipping titles, with the leaves silent behind it), the vendored MIT headers (tag v2.3.0) decode the dispatch descriptor, and rows A1–A3 landed as pre-committed and **R6 closed on Dying Light: The Beast and KCD2 the same night** (`FSR (3.1 or 4 …)` / `FsrFg` / ×2 / 1.01 and `none` / 1.00 through the loader row). Wukong's FSR upscaling is compiled in (Rune Factory's shape; the title has no FSR frame generation), so nothing more is owed on the AMD half; the FSR 3.0 host route is the one deferred piece Intel's SDK failed the licence checklist, so XeSS/XeFG stay at the census (§Scope decisions). `ffx_fsr3_x64.dll` (FSR 3.0, Cyberpunk only here) ~~needs ten host headers from tag v1.1.4 and is deferred with that costing written~~ **built 2026-09-05** from tag `fsr3-v3.0.4` (the docs' `v1.1.4` was the wrong tag: twelve exports match 3.0.4, not 1.1.4's fifteen, and 1.1.4's descriptor appends fields after `renderSize`); one row, the host's UPSCALE; **rows B1–B4 owed** (below) |
|
||||
|
||||
~~**Six items are ❓ and one is 🚫.**~~ **Recounted 2026-08-05: TWELVE items block
|
||||
exit criterion 2, not seven, and the undercount came from reading only the ❓ rows.**
|
||||
@@ -3127,7 +3127,347 @@ lazily, which is the case the hook exists for. Until then, keep the rule and do
|
||||
not let anyone "simplify" it back to an inline install on the grounds that the
|
||||
probe never showed a deadlock.
|
||||
|
||||
### H5 ◐ · Proxy swapchains defeat the dummy-vtable assumption
|
||||
### H5 ✅ · Proxy swapchains defeat the dummy-vtable assumption — **the DLSS / DLSS-G question closed 2026-09-06 (owner)**
|
||||
|
||||
> **CLOSED 2026-09-06, 12:17, on Cronos: The New Dawn demo with frame generation ON (`spike-notes` §9).**
|
||||
> The second Streamline 2.8.0 title, UE: `Native FPS: 86.8 -> Displayed FPS: 172.72 (x1.99 FG)`,
|
||||
> `unseen=0 over samples=10063`, `frame generation: DlssG — the NVIDIA driver agrees`, `upscaler: Dlss
|
||||
> (driver-reported)`, RT Yes. **So the pacer that bypasses the patched `Present` bodies is Dying Light:
|
||||
> The Beast's integration, not SDK 2.8.0's** — 2.8.0 on UE presents its generated frames through the body
|
||||
> the inline patches cover, exactly as 2.7.x and 2.10.x do. Every measured title now prints the rule-6 trio
|
||||
> or a counted `none`, on NVIDIA through one of three producers: the hooked bodies (Cyberpunk, Hell Is Us,
|
||||
> Expedition 33, Wukong, Rune Factory, Onimusha, Cronos), DXGI's own counter where the hook cannot count
|
||||
> (DL:TB), or a withheld `N/A` only when that counter was never read. Identity comes from the tags (DLSS-G)
|
||||
> and the hooks, and from the driver's per-process word where no hook can see it (the NGX-direct titles),
|
||||
> with the negative measured. **What stays unlocalised and is not needed for any number the report
|
||||
> prints:** which body DL:TB's pacer reaches. The owner closed the item on this reading; the sub-items
|
||||
> below are its history.
|
||||
|
||||
> ### CASE 3 HAS A CANDIDATE TITLE — Dying Light: The Beast, Streamline 2.8.0, DLSS Frame Generation ON, 2026-09-05
|
||||
>
|
||||
> **The numbers.** Five 58 s captures at DLSS with DLSS Frame Generation on (the owner's
|
||||
> setting, confirmed after the runs): `presents = tokens = batches` on every one —
|
||||
> 4706 / 4258 / 4560 / 4311 / 3441 — so the report printed `FPS: 80.41 / 72.73 / 77.69 /
|
||||
> 73.64 / 58.87` and **`frame generation: none`**, with `sl.dlss_g.dll` and `nvngx_dlssg.dll`
|
||||
> (310.6) in the census. The fifth ran on the #116 build, 2026-09-05 00:53. **Owner decision
|
||||
> the same night: a separate session and a separate PR own this; nothing below is started
|
||||
> until the discriminator has a reading.**
|
||||
> **The same title with FSR frame generation on** read presents 8255 against 4129 tokens
|
||||
> (×2, the loader row, §H11 R6). **Cyberpunk 2077 on Streamline 2.7.1 with the same DLSS-G
|
||||
> generation (310.8), same GPU,** read presents 13706 against 3439 tokens (×3.99) on 2026-09-03.
|
||||
>
|
||||
> **What that means, stated as the two readings the record cannot separate.** Either (a)
|
||||
> Streamline 2.8's DLSS-G presents its generated frames on a path the class-vtable hook on
|
||||
> `Present`/`Present1` does not see — case 3 of this entry, realised, with the application
|
||||
> frames still counted by `slGetNewFrameToken` and the generated ones simply absent — or (b)
|
||||
> the title was not generating in those runs despite the setting. **The discriminator is the
|
||||
> owner's counter reading**: an in-game or Steam frame counter near 2× our `FPS:` line is (a);
|
||||
> one near our line is (b). It is pre-committed here so the next run answers it rather than
|
||||
> being read into whichever reading is more comfortable.
|
||||
>
|
||||
> **Why this is a rule-6 exposure and not a curiosity.** `none` there is computed —
|
||||
> `presents == application frames` — and under reading (a) that equality holds *because*
|
||||
> the generated presents are missing, so the report states the absence of frame generation on
|
||||
> a title that is generating. The consumer cannot tell this from a real off. Until the
|
||||
> discriminator runs, a `none` on a Streamline 2.8 title with DLSS-G in the census is a
|
||||
> **count**, not a verdict, and `03_METRICS` §FG has no wording for that case yet. This is the
|
||||
> §H5 outcome the entry was written to fear, on a newer Streamline than the one that measured
|
||||
> it not happening; whether the fix is a wording, a census-version gate (the interposer's file
|
||||
> version is ours to read — it is a module in our process, not game memory), or a second
|
||||
> present sink is the owner's decision after the reading. **What is NOT in doubt:** the
|
||||
> Streamline tag row (`slSetTagForFrame`, #115) is unrelated — this is about presents.
|
||||
>
|
||||
> ### THE READING, 2026-09-05 — reading (a), and what landed on it
|
||||
>
|
||||
> The owner, verbatim: *"Trong game là DLSS X 4, steam đã hiện dlss, frame ghi nhận được
|
||||
> native/frame gốc chưa frame gen."* — the title is at DLSS ×4 (multi-frame generation), the Steam
|
||||
> overlay shows DLSS, and the frames this hook records are the native ones, before frame
|
||||
> generation. That is reading **(a)**: case 3 realised on Streamline 2.8.0. The numeric counter
|
||||
> value was not part of the reading and is the first thing the session below writes down.
|
||||
>
|
||||
> **The record already corroborated it, in a field nobody had read for this purpose.** The RT
|
||||
> census on the DLSS ×4 runs reads **97.1 % of all presents RT-active**; the same title with FSR
|
||||
> frame generation ×2 reads **54.6 %** — generated presents carry no ray-tracing work, so at ×2
|
||||
> half of them are RT-silent. A window in which every present carries RT work is a window that
|
||||
> holds no generated presents. Both readings of the count predicted that; only the owner's
|
||||
> reading says which.
|
||||
>
|
||||
> **What landed (PR-A1, C# only, nothing on the present path):**
|
||||
>
|
||||
> - The capture host takes an **out-of-process module snapshot** beside every guard scan —
|
||||
> `Process.Modules`, the loader's list through documented PSAPI, the same read the guard
|
||||
> already performs on every target — and the file's version resource on the path it names.
|
||||
> The report prints one `module:` line per census-named module (version, path). The census
|
||||
> cannot carry a version without a layout change; this can, at no cost in the hook.
|
||||
> - `MeasuredFacts` **withholds `none`** when `sl.dlss_g.dll` is in the census beside an
|
||||
> interposer whose file version is ≥ 2.8.0 or could not be read, and the report prints
|
||||
> `Presented FPS` with a qualifier: the number counts APPLICATION frames; whether frames were
|
||||
> generated, and the Displayed rate, are unknown. **The key is the Streamline plugin, not
|
||||
> `nvngx_dlssg.dll`:** every validated `none` on this machine — Cyberpunk off / ×3 / ×4 at 2.7.1
|
||||
> (census `0x5793D`), Expedition 33 and Lies of P with frame generation off — has the NGX
|
||||
> module loaded and the plugin bit CLEAR; every DL:TB run (`0x25F0F` / `0x25F4F`) has it SET.
|
||||
> The gate leaves each validated result byte-identical, and eight consumer cases pin that.
|
||||
> - **Cost, pre-committed:** DL:TB at DLSS with frame generation **off** also reads withheld if
|
||||
> the plugin is a startup-time load on this title. Leg 0 below measures which.
|
||||
>
|
||||
> **The session, pre-committed before it runs.** One owner session, one launch per leg, the
|
||||
> capture host as built plus **PresentMon 2.5.1 console, elevated, concurrently** (it is retired
|
||||
> as a shipped rung — §S31 row P2 — and is still the one instrument on this box that counts
|
||||
> presents from the kernel's side; on Cyberpunk it counted every generated present at the same
|
||||
> rate as this hook), plus the title's own FPS counter and the Steam overlay counter read by
|
||||
> eye mid-capture and written down **as numbers**. Read off our report: `FPS:` / `Presented FPS`,
|
||||
> `FG counts` (`presents=`, `tokens=`, `streams=`), the `module:` lines. Read off PresentMon:
|
||||
> rows over span, the number of distinct `SwapChainAddress` values, `PresentRuntime` and
|
||||
> `PresentMode`.
|
||||
>
|
||||
> | Leg | Title / setting | What it settles |
|
||||
> |---|---|---|
|
||||
> | 0 | DL:TB, DLSS, DLSS FG **off** | whether `sl.dlss_g.dll` is in the census with FG off (per-setting vs startup); ours ≈ PresentMon ≈ counter ≈ 1× |
|
||||
> | 1 | DL:TB, DLSS, DLSS FG **×4** | the discriminating leg |
|
||||
> | 2 | Cyberpunk 2077, DLSS, MFG ×4 (Streamline 2.7.1) | control on the same build: ours ≈ PresentMon ≈ 4× tokens, `x3.99 FG` printed, `module: sl.interposer.dll 2.7.1.0`, plugin bit clear |
|
||||
>
|
||||
> **Leg 1, the counter half, READ 2026-09-05** (owner's run on #118, `dyinglightbeast-141045`):
|
||||
> DLSS FG ×4, our line `Presented FPS: 76.7` with `none` withheld exactly as built, the title's own
|
||||
> counter **~300** — 3.9× ours. Reading (a) now has its number. The same day's `-105050` run read
|
||||
> 93.24 on the same shape. **Still owed from this table:** the PresentMon leg beside it (which
|
||||
> decides P1 against P3, i.e. whether the generated presents are kernel-visible at all), Leg 0
|
||||
> (whether `sl.dlss_g.dll` is a startup load), and Leg 2's control. Also the same day, Cyberpunk
|
||||
> at DLSS + RR + MFG ×3 read `62.86 → 187.49 (×2.98 FG)`, `frame generation: Active (technology not
|
||||
> identified)` — the count is right and the technology is unnamed, because `kFeatureDLSS_G` is
|
||||
> never evaluated through the export this build hooks; and the four UE titles at DLSS read
|
||||
> `upscaler: N/A` (Lies of P, Hell Is Us, Expedition 33, Wukong: NGX-direct super-resolution, the
|
||||
> Streamline interposer loaded and idle for it). **These three shapes — hidden presents on SL 2.8,
|
||||
> an unnamed DLSS-G, and an unnamed NGX-direct DLSS — are one question with one candidate answer
|
||||
> that is not a hook:** `NvAPI_NGX_GetNGXOverrideState` (NVAPI, MIT, vendored; R570+) takes a
|
||||
> PROCESS ID and returns the driver's own feedback bits per feature — SR / RR / FG each with
|
||||
> `DLL_LOADED`, `CREATED`, `EVALUATE`, `FG_MODE`, `FG_MULTI_FRAME` — plus `scalingRatio`,
|
||||
> `performanceMode` (the quality mode), `renderPreset`, `frameGenerationCount` and
|
||||
> `frameGenerationMode`. Out of process, from the driver's bookkeeping, whatever route the title
|
||||
> took to NGX. **Unmeasured, and measured before anything is built on it:** whether the bits are
|
||||
> populated for a process with no NVIDIA-app override configured (the API's name says "override"),
|
||||
> and whether `frameGenerationCount` is the title's multiplier or only an override target.
|
||||
> `fl-probe-nvapi --ngx-state <pid>` prints the raw words and every decoded bit; the owner runs it
|
||||
> against Lies of P (DLSS, no FG), Hell Is Us (DLSS + FG ×4), Dying Light: The Beast (DLSS FG ×4)
|
||||
> and Cyberpunk (MFG), each while the title runs — no capture, no injection, no consent needed.
|
||||
> **The decision it opens is the owner's:** a driver-reported fact is neither a hooked argument
|
||||
> (rule 4) nor a static hint (`05_DETECTION`); if the probe answers, `03_METRICS` needs a
|
||||
> *driver-reported* rung with its own wording ("reported by the NVIDIA driver, not counted"), and
|
||||
> the rule-6 pair on the hidden-presents shape could then read *application frames counted ×
|
||||
> multiplier reported* — labelled as such, never as a measured Displayed.
|
||||
>
|
||||
> **MEASURED 2026-09-06 morning, three titles, driver 616.64 (`spike-notes` §9): the bits ARE populated
|
||||
> without an override, for super resolution only.**
|
||||
>
|
||||
> | Title (override?) | SR feedback | RR feedback | FG feedback | ratio / mode / preset / fgCount |
|
||||
> |---|---|---|---|---|
|
||||
> | Hell Is Us (none), DLSS + **DLSS-G ×4 running** | `0x80605` INITIALIZED DLL_EXISTS **CREATED EVALUATE** ERR_NOT_FOUND | INITIALIZED DLL_EXISTS ERR_NOT_FOUND | `0x5` INITIALIZED DLL_EXISTS — **no CREATED / EVALUATE / FG_MODE** | 0 / 0 / 0 / 0 |
|
||||
> | Expedition 33 (NVIDIA-app override ON), FG off | `0x8067F` … ENABLED DLL_LOADED DLL_SELECTED PRESET PERF_MODE **CREATED EVALUATE** ERR_NOT_FOUND | INITIALIZED DLL_EXISTS ERR_NOT_FOUND | `0x1F` INITIALIZED ENABLED DLL_EXISTS DLL_LOADED DLL_SELECTED | 0 / **2** / **11** / 0 |
|
||||
> | Lies of P (none), DLSS, no FG | `0x605` INITIALIZED DLL_EXISTS **CREATED EVALUATE** | INITIALIZED ERR_FAILED ERR_NOT_FOUND | INITIALIZED ERR_FAILED ERR_NOT_FOUND | 0 / 0 / 0 / 0 |
|
||||
>
|
||||
> Four readings. **(1) `CREATED | EVALUATE` on the SR word is set on both no-override titles** — the
|
||||
> driver keeps per-process bookkeeping of the NGX super-resolution feature whatever route the title took,
|
||||
> which is exactly the identity `upscaler: N/A` lacks on the NGX-direct titles (all three print it). **(2)
|
||||
> The FG word does NOT reflect DLSS-G activity:** Hell Is Us was generating at ×4 through Streamline
|
||||
> (`83.21 → 332.82 (×4 FG)`, `DlssG`, the same session) and its FG word says INITIALIZED | DLL_EXISTS and
|
||||
> nothing more — the word tracks the override machinery's DLL, not the plugin's evaluations. Frame
|
||||
> generation stays with the tags and the count. **(3) `frameGenerationCount` is 0 on every title,
|
||||
> including the one at ×4 — it is the override target the header names, never the title's multiplier**,
|
||||
> so the "application frames counted × multiplier reported" pair above has no producer and is dropped.
|
||||
> **(4) `scalingRatio` is 0 everywhere, override included; `performanceMode` / `renderPreset` are
|
||||
> populated only under the override (E33: 2 / 11) and are then the OVERRIDE's values, not the title's** —
|
||||
> so this route gives an identity and nothing about the render size or quality. `ERR_NOT_FOUND` sits
|
||||
> beside CREATED | EVALUATE on two titles and is absent on the third; the header does not say what it
|
||||
> refers to (a DRS profile, most likely), and it is not read as anything.
|
||||
>
|
||||
> **What a driver-reported rung may therefore claim — the owner's decision, not yet built:** on a
|
||||
> session where every hook says `upscaler: N/A`, `Dlss (driver-reported: the NVIDIA driver reports an
|
||||
> NGX super-resolution feature created and evaluated in this process — not counted by this hook)`. It
|
||||
> may name the vendor and the feature; it may not state a quality, a ratio, a render size, a frame
|
||||
> generation mode or a multiplier. On a hooked-identity session (Cyberpunk, DL:TB, Onimusha) the word
|
||||
> is a consistency check the report prints beside the hooked name. **Owed before it is built — the
|
||||
> negative:** the probe on Lies of P or Hell Is Us with DLSS switched OFF in the menu, expected
|
||||
> `CREATED` clear; a rung that has only ever seen the positive would be the census's mistake again.
|
||||
> Plumbing when decided: the probe already builds against `fl_nvapi`; the capture host would call it
|
||||
> beside each module snapshot (out of process, no consent needed) or, if it goes in-process, through
|
||||
> `Infrastructure` only (CLAUDE.md: no P/Invoke elsewhere).
|
||||
>
|
||||
> **BUILT 2026-09-06, on the owner's decision ("nối probe để bắt đầu").** The capture host spawns
|
||||
> `fl-probe-nvapi --ngx-state <pid>` beside every module snapshot (the probe prints one machine line,
|
||||
> `NGXSTATE status=… sr=0x… …`, and is staged beside the host by the project file), merges the readings
|
||||
> (the last answered word is the state; a change between readings is printed, never averaged) and
|
||||
> prints `NVIDIA driver NGX state:` in the runtime block. `03_METRICS` §Upscaling carries the rung and
|
||||
> its limits. **Pre-committed, read off the next run:**
|
||||
>
|
||||
> | Row | Title / setting | Expected | Else |
|
||||
> |---|---|---|---|
|
||||
> | **N1** | Lies of P, Hell Is Us, Expedition 33 at DLSS | `upscaler: Dlss (driver-reported: …)` | a `CREATED \| EVALUATE` word beside `N/A` is a parser or plumbing defect — localise |
|
||||
> | **N2** | Cyberpunk, DL:TB, Onimusha (hooked `Dlss`) | `upscaler: Dlss — the NVIDIA driver agrees …` | a disagreement WARNING is printed as such; it is not resolved by preferring either |
|
||||
> | **N3** | **the negative, still owed:** Lies of P with DLSS switched OFF in the menu | `CREATED` clear → `upscaler: N/A (…) — the NVIDIA driver reports no NGX super-resolution feature created …` | `CREATED \| EVALUATE` still set with DLSS off → **the rung is withdrawn** (the bit is a session-lifetime latch, not a state) and the line goes back to N/A |
|
||||
> | **N4** | a title at FSR / XeSS with no NGX feature | `Fsr3` / `N/A` with the driver's negative beside it | `CREATED` set on a title with no DLSS in its menu → withdraw |
|
||||
>
|
||||
> Lies of P has no DLSS Frame Generation (owner, 2026-09-06), which is why its FG word reads
|
||||
> `ERR_FAILED ERR_NOT_FOUND`: nothing to load.
|
||||
>
|
||||
> **LANDED 2026-09-06, 10:39–11:36 (`spike-notes` §9): N1, N2 and N3 as pre-committed, N4 in a shape the
|
||||
> row did not foresee, and one correction.** N3 first, because it decides: the standalone probe on Lies of
|
||||
> P with upscaling OFF read `SR 0x5` — `CREATED` clear — and with DLSS on `0x605`; **the rung stands.** N1:
|
||||
> Lies of P, Expedition 33, Hell Is Us and the new Cronos: The New Dawn demo all print
|
||||
> `upscaler: Dlss (driver-reported: …)` where they printed `N/A`. N2: Onimusha and DL:TB print
|
||||
> `upscaler: Dlss — the NVIDIA driver agrees`. N4 arrived as DL:TB at **FSR upscaling + DLSS Frame
|
||||
> Generation**: `upscaler: FSR (3.1 or 4 …)`, `2560x1440 -> 2560x1440`, `SR 0x205` — CREATED without
|
||||
> EVALUATE, so the driver's word correctly does NOT claim DLSS beside FSR (the rung needs both bits).
|
||||
> **The correction:** the FG word is NOT blind to DLSS-G. It read `CREATED | EVALUATE` on Hell Is Us,
|
||||
> Onimusha and DL:TB at ×4, and *"the words CHANGED between readings"* on all three — the morning's
|
||||
> `INITIALIZED | DLL_EXISTS` on Hell Is Us was a first reading taken before the feature came up.
|
||||
> `FG_MODE` / `FG_MULTI_FRAME` stay clear and `fgCount` is 0 at ×4, so it names the feature and never the
|
||||
> multiplier: printed beside `frame generation:` as agreement, promoted to `DlssG (driver-reported)` only
|
||||
> where the count is active and no tag named the technology. Also on this run: Cronos is a **second
|
||||
> Streamline 2.8.0 title** (UE, FG off, `sl.dlss_g.dll` absent from its census — per-setting there — `FPS
|
||||
> 105.01`, `none` with DXGI agreeing); its FG-on capture would say whether the 2.8.0 pacer bypass is the
|
||||
> SDK's or Techland's. And the FSR + DLSS-G session's factor was refused (bucket 8 of 8 at 1.96 against
|
||||
> 2.85 — the guard working) while the qualifier said *"no evaluation was observed"* beside 4,415 tokens; the
|
||||
> qualifier now says the factor was counted and refused, and that DXGI counted 8,174 presents this hook
|
||||
> never saw so the Displayed rate is above the printed one.
|
||||
>
|
||||
> **The last row, 12:17 — Cronos with frame generation ON: `86.8 → 172.72 (×1.99 FG)`, `unseen=0`, `DlssG`
|
||||
> with the driver agreeing.** The 2.8.0 pacer bypass is Techland's, not the SDK's. Closed above.
|
||||
>
|
||||
> ### THE STREAMLINE DOCS, READ 2026-09-05 (v2.8.0 and main), AND WHAT THEY CHANGED
|
||||
>
|
||||
> The owner asked for the vendor's own guides before any rewrite. Three things in them decide this item.
|
||||
>
|
||||
> 1. **DLSS-G presents through the "SL pacer"** (DLSS-G guide §14.1): an asynchronous presentation
|
||||
> mechanism, with *"specialized hardware to delay the image after Present() has been called"* and a
|
||||
> note that `MsBetweenPresents` in third-party tools *"indicates when the internal Present() call has
|
||||
> happened"*. So the generated frames ARE presented by internal `Present()` calls on 2.7.1 — which is
|
||||
> what this hook counts on Cyberpunk — and whether 2.8's pacer on Blackwell still reaches the body we
|
||||
> patch is exactly what Leg 1's PresentMon half measures. The docs do not say; they say FrameView 16.1
|
||||
> is the recommended tool because it reads `MsBetweenDisplayChange`, i.e. the display side.
|
||||
> 2. **`slDLSSGGetState` is the documented way to get the presented count** (§14.0: `actualFPS = myFPS *
|
||||
> state.numFramesActuallyPresented`) — and it is **refused here**, with the reason in `03_METRICS` §FG:
|
||||
> the header defines the field as *"number of frames presented since the last `slDLSSGGetState` call"*,
|
||||
> so every call RESETS the plugin's counter, and a title that reads it for its own FPS display would
|
||||
> read our calls' remainder. It is also marked *"NOT thread safe"*. A measurement that alters the
|
||||
> host's measurement is not observing.
|
||||
> 3. **§5.0 "Tag all required resources": DLSS-G requires the HUD-less and UI buffers to be tagged every
|
||||
> frame** through `slSetTag` / `slSetTagForFrame` / `slEvaluateFeature`'s inputs — the three routes this
|
||||
> build already hooks and read ONE tag type from. **Built the same day:** every tag's type is recorded
|
||||
> (`FlWriterState.slTagCensus`, per route), a HUD-less or UI tag drained by a present marks it
|
||||
> `FL_FG_DLSS_G`, and the consumer names `DlssG` beside an active count. Identity, not a count: the
|
||||
> count still decides `none`, so a title tagging the inputs with the feature off prints `none` with the
|
||||
> inputs noted, and the withheld shape keeps its N/A.
|
||||
>
|
||||
> **Pre-committed for the next run, per title:** Cyberpunk at DLSS + MFG → `frame generation: DlssG`,
|
||||
> tag census `global=[depth, mvec, hudless, ui-color-alpha, …]` (2.7.1 tags globally; the scaling input
|
||||
> arrives locally). Hell Is Us / Expedition 33 / Wukong at DLSS + FG ×4 → `DlssG` **if** the UE Streamline
|
||||
> plugin tags through the exports (their `UpscalerParams = 0` says no scaling-input tag arrived, which is
|
||||
> consistent with NGX-direct super-resolution and says nothing about the DLSS-G inputs); if the census
|
||||
> reads `global=[-] frame=[-] local=[-]` on those titles, they tag through neither export and the identity
|
||||
> stays `Active (technology not identified)` honestly. DL:TB at DLSS FG ×4 → the census line says whether
|
||||
> the title feeds DLSS-G through a route this build sees; the qualifier then says *"FEEDING frame
|
||||
> generation"* beside the withheld count. Lies of P at DLSS (no Streamline tokens at all) → unchanged:
|
||||
> the super-resolution identity on NGX-direct titles is what the NVAPI probe above is for.
|
||||
>
|
||||
> **LANDED 2026-09-05 evening, on the owner's run on #121 (`spike-notes` §9):** `frame generation: DlssG` on
|
||||
> Hell Is Us (×4, twice), Expedition 33 (×1.97), Wukong (×4), Rune Factory (×3.98) and Cyberpunk — every
|
||||
> Streamline title tags the DLSS-G inputs through a route this build hooks (the UE plugin and Cyberpunk 2.7.1
|
||||
> globally, DL:TB 2.8 through `slSetTagForFrame`), so the identity is measured six of six and *"technology
|
||||
> not identified"* is gone from all of them. DL:TB's withheld line now says *"FEEDING frame generation"*
|
||||
> beside the count it cannot make; its census also shows a `scaling-in` tag on the frame route with
|
||||
> `UpscalerParams` still 0 — the tag carries no size on this title, which closes 7a's last question without
|
||||
> the layout bump it was thought to need. Cyberpunk's factor was refused on that run (bucket 1 at 3.0 against
|
||||
> 1.67 overall, `tokens/batch 2.97`): a mixed session, refused as designed rather than averaged. **What is
|
||||
> left on NVIDIA is one thing: `upscaler: N/A` on the NGX-direct titles** — the probe above.
|
||||
>
|
||||
> **BUILT 2026-09-05, late — A1.7 promoted from "not in A1" to the in-process half of Leg 1.** The owner
|
||||
> read that Streamline ≥ 2.8 "needs `sl.interposer.dll` and `sl.common.dll` loaded before an injection
|
||||
> succeeds". Checked against the source, not the claim: the interposer's DXGI proxy
|
||||
> (`source/core/sl.interposer/d3d12/dxgiSwapchain.cpp`) is **byte-for-byte the same file at v2.7.32 and
|
||||
> v2.8.0** — plugins' before-hooks receive `m_base` and may `skip` the base call, exactly as before — and
|
||||
> 2.8's `sl.common` gains `resourceTaggingForFrame.cpp` (the `slSetTagForFrame` route #121 already hooks).
|
||||
> Injection into DL:TB already succeeds (every capture there has `streams=1`, a full `runtime census`, a
|
||||
> tag census), so "loaded before injection" is a launcher's problem, not this hook's. What 2.8 does NOT
|
||||
> show is where its closed `sl.dlss_g` pacer presents. So the Overlay now asks DXGI itself: on every hooked
|
||||
> present it reads `IDXGISwapChain::GetLastPresentCount` on the chain it just saw (rule 4: the same object
|
||||
> `FindOrAdd` already calls `GetDesc` on) and publishes two words on the 1 Hz watchdog —
|
||||
> `dxgiPresentSamples` (hooked presents that read it) and `dxgiPresentsUnseen` (presents DXGI counted
|
||||
> between two hooked ones, beyond the one seen). The report prints
|
||||
> `DXGI present counter: unseen=M over samples=N (r unseen per hooked present)` and the withheld qualifier
|
||||
> carries the reading. The harness's own presents are the negative control (`fl_guard` `[fg]`:
|
||||
> `unseen == 0`, `samples >= drained`); the positive cannot be fixtured — nothing in this repo presents
|
||||
> through a body the inline patches miss — which is why the rows below are written before the run.
|
||||
> Cost: one virtual call per hooked present, measured by `hook-harness --probe-frames` (number in the PR
|
||||
> body); `--probe-cost` is the empty-detour floor and does not include it.
|
||||
>
|
||||
> Leg 1's in-process rows, read off the new line on a DL:TB DLSS FG ×4 capture (r = unseen / samples):
|
||||
>
|
||||
> | Row | Reading | Meaning | Action |
|
||||
> |---|---|---|---|
|
||||
> | **P1-DXGI** | r ≈ 3 (×4) — `unseen ≈ 3 × samples` | the pacer presents on the SAME chain through a body the inline patches do not cover; the generated presents ARE DXGI presents | the next PR promotes `Displayed = hooked + unseen`, labelled **DXGI-counted** (a count DXGI made, not this hook), `presents/batch` from it, and `none` withdraws by count; the pacer's entry is then localised (a second `CDXGISwapChain` class, or a path that bypasses `Present`'s body) at leisure |
|
||||
> | **P3-DXGI** | r ≈ 0 | DXGI counted nothing this hook did not: the generated frames are displayed below DXGI (driver pacing / flip metering) or on an object this hook never saw | the withheld wording stays; no in-process sink exists; only PresentMon (kernel) and the NVAPI corroboration remain, and if PresentMon also reads 1× the frames never were kernel presents |
|
||||
> | **P5-DXGI** | 0 < r < 2.5, or r ≠ 0 with `streams > 1` | a mixed path or a second chain | stop and localise; the number is printed, never averaged into a factor |
|
||||
> | **P2/P4** | r ≈ 0 with ours ≈ 4× tokens, or the count itself moved | as the kernel rows say: not generating, or the title changed | the kernel rows above decide |
|
||||
>
|
||||
> **LANDED 2026-09-05 night, on the owner's run on #124 (`spike-notes` §9): row P1-DXGI, twice.** DL:TB at
|
||||
> DLSS FG ×4 read `unseen=12204 over samples=4136 (2.95)` at 21:56 and `unseen=12741 over samples=4392
|
||||
> (2.90)` at 22:06 — DXGI counted 3.9× the presents this hook did, on the SAME chain, which is the owner's
|
||||
> ~300 against ours ~75 from the afternoon, now measured in-process. The two controls read 0.00: Hell Is Us
|
||||
> (Streamline **2.7.3**, `79.89 → 308.14 (×3.86)` through the patched bodies, 18,207 samples) and the
|
||||
> owner's new title, the **Onimusha: Way of the Sword demo on Streamline 2.10.3** (`60.04 → 220.33
|
||||
> (×3.67)`, `DlssG`, `upscaler: Dlss`, 12,914 samples, 0 unseen). So **2.8.0's pacer is the odd one** —
|
||||
> 2.7.x before it and 2.10.x after it present the generated frames through `Present`'s body — and the
|
||||
> "`sl.interposer.dll` + `sl.common.dll` must be loaded on ≥ 2.8" lead is closed by 2.10.3, which injects,
|
||||
> tags on the frame route and counts exactly like 2.7. **The pre-committed action is built:** the record
|
||||
> carries `dxgiUnseen` (@52, `FL_MEASURED_DXGI_PRESENTS`), the window counts `Displayed = hooked +
|
||||
> unseen` and prints *"Displayed is DXGI-COUNTED"* on its own line, `presents/batch` takes the same
|
||||
> numerator, and `none` withdraws on DL:TB by count (`03_METRICS` §Displayed may be DXGI-COUNTED). Expected
|
||||
> on DL:TB's next capture: the trio at ≈ ×3.9 with the label, no withheld line, `frame generation: DlssG`.
|
||||
> Which body the 2.8.0 pacer reaches stays unlocalised, as the row said.
|
||||
>
|
||||
> **LANDED 2026-09-06 morning, on the owner's run on #125 (`spike-notes` §9): the promotion, and Leg 0.**
|
||||
> DL:TB at DLSS FG ×4 (07:31): `Native FPS: 70.52 -> Displayed FPS: 282.08 (x4 FG) over 16516 present(s)`,
|
||||
> *"Displayed is DXGI-COUNTED: 12387 of those present(s)"*, `unseen=12483 over samples=4202 (2.97)`,
|
||||
> `frame generation: DlssG`, uniform across every bucket, no withheld line — the trio rule 6 asks for, on
|
||||
> the title that could not print it. **Leg 0, twice (07:45, 07:55): frame generation OFF**, census still
|
||||
> `0x25F0F` — `sl.dlss_g.dll` is a **startup-time load**, the cost paragraph's fear measured true —
|
||||
> presents = tokens, `unseen=0 over samples=3659` and `4519`, tag census `0x23600` (depth, mvec,
|
||||
> scaling-in, scaling-out, other: **no hudless / UI tag with FG off**, so the DLSS-G identity is
|
||||
> per-setting on this title too), and the report withheld `none` exactly as pre-committed. **The gate is
|
||||
> narrowed rather than withdrawn:** DXGI's counter is the discriminator it lacked — the 2.8.0 pacer's
|
||||
> presents are DXGI presents on this chain (P1-DXGI), so a counted 1.0 beside a READ counter with zero
|
||||
> unseen is `none`, printed with DXGI's agreement; withheld only when the counter was not read. Control:
|
||||
> Expedition 33 FG off (Streamline 2.7.30) reads `FPS: 85.86`, `none` by count, tag census `0x0` — the UE
|
||||
> plugin sends no tags at all with FG off.
|
||||
>
|
||||
> Leg 1's rows (ours = `presents / span`; PM = PresentMon rows / span; C = the counter; ≈ = within 5 %):
|
||||
>
|
||||
> | Row | Reading | Meaning | Action |
|
||||
> |---|---|---|---|
|
||||
> | **P1** | PM ≈ 4× ours, C ≈ PM | generated presents reach the kernel on a path **outside** the `CDXGISwapChain::Present/Present1` bodies the Overlay inline-patches — case 3 realised | gate stays; a second present sink is costed (candidates below) and the route is the owner's; PresentMon's `SwapChainAddress` count says whether it is a second chain (2 addresses against our `streams=1`) or the same chain by another entry (1) |
|
||||
> | **P2** | PM ≈ ours ≈ C ≈ 1× | the title was not generating despite the setting | **withdraw the gate** (keep the `module:` lines); `none` was right; case 3 stays unrealised; the owner checks the setting |
|
||||
> | **P3** | PM ≈ ours ≈ 1×, C ≈ 4× | frames displayed without a kernel-visible present per frame (driver pacing / flip metering), or the counter reports a target rather than a measurement | keep the wording ("Displayed unknown"); no in-process or kernel sink would help; only a vendor read could corroborate |
|
||||
> | **P4** | ours ≈ 4× tokens on the rerun | the five earlier runs were not generating, or the title changed — compare the `module:` versions and the exe fingerprint against the 00:53 run | withdraw the gate; localise what changed |
|
||||
> | **P5** | PM ≈ 2×, or two `SwapChainAddress` values with ours `streams=1` | a second chain or a mixed path | stop and localise before deciding |
|
||||
> | **P6** | elevation refused / a leg unrun | nothing measured | not a result — P2 is not inferred from silence |
|
||||
>
|
||||
> Leg 0's own row: if `sl.dlss_g.dll` is **absent** with FG off, the census bit is per-setting on
|
||||
> this title and the gate is sharper than its cost paragraph feared (consider dropping the version
|
||||
> conjunct); if present, the interim cost stands as written. **Landed 2026-09-06: PRESENT, twice** —
|
||||
> and the cost stood for one morning, because the DXGI counter (above) narrowed the gate the same day.
|
||||
>
|
||||
> **Second-present-sink candidates for P1 / P5, one line each, none chosen:** MinHook inline
|
||||
> patches on the `gdi32.dll` D3DKMT thunks (`D3DKMTPresent`, `D3DKMTPresentMultiPlaneOverlay3`,
|
||||
> `D3DKMTSubmitPresentToHwQueue`) — in-process, no elevation, argument reads only, but
|
||||
> semi-documented structs that move between Windows builds and more patched bytes on the most
|
||||
> anti-cheat-sensitive path; an ETW `Microsoft-Windows-DxgKrnl` consumer in the capture host
|
||||
> (what PresentMon reads) — exact per-pid kernel count, costs **elevation**, which is §G's Tier-2
|
||||
> question re-entering; an `IDXGIFactory2::CreateSwapChain*` hook (`17_HOOK_ENGINE` ⏳) — sees a
|
||||
> second chain at creation only, i.e. launch mode (§S1); in-hook `IDXGISwapChain::GetLastPresentCount`
|
||||
> sampling — a same-chain localiser only, and a hot-path virtual call with two reserved words
|
||||
> behind it. NVAPI has no present count outside present barrier; `NvAPI_NGX_GetNGXOverrideState`
|
||||
> (R570, by PID) reports the driver's DLSS override state and multi-frame target, which is
|
||||
> corroboration rather than a count — an optional `fl-probe-nvapi --ngx-state <pid>` reading on
|
||||
> Legs 2 then 1, never a gate input.
|
||||
|
||||
> ### NARROWED, NOT CLOSED — five real-title captures, 2026-08-15
|
||||
>
|
||||
@@ -3302,7 +3642,27 @@ turns a would-be STL throw into `__fastfail`, which SEH cannot intercept
|
||||
(`spike-notes.md` §H3). The "no throwing STL in hook paths" rule is therefore
|
||||
load-bearing rather than stylistic.
|
||||
|
||||
### H11 ◐ · XeFG and FSR3-FG identity — **AMD built 2026-09-04 through the ffx-api leaves; Intel closed by licence; FSR 3.0 host route deferred**
|
||||
### H11 ◐ · XeFG and FSR3-FG identity — **AMD built 2026-09-04 through the ffx-api leaves, complete 2026-09-06; Intel closed by licence; FSR 3.0 host route built 2026-09-05**
|
||||
|
||||
> **2026-09-06: the AMD half is complete on its oracle** — Lies of P at FSR 3.1 + FSR FG on the #129 build
|
||||
> prints `Fsr3` / `FsrFg` / `59.77 → 119.55 (×2 FG)` / `2560x1440 -> 2560x1440` with `presents/frame=2.00`,
|
||||
> `frames/upscale-drained=1.00`, `unseen=0` and the NVIDIA driver's word saying nothing was created
|
||||
> (`spike-notes` §9); the owner called it done. **Intel, re-checked the same day: the licence has not
|
||||
> changed** (`18_GPU_VENDOR_APIS` §Intel), so nothing in `libxess*.dll` may be hooked or declared, and the
|
||||
> signature-free thunk stays refused. **What is left in policy for an XeFG session, proposed and not yet
|
||||
> built — identity BY ELIMINATION, labelled as such:** frame generation is COUNTED by the Streamline token
|
||||
> (UE titles request it whatever the FG vendor — measured on Rune Factory's compiled-in FSR) or by DXGI's
|
||||
> counter; DLSS-G is EXCLUDED by the NVIDIA driver's FG word (no feature created) and by the absence of the
|
||||
> HUD-less / UI tags; FSR-FG through a shipped DLL is EXCLUDED by the ffx census (no FRAMEGENERATION dispatch
|
||||
> at any hooked module); the frame-generation runtime the census names is `libxess_fg.dll`. The line would
|
||||
> read `Active (technology not identified) — by elimination among the runtimes loaded: not DLSS-G (the
|
||||
> NVIDIA driver reports no NGX frame-generation feature), no FSR dispatch reached a hooked module, and the
|
||||
> frame-generation runtime present is libxess_fg.dll; a frame generator compiled into the executable would
|
||||
> read the same`. Never `XeFg` as a measured identity; never a render extent. Intel's README says XeSS-FG
|
||||
> runs on non-Intel GPUs with SM 6.4, so DL:TB / Hell Is Us / Cronos / Expedition 33 with XeSS FG on are
|
||||
> the sessions that measure it, and the pre-commitment is the last clause: the wording must survive the
|
||||
> one static title (Rune Factory at FSR FG) reading the same way.
|
||||
>
|
||||
|
||||
> **BUILT, 2026-09-04, the AMD half — and the deferral's own rule was kept: header first, decode
|
||||
> second, never from observation.** `HANDOFF` item 7c. The FidelityFX headers cleared the
|
||||
@@ -3344,7 +3704,7 @@ load-bearing rather than stylistic.
|
||||
> | **Hell Is Us**, FSR, FG off | same | same | `none` | `FPS: 104.18` | 1.00 |
|
||||
> | **Expedition 33**, FSR upscale + **DLSS frame generation ×3** | UE5, two leaves | `FSR (3.1 or 4 …)`, 1707×961 | `Active (technology not identified)` — no FRAMEGENERATION dispatch, no Streamline token; the count came from the UPSCALE dispatches | `67.51 → 200.66 (×2.97 FG)` | 1.00 (fg-dispatch/frame 0.00) |
|
||||
> | **Expedition 33**, FSR, FG off | same | same | `none` | `FPS: 85.12` | 1.00 |
|
||||
> | **Cyberpunk 2077**, FSR 3 + FG | FSR 3.0 host DLLs for upscaling, the **1.1.x monolith for frame generation** | `N/A` (upscale is `ffx_fsr3upscaler_x64.dll`, the deferred route) — render 1506×847 from PREPARE | `FsrFg` (4261 generated batches) | `72.93 → 145.76 (×2)` | — (no UPSCALE dispatch; count = Streamline tokens 4266) |
|
||||
> | **Cyberpunk 2077**, FSR 3 + FG | FSR 3.0 host DLLs for upscaling, the **1.1.x monolith for frame generation** | `N/A` (upscale is through the FSR 3.0 host DLLs, unhooked on this build; **the host row landed 2026-09-05 — rows B1–B4 below**) — render 1506×847 from PREPARE | `FsrFg` (4261 generated batches) | `72.93 → 145.76 (×2)` | — (no UPSCALE dispatch; count = Streamline tokens 4266) |
|
||||
> | **Dying Light: The Beast**, FSR + **FSR FG** | loader + two leaves | `N/A` | `N/A` — **zero dispatches at any leaf export** | `Presented 146.54`, WARNING | census: no FSR identity, no FSR_FG |
|
||||
> | **KCD2**, FSR (×2 runs) | loader + upscaler leaf | `N/A` | `N/A` — zero leaf dispatches | `Presented 58.8`, cannot-include shape (no FG runtime) | — |
|
||||
> | **Black Myth: Wukong**, FSR | monolith + loader 2.1.0 | `N/A` | `none` (Streamline tokens = presents) — zero leaf dispatches | `FPS: 41.11` | — |
|
||||
@@ -3381,11 +3741,82 @@ load-bearing rather than stylistic.
|
||||
> title Streamline's token is there even when the upscaler and FG are AMD's, so the application-frame
|
||||
> count survives static linking. The identity does not, and cannot.
|
||||
>
|
||||
> **Still deferred, with the costing written:** the FSR 3.0 host route — `ffx_fsr3_x64.dll!ffxFsr3ContextDispatchUpscale`
|
||||
> **ROW R6 RUN, 2026-09-04 night, on #111 (one launch each):**
|
||||
>
|
||||
> | Title / setting | `upscaler` | `frame generation` | Trio | `frames/upscale-drained` | Verdict |
|
||||
> |---|---|---|---|---|---|
|
||||
> | **Dying Light: The Beast**, FSR + FSR FG | `FSR (3.1 or 4 …)`, 1505×847 | `FsrFg` | `70.49 → 140.9 (×2 FG)` | **1.01** (fg-dispatch/frame 0.99) | **R6-accept** — the loader row carries the title the leaf rows could not, at 1×, no double count |
|
||||
> | **KCD2**, FSR | `FSR (3.1 or 4 …)`, 1505×847 | `none` by count (3523 / 3523) | `FPS: 59.97` | **1.00** | **R6-accept** |
|
||||
> | **Black Myth: Wukong**, FSR (×2 runs; **the title has no FSR frame-generation option**) | `N/A` | `none` (Streamline tokens = presents) | `FPS: 39.15 / 90.64` | — (no dispatch at the monolith OR the loader) | **not R6 at all** — Rune Factory's shape, see below |
|
||||
>
|
||||
> Two of the three loader titles are closed on the first rerun, and the K = 1 control the fixtures
|
||||
> run is confirmed by a real title: with all four modules hooked, DL:TB's loader route counts
|
||||
> once. **Wukong is a different shape**: `amd_fidelityfx_dx12.dll` is *loaded* (it is in the census)
|
||||
> and *never dispatched to*, with the loader silent too, while FSR upscaling is on and Streamline's
|
||||
> tokens equal the presents. That is Rune Factory's shape with one difference — the monolith is in
|
||||
> the process — and the reading that fits every number is **FSR upscaling compiled into the UE
|
||||
> plugin (static, as Rune Factory's) with the 1.1.x monolith loaded for FSR frame generation and
|
||||
> idle while FG is off.** ~~The leg that tests it is Wukong with FSR frame generation ON~~ —
|
||||
> **the owner reports the title offers no FSR frame generation at all**, so the monolith is loaded
|
||||
> for nothing this hook can see (a plugin that ships it and never dispatches to it), and **Wukong
|
||||
> joins Rune Factory in §Scope decisions' static row**: FSR upscaling compiled into the UE plugin,
|
||||
> identity out of reach by name, the application-frame count carried by Streamline's token. Nothing
|
||||
> is owed on it.
|
||||
>
|
||||
> ~~**Still deferred, with the costing written:** the FSR 3.0 host route — `ffx_fsr3_x64.dll!ffxFsr3ContextDispatchUpscale`
|
||||
> / `ffxFsr3DispatchFrameGeneration`, named exports, no struct decode for identity — needs ten
|
||||
> host headers from tag `v1.1.4` (`main` dropped `ffx_fsr3.h`), whose closure reaches
|
||||
> `<mutex>`/`<shared_mutex>` through `ffx_types.h`, for exactly one installed title (Cyberpunk 2077,
|
||||
> whose default here is DLSS). Its own PR, with Cyberpunk switched to FSR 3 as the oracle.
|
||||
> whose default here is DLSS). Its own PR, with Cyberpunk switched to FSR 3 as the oracle.~~
|
||||
>
|
||||
> ### THE FSR 3.0 HOST ROUTE IS BUILT, 2026-09-05 — and the costing above named the wrong tag
|
||||
>
|
||||
> **`fsr3-v3.0.4`, not `v1.1.4`.** Read off the upstream tags: Cyberpunk's `ffx_fsr3_x64.dll`
|
||||
> exports twelve `ffxFsr3*` names, which is exactly `fsr3-v3.0.4`'s declaration list; `v1.1.4`
|
||||
> declares fifteen (adds `ContextGetGpuMemoryUsage`, `ContextDispatchFrameGenerationPrepare`,
|
||||
> `GetEffectVersion`) and its `FfxFsr3DispatchUpscaleDescription` appends `upscaleSize`, `flags`
|
||||
> and `frameID` **after `renderSize`** — a detour typed against it would read the wrong bytes off
|
||||
> the module the title ships. The prefix through `renderSize` is identical across 3.0.3 / 3.0.4 /
|
||||
> 1.1.4 and is the only field read; `dllmain.cpp` pins its offset to a literal. And **`<mutex>` is
|
||||
> not in the closure at all** at this tag — `ffx_types.h` includes `<stdint.h>` only; the mutex block
|
||||
> exists only from 1.1.x. Ten files, no `ffx_message.h`, vendored at
|
||||
> `src/native/third_party/fidelityfx-fsr3/` (root `LICENSE.txt` = MIT verbatim, inline grants;
|
||||
> `license-check.ps1` §2e).
|
||||
>
|
||||
> **One row, the same family.** `ffx_fsr3_x64.dll!ffxFsr3ContextDispatchUpscale` feeds the ffx-api
|
||||
> drain word: identity `FSR3` as a fact (the 3.0 host hosts nothing else), `renderSize` as the
|
||||
> extent, and the UPSCALE count when neither Streamline nor a PREPARE has ever spoken. Published by
|
||||
> `PublishFfxFamilyIfWhole`, which now waits for a loaded host as it waits for a loaded leaf.
|
||||
> `ffxFsr3DispatchFrameGeneration` is **not** a row: on the one title the monolith generates
|
||||
> (4261 batches) and the count is Streamline's, and the host's FG export fires per *generated*
|
||||
> batch. **Reversal, pre-committed:** it becomes a row only on a title reading
|
||||
> `Active (technology not identified)` with `FL_CENSUS_FFX_FSR3` set and no monolith in the census.
|
||||
> Fixtures: the `ffx_fsr3_x64.dll` stub (Pass C's second positive control), harness topologies
|
||||
> `fsr3host` and `fsr3host+mono`, and a `[ffx]` injected case at K = 1 (the double-count control
|
||||
> for the row) and K ∈ {1, 4} beside the monolith.
|
||||
>
|
||||
> **Acceptance, pre-committed — Cyberpunk 2077 (runbook title 3), one launch per leg:**
|
||||
>
|
||||
> | Row | Leg / reading | Verdict |
|
||||
> |---|---|---|
|
||||
> | **B1** | FSR 3 + FSR FG: `upscaler: Fsr3`; `render 1506x847 -> 2560x1440` with **one** distinct extent (the host's `renderSize` and the monolith's PREPARE agree); `frame generation: FsrFg`; `≈73 → ≈146 (×2 FG)` from tokens; `frames/upscale-drained = 1.00`, `fg-dispatch/frame = 1.00`; `module: ffx_fsr3_x64.dll (no version resource)` | accept |
|
||||
> | **B1-off** | FSR 3, FG off: `Fsr3`, `none` by count, `frames/upscale-drained = 1.00` | accept |
|
||||
>
|
||||
> **B1 and B1-off LANDED, 2026-09-05 (owner's run on #119, `cyberpunk2077-105954` and `-135728`):**
|
||||
> FSR 3 + FG → `upscaler: Fsr3`, `render 1506x847 upscaler=Fsr3 on 4332 record(s)` (one tuple),
|
||||
> `frame generation: FsrFg`, `74.31 → 148.56 (×2 FG)`, `frames/upscale-drained = 1.01`,
|
||||
> `fg-dispatch/frame = 1.00`, `module: ffx_fsr3_x64.dll (no version resource)`; FSR 3 with FG off →
|
||||
> `Fsr3`, `none` by count (4919 = 4919), `frames/upscale-drained = 1.00`,
|
||||
> `render -> output: 1506x847 -> 2560x1440 = 1.7x (59% render scale)`. B2–B4 did not fire. **One
|
||||
> defect the run exposed, in the consumer:** the FG-on leg printed `render -> output: N/A` two lines
|
||||
> under its own raw block — `UpscaleExtent` keyed its window on the params bit, which under frame
|
||||
> generation rides on one present in N, so `ClaimedSuffixStart`'s clean-suffix rule found no
|
||||
> window; it now keys on the identity bit (per-record once live) and counts every record inside
|
||||
> that carries both sizes. Every FG-on capture since 2026-08-16 had been reading `N/A` there; the
|
||||
> earlier "not computed yet" wording had hidden it.
|
||||
> | **B2** | `upscale-drained = 0` with `ffx_fsr3_x64.dll` in the census and FSR on — the game calls `ffx_fsr3upscaler_x64.dll` directly and the facade is silent | add the upscaler-DLL row (`ffxFsr3UpscalerContextDispatch`, ten `FfxResource`s, its own offset pin) **instead** — never both |
|
||||
> | **B3** | `frames/upscale-drained ≈ 2.00` | two upscale contexts per frame or a re-entered dispatch — investigate before publishing (mirrors R4) |
|
||||
> | **B4** | `SETTINGS MOVED: 2 distinct extents` | the host and the PREPARE disagree on the input size; print both, do not average |
|
||||
>
|
||||
> *The banner as it stood on the morning of 2026-09-04:* **The deferral has a next step, and it is `HANDOFF` item 7c.** The Streamline
|
||||
> work built every tool this needs — module-scoped inventory rows, types-only vendoring with a
|
||||
@@ -3396,7 +3827,7 @@ load-bearing rather than stylistic.
|
||||
> entry names and nobody had made: **run the licence checklist on the FidelityFX and XeSS SDK
|
||||
> headers.** ~~Both are published under MIT~~ — **run 2026-09-04, and the sentence struck was
|
||||
> wrong about Intel.** FidelityFX at tag `v1.1.4` is MIT root-and-inline and is clear to vendor
|
||||
> types-only; the XeSS SDK is the Intel Simplified Software License (binary-only grant,
|
||||
> types-only (as is `fsr3-v3.0.4`, the tag the host route actually vendored on 2026-09-05); the XeSS SDK is the Intel Simplified Software License (binary-only grant,
|
||||
> no-reverse-engineering, termination) and its headers say they may not be copied without
|
||||
> Intel's permission, so step 3 binds and XeSS stays where NGX is. `18_GPU_VENDOR_APIS` §Vendor
|
||||
> SDKs carries both decisions with the evidence. **So 7c is AMD only.** The one thing that
|
||||
|
||||
+136
-12
@@ -265,8 +265,14 @@ It is the route `17_HOOK_ENGINE` reads as natural, and it fails five ways:
|
||||
1. It needs an "indirect" inventory class, which becomes an **unconditional escape hatch
|
||||
from `hookinventory-check` Pass A** — its oracle would be "a `PFun_*` exists in a
|
||||
vendored header", and `sl_core_api.h:63` declares `PFun_slSetTagForFrame` for a symbol
|
||||
**zero measured modules export**. Any name the headers declare could be laundered past
|
||||
the gate.
|
||||
~~zero measured modules export~~. Any name the headers declare could be laundered past
|
||||
the gate. *(2026-09-04: `slSetTagForFrame` IS now exported — by `sl.interposer.dll` 2.8.0,
|
||||
which Dying Light: The Beast ships — and it entered the inventory the ordinary way, as a row
|
||||
Pass A checks against the measured oracle. The argument stands: the point was never that
|
||||
this one symbol was fictional, it was that a header-declared oracle cannot tell the two
|
||||
apart. The oracle itself needed a fix to see it: `tools/vendor-exports.ps1` took the FIRST
|
||||
copy of each module name, and with 2.7.1 and 2.8.0 both installed the row's verdict
|
||||
depended on directory order. It unions across copies now and lists every version seen.)*
|
||||
2. A second MinHook install site **reopens the install-after-stop window**
|
||||
`dllmain.cpp:643-646` exists to close.
|
||||
3. MinHook v1.3.4 has **no function-length oracle for a runtime-returned address**, so a
|
||||
@@ -684,7 +690,15 @@ FG factor and RT state are measured against the titles' own menus. What follows
|
||||
owner's list for the next session, in the order the dependencies run, each with what makes
|
||||
it fail on unmodified `main` — because a criterion already true on `main` is decoration.
|
||||
|
||||
#### 7a. The quality preset — the last value criterion 1 lacks
|
||||
#### ~~7a. The quality preset — the last value criterion 1 lacks~~ — **CLOSED 2026-09-06 (owner): DLSS / DLSS-G done on every measured title**
|
||||
|
||||
*Closed on the Cronos FG-on capture (`20_OPEN_QUESTIONS` §H5 head, `spike-notes` §9): the trio or a counted
|
||||
`none` on every NVIDIA title through the hooked bodies, DXGI's counter where the hook cannot count (DL:TB —
|
||||
that title's integration, not SDK 2.8.0's), and the driver-reported identity where no hook can see it, with
|
||||
its negative measured. The quality preset itself stays `0xFF` / N/A everywhere — the override fields are
|
||||
the override's, the tags carry no size on D3D12 — and the owner closed the item on that. What follows is
|
||||
the history.*
|
||||
|
||||
|
||||
*Fails on `main` because:* every real title measured reads `upscalerQuality = 0xFF`.
|
||||
Cyberpunk 2077 never chains `sl::DLSSOptions`, so 0xFF there is the title's truth; **Alan Wake
|
||||
@@ -694,7 +708,15 @@ Cyberpunk 2077 never chains `sl::DLSSOptions`, so 0xFF there is the title's trut
|
||||
`quality=` off the `render … quality=… upscaler=…` line. If it reads the preset, criterion 1
|
||||
is 5 of 5 on that title and this item is a spike-notes entry. If it reads 0xFF too, the
|
||||
Streamline options route yields nothing on either measured title, and the decision below is
|
||||
live.
|
||||
live. *(Runbook title 12 is Alan Wake 2 as of 2026-09-04; Epic may update the executable on
|
||||
launch, so launch first and grant after.)*
|
||||
- **The input to that decision is on the report now** (2026-09-04): `render -> output` prints the
|
||||
two measured sizes, `03_METRICS`' ratio and the render-scale percentage — Cyberpunk reads
|
||||
`1485x835 -> 2560x1440 = 1.72x (58% render scale)` — plus a **SETTINGS MOVED** flag when the
|
||||
window held more than one tuple. It prints **no preset name**; that is the decision below,
|
||||
still the owner's. Every FSR title measured on 2026-09-04 also reads `0xFF` for the quality
|
||||
byte, and on that route it is the true value rather than a gap: the ffx-api dispatch carries
|
||||
no quality mode at all, so the derived label is the only route to a preset name for AMD too.
|
||||
- **The decision, if 0xFF everywhere:** `renderW/H ÷ outputW/H` is *exact* (Cyberpunk: 1485×835
|
||||
at 2560×1440 = 0.58, which IS DLSS Balanced, and the menu agreed), and DLSS's preset ratios
|
||||
are documented constants (DLAA 1.0, Quality 0.667, Balanced 0.58, Performance 0.5, Ultra
|
||||
@@ -706,6 +728,79 @@ Cyberpunk 2077 never chains `sl::DLSSOptions`, so 0xFF there is the title's trut
|
||||
call, and if built, the byte stays 0xFF and the report says *derived*.
|
||||
- **Do not** reach for `slDLSSSetOptions` via `slGetFeatureFunction`: §2b refused it on five
|
||||
grounds that have not changed, and NGX-direct `NVSDK_NGX_Parameter_GetUI` is licence-blocked.
|
||||
- **Alan Wake 2 did not run on 2026-09-04** (the owner tried every workaround; the title is
|
||||
broken on this machine), so the measurement moved to **Dying Light: The Beast at DLSS**, the
|
||||
first Streamline title measured whose batches carry `kFeatureDLSS` — identity `Dlss` on 4,575
|
||||
of 4,575 batches. It read `UpscalerParams = 0` on three captures, because DL:TB ships
|
||||
**Streamline 2.8.0, which deprecates `slSetTag` for `slSetTagForFrame`**, and only the
|
||||
deprecated export had a row. The `slSetTagForFrame` row exists as of this entry (#115) —
|
||||
**and the rerun on it still read `UpscalerParams = 0` with both rows live**, so the title
|
||||
tags with a zero extent or not on this route at all. The next build reads the size the
|
||||
tagged `sl::Resource` declares when the extent is zero (`TagSize`, every route); one more
|
||||
DL:TB DLSS capture on it is ~~owed~~ **ran 2026-09-05 00:53 (#116 build): `N/A` stands** —
|
||||
params 0 of 3523 with both rows live and the fallback in. The route yields nothing on this
|
||||
title; the honest answer is `N/A`, and 7a on DL:TB is closed on that. What would reopen it
|
||||
is a tag-route census (calls per export, zero-extent seen, Resource-size seen), which needs
|
||||
a layout bump and is not worth one for a preset byte. The derived-label decision above is
|
||||
unchanged and applies to the titles that do print the line.
|
||||
- **Separately, and more important than the preset:** every DL:TB DLSS run (five, the last at
|
||||
00:53 on the #116 build) had DLSS Frame Generation ON per the owner, and every one read
|
||||
`presents = tokens`, `frame generation: none`. That is `20_OPEN_QUESTIONS` §H5 case 3's
|
||||
candidate title. **Owner decision 2026-09-05: this is its own session and its own PR.** Read
|
||||
§H5 first; the discriminator (the owner's counter beside our `FPS:` line) is pre-committed
|
||||
there and is the first thing that session asks for. Nothing in FG counting changes before
|
||||
that reading. **The reading came the same day and the first PR landed on it** — the owner:
|
||||
the title runs at DLSS ×4, the frames we record are the native ones (§H5, verbatim). The
|
||||
capture host now prints each census-named module's file version and withholds `none` on
|
||||
that shape (`03_METRICS` §Frame Generation; the key is `sl.dlss_g.dll`, not
|
||||
`nvngx_dlssg.dll`). **What is next is the owner's session pre-committed in §H5** — DL:TB with
|
||||
DLSS FG off and ×4, Cyberpunk MFG ×4 as the control, PresentMon elevated beside each, the
|
||||
counter's NUMBER written down — and the row it lands on decides whether the gate stays, a
|
||||
second present sink is costed (§H5 lists the candidates; the route is the owner's), or the
|
||||
gate is withdrawn. Nothing in the hook changes before that row. **The counter half of Leg 1
|
||||
is read (2026-09-05): ~300 against our 76.7, reading (a) with its number; the PresentMon half
|
||||
is still owed.** And the owner's eleven-capture run the same day (`spike-notes` §9) put the
|
||||
remaining NVIDIA gap in one sentence: the COUNT is right on every title and the IDENTITY is
|
||||
what this build cannot say — DLSS on the NGX-direct UE titles, DLSS-G everywhere. **The identity half landed 2026-09-05 from the Streamline docs** (DLSS-G guide §5.0: the HUD-less / UI tags a
|
||||
frame-generating title MUST send, through exports already hooked): `frame generation: DlssG` is expected on
|
||||
Cyberpunk at MFG and on the UE titles at ×4 on the next run, with the new `Streamline tag census:` line saying
|
||||
which route carried the tags — and DL:TB's census line says whether that title feeds DLSS-G through a route
|
||||
this build sees. `slDLSSGGetState` was refused (`03_METRICS` §FG: it resets the plugin's own counter).
|
||||
~~**START HERE next:** `fl-probe-nvapi --ngx-state <pid>` against a running Lies of P, Hell Is Us, DL:TB
|
||||
and Cyberpunk (no capture, no injection) — the super-resolution identity on NGX-direct titles is still the
|
||||
gap the tags cannot close.~~ **RAN 2026-09-06 on Hell Is Us, Expedition 33 and Lies of P (§H5, `spike-notes`
|
||||
§9): `CREATED | EVALUATE` on the SR word without an override on both no-override titles — the identity
|
||||
exists in the driver's bookkeeping; the FG word does not see DLSS-G at ×4; `frameGenerationCount` is the
|
||||
override target, `scalingRatio` is 0 even under an override.** ~~**START HERE next: the owner decides the
|
||||
driver-reported rung (§H5 says exactly what it may claim: `Dlss (driver-reported …)` on a session where
|
||||
every hook says N/A, nothing about quality, ratio or FG), and the negative is owed first — the probe on
|
||||
Lies of P with DLSS switched OFF, expected `CREATED` clear.**~~ **Decided and BUILT 2026-09-06: the capture
|
||||
host probes the driver beside every module snapshot and the `upscaler:` line has the driver-reported rung
|
||||
(`03_METRICS` §Upscaling). START HERE next: the owner's run — §H5 rows N1–N4, and N3 (Lies of P with DLSS
|
||||
OFF) is the one that keeps or withdraws the rung — LANDED 2026-09-06 midday: N3 read `CREATED` clear with
|
||||
upscaling off, N1 prints `Dlss (driver-reported …)` on four NGX-direct titles, N2 prints agreement on two,
|
||||
and the FG word turned out to follow DLSS-G too (identity, never the multiplier). START HERE next: Cronos
|
||||
(a second Streamline 2.8.0 title, UE) with frame generation ON — does the 2.8.0 pacer bypass the patched
|
||||
bodies there too (`DXGI present counter` ≈ 3) or is it Techland's (0)? — ANSWERED 12:17: Cronos FG on reads
|
||||
`86.8 → 172.72 (×1.99 FG)` with `unseen=0`; the bypass is Techland's. Item closed; the next item is the
|
||||
owner's pick from 7b / 7c below.** **The tag route LANDED on the owner's evening run (`spike-notes` §9): `DlssG` on
|
||||
six of six Streamline titles, and DL:TB's census shows its scaling-input tag arrives with no size, which
|
||||
closes 7a's last question.** If the driver's per-process NGX feedback is
|
||||
populated without an NVIDIA-app override, the identity question has a producer that is not a
|
||||
hook and the owner decides whether `03_METRICS` gains a *driver-reported* rung (§H5 says what
|
||||
that rung may and may not claim). If it is not populated, the answer stays `N/A` and the
|
||||
session goes back to the PresentMon leg. **The in-process half of that leg LANDED (2026-09-05,
|
||||
night): DL:TB at DLSS FG ×4 read 2.90 and 2.95 unseen presents per hooked one on the same chain —
|
||||
§H5 row P1-DXGI — while Streamline 2.7.3 (Hell Is Us) and 2.10.3 (the Onimusha demo) read 0.00, so
|
||||
2.8.0's pacer is the one that bypasses the patched bodies. The record now carries `dxgiUnseen` and
|
||||
the window counts `Displayed = hooked + unseen`, labelled DXGI-COUNTED (`03_METRICS`); DL:TB's next
|
||||
capture is expected to print the trio at ≈ ×3.9 with that label and no withheld line — LANDED
|
||||
2026-09-06: `70.52 → 282.08 (×4 FG)`, DXGI-COUNTED 12,387, `DlssG`. Leg 0 the same morning (FG off,
|
||||
twice) showed the plugin is a startup-time load and the report withheld as pre-committed, so the
|
||||
gate is now narrowed to sessions where the DXGI counter was not read; a read counter with zero
|
||||
unseen prints `none` with DXGI's agreement.** The
|
||||
"sl.common must be loaded on 2.8" lead is closed by the 2.10.3 title, which injects and counts like
|
||||
2.7 (§H5).
|
||||
|
||||
#### 7b. Titles whose upscaler or frame generation is compiled into the executable
|
||||
|
||||
@@ -739,9 +834,21 @@ hole; it does not close it.
|
||||
token is requested on that UE5 title regardless, so the count read `59.99 → 119.95 (×2 FG)`,
|
||||
*technology not identified* — the trio, with the vendor missing. Identity by name stays out of
|
||||
reach; §Scope decisions carries the corrected row. A disk scan cannot find this shape; a
|
||||
capture with the census line can.
|
||||
capture with the census line can. **Black Myth: Wukong is the second** — its FSR upscaling
|
||||
dispatches to neither the loaded monolith nor the loader, and it offers no FSR frame generation.
|
||||
|
||||
#### ~~7c. AMD and Intel identity, measured rather than inferred~~ — **AMD LANDED 2026-09-04 and re-confirmed complete 2026-09-06 on Lies of P; Intel closed by licence (re-checked 2026-09-06, unchanged)**
|
||||
|
||||
*2026-09-06, 12:46: Lies of P at FSR 3.1 + FSR FG prints `Fsr3` / `FsrFg` / `59.77 → 119.55 (×2 FG)` /
|
||||
`2560x1440 -> 2560x1440` with every count agreeing (`spike-notes` §9) — acceptance step 5 in full, beside
|
||||
the DXGI counter (0 unseen) and the NVIDIA driver's word (nothing created). The owner called the AMD half
|
||||
done. Intel: the licence was re-fetched the same day — Intel Simplified Software License, October 2022,
|
||||
binary-only, "nor any modification", termination; the header banner still forbids copying — so the
|
||||
reversal condition has not fired and the census stays the answer. What is new: Intel's own README says
|
||||
XeSS-FG runs on non-Intel GPUs with SM 6.4, so an XeFG session IS capturable on this box (DL:TB, Hell Is
|
||||
Us, Cronos, Expedition 33 ship `libxess_fg.dll`), and the proposal on the table is identity BY ELIMINATION,
|
||||
labelled — see `20_OPEN_QUESTIONS` §H11's 2026-09-06 note.*
|
||||
|
||||
#### ~~7c. AMD and Intel identity, measured rather than inferred~~ — **AMD LANDED 2026-09-04; Intel closed; the owner's three launches are owed**
|
||||
|
||||
**Do not start here.** The three ffx-api leaves are hooked, the FidelityFX headers are vendored
|
||||
at tag **`v2.3.0`** (not the `v1.1.4` step 1 below names — its own reversal condition fired:
|
||||
@@ -775,10 +882,25 @@ corrections to the entry below, each of which changed what got built:**
|
||||
`FsrFg` / ×2 on Hell Is Us), Expedition 33 showed the mixed-vendor shape (FSR upscale + DLSS FG ×3
|
||||
→ *active, technology not identified* at ×2.97), Cyberpunk at FSR 3 split across two AMD
|
||||
generations, and **Rune Factory turned out to be 7b's statically linked title** with the Streamline
|
||||
token count still reading ×2. **Owed after the loader row lands:** Dying Light: The Beast at
|
||||
FSR + FSR FG, KCD2 at FSR, Wukong at FSR — against row R6. **The FSR 3.0 host route
|
||||
token count still reading ×2. **Row R6 ran the same night on #111:** Dying Light: The Beast at
|
||||
FSR + FSR FG printed `FSR (3.1 or 4 …)` / `FsrFg` / `70.49 → 140.9 (×2)` with the counts agreeing
|
||||
at 1.01, KCD2 at FSR printed the identity and `none` by count at 1.00 — the loader row carries
|
||||
both, once. **Wukong at FSR read silent at the monolith AND the loader with the monolith loaded**:
|
||||
FSR upscaling compiled into its UE plugin (Rune Factory's shape) with the monolith loaded and
|
||||
unused — ~~owed: Wukong with FSR frame generation ON~~ **the title has no FSR frame-generation
|
||||
option (owner, same night)**, so Wukong is the second static title and nothing is owed on it. ~~**The FSR 3.0 host route
|
||||
(`ffx_fsr3_x64.dll`, step 3 below) is deferred to its own PR** — ten host headers from `v1.1.4`;
|
||||
Cyberpunk at FSR 3 is its oracle and already prints `FsrFg` from the monolith beside it.
|
||||
Cyberpunk at FSR 3 is its oracle and already prints `FsrFg` from the monolith beside it.~~
|
||||
**BUILT 2026-09-05, and the tag was not `v1.1.4`.** Cyberpunk's module exports exactly
|
||||
`fsr3-v3.0.4`'s twelve `ffxFsr3*` names; 1.1.4 appends fields after `renderSize` and declares
|
||||
three exports the module lacks. One row — `ffx_fsr3_x64.dll!ffxFsr3ContextDispatchUpscale`,
|
||||
the same family and publish point as the ffx-api rows, keyed by module in the installer —
|
||||
reads `renderSize` and nothing else; `ffxFsr3DispatchFrameGeneration` is deliberately not a
|
||||
row (the monolith generates on the one title; §H11 pre-commits the reversal). **What is owed
|
||||
is the owner's acceptance run**, rows B1–B4 in §H11: Cyberpunk at FSR 3 + FG must print
|
||||
`upscaler: Fsr3` with one extent agreeing between the host and the monolith's PREPARE, and
|
||||
`frames/upscale-drained = 1.00`; B2 (facade silent, `upscale-drained = 0`) is the pre-committed
|
||||
condition for adding the `ffx_fsr3upscaler_x64.dll` row instead — never both.
|
||||
|
||||
<details>
|
||||
<summary>The entry as it stood, kept for the reasoning it carries</summary>
|
||||
@@ -801,7 +923,7 @@ exports `xessD3D12Init` / `xessD3D12Execute` and XeFG `xefgSwapChainD3D12InitFro
|
||||
ffx_framegeneration.h, dx12/ffx_api_dx12.h, vk/ffx_api_vk.h}` for the 3.1 facade the
|
||||
installed titles call, and `sdk/include/FidelityFX/host/{ffx_fsr3.h, ffx_fsr3upscaler.h,
|
||||
ffx_frameinterpolation.h, ffx_opticalflow.h, ffx_types.h, ffx_error.h, ffx_interface.h,
|
||||
ffx_util.h, ffx_assert.h}` for the FSR 3.0 host API. Do not take `main`: it is SDK 2.x under
|
||||
ffx_util.h, ffx_assert.h}` for the FSR 3.0 host API *(2026-09-05: vendored from **`fsr3-v3.0.4`**, not `v1.1.4` — the tag whose declarations match the module Cyberpunk ships; see the banner above)*. Do not take `main`: it is SDK 2.x under
|
||||
a binary-only `docs/license.md` that excepts these headers as MIT only by an 845-line list.
|
||||
Extend `hookinventory-check` Pass C's forbidden-import list with `amd_fidelityfx_*.dll` /
|
||||
`ffx_*.dll` in the same PR — the Streamline lesson, one vendor over. *Intel XeSS SDK*:
|
||||
@@ -828,8 +950,10 @@ exports `xessD3D12Init` / `xessD3D12Execute` and XeFG `xefgSwapChainD3D12InitFro
|
||||
same five names, and the plugin modules are called by the facade, not by the game — an
|
||||
unscoped hook would count each dispatch twice, straight into `fg_factor`.
|
||||
3. **AMD 3.0 (`ffx_fsr3_x64.dll`, Cyberpunk's copy):** named exports, no struct decode needed —
|
||||
`ffxFsr3ContextDispatchUpscale` for identity and extent, `ffxFsr3DispatchFrameGeneration`
|
||||
once per application frame.
|
||||
`ffxFsr3ContextDispatchUpscale` for identity and extent, ~~`ffxFsr3DispatchFrameGeneration`
|
||||
once per application frame~~ *(built 2026-09-05 without the FG row: on the one title the
|
||||
monolith generates and the count is Streamline's; the host's FG export fires per generated
|
||||
batch and is not a count producer. §H11 carries the reversal condition.)*
|
||||
4. **Intel — closed at the census (step 1).** No hook on any `libxess*.dll` export. The
|
||||
report line for an Intel title is what the writer already produces: upscaler
|
||||
`NOT_REPORTED`, and if `libxess_fg.dll` is in the census, Presented FPS with the *"MAY
|
||||
|
||||
+202
-4
@@ -1702,7 +1702,7 @@ one launch per capture, consent granted after launch. Exit codes and full report
|
||||
| Expedition 33 | upscaler 4.0.2 + frame generation 3.1.5, **no loader** | UE5: the plugin's built-in loader calls the leaves directly |
|
||||
| Hell Is Us | upscaler **4.0.3** + frame generation **4.0.0** under `Plugins/FSR/Source/fidelityfx-sdk/Kits/FidelityFX/signedbin/`, **no loader** | UE5, SDK 2.1.x |
|
||||
| Red Dead Redemption 2 | `ffx_fsr2_api_x64.dll` + `_dx12_` + `_vk_` | FSR 2, dynamic |
|
||||
| Cyberpunk 2077 (also) | `ffx_fsr3_x64.dll`, `ffx_backend_dx12_x64.dll`, `ffx_frameinterpolation_x64.dll`, `ffx_fsr3upscaler_x64.dll`, `ffx_opticalflow_x64.dll` | FSR 3.0 host DLLs, named exports — the deferred route |
|
||||
| Cyberpunk 2077 (also) | `ffx_fsr3_x64.dll`, `ffx_backend_dx12_x64.dll`, `ffx_frameinterpolation_x64.dll`, `ffx_fsr3upscaler_x64.dll`, `ffx_opticalflow_x64.dll` | FSR 3.0 host DLLs, named exports — ~~the deferred route~~ hooked 2026-09-05 at the host facade (`ffxFsr3ContextDispatchUpscale`, tag `fsr3-v3.0.4`: the module's twelve exports match that tag, not `v1.1.4`) |
|
||||
|
||||
Every module in the ffx-api family exports the same five names and nothing else
|
||||
(`vendor-exports.json`) — which the morning read as "the loader can only reach a leaf through
|
||||
@@ -1718,13 +1718,211 @@ one launch per capture, consent granted after launch. Exit codes and full report
|
||||
and `none` by count with FG off; **Hell Is Us** `FSR (3.1 or 4 …)` / `FsrFg` / ×2 / 1.00, and
|
||||
`none` with FG off; **Expedition 33** FSR upscale under DLSS FG ×3 → `×2.97`, *technology not
|
||||
identified*, count from UPSCALE dispatches (no PREPARE, no token); **Cyberpunk** at FSR 3: the FSR
|
||||
3.0 host DLLs upscale (`upscaler: N/A`, deferred route) while the 1.1.x monolith generates
|
||||
3.0 host DLLs upscale (`upscaler: N/A` on that build; the host row landed 2026-09-05, §H11 B1 owed) while the 1.1.x monolith generates
|
||||
(`FsrFg`, 4261 batches, ×2); **Dying Light: The Beast** (FSR + FSR FG), **KCD2** (FSR) and
|
||||
**Wukong** (FSR): **zero dispatches at any leaf export**, `upscaler: N/A` — the loader-row
|
||||
reversal; **Rune Factory** (FSR FG): no AMD module in the census, `59.99 → 119.95 (×2)` from
|
||||
Streamline tokens, *technology not identified* — 7b's statically linked title, with the count
|
||||
surviving and the identity not. **Owed after the loader row:** the three loader titles again,
|
||||
against row R6.
|
||||
surviving and the identity not. **Row R6, same night, on #111:** DL:TB FSR + FSR FG →
|
||||
`FSR (3.1 or 4 …)` / `FsrFg` / `70.49 → 140.9 (×2)` / 1.01 and KCD2 FSR → identity + `none` /
|
||||
1.00, both through the loader row at 1×; Wukong FSR (×2 runs) → silent at monolith and loader
|
||||
with the monolith loaded, and the title has no FSR frame-generation option — FSR upscaling
|
||||
compiled in (Rune Factory's shape), the monolith shipped and loaded for nothing this hook sees.
|
||||
- **2026-09-04, late: Dying Light: The Beast at DLSS, three captures (23:31 / 23:39 / 23:43), for
|
||||
7a after Alan Wake 2 would not run.** The first Streamline title measured whose batches carry
|
||||
`kFeatureDLSS`: `upscaler: Dlss` on 4720/4783, 4271/4345 and 4575/4657 records, `FPS 80.41 /
|
||||
72.73 / 77.69`, every batch identified, RT measured on ~98% of presents. **`UpscalerParams`
|
||||
0 of N on all three**, `render -> output: N/A`, quality byte never published. Cause, measured
|
||||
with dumpbin: DL:TB ships `sl.interposer.dll` **2.8.0**, which exports `slSetTagForFrame`
|
||||
(Cyberpunk's 2.7.1 does not); `sl.h` marks `slSetTag` deprecated in its favour, and a 2.8 title
|
||||
tagging per frame never calls the export the only params row hooked. The oracle had hidden it:
|
||||
`vendor-exports.ps1` recorded the FIRST `sl.interposer.dll` found (2.7.4.0), so the 2.8 export
|
||||
was absent from `docs/vendor-exports.json` until the tool unioned across copies (ten copies,
|
||||
eight distinct versions from 1.5.6 to 2.10.3). All three runs read `frame generation: none`
|
||||
with presents = tokens = batches; **which of the three had DLSS Frame Generation on is the
|
||||
owner's to say** — if any did, `none` there is the §H5 false negative on a title where the FG
|
||||
runtime (`sl.dlss_g.dll`) is in the census, and it is a finding about DLSS-G on SL 2.8, not
|
||||
about the tag row. Row added; rerun owed.
|
||||
- **2026-09-05 00:19, DL:TB at DLSS again, on the #115 build** (the payload is the CaptureHost
|
||||
bin's `FrameLedger.Overlay.dll`, rebuilt 00:17): `Dlss` 4331/4401, `FPS 73.64`, and
|
||||
**`UpscalerParams` still 0 of 4401** with the params family live — which, under
|
||||
publish-when-whole, means BOTH tag rows were patched. So the title either tags the scaling
|
||||
input with a **zero extent** ("use the entire resource") or tags it nowhere we hook. The
|
||||
zero-extent reading is the one the record can still act on: `sl::Resource` carries its own
|
||||
`width/height` (mandatory only on Vulkan, so filled or not on D3D12 at the title's choice),
|
||||
and `TagSize` in `fl_sl_inputs.h` now reads them when the extent is zero — on every route,
|
||||
local and both global — GUID-checked, from the argument the hooked API received. If the
|
||||
next run prints a `render -> output` line, that was the shape; if not, the title does not
|
||||
state the size on this route at all and the honest line stays `N/A`.
|
||||
- **2026-09-05 00:53, DL:TB at DLSS on the #116 build (payload rebuilt 00:51): `N/A` stands.**
|
||||
`Dlss` 3460/3523, `FPS 58.87`, **`UpscalerParams` 0 of 3523**, both tag rows live, the
|
||||
whole-resource fallback in. So on this title the scaling-input tag reaches neither global
|
||||
export with a size in either place, or does not reach them at all — the record cannot
|
||||
separate those two, and that is the one thing left to instrument if 7a is ever reopened on
|
||||
this title (a tag-route census: calls seen per export, zero-extent seen, Resource-size seen —
|
||||
a record bit or a writer-state word, so a layout bump). **7a on DL:TB closes as measured
|
||||
`N/A`** for the quality byte and the render size; the derived label has no input here and
|
||||
stays the owner's decision for the titles that do print the line (Cyberpunk).
|
||||
`frame generation: none` again with presents = tokens = 3441 and DLSS FG on — the fifth
|
||||
such run, §H5.
|
||||
- **And the owner's answer to the FG question: all four DLSS runs had DLSS Frame Generation
|
||||
ON.** `presents = tokens` on every one, against ×2 with FSR FG on the same title and ×3.99
|
||||
on Cyberpunk (SL 2.7.1, DLSS-G 310.8) — recorded in `20_OPEN_QUESTIONS` §H5 as case 3's
|
||||
candidate, with the discriminator (the owner's counter reading) pre-committed there.
|
||||
- **2026-09-05, the owner's run on #118 + #119 — eleven captures, seven titles, every one with
|
||||
DLSS or frame generation on**, the first with the `module:` lines (interposer versions read off
|
||||
the files: DL:TB 2.8.0, Cyberpunk 2.7.1, Hell Is Us 2.7.3, Expedition 33 2.7.30, Wukong 2.7.4;
|
||||
`_nvngx.dll` 32.0.16.1664 from the driver store on every NVIDIA title):
|
||||
|
||||
| Title / setting | What printed | Reading |
|
||||
|---|---|---|
|
||||
| **Cyberpunk 2077**, FSR 3 + FSR FG | `upscaler: Fsr3` (host route, 4332 records at 1506×847), `FsrFg`, `74.31 → 148.56 (×2)`, `frames/upscale-drained 1.01` | **§H11 B1 accepted** |
|
||||
| **Cyberpunk 2077**, FSR 3, FG off | `Fsr3`, `none` by count 4919/4919, `1506x847 -> 2560x1440 = 1.7x (59%)` | **B1-off accepted** |
|
||||
| **Cyberpunk 2077**, DLSS + RR + MFG ×3 | `Dlss` (via RR, 3704 batches), `62.86 → 187.49 (×2.98)`, `Active (technology not identified)`, `render 1707x960` on 3677 records | count right, DLSS-G unnamed (`kFeatureDLSS_G` never evaluated) |
|
||||
| **Dying Light: The Beast**, DLSS FG ×4 (twice) | `Presented FPS 76.7` / `93.24`, **`none` WITHHELD** with the §H5 qualifier, `sl.interposer.dll 2.8.0.0` named | **owner's counter ~300 = 3.9× ours** — reading (a) with its number |
|
||||
| **Hell Is Us**, DLSS + FG ×4 (twice) | `82.23 → 328.98 (×4)`, `Active (technology not identified)`, `upscaler: N/A`; the first run refused the factor (bucket 2.25 vs 3.65 — 53 unfocused ticks) | NGX-direct SR, Streamline tokens still count |
|
||||
| **Expedition 33**, DLSS + FG (twice) | `54.9 → 218.38 (×3.98)`, `Active (technology not identified)`, `upscaler: N/A` | same shape |
|
||||
| **Black Myth: Wukong**, DLSS + FG ×4 | `55.39 → 221.53 (×4)`, `Active (technology not identified)`, `upscaler: N/A`, `sl.dlss_g.dll 2.7.4.0` loaded | same shape; the plugin bit is set on a 2.7 title, and the gate correctly did not fire (factor active) |
|
||||
| **Lies of P**, DLSS, no FG (owner) | `Presented FPS 59.77`, WARNING naming `amd_fidelityfx_dx12.dll`, `upscaler: N/A`, `tokens=0` | NGX-direct SR with no Streamline at all: nothing this build hooks fires |
|
||||
|
||||
Two things the run found beyond the rows. **A consumer defect:** `render -> output: N/A` on every
|
||||
FG-on capture — Cyberpunk at FSR 3 + FG printed it two lines under `render 1506x847 on 4332
|
||||
record(s)` — because `UpscaleExtent` keyed its window on the params bit, which under frame
|
||||
generation rides on one present in N; fixed the same day (identity-bit window). **And the shape
|
||||
of what is left:** on every NVIDIA title measured the *count* is right and the *identity* is
|
||||
what this build cannot say — DLSS on four NGX-direct titles, DLSS-G on all of them — because
|
||||
the NGX SDK is licence-blocked and `kFeatureDLSS_G` is never evaluated through the export the
|
||||
Streamline hook owns. `20_OPEN_QUESTIONS` §H5 carries the one candidate that is not a hook
|
||||
(`NvAPI_NGX_GetNGXOverrideState`, by PID) and the probe that measures it before anything is
|
||||
built on it.
|
||||
|
||||
- **2026-09-05 evening, the owner's run on #121 (the tag route) — eight captures, six titles, every one at DLSS**
|
||||
**with frame generation on**, the first with the `Streamline tag census:` line. The pre-commitment in
|
||||
`20_OPEN_QUESTIONS` §H5 landed on every title that goes through Streamline:
|
||||
|
||||
| Title / setting | `frame generation:` | Trio | Tag census (route: types) |
|
||||
|---|---|---|---|
|
||||
| **Hell Is Us**, DLSS + FG ×4 (twice) | **`DlssG`** | `38.5 → 154.04 (×4)`, `81.41 → 325.58 (×4)` | global: depth, mvec, hudless, ui-color-alpha, backbuffer, other |
|
||||
| **Expedition 33**, DLSS + FG ×2 | **`DlssG`** | `75.95 → 149.83 (×1.97)` | global: same set |
|
||||
| **Black Myth: Wukong**, DLSS + FG ×4 | **`DlssG`** | `47.99 → 191.89 (×4)` | global: depth, mvec, hudless, ui-color-alpha, backbuffer |
|
||||
| **Rune Factory**, DLSS + FG ×4 | **`DlssG`** | `128.85 → 513.02 (×3.98)` | global: same as Hell Is Us |
|
||||
| **Cyberpunk 2077**, DLSS + RR + MFG | **`DlssG`**, `upscaler: Dlss`, `1707x960 -> 2560x1440 = 1.5x (67%)` | **factor refused** — bucket 1 of 8 reads 3.0 against 1.67 overall; `tokens/batch 2.97` | global: depth, mvec, hudless, scaling-in, scaling-out, other (no UI tag) |
|
||||
| **Dying Light: The Beast**, DLSS FG ×4 | N/A (`none` withheld, §H5) + *"it is FEEDING frame generation"* | `Presented FPS 67.13` | **frame** (`slSetTagForFrame`): depth, mvec, hudless, scaling-in, scaling-out, ui-color-alpha, other |
|
||||
|
||||
Three readings. **The identity is measured on six of six Streamline titles** — the UE Streamline plugin tags
|
||||
the DLSS-G inputs globally (`slSetTag`) on every UE title, Cyberpunk on 2.7.1 tags globally too, DL:TB on 2.8
|
||||
tags through `slSetTagForFrame` — so `Active (technology not identified)` is gone from every one of them,
|
||||
and `upscaler: N/A` on the UE titles is now the ONLY NVIDIA gap (NGX-direct super-resolution, the NVAPI
|
||||
probe's job). **DL:TB's 7a question is answered by the census, at no layout cost**: the title DOES tag
|
||||
`kBufferTypeScalingInputColor`, through the 2.8 export, and `UpscalerParams` is still 0 of 4030 — so the tag
|
||||
carries neither an extent nor a Resource size, which is exactly the shape #116 named and could not see; the
|
||||
`N/A` there is the title's truth. **Cyberpunk's refusal is the guard working**: `tokens/batch 2.97` with
|
||||
`presents/batch 4.97` and bucket 1 at 3.0 is a session whose state changed after the first eighth — tokens
|
||||
kept flowing while Ray Reconstruction stopped being evaluated, which is what a menu or a pause does — and the
|
||||
report refused the session-level number rather than averaging two configurations (the 2026-08-16 alt-tab
|
||||
lesson). The owner's settings for that run are recorded when known; the earlier 14:01 run at MFG ×3 read
|
||||
`×2.98` with `tokens/batch 1.00` on the same title.
|
||||
|
||||
- **2026-09-05 night, the owner's run on #124 (the DXGI present counter) — DL:TB twice, Hell Is Us, and a
|
||||
new title, the Onimusha: Way of the Sword demo on Streamline 2.10.3.** `20_OPEN_QUESTIONS` §H5 row
|
||||
P1-DXGI landed on the first title and both controls read zero:
|
||||
|
||||
| Title / Streamline | Trio or Presented | `DXGI present counter:` | `frame generation:` |
|
||||
|---|---|---|---|
|
||||
| **Dying Light: The Beast**, 2.8.0, DLSS FG ×4 (21:56) | `Presented FPS 69.99` (withheld) | `unseen=12204 over samples=4136 (2.95)` | N/A (withheld) + *FEEDING* |
|
||||
| **Dying Light: The Beast**, 2.8.0, DLSS FG ×4 (22:06) | `Presented FPS 73.19` (withheld) | `unseen=12741 over samples=4392 (2.90)` | same |
|
||||
| **Hell Is Us**, 2.7.3, DLSS + FG ×4 | `79.89 → 308.14 (×3.86)` | `unseen=0 over samples=18207` | `DlssG` |
|
||||
| **Onimusha: Way of the Sword demo**, **2.10.3**, DLSS + FG | `60.04 → 220.33 (×3.67)` | `unseen=0 over samples=12914` | `DlssG`, `upscaler: Dlss`, RT Yes (27.1 %) |
|
||||
|
||||
The 2.8.0 pacer presents on the hooked chain through a body the inline patches do not cover; 2.7.3 and
|
||||
2.10.3 present through the body they do. The owner's "`sl.interposer.dll` + `sl.common.dll` must be
|
||||
loaded on ≥ 2.8" lead is closed by the 2.10.3 title: it injects, tags on the frame route (`depth, mvec,
|
||||
hudless, scaling-in, scaling-out, ui-color-alpha, backbuffer, other`) and counts like 2.7. Onimusha's
|
||||
`render -> output: N/A` with `UpscalerParams 0/13014` is DL:TB's shape again — the frame-route tags carry
|
||||
no size on D3D12, where `sl::Resource` declares none. The PR after #124 turns the 2.8.0 reading into a
|
||||
DXGI-COUNTED Displayed (`03_METRICS` §Displayed may be DXGI-COUNTED).
|
||||
|
||||
- **2026-09-06 morning, the owner's run on #125 — DL:TB three times (frame generation on, then off twice)
|
||||
and Expedition 33 with frame generation off.** The promotion landed and §H5's Leg 0 answered:
|
||||
|
||||
| Title / setting | Line | `DXGI present counter:` | `frame generation:` |
|
||||
|---|---|---|---|
|
||||
| **Dying Light: The Beast**, DLSS FG ×4 (07:31) | `Native FPS: 70.52 -> Displayed FPS: 282.08 (x4 FG) over 16516 present(s)` + *Displayed is DXGI-COUNTED: 12387* | `unseen=12483 over samples=4202 (2.97)` | **`DlssG`** |
|
||||
| **Dying Light: The Beast**, DLSS, FG **off** (07:45) | `Presented FPS 75.52` (withheld) | `unseen=0 over samples=4519` | N/A (withheld) — census still `0x25F0F`, tags `0x23600` (no hudless / UI) |
|
||||
| **Dying Light: The Beast**, DLSS, FG **off** (07:55) | `Presented FPS 61.14` (withheld) | `unseen=0 over samples=3659` | same |
|
||||
| **Expedition 33**, FG off (Streamline 2.7.30) | `FPS: 85.86` | `unseen=0 over samples=5063` | `none` by count; tag census `0x0` |
|
||||
|
||||
Two readings. **The trio is printed on the title that could not print it**, from a count DXGI made
|
||||
(12,387 presents this hook never timed), and it is the number the owner's own counter showed (~300 at
|
||||
×4 against ~75 native). **Leg 0: `sl.dlss_g.dll` is a startup-time load** — the census cannot tell FG
|
||||
off from FG on, exactly the cost the gate pre-committed — but the DXGI counter can (0 unseen with FG
|
||||
off, 2.9–3.0 with it on), so the gate is narrowed to sessions where the counter was not read, and the
|
||||
two FG-off captures above print `none` with DXGI's agreement on the next build. Also visible: with FG
|
||||
off DL:TB sends no hudless / UI tag and the UE plugin sends no tags at all, so the DLSS-G identity is
|
||||
per-setting on both.
|
||||
|
||||
- **2026-09-06, 09:20–09:35, the NVAPI probe against three running titles (`fl-probe-nvapi --ngx-state
|
||||
<pid>`, driver 616.64), each beside a capture on the #126 build.** The question §H5 opened on 2026-09-05 —
|
||||
are the driver's per-process NGX feedback bits populated without an NVIDIA-app override? — is answered
|
||||
YES for super resolution and NO for frame generation:
|
||||
|
||||
| Title / override / capture beside it | SR | RR | FG | `scalingRatio` / `performanceMode` / `renderPreset` / `frameGenerationCount` |
|
||||
|---|---|---|---|---|
|
||||
| **Hell Is Us**, no override, `83.21 → 332.82 (×4 FG)` `DlssG`, `upscaler: N/A` | `0x80605` CREATED EVALUATE (+ INITIALIZED DLL_EXISTS ERR_NOT_FOUND) | INITIALIZED DLL_EXISTS ERR_NOT_FOUND | `0x5` INITIALIZED DLL_EXISTS only | 0 / 0 / 0 / 0 |
|
||||
| **Expedition 33**, override ON, FG off, `FPS: 79.4` `none` (DXGI agrees), `upscaler: N/A` | `0x8067F` CREATED EVALUATE ENABLED DLL_LOADED DLL_SELECTED PRESET PERF_MODE (+ …) | INITIALIZED DLL_EXISTS ERR_NOT_FOUND | `0x1F` INITIALIZED ENABLED DLL_EXISTS DLL_LOADED DLL_SELECTED | 0 / 2 / 11 / 0 |
|
||||
| **Lies of P**, no override, `Presented FPS 59.89`, `upscaler: N/A` | `0x605` CREATED EVALUATE (+ INITIALIZED DLL_EXISTS) | INITIALIZED ERR_FAILED ERR_NOT_FOUND | INITIALIZED ERR_FAILED ERR_NOT_FOUND | 0 / 0 / 0 / 0 |
|
||||
|
||||
The SR word carries the identity the hooks cannot see on these three titles; the FG word does not see
|
||||
DLSS-G running at ×4 (it tracks the override machinery's DLL, not the plugin), `frameGenerationCount` is
|
||||
the override target and not the multiplier, and `scalingRatio` is 0 even under the override. §H5 carries
|
||||
what a driver-reported rung may and may not claim, and the negative still owed (DLSS off in the menu).
|
||||
Also on this run: Expedition 33 with FG off now prints `none` with *DXGI's own present counter agrees:
|
||||
0 unseen over 4774* (#126), and Lies of P's `Presented FPS` keeps its "MAY include generated frames"
|
||||
qualifier because `amd_fidelityfx_dx12.dll` is loaded there — the census cannot say `none` and the
|
||||
token count is 0 on that title, so that line is right as printed.
|
||||
|
||||
- **2026-09-06, 10:39–11:36, the owner's run on #128 (the driver-reported rung) — §H5 rows N1–N4 and one
|
||||
correction.** The standalone probe first: Lies of P with upscaling OFF reads `SR 0x5` (CREATED clear), with
|
||||
DLSS on `0x605` — N3 keeps the rung. Then the captures:
|
||||
|
||||
| Title / setting | `upscaler:` | `NVIDIA driver NGX state:` SR / RR / FG | FG line |
|
||||
|---|---|---|---|
|
||||
| **Lies of P**, DLSS (no override) | **`Dlss (driver-reported: …)`** | `0x605` / `0x90001` / `0x90001` | N/A (no FG in this title) |
|
||||
| **Expedition 33**, override ON, FG off | **`Dlss (driver-reported: …)`** | `0x8067F` (mode 2, preset 11) / `0x80005` / `0x1F` | `none`, DXGI agrees |
|
||||
| **Hell Is Us**, DLSS + FG ×4 | **`Dlss (driver-reported: …)`** | `0x80605` / `0x80005` / **`0x605`** (CHANGED between readings) | `81.32 → 321.73 (×3.96)`, `DlssG` |
|
||||
| **Onimusha demo**, SL 2.10.3, DLSS + FG | `Dlss — the NVIDIA driver agrees` | `0x605` / `0x5` / **`0x605`** (CHANGED) | `59.99 → 235.47 (×3.93)`, `DlssG` |
|
||||
| **Dying Light: The Beast**, DLSS + FG ×4 | `Dlss — the NVIDIA driver agrees` | `0x605` / `0x90001` / **`0x605`** (CHANGED) | `39.63 → 158.5 (×4)` DXGI-COUNTED, `DlssG` |
|
||||
| **Cronos: The New Dawn demo** (new; UE, **SL 2.8.0**), DLSS, FG off | **`Dlss (driver-reported: …)`** | `0x80605` / `0x80005` / `0x5` | `FPS 105.01`, `none`, DXGI agrees; RT Yes |
|
||||
| **Dying Light: The Beast**, **FSR upscaling + DLSS FG** | `FSR (3.1 or 4 …)`, `2560x1440 -> 2560x1440` | **`0x205`** (CREATED, not EVALUATE) / `0x90001` / `0x605` | `DlssG` from the tags; factor REFUSED (bucket 8 of 8 at 1.96 vs 2.85); DXGI 1.80 unseen / present |
|
||||
|
||||
Three readings. **The rung works as written and its negative held.** **The FG word is not blind** — the
|
||||
morning's Hell Is Us reading was taken before the feature came up, and every ×4 session's loop readings
|
||||
show `CREATED | EVALUATE` with the word changing mid-session; the multiplier bits never set, so it is an
|
||||
identity witness and is now printed beside `frame generation:`. **`SR 0x205` on the FSR session is the
|
||||
word telling the truth finely**: DLSS was created at some point (the title initialises it) and not
|
||||
evaluated, and the rung's two-bit key keeps it from claiming DLSS beside FSR. The FSR + DLSS-G session
|
||||
also exposed a wrong qualifier ("no evaluation was observed" beside 4,415 tokens and a refused factor),
|
||||
fixed the same day. Cronos is a second Streamline 2.8.0 title; its FG-on capture is the one that says
|
||||
whether the pacer bypass measured on DL:TB belongs to SDK 2.8.0 or to that title.
|
||||
|
||||
- **2026-09-06, 12:17, Cronos: The New Dawn demo with frame generation ON — the row that closed §H5's
|
||||
DLSS / DLSS-G question.** Streamline 2.8.0, UE: `Native FPS: 86.8 -> Displayed FPS: 172.72 (x1.99 FG)`
|
||||
over 9,948 presents, `unseen=0 over samples=10063`, tag census `frame=[depth, mvec, hudless,
|
||||
ui-color-alpha, backbuffer, other]`, `frame generation: DlssG — the NVIDIA driver agrees`, `upscaler: Dlss
|
||||
(driver-reported)`, RT Yes. The 2.8.0 SDK presents its generated frames through the body the inline
|
||||
patches cover; the bypass measured on Dying Light: The Beast is that title's integration. With this row
|
||||
every measured NVIDIA title prints the rule-6 trio or a counted `none`, and the owner closed the item.
|
||||
|
||||
- **2026-09-06, 12:46, Lies of P at FSR 3.1 + FSR frame generation, on the #129 build — §H11 row A1 again,
|
||||
now with every witness on the page.** `upscaler: Fsr3`, `render -> output: 2560x1440 -> 2560x1440 = 1x` on
|
||||
3,538 records, `frame generation: FsrFg`, `Native FPS: 59.77 -> Displayed FPS: 119.55 (x2 FG)` over 7,042
|
||||
presents; the ffx census `upscale-drained=3518 fg-dispatch-drained=3518 frames=3520`, `presents/frame=2.00`,
|
||||
`frames/upscale-drained=1.00`; `DXGI present counter: unseen=0 over samples=7096` (the FSR 3.1 pacer presents
|
||||
through the patched body); the NVIDIA driver's word `SR 0x5` / `FG 0x90001` — nothing created, so the
|
||||
driver-reported rung correctly says nothing beside an AMD identity. The census names only
|
||||
`amd_fidelityfx_dx12.dll` (the 3.1 monolith Lies of P calls) — the AMD half of 7c is complete on its oracle.
|
||||
Same run, Rune Factory at DLSS + FG ×4: `125.45 → 498.51 (×3.97)`, `Dlss (driver-reported)`, `DlssG` with the
|
||||
driver agreeing — the 7b title on its NVIDIA path.
|
||||
|
||||
## 10 · Telemetry layering
|
||||
|
||||
|
||||
+253
-72
@@ -8,6 +8,9 @@
|
||||
"amd_fidelityfx_denoiser_dx12.dll": {
|
||||
"exportCount": 5,
|
||||
"version": "1.0.1.0",
|
||||
"versions": [
|
||||
"1.0.1.0"
|
||||
],
|
||||
"exports": [
|
||||
"ffxConfigure",
|
||||
"ffxCreateContext",
|
||||
@@ -20,6 +23,9 @@
|
||||
"amd_fidelityfx_dx12.dll": {
|
||||
"exportCount": 5,
|
||||
"version": "1.0.1.41314",
|
||||
"versions": [
|
||||
"1.0.1.41314"
|
||||
],
|
||||
"exports": [
|
||||
"ffxConfigure",
|
||||
"ffxCreateContext",
|
||||
@@ -27,11 +33,16 @@
|
||||
"ffxDispatch",
|
||||
"ffxQuery"
|
||||
],
|
||||
"copiesFound": 7
|
||||
"copiesFound": 6
|
||||
},
|
||||
"amd_fidelityfx_loader_dx12.dll": {
|
||||
"exportCount": 5,
|
||||
"version": "2.1.0.450",
|
||||
"versions": [
|
||||
"2.1.0.450",
|
||||
"1.0.2.44888",
|
||||
"2.2.0.0"
|
||||
],
|
||||
"exports": [
|
||||
"ffxConfigure",
|
||||
"ffxCreateContext",
|
||||
@@ -39,11 +50,16 @@
|
||||
"ffxDispatch",
|
||||
"ffxQuery"
|
||||
],
|
||||
"copiesFound": 3
|
||||
"copiesFound": 4
|
||||
},
|
||||
"libxess_dx11.dll": {
|
||||
"exportCount": 51,
|
||||
"version": "2.0.2.68",
|
||||
"versions": [
|
||||
"2.0.2.68",
|
||||
"2.0.1.41",
|
||||
"2.0.2.53"
|
||||
],
|
||||
"exports": [
|
||||
"INTC_D3D11_XessCreateContext",
|
||||
"INTC_D3D11_XessDestroyContext",
|
||||
@@ -97,15 +113,68 @@
|
||||
"xessSetVelocityScale",
|
||||
"xessStartDump"
|
||||
],
|
||||
"copiesFound": 5
|
||||
"copiesFound": 6
|
||||
},
|
||||
"libxess_fg.dll": {
|
||||
"exportCount": 31,
|
||||
"exportCount": 78,
|
||||
"version": "1.3.1.68",
|
||||
"versions": [
|
||||
"1.3.1.68",
|
||||
"1.3.1.78",
|
||||
"1.2.2.118",
|
||||
"1.2.0.87"
|
||||
],
|
||||
"exports": [
|
||||
"?xefgDebugLogMessage@@YAXPEB_W@Z",
|
||||
"INTC_D3D11_XessCreateContext",
|
||||
"INTC_D3D11_XessDestroyContext",
|
||||
"INTC_D3D11_XessExecute",
|
||||
"INTC_D3D11_XessForceLegacyScaleFactors",
|
||||
"INTC_D3D11_XessGetExposureMultiplier",
|
||||
"INTC_D3D11_XessGetInitParams",
|
||||
"INTC_D3D11_XessGetInputResolution",
|
||||
"INTC_D3D11_XessGetIntelXeFXVersion",
|
||||
"INTC_D3D11_XessGetJitterScale",
|
||||
"INTC_D3D11_XessGetOptimalInputResolution",
|
||||
"INTC_D3D11_XessGetProfilingData",
|
||||
"INTC_D3D11_XessGetVelocityScale",
|
||||
"INTC_D3D11_XessGetVersion",
|
||||
"INTC_D3D11_XessInit",
|
||||
"INTC_D3D11_XessIsOptimalDriver",
|
||||
"INTC_D3D11_XessSelectNetworkModel",
|
||||
"INTC_D3D11_XessSetExposureMultiplier",
|
||||
"INTC_D3D11_XessSetJitterScale",
|
||||
"INTC_D3D11_XessSetLoggingCallback",
|
||||
"INTC_D3D11_XessSetVelocityScale",
|
||||
"INTC_D3D12_GetApplicationInfo",
|
||||
"INTC_D3D12_GetGpuCrashDumpBufferInfo",
|
||||
"INTC_D3D12_GpuCrashDumpOnCommandListCreate",
|
||||
"INTC_D3D12_GpuCrashDumpOnCommandListDestroy",
|
||||
"INTC_D3D12_GpuCrashDumpOnDeviceDestroy",
|
||||
"INTC_D3D12_RegisterDriverCallbacks",
|
||||
"xefgAILGetDecision",
|
||||
"xefgAILGetVersion",
|
||||
"xefgAILSetAppXeFGVersion",
|
||||
"xefgD3D12BuildPipelines",
|
||||
"xefgD3D12CreateContext",
|
||||
"xefgD3D12Execute",
|
||||
"xefgD3D12GetInitParams",
|
||||
"xefgD3D12GetProfilingData",
|
||||
"xefgD3D12GetResourcesToDump",
|
||||
"xefgD3D12Init",
|
||||
"xefgDebugLog",
|
||||
"xefgDebugLogMessage",
|
||||
"xefgDestroyContext",
|
||||
"xefgGetContextParameterP",
|
||||
"xefgGetPipelineBuildStatus",
|
||||
"xefgGetProperties",
|
||||
"xefgGetVersion",
|
||||
"xefgSelectTechnique",
|
||||
"xefgSetColorSpace",
|
||||
"xefgSetContextParameterF",
|
||||
"xefgSetLoggingCallback",
|
||||
"xefgSetSceneChangeThreshold",
|
||||
"xefgStartDump",
|
||||
"xefgSwapChainD3D12BuildPipelines",
|
||||
"xefgSwapChainD3D12CreateContext",
|
||||
"xefgSwapChainD3D12GetInitializationParameters",
|
||||
@@ -135,11 +204,17 @@
|
||||
"xefgSwapChainSetUiCompositionState",
|
||||
"xefgSwapChainTagFrameConstants"
|
||||
],
|
||||
"copiesFound": 5
|
||||
"copiesFound": 6
|
||||
},
|
||||
"libxess.dll": {
|
||||
"exportCount": 72,
|
||||
"version": "2.0.2.68",
|
||||
"versions": [
|
||||
"2.0.2.68",
|
||||
"2.0.1.41",
|
||||
"1.1.0.21",
|
||||
"2.0.2.53"
|
||||
],
|
||||
"exports": [
|
||||
"INTC_D3D11_XessCreateContext",
|
||||
"INTC_D3D11_XessDestroyContext",
|
||||
@@ -217,8 +292,16 @@
|
||||
"copiesFound": 10
|
||||
},
|
||||
"nvngx_dlss.dll": {
|
||||
"exportCount": 59,
|
||||
"exportCount": 62,
|
||||
"version": "310,6,0,0",
|
||||
"versions": [
|
||||
"310,6,0,0",
|
||||
"310,8,0,0",
|
||||
"2,3,11,0",
|
||||
"2,2,10,0",
|
||||
"310,3,0,0",
|
||||
"310,5,0,0"
|
||||
],
|
||||
"exports": [
|
||||
"NGX_SNIPPETS_GetRequiredDriverSupport",
|
||||
"NVSDK_NGX_CUDA_CreateFeature",
|
||||
@@ -228,6 +311,7 @@
|
||||
"NVSDK_NGX_CUDA_Init",
|
||||
"NVSDK_NGX_CUDA_Init_Ext",
|
||||
"NVSDK_NGX_CUDA_Init_Ext1",
|
||||
"NVSDK_NGX_CUDA_Init1",
|
||||
"NVSDK_NGX_CUDA_PopulateParameters_Impl",
|
||||
"NVSDK_NGX_CUDA_ReleaseFeature",
|
||||
"NVSDK_NGX_CUDA_Shutdown",
|
||||
@@ -263,7 +347,9 @@
|
||||
"NVSDK_NGX_GetDriverVersionEx",
|
||||
"NVSDK_NGX_GetGPUArchitecture",
|
||||
"NVSDK_NGX_GetSnippetVersion",
|
||||
"NVSDK_NGX_SetInfoCallback",
|
||||
"NVSDK_NGX_SetOverrideStatusCallback",
|
||||
"NVSDK_NGX_SetTelemetryCallback",
|
||||
"NVSDK_NGX_SetTelemetryEvaluateCallback",
|
||||
"NVSDK_NGX_VULKAN_CreateFeature",
|
||||
"NVSDK_NGX_VULKAN_CreateFeature1",
|
||||
@@ -283,8 +369,14 @@
|
||||
"copiesFound": 15
|
||||
},
|
||||
"nvngx_dlssd.dll": {
|
||||
"exportCount": 59,
|
||||
"exportCount": 61,
|
||||
"version": "310,6,0,0",
|
||||
"versions": [
|
||||
"310,6,0,0",
|
||||
"310,7,129,0",
|
||||
"310,3,0,0",
|
||||
"310,5,0,0"
|
||||
],
|
||||
"exports": [
|
||||
"NGX_SNIPPETS_GetRequiredDriverSupport",
|
||||
"NVSDK_NGX_CUDA_CreateFeature",
|
||||
@@ -294,6 +386,7 @@
|
||||
"NVSDK_NGX_CUDA_Init",
|
||||
"NVSDK_NGX_CUDA_Init_Ext",
|
||||
"NVSDK_NGX_CUDA_Init_Ext1",
|
||||
"NVSDK_NGX_CUDA_Init1",
|
||||
"NVSDK_NGX_CUDA_PopulateParameters_Impl",
|
||||
"NVSDK_NGX_CUDA_ReleaseFeature",
|
||||
"NVSDK_NGX_CUDA_Shutdown",
|
||||
@@ -329,6 +422,7 @@
|
||||
"NVSDK_NGX_GetDriverVersionEx",
|
||||
"NVSDK_NGX_GetGPUArchitecture",
|
||||
"NVSDK_NGX_GetSnippetVersion",
|
||||
"NVSDK_NGX_SetInfoCallback",
|
||||
"NVSDK_NGX_SetOverrideStatusCallback",
|
||||
"NVSDK_NGX_SetTelemetryEvaluateCallback",
|
||||
"NVSDK_NGX_VULKAN_CreateFeature",
|
||||
@@ -349,14 +443,21 @@
|
||||
"copiesFound": 8
|
||||
},
|
||||
"nvngx_dlssg.dll": {
|
||||
"exportCount": 50,
|
||||
"exportCount": 52,
|
||||
"version": "310,6,0,0",
|
||||
"versions": [
|
||||
"310,6,0,0",
|
||||
"310,8,0,0",
|
||||
"310,3,0,0",
|
||||
"310,5,2,0"
|
||||
],
|
||||
"exports": [
|
||||
"NVSDK_NGX_CUDA_CreateFeature",
|
||||
"NVSDK_NGX_CUDA_EvaluateFeature",
|
||||
"NVSDK_NGX_CUDA_GetScratchBufferSize",
|
||||
"NVSDK_NGX_CUDA_Init",
|
||||
"NVSDK_NGX_CUDA_Init_Ext",
|
||||
"NVSDK_NGX_CUDA_PopulateParameters_Impl",
|
||||
"NVSDK_NGX_CUDA_ReleaseFeature",
|
||||
"NVSDK_NGX_CUDA_Shutdown",
|
||||
"NVSDK_NGX_D3D11_CreateFeature",
|
||||
@@ -387,6 +488,7 @@
|
||||
"NVSDK_NGX_GetDriverVersionEx",
|
||||
"NVSDK_NGX_GetGPUArchitecture",
|
||||
"NVSDK_NGX_GetSnippetVersion",
|
||||
"NVSDK_NGX_SetInfoCallback",
|
||||
"NVSDK_NGX_SetOverrideStatusCallback",
|
||||
"NVSDK_NGX_SetTelemetryEvaluateCallback",
|
||||
"NVSDK_NGX_VULKAN_CreateFeature",
|
||||
@@ -403,11 +505,21 @@
|
||||
"NVSDK_NGX_VULKAN_Shutdown",
|
||||
"NVSDK_NGX_VULKAN_Shutdown1"
|
||||
],
|
||||
"copiesFound": 11
|
||||
"copiesFound": 10
|
||||
},
|
||||
"sl.common.dll": {
|
||||
"exportCount": 60,
|
||||
"version": "2,7,4,0",
|
||||
"versions": [
|
||||
"2,7,4,0",
|
||||
"2,7,1,0",
|
||||
"2,8,0,0",
|
||||
"2,7,30,0",
|
||||
"2,7,3,0",
|
||||
"1.5.6.0",
|
||||
"2,10,3,0",
|
||||
"2,7,0,0"
|
||||
],
|
||||
"exports": [
|
||||
"DllMain",
|
||||
"NVSDK_NGX_D3D11_AllocateParameters",
|
||||
@@ -470,20 +582,40 @@
|
||||
"NVSDK_NGX_VULKAN_Shutdown1",
|
||||
"slGetPluginFunction"
|
||||
],
|
||||
"copiesFound": 11
|
||||
"copiesFound": 10
|
||||
},
|
||||
"sl.dlss_g.dll": {
|
||||
"exportCount": 2,
|
||||
"version": "2,7,4,0",
|
||||
"versions": [
|
||||
"2,7,4,0",
|
||||
"2,7,1,0",
|
||||
"2,8,0,0",
|
||||
"2,7,30,0",
|
||||
"2,7,3,0",
|
||||
"1.5.6.0",
|
||||
"2,10,3,0",
|
||||
"2,7,0,0"
|
||||
],
|
||||
"exports": [
|
||||
"DllMain",
|
||||
"slGetPluginFunction"
|
||||
],
|
||||
"copiesFound": 11
|
||||
"copiesFound": 10
|
||||
},
|
||||
"sl.interposer.dll": {
|
||||
"exportCount": 261,
|
||||
"exportCount": 269,
|
||||
"version": "2,7,4,0",
|
||||
"versions": [
|
||||
"2,7,4,0",
|
||||
"2,7,1,0",
|
||||
"2,8,0,0",
|
||||
"2,7,30,0",
|
||||
"2,7,3,0",
|
||||
"1.5.6.0",
|
||||
"2,10,3,0",
|
||||
"2,7,0,0"
|
||||
],
|
||||
"exports": [
|
||||
"CreateDXGIFactory",
|
||||
"CreateDXGIFactory1",
|
||||
@@ -502,18 +634,26 @@
|
||||
"slAllocateResources",
|
||||
"slEvaluateFeature",
|
||||
"slFreeResources",
|
||||
"slGetFeatureConfiguration",
|
||||
"slGetFeatureFunction",
|
||||
"slGetFeatureRequirements",
|
||||
"slGetFeatureSettings",
|
||||
"slGetFeatureVersion",
|
||||
"slGetHooks",
|
||||
"slGetNativeInterface",
|
||||
"slGetNewFrameToken",
|
||||
"slGetNumHooks",
|
||||
"slInit",
|
||||
"slIsFeatureEnabled",
|
||||
"slIsFeatureLoaded",
|
||||
"slIsFeatureSupported",
|
||||
"slSetConstants",
|
||||
"slSetD3DDevice",
|
||||
"slSetFeatureConstants",
|
||||
"slSetFeatureEnabled",
|
||||
"slSetFeatureLoaded",
|
||||
"slSetTag",
|
||||
"slSetTagForFrame",
|
||||
"slSetVulkanInfo",
|
||||
"slShutdown",
|
||||
"slUpgradeInterface",
|
||||
@@ -747,29 +887,49 @@
|
||||
"vkWaitForFences",
|
||||
"vkWaitSemaphores"
|
||||
],
|
||||
"copiesFound": 11
|
||||
"copiesFound": 10
|
||||
},
|
||||
"sl.pcl.dll": {
|
||||
"exportCount": 2,
|
||||
"version": "2,7,4,0",
|
||||
"versions": [
|
||||
"2,7,4,0",
|
||||
"2,7,1,0",
|
||||
"2,8,0,0",
|
||||
"2,7,30,0",
|
||||
"2,7,3,0",
|
||||
"2,10,3,0",
|
||||
"2,7,0,0"
|
||||
],
|
||||
"exports": [
|
||||
"DllMain",
|
||||
"slGetPluginFunction"
|
||||
],
|
||||
"copiesFound": 9
|
||||
},
|
||||
"sl.reflex.dll": {
|
||||
"exportCount": 2,
|
||||
"version": "2,7,4,0",
|
||||
"versions": [
|
||||
"2,7,4,0",
|
||||
"2,7,1,0",
|
||||
"2,8,0,0",
|
||||
"2,7,30,0",
|
||||
"2,7,3,0",
|
||||
"1.5.6.0",
|
||||
"2,10,3,0",
|
||||
"2,7,0,0"
|
||||
],
|
||||
"exports": [
|
||||
"DllMain",
|
||||
"slGetPluginFunction"
|
||||
],
|
||||
"copiesFound": 10
|
||||
},
|
||||
"sl.reflex.dll": {
|
||||
"exportCount": 2,
|
||||
"version": "2,7,4,0",
|
||||
"exports": [
|
||||
"DllMain",
|
||||
"slGetPluginFunction"
|
||||
],
|
||||
"copiesFound": 11
|
||||
},
|
||||
"ffx_backend_dx12_x64.dll": {
|
||||
"exportCount": 21,
|
||||
"version": null,
|
||||
"versions": [],
|
||||
"exports": [
|
||||
"?ffxFrameInterpolationUiComposition@@YAHPEBUFfxPresentCallbackDescription@@@Z",
|
||||
"ffxAssertReport",
|
||||
@@ -798,6 +958,7 @@
|
||||
"ffx_frameinterpolation_x64.dll": {
|
||||
"exportCount": 8,
|
||||
"version": null,
|
||||
"versions": [],
|
||||
"exports": [
|
||||
"ffxAssertReport",
|
||||
"ffxAssertSetPrintingCallback",
|
||||
@@ -813,6 +974,7 @@
|
||||
"ffx_fsr3_x64.dll": {
|
||||
"exportCount": 17,
|
||||
"version": null,
|
||||
"versions": [],
|
||||
"exports": [
|
||||
"ffxAssertReport",
|
||||
"ffxAssertSetPrintingCallback",
|
||||
@@ -837,6 +999,7 @@
|
||||
"ffx_fsr3upscaler_x64.dll": {
|
||||
"exportCount": 15,
|
||||
"version": null,
|
||||
"versions": [],
|
||||
"exports": [
|
||||
"ffxAssertReport",
|
||||
"ffxAssertSetPrintingCallback",
|
||||
@@ -859,6 +1022,7 @@
|
||||
"ffx_opticalflow_x64.dll": {
|
||||
"exportCount": 10,
|
||||
"version": null,
|
||||
"versions": [],
|
||||
"exports": [
|
||||
"?ffxOpticalflowResourceIsNull@@YA_NUFfxResource@@@Z",
|
||||
"ffxAssertReport",
|
||||
@@ -876,45 +1040,52 @@
|
||||
"sl.dlss_d.dll": {
|
||||
"exportCount": 2,
|
||||
"version": "2,7,1,0",
|
||||
"versions": [
|
||||
"2,7,1,0",
|
||||
"2,7,0,0"
|
||||
],
|
||||
"exports": [
|
||||
"DllMain",
|
||||
"slGetPluginFunction"
|
||||
],
|
||||
"copiesFound": 3
|
||||
"copiesFound": 2
|
||||
},
|
||||
"sl.dlss.dll": {
|
||||
"exportCount": 2,
|
||||
"version": "2,7,1,0",
|
||||
"versions": [
|
||||
"2,7,1,0",
|
||||
"2,8,0,0",
|
||||
"1.5.6.0",
|
||||
"2,7,0,0"
|
||||
],
|
||||
"exports": [
|
||||
"DllMain",
|
||||
"slGetPluginFunction"
|
||||
],
|
||||
"copiesFound": 5
|
||||
"copiesFound": 4
|
||||
},
|
||||
"sl.nis.dll": {
|
||||
"exportCount": 2,
|
||||
"version": "2,7,1,0",
|
||||
"versions": [
|
||||
"2,7,1,0",
|
||||
"2,8,0,0"
|
||||
],
|
||||
"exports": [
|
||||
"DllMain",
|
||||
"slGetPluginFunction"
|
||||
],
|
||||
"copiesFound": 3
|
||||
"copiesFound": 2
|
||||
},
|
||||
"amd_fidelityfx_framegeneration_dx12.dll": {
|
||||
"exportCount": 5,
|
||||
"version": "3.1.5.44888",
|
||||
"exports": [
|
||||
"ffxConfigure",
|
||||
"ffxCreateContext",
|
||||
"ffxDestroyContext",
|
||||
"ffxDispatch",
|
||||
"ffxQuery"
|
||||
"versions": [
|
||||
"3.1.5.44888",
|
||||
"4.0.0.604",
|
||||
"4.0.0.0"
|
||||
],
|
||||
"copiesFound": 3
|
||||
},
|
||||
"amd_fidelityfx_upscaler_dx12.dll": {
|
||||
"exportCount": 5,
|
||||
"version": "4.0.2.44888",
|
||||
"exports": [
|
||||
"ffxConfigure",
|
||||
"ffxCreateContext",
|
||||
@@ -924,9 +1095,32 @@
|
||||
],
|
||||
"copiesFound": 4
|
||||
},
|
||||
"amd_fidelityfx_upscaler_dx12.dll": {
|
||||
"exportCount": 5,
|
||||
"version": "4.0.2.44888",
|
||||
"versions": [
|
||||
"4.0.2.44888",
|
||||
"4.0.3.604",
|
||||
"4.1.0.0"
|
||||
],
|
||||
"exports": [
|
||||
"ffxConfigure",
|
||||
"ffxCreateContext",
|
||||
"ffxDestroyContext",
|
||||
"ffxDispatch",
|
||||
"ffxQuery"
|
||||
],
|
||||
"copiesFound": 5
|
||||
},
|
||||
"nvngx_deepdvc.dll": {
|
||||
"exportCount": 36,
|
||||
"exportCount": 37,
|
||||
"version": "310,2,0,0",
|
||||
"versions": [
|
||||
"310,2,0,0",
|
||||
"310,1,0,0",
|
||||
"310,3,0,0",
|
||||
"310,5,2,0"
|
||||
],
|
||||
"exports": [
|
||||
"NvOptimusEnablementCuda",
|
||||
"NVSDK_NGX_D3D11_CreateFeature",
|
||||
@@ -953,6 +1147,7 @@
|
||||
"NVSDK_NGX_GetSnippetVersion",
|
||||
"NVSDK_NGX_PopulateParameters",
|
||||
"NVSDK_NGX_SetInfoCallback",
|
||||
"NVSDK_NGX_SetOverrideStatusCallback",
|
||||
"NVSDK_NGX_SetTelemetryEvaluateCallback",
|
||||
"NVSDK_NGX_VULKAN_CreateFeature",
|
||||
"NVSDK_NGX_VULKAN_CreateFeature1",
|
||||
@@ -965,20 +1160,27 @@
|
||||
"NVSDK_NGX_VULKAN_Shutdown",
|
||||
"NVSDK_NGX_VULKAN_Shutdown1"
|
||||
],
|
||||
"copiesFound": 6
|
||||
"copiesFound": 5
|
||||
},
|
||||
"sl.deepdvc.dll": {
|
||||
"exportCount": 2,
|
||||
"version": "2,7,30,0",
|
||||
"versions": [
|
||||
"2,7,30,0",
|
||||
"2,7,3,0",
|
||||
"2,8,0,0",
|
||||
"2,10,3,0"
|
||||
],
|
||||
"exports": [
|
||||
"DllMain",
|
||||
"slGetPluginFunction"
|
||||
],
|
||||
"copiesFound": 6
|
||||
"copiesFound": 5
|
||||
},
|
||||
"ffx_fsr2_api_dx12_x64.dll": {
|
||||
"exportCount": 8,
|
||||
"version": null,
|
||||
"versions": [],
|
||||
"exports": [
|
||||
"ffxAssertReport",
|
||||
"ffxAssertSetPrintingCallback",
|
||||
@@ -994,6 +1196,7 @@
|
||||
"ffx_fsr2_api_vk_x64.dll": {
|
||||
"exportCount": 11,
|
||||
"version": null,
|
||||
"versions": [],
|
||||
"exports": [
|
||||
"ffxAssertReport",
|
||||
"ffxAssertSetPrintingCallback",
|
||||
@@ -1012,6 +1215,7 @@
|
||||
"ffx_fsr2_api_x64.dll": {
|
||||
"exportCount": 11,
|
||||
"version": null,
|
||||
"versions": [],
|
||||
"exports": [
|
||||
"ffxAssertReport",
|
||||
"ffxAssertSetPrintingCallback",
|
||||
@@ -1027,39 +1231,13 @@
|
||||
],
|
||||
"copiesFound": 1
|
||||
},
|
||||
"amd_fidelityfx_vk.dll": {
|
||||
"exportCount": 5,
|
||||
"version": "1.0.1.42386",
|
||||
"exports": [
|
||||
"ffxConfigure",
|
||||
"ffxCreateContext",
|
||||
"ffxDestroyContext",
|
||||
"ffxDispatch",
|
||||
"ffxQuery"
|
||||
],
|
||||
"copiesFound": 1
|
||||
},
|
||||
"sl.directsr.dll": {
|
||||
"exportCount": 2,
|
||||
"version": "2,11,1,0",
|
||||
"exports": [
|
||||
"DllMain",
|
||||
"slGetPluginFunction"
|
||||
],
|
||||
"copiesFound": 1
|
||||
},
|
||||
"sl.nvperf.dll": {
|
||||
"exportCount": 2,
|
||||
"version": "2,11,1,0",
|
||||
"exports": [
|
||||
"DllMain",
|
||||
"slGetPluginFunction"
|
||||
],
|
||||
"copiesFound": 1
|
||||
},
|
||||
"_nvngx.dll": {
|
||||
"exportCount": 75,
|
||||
"version": "32.0.16.1088",
|
||||
"version": "32.0.16.1664",
|
||||
"versions": [
|
||||
"32.0.16.1664",
|
||||
"32.0.16.1656"
|
||||
],
|
||||
"exports": [
|
||||
"NVSDK_NGX_CUDA_AllocateParameters",
|
||||
"NVSDK_NGX_CUDA_CreateFeature",
|
||||
@@ -1137,11 +1315,14 @@
|
||||
"NVSDK_NGX_VULKAN_Shutdown",
|
||||
"NVSDK_NGX_VULKAN_Shutdown1"
|
||||
],
|
||||
"copiesFound": 1
|
||||
"copiesFound": 2
|
||||
},
|
||||
"nvngx.dll": {
|
||||
"exportCount": 59,
|
||||
"version": "30.0.14.9516",
|
||||
"versions": [
|
||||
"30.0.14.9516"
|
||||
],
|
||||
"exports": [
|
||||
"NVSDK_NGX_CUDA_AllocateParameters",
|
||||
"NVSDK_NGX_CUDA_CreateFeature",
|
||||
@@ -1203,7 +1384,7 @@
|
||||
"NVSDK_NGX_VULKAN_Shutdown",
|
||||
"NVSDK_NGX_VULKAN_Shutdown1"
|
||||
],
|
||||
"copiesFound": 1
|
||||
"copiesFound": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,7 @@ Telemetry is layered so no proprietary vendor licence is ever required (`docs/18
|
||||
| **DXGI + Windows performance counters (PDH)** | Vendor-neutral baseline: utilisation, VRAM, adapter identity | Windows OS APIs | n/a |
|
||||
| **NVIDIA Streamline headers** (`sl.h`, its eight-file include closure, and `sl_dlss.h`) | Declarations only — `sl::Feature`, the `kFeature*` ids and `PFun_slEvaluateFeature` — so the Overlay's upscaler hook has the vendor's own signature instead of a hand-written guess. **Types and `decltype` only: never linked**, or `sl.interposer.dll` would become a load-time dependency and the Overlay would fail to load in every game that ships no Streamline | **MIT** — <https://github.com/NVIDIA-RTX/Streamline>, `main`, 2026-08-09 | **Vendored 2026-08-09** at `src/native/third_party/streamline/`: `license.txt` and ten headers. **`sl_nvperf.h` is excluded** — the same `license.txt` carries a second, proprietary "NSight Perf SDK License, Version 2023.3" block naming `sl_nvperf.h` and `sl_nvperf.dll`. **All of `external/` is excluded** — upstream's `external/ngx-sdk/` is the RTX SDKs Licence. `license-check.ps1` asserts both exclusions and the grant text |
|
||||
| **AMD FidelityFX SDK headers** (`ffx_api.h`, `ffx_api_types.h`, `ffx_upscale.h`, `ffx_framegeneration.h`, `ffx_framegeneration_api_types.h`) | Declarations only — `ffxApiHeader::type`, the `FFX_API_*_DESC_TYPE_*` values, `ffxDispatchDescUpscale::renderSize`, the frame-generation `Prepare` descriptors' `frameID` and `PfnFfxDispatch` — so the Overlay's AMD hook decodes the dispatch descriptor by the vendor's own layout instead of a guess. **Types only: never linked**, and the Overlay defines none of the names the header declares `dllexport` (`hookinventory-check` Pass C reads its export table) | **MIT, by exception** — <https://github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK> tag `v2.3.0` (`60f4ea81`, 2026-06-24). Upstream's `docs/license.md` is a binary-only default licence followed by an MIT exception list; on 2026-09-04 that list named all 845 files in the tree, these five among them, and each header carries the grant in its own banner | **Vendored 2026-09-04** at `src/native/third_party/fidelityfx/`: `license.md` verbatim (exception list included) and five headers in upstream's `Kits/FidelityFX/…` layout. **No `signedbin/`, no `.lib`, no source, no `dx12/` backend headers** (no consumer yet). `license-check.ps1` §2d asserts every vendored path is on the exception list and every header carries the grant |
|
||||
| **AMD FidelityFX SDK 3.0 host headers** (`ffx_fsr3.h` and its nine-file include closure: `ffx_interface.h`, `ffx_fsr3upscaler.h`, `ffx_frameinterpolation.h`, `ffx_opticalflow.h`, `ffx_assert.h`, `ffx_types.h`, `ffx_error.h`, `ffx_util.h`, `gpu/fsr3upscaler/ffx_fsr3upscaler_resources.h`) | Declarations only — `FfxFsr3DispatchUpscaleDescription::renderSize` and the type of `ffxFsr3ContextDispatchUpscale` — so the Overlay's hook on the FSR 3.0 **host** DLL (`ffx_fsr3_x64.dll`, Cyberpunk 2077's copy, which upscales through named exports rather than the ffx-api facade) reads the render extent by the vendor's own layout. **Types and `decltype` only: never linked**, and the Overlay defines none of the names the header declares `dllexport` (`hookinventory-check` Pass C reads its export table; the `ffx_fsr3_x64.dll` fixture in `tools/vendor-stubs` is that parser's second positive control) | **MIT** — <https://github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK> tag `fsr3-v3.0.4` (`55ff22bb`). The root `LICENSE.txt` at that tag is the MIT grant verbatim and every header carries it inline — a different licence *shape* from the `v2.3.0` row above, which is why it is a separate directory and `license-check.ps1` §2e rather than §2d. The tag is the one whose declarations match the module the title ships (twelve `ffxFsr3*` exports); `v1.1.4`, which the docs first named, declares three more and appends fields to the dispatch descriptor | **Vendored 2026-09-05** at `src/native/third_party/fidelityfx-fsr3/`: `LICENSE.txt` verbatim and ten headers in upstream's `sdk/include/FidelityFX/…` layout, each blob sha checked against the upstream tree. **No backends, no `.cpp`, no shaders, no samples.** `license-check.ps1` §2e asserts the root grant and every header's banner, file by file. Same MIT text as the row above, so `legal/licenses/fidelityfx-MIT.txt` is the notice for both |
|
||||
| NVIDIA **NGX** / **Streamline**, AMD **FidelityFX**, Intel **XeSS** **runtimes** (the DLLs themselves) | Not loaded, not linked, not redistributed. We observe the calls a *game* makes to the copies it ships (`docs/17_HOOK_ENGINE.md`). Unchanged by the row above, which vendors **headers** and no runtime | — | **No vendor upscaler code is distributed by FrameLedger** |
|
||||
|
||||
### GPL-3.0 compatibility
|
||||
@@ -98,5 +99,6 @@ All product names, logos, and brands are property of their respective owners and
|
||||
- [ ] MPL-2.0 source-availability note points to upstream LibreHardwareMonitor repository
|
||||
- [x] LHM checked for MPL-2.0 Exhibit B on any depended-upon file — clear as of 0.9.6 / commit `3d331e33`, 2026-08-02
|
||||
- [x] **AMD FidelityFX headers are vendored** (2026-09-04) — five headers, MIT **by exception**: `license-check.ps1` §2d asserts each vendored path against the exception list inside the vendored `license.md` and each header's own banner, file by file. No binary, no source
|
||||
- [x] **AMD FidelityFX SDK 3.0 host headers are vendored** (2026-09-05) — ten headers at tag `fsr3-v3.0.4`, MIT at the root **and** inline: `license-check.ps1` §2e asserts the root grant and every header's banner, file by file, in a directory of its own because the licence shape differs from the row above. No binary, no source, no shaders
|
||||
- [x] **NVAPI is vendored** (2026-08-05) and all nine headers carry their `SPDX-License-Identifier: MIT` blocks unmodified — asserted file by file, not sampled. `license-check.ps1` enforces that this line and the table agree with the filesystem, **in both directions**: vendoring the material while the table still said "Not yet" failed the build, which is how this row came to be flipped
|
||||
- [ ] No Intel IGCL or AMD ADLX material anywhere in the tree (CI grep, see `docs/13_CI_CD.md`)
|
||||
@@ -1,5 +1,6 @@
|
||||
using FrameLedger.Application.AntiCheat;
|
||||
using FrameLedger.Application.Consent;
|
||||
using FrameLedger.CaptureHost.Consume;
|
||||
using FrameLedger.Domain.AntiCheat;
|
||||
using FrameLedger.Domain.Consent;
|
||||
using FrameLedger.Infrastructure.Ipc;
|
||||
@@ -28,7 +29,9 @@ internal sealed class CaptureLoop(
|
||||
ITargetResolver resolver,
|
||||
Func<int, ITargetLiveness?> liveness,
|
||||
Func<int, (ICaptureSink? Sink, ShmAttachRefusal Refusal)> attach,
|
||||
CaptureOptions options)
|
||||
CaptureOptions options,
|
||||
Func<int, RuntimeModuleSet>? modules = null,
|
||||
Func<int, NgxDriverState>? ngx = null)
|
||||
{
|
||||
/// <summary>Start one session, or say why not.</summary>
|
||||
/// <remarks>
|
||||
@@ -158,11 +161,15 @@ internal sealed class CaptureLoop(
|
||||
var records = new List<FlFrameRecord>();
|
||||
var gaps = new List<ulong>();
|
||||
var focus = new FocusTally();
|
||||
SessionEndReason end = await SuperviseAsync(pid, alive, sink, supervisor, records, gaps, focus, ct)
|
||||
var loaded = new ModuleTally(modules, ngx);
|
||||
SessionEndReason end = await SuperviseAsync(pid, alive, sink, supervisor, records, gaps, focus, loaded, ct)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
return new CaptureResult
|
||||
{
|
||||
RuntimeModules = loaded.Set,
|
||||
NgxDriver = loaded.Ngx,
|
||||
TouchQpc = loaded.TouchQpc,
|
||||
Reason = end,
|
||||
Verdict = verdict,
|
||||
AttachRefusal = ShmAttachRefusal.Ok,
|
||||
@@ -213,12 +220,11 @@ internal sealed class CaptureLoop(
|
||||
/// </remarks>
|
||||
private async Task<SessionEndReason> SuperviseAsync(int pid, ITargetLiveness alive, ICaptureSink sink,
|
||||
GuardSupervisor supervisor, List<FlFrameRecord> records, IList<ulong> gaps, FocusTally focus,
|
||||
CancellationToken ct)
|
||||
ModuleTally loaded, CancellationToken ct)
|
||||
{
|
||||
var buffer = new FlFrameRecord[512];
|
||||
|
||||
bool mayContinue = await supervisor.ScanOnceAsync(pid, ct).ConfigureAwait(false);
|
||||
sink.PublishGuardResult(supervisor.CompletedEvaluations, supervisor.UnhookRequested);
|
||||
bool mayContinue = await ScanAsync(pid, sink, supervisor, loaded, ct).ConfigureAwait(false);
|
||||
|
||||
DateTimeOffset nextScan = DateTimeOffset.UtcNow + options.ScanInterval;
|
||||
DateTimeOffset attachSettledAt = DateTimeOffset.UtcNow + options.AttachBudget;
|
||||
@@ -250,7 +256,7 @@ internal sealed class CaptureLoop(
|
||||
{
|
||||
try
|
||||
{
|
||||
mayContinue = await supervisor.ScanOnceAsync(pid, ct).ConfigureAwait(false);
|
||||
mayContinue = await ScanAsync(pid, sink, supervisor, loaded, ct).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex) when (ex is not OperationCanceledException)
|
||||
{
|
||||
@@ -258,13 +264,16 @@ internal sealed class CaptureLoop(
|
||||
break;
|
||||
}
|
||||
|
||||
sink.PublishGuardResult(supervisor.CompletedEvaluations, supervisor.UnhookRequested);
|
||||
nextScan = DateTimeOffset.UtcNow + options.ScanInterval;
|
||||
}
|
||||
|
||||
await Task.Delay(options.DrainInterval, ct).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
// ONE LAST SNAPSHOT before the last drain, so a module that loaded after the final scan is
|
||||
// still named; on TargetExited it reads nothing, which the tally counts rather than hides.
|
||||
loaded.Take(pid);
|
||||
|
||||
// ONE LAST DRAIN ON EVERY PATH, including the faulted one — that is the whole point of catching
|
||||
// the mid-loop throw rather than letting it leave the method. Then let go promptly: holding the
|
||||
// section keeps the named object alive, and a recycled pid's Overlay would hit
|
||||
@@ -273,6 +282,57 @@ internal sealed class CaptureLoop(
|
||||
return Conclude(end, faulted, mayContinue);
|
||||
}
|
||||
|
||||
/// <summary>One guard scan: evaluate, publish the supervisor's own count, then snapshot the modules.</summary>
|
||||
/// <remarks>
|
||||
/// <b>The module snapshot rides beside the guard scan, never on its own cadence.</b> The scan is
|
||||
/// the moment this host already enumerates the target's modules, and a vendor runtime that loads
|
||||
/// late (a title enabling frame generation from its menu) is caught by the next scan the way the
|
||||
/// Overlay's watchdog catches it on the next tick. The scan's exception propagates: the caller
|
||||
/// decides whether a throw ends the session or only the supervision.
|
||||
/// </remarks>
|
||||
private static async Task<bool> ScanAsync(int pid, ICaptureSink sink, GuardSupervisor supervisor,
|
||||
ModuleTally loaded, CancellationToken ct)
|
||||
{
|
||||
bool mayContinue = await supervisor.ScanOnceAsync(pid, ct).ConfigureAwait(false);
|
||||
sink.PublishGuardResult(supervisor.CompletedEvaluations, supervisor.UnhookRequested);
|
||||
loaded.Take(pid);
|
||||
return mayContinue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Accumulates module snapshots and the driver's NGX word; a loop built without a source takes none.
|
||||
/// The NGX probe rides on the same touch as the snapshot: out of process, and the moment a title that
|
||||
/// enabled DLSS from its menu is caught by the next scan, exactly as a late-loading module is.
|
||||
/// </summary>
|
||||
private sealed class ModuleTally(Func<int, RuntimeModuleSet>? source, Func<int, NgxDriverState>? ngxSource)
|
||||
{
|
||||
public RuntimeModuleSet Set { get; private set; } = RuntimeModuleSet.Empty;
|
||||
|
||||
public NgxDriverState Ngx { get; private set; } = NgxDriverState.NotRun;
|
||||
|
||||
/// <summary>
|
||||
/// When this host touched the target — a guard scan just completed, and the module snapshot
|
||||
/// is about to run — as QPC ticks (<see cref="System.Diagnostics.Stopwatch.GetTimestamp"/> is
|
||||
/// QueryPerformanceCounter on Windows, the clock the records carry). Recorded whether or not a
|
||||
/// snapshot source exists, because it is the stall diagnostic's alibi, not the snapshot's.
|
||||
/// </summary>
|
||||
public List<long> TouchQpc { get; } = [];
|
||||
|
||||
public void Take(int pid)
|
||||
{
|
||||
TouchQpc.Add(System.Diagnostics.Stopwatch.GetTimestamp());
|
||||
if (source is not null)
|
||||
{
|
||||
Set = Set.Merge(source(pid));
|
||||
}
|
||||
|
||||
if (ngxSource is not null)
|
||||
{
|
||||
Ngx = Ngx.Merge(ngxSource(pid));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Turns the loop's exit condition into the reason a caller sees.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using FrameLedger.CaptureHost.Consume;
|
||||
using FrameLedger.Domain.AntiCheat;
|
||||
using FrameLedger.Shared;
|
||||
|
||||
@@ -44,4 +45,24 @@ internal sealed record CaptureResult
|
||||
/// configured for ×2.
|
||||
/// </remarks>
|
||||
public long ForegroundTicks { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The census-named modules the target had loaded, with their file versions, merged over every
|
||||
/// snapshot the loop took beside a guard scan. <see cref="RuntimeModuleSet.Empty"/> when the loop
|
||||
/// had no snapshot source.
|
||||
/// </summary>
|
||||
public RuntimeModuleSet RuntimeModules { get; init; } = RuntimeModuleSet.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The NVIDIA driver's per-process NGX word, probed out of process beside each module snapshot and merged.
|
||||
/// <see cref="NgxDriverState.NotRun"/> when the loop had no probe.
|
||||
/// </summary>
|
||||
public NgxDriverState NgxDriver { get; init; } = NgxDriverState.NotRun;
|
||||
|
||||
/// <summary>
|
||||
/// QPC timestamps of every moment this host touched the target's process — a guard scan
|
||||
/// completing, followed by the module snapshot — in the records' own clock, so a stall in the
|
||||
/// frame stream can be checked against what FrameLedger itself was doing at that moment.
|
||||
/// </summary>
|
||||
public IReadOnlyList<long> TouchQpc { get; init; } = [];
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using FrameLedger.CaptureHost.Consume;
|
||||
|
||||
namespace FrameLedger.CaptureHost.Capture;
|
||||
|
||||
/// <summary>
|
||||
/// Runs <c>fl-probe-nvapi --ngx-state <pid></c> beside this host and parses its machine line.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>Out of process, on purpose.</b> The probe links <c>nvapi64.lib</c> (MIT, vendored) and asks the driver about
|
||||
/// a pid; nothing is injected, nothing in the target is touched, no consent is involved. Spawning the tool this
|
||||
/// repo already builds keeps the native layer reachable only through what is already there (CLAUDE.md: no
|
||||
/// P/Invoke outside <c>Infrastructure</c>) — the day the shipped Agent wants this fact, it goes through
|
||||
/// <c>Infrastructure</c> as a native call, not through a child process.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The probe is staged beside the host by the project file the way the Overlay payload is; a missing binary is
|
||||
/// an outcome the report prints, never an exception the loop sees.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
internal static class NgxDriverProbe
|
||||
{
|
||||
private const string _probeFileName = "fl-probe-nvapi.exe";
|
||||
|
||||
private static readonly TimeSpan _budget = TimeSpan.FromSeconds(5);
|
||||
|
||||
public static string ProbePath => Path.Combine(AppContext.BaseDirectory, _probeFileName);
|
||||
|
||||
public static NgxDriverState Run(int pid) => Run(pid, ProbePath);
|
||||
|
||||
public static NgxDriverState Run(int pid, string probePath)
|
||||
{
|
||||
if (!File.Exists(probePath))
|
||||
{
|
||||
return NgxDriverState.Of(NgxProbeOutcome.ProbeMissing, probePath);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using var probe = new Process();
|
||||
probe.StartInfo = new ProcessStartInfo(probePath)
|
||||
{
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = true,
|
||||
CreateNoWindow = true,
|
||||
};
|
||||
probe.StartInfo.ArgumentList.Add("--ngx-state");
|
||||
probe.StartInfo.ArgumentList.Add(pid.ToString(System.Globalization.CultureInfo.InvariantCulture));
|
||||
probe.Start();
|
||||
string output = probe.StandardOutput.ReadToEnd();
|
||||
if (!probe.WaitForExit((int)_budget.TotalMilliseconds))
|
||||
{
|
||||
probe.Kill();
|
||||
return NgxDriverState.Of(NgxProbeOutcome.ProbeFailed, "the probe did not exit within " + _budget.TotalSeconds + " s");
|
||||
}
|
||||
|
||||
return NgxDriverState.Parse(output);
|
||||
}
|
||||
catch (Exception e) when (e is Win32Exception or InvalidOperationException or IOException)
|
||||
{
|
||||
return NgxDriverState.Of(NgxProbeOutcome.ProbeFailed, e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using FrameLedger.CaptureHost.Consume;
|
||||
|
||||
namespace FrameLedger.CaptureHost.Capture;
|
||||
|
||||
/// <summary>
|
||||
/// One out-of-process look at which census-named modules the target has loaded, and what
|
||||
/// version each file on disk carries.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>Consumer-side, deliberately.</b> The writer could read the same thing on its watchdog, but
|
||||
/// that costs <c>version.dll</c> as an import of the injected DLL, an allocation per module, and
|
||||
/// a packed word per module in <c>FlWriterState.reserved[]</c> — twenty bytes for up to twenty
|
||||
/// names does not fit. Out here it is <see cref="Process.Modules"/>, which is the loader's
|
||||
/// list through documented PSAPI, plus <see cref="FileVersionInfo"/> on the path it names.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>Never throws.</b> A target that is protected, elevated, or already gone yields an
|
||||
/// unreadable snapshot with whatever was collected before the failure; the loop records that
|
||||
/// rather than ending the session over a diagnostic.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
internal static class RuntimeModuleSnapshot
|
||||
{
|
||||
public static RuntimeModuleSet Take(int pid, IReadOnlyCollection<string> fileNames)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(fileNames);
|
||||
var found = new List<RuntimeModuleInfo>();
|
||||
try
|
||||
{
|
||||
using Process target = Process.GetProcessById(pid);
|
||||
foreach (ProcessModule module in target.Modules)
|
||||
{
|
||||
using (module)
|
||||
{
|
||||
if (module.ModuleName is not { } name || module.FileName is not { } path)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!fileNames.Contains(name, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
found.Add(Describe(name, path));
|
||||
}
|
||||
}
|
||||
|
||||
return new RuntimeModuleSet(found, Snapshots: 1, Unreadable: 0);
|
||||
}
|
||||
catch (Exception ex) when (ex is Win32Exception or InvalidOperationException or ArgumentException
|
||||
or NotSupportedException)
|
||||
{
|
||||
return new RuntimeModuleSet(found, Snapshots: 1, Unreadable: 1);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The fixed-part version numbers, not the string: Streamline stamps its string as
|
||||
/// <c>2,8,0,0</c>, and a module with no version resource at all — Cyberpunk's
|
||||
/// <c>ffx_fsr3_x64.dll</c> — has neither, which is reported as null rather than as 0.0.0.0.
|
||||
/// </summary>
|
||||
private static RuntimeModuleInfo Describe(string name, string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
FileVersionInfo info = FileVersionInfo.GetVersionInfo(path);
|
||||
Version? parsed = info.FileVersion is null
|
||||
? null
|
||||
: new Version(info.FileMajorPart, info.FileMinorPart, info.FileBuildPart, info.FilePrivatePart);
|
||||
return new RuntimeModuleInfo(name, path, info.FileVersion, parsed);
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||
{
|
||||
return new RuntimeModuleInfo(name, path, null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -94,8 +94,19 @@ internal sealed class TargetResolver : ITargetResolver
|
||||
// A process we cannot read is NOT a match — "could not look" must not widen the set —
|
||||
// but it is counted below so it cannot narrow one either.
|
||||
string? image = p.MainModule?.FileName;
|
||||
if (image is not null
|
||||
&& string.Equals(ExecutableIdentity.Normalise(image), normalisedExePath,
|
||||
if (image is null)
|
||||
{
|
||||
// A process that is in the snapshot with NO main module yet -- it exists and has
|
||||
// not finished mapping its image. Measured on the hosted runner 2026-09-04, twice
|
||||
// in one hour, on a single freshly started instance: the resolver skipped it here
|
||||
// without counting it and answered TargetNotRunning about a process it had just
|
||||
// enumerated. "Could not look" must not narrow the set, and that includes this
|
||||
// shape; it is counted like a process we lack the rights to read.
|
||||
unreadable++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (string.Equals(ExecutableIdentity.Normalise(image), normalisedExePath,
|
||||
StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
matches.Add(p.Id);
|
||||
|
||||
@@ -36,6 +36,13 @@ internal static class CensusNames
|
||||
(FlRuntimeCensus.AmdFfxDx12, "amd_fidelityfx_dx12.dll"),
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Every module FILE name the census can answer for — the <c>a / b</c> pairs above split into
|
||||
/// their members — so a module snapshot asks about exactly the set the census names.
|
||||
/// </summary>
|
||||
public static IReadOnlyList<string> ModuleFileNames { get; } =
|
||||
_names.SelectMany(n => n.Name.Split(" / ", StringSplitOptions.RemoveEmptyEntries)).ToArray();
|
||||
|
||||
/// <summary>Comma-separated module names for the set family bits; <c>-</c> when none.</summary>
|
||||
public static string Describe(FlRuntimeCensus bits)
|
||||
{
|
||||
|
||||
@@ -110,7 +110,7 @@ internal sealed record FfxCensus
|
||||
if (!SawAnything)
|
||||
{
|
||||
return " ffx dispatch census over " + N(Records) + " record(s): no UPSCALE or FRAMEGENERATION dispatch "
|
||||
+ "reached an ffx-api leaf (no FSR identity, no FSR_FG mode)";
|
||||
+ "reached an ffx-api leaf or the FSR 3.0 host facade (no FSR identity, no FSR_FG mode)";
|
||||
}
|
||||
|
||||
var sb = new StringBuilder();
|
||||
|
||||
@@ -61,6 +61,30 @@ internal sealed record FgWindow
|
||||
/// <summary>Records whose count hit the byte's ceiling.</summary>
|
||||
public required int Saturated { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Σ <c>dxgiUnseen</c> over the records that claim <see cref="FlMeasured.DxgiPresents"/>: presents DXGI
|
||||
/// counted on the hooked chain that this hook never saw. 0 on every title measured except Dying Light:
|
||||
/// The Beast on Streamline 2.8.0, where it is ≈ 3 × <see cref="Presents"/> at DLSS FG ×4 (§H5 row P1-DXGI).
|
||||
/// </summary>
|
||||
public required long DxgiUnseen { get; init; }
|
||||
|
||||
/// <summary>Records claiming <see cref="FlMeasured.DxgiPresents"/> — the byte's own denominator.</summary>
|
||||
public required int DxgiClaiming { get; init; }
|
||||
|
||||
/// <summary>Records whose <c>dxgiUnseen</c> hit 255, the saturation sentinel; any means a refusal.</summary>
|
||||
public required int DxgiSaturated { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The presents the window counts as DISPLAYED: the ones this hook timed plus the ones DXGI counted on the
|
||||
/// same chain and this hook never saw. Equal to <see cref="Presents"/> on every title where DXGI and the hook
|
||||
/// agree, and the numerator of <see cref="Factor"/>, <see cref="DisplayedFps"/> and
|
||||
/// <see cref="PresentsPerBatch"/> — never of a frame-time distribution, which has no timestamps for them.
|
||||
/// </summary>
|
||||
public long DisplayedPresents => Presents + DxgiUnseen;
|
||||
|
||||
/// <summary>True when Displayed is a count DXGI made rather than this hook — the report must say so.</summary>
|
||||
public bool DxgiCounted => DxgiUnseen > 0;
|
||||
|
||||
/// <summary>How many records carried 0, 1, 2 … evaluations. Index is the value.</summary>
|
||||
public required IReadOnlyList<int> Histogram { get; init; }
|
||||
|
||||
@@ -86,11 +110,11 @@ internal sealed record FgWindow
|
||||
|
||||
/// <summary><c>presents / Σ evaluations</c>, or null.</summary>
|
||||
public double? Factor =>
|
||||
Refusal is null && Evaluations > 0 ? Presents / (double)Evaluations : null;
|
||||
Refusal is null && Evaluations > 0 ? DisplayedPresents / (double)Evaluations : null;
|
||||
|
||||
/// <summary><c>F_disp</c> over this window's own intervals.</summary>
|
||||
public double? DisplayedFps =>
|
||||
Refusal is null && Seconds > 0 && Presents > 1 ? (Presents - 1) / Seconds : null;
|
||||
Refusal is null && Seconds > 0 && DisplayedPresents > 1 ? (DisplayedPresents - 1) / Seconds : null;
|
||||
|
||||
/// <summary><c>F_app</c>, counted rather than derived.</summary>
|
||||
public double? NativeFps => Refusal is null && Seconds > 0 ? Evaluations / Seconds : null;
|
||||
@@ -129,7 +153,7 @@ internal sealed record FgWindow
|
||||
/// <see cref="BatchRefusal"/>; it is never published as <c>fg_factor</c>, and
|
||||
/// <see cref="Factor"/> stays keyed on counted evaluations.
|
||||
/// </remarks>
|
||||
public double? PresentsPerBatch => Batches > 0 ? Presents / (double)Batches : null;
|
||||
public double? PresentsPerBatch => Batches > 0 ? DisplayedPresents / (double)Batches : null;
|
||||
|
||||
/// <summary>
|
||||
/// Why <see cref="PresentsPerBatch"/> may not be read as one configuration's number, or
|
||||
@@ -178,6 +202,9 @@ internal sealed record FgWindow
|
||||
Unidentified = 0,
|
||||
Streams = 0,
|
||||
Saturated = 0,
|
||||
DxgiUnseen = 0,
|
||||
DxgiClaiming = 0,
|
||||
DxgiSaturated = 0,
|
||||
Histogram = [],
|
||||
BucketFactors = [],
|
||||
BatchFactors = [],
|
||||
@@ -205,6 +232,7 @@ internal sealed record FgWindow
|
||||
int batches = 0;
|
||||
int unidentified = 0;
|
||||
int saturated = 0;
|
||||
(long dxgiUnseen, int dxgiClaiming, int dxgiSaturated) = TallyDxgi(all, start);
|
||||
|
||||
for (int i = start; i < all.Count; i++)
|
||||
{
|
||||
@@ -242,6 +270,9 @@ internal sealed record FgWindow
|
||||
Unidentified = unidentified,
|
||||
Streams = streams.Count,
|
||||
Saturated = saturated,
|
||||
DxgiUnseen = dxgiUnseen,
|
||||
DxgiClaiming = dxgiClaiming,
|
||||
DxgiSaturated = dxgiSaturated,
|
||||
Histogram = histogram,
|
||||
BucketFactors = BucketsOf(all, start, EvaluationWeight),
|
||||
BatchFactors = BucketsOf(all, start, BatchWeight),
|
||||
@@ -249,6 +280,34 @@ internal sealed record FgWindow
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Σ <c>dxgiUnseen</c>, the records claiming it, and the ones at the 255 sentinel — the DXGI half of
|
||||
/// the tally, in its own pass because it is its own measurement (<c>fl_shm.h</c> §dxgiUnseen).
|
||||
/// </summary>
|
||||
private static (long Unseen, int Claiming, int Saturated) TallyDxgi(IReadOnlyList<FlFrameRecord> all, int start)
|
||||
{
|
||||
long unseen = 0;
|
||||
int claiming = 0;
|
||||
int saturated = 0;
|
||||
for (int i = start; i < all.Count; i++)
|
||||
{
|
||||
FlFrameRecord r = all[i];
|
||||
if (!((FlMeasured)r.MeasuredMask).HasFlag(FlMeasured.DxgiPresents))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
claiming++;
|
||||
unseen += r.DxgiUnseen;
|
||||
if (r.DxgiUnseen == byte.MaxValue)
|
||||
{
|
||||
saturated++;
|
||||
}
|
||||
}
|
||||
|
||||
return (unseen, claiming, saturated);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Per-bucket <c>presents ÷ weight</c> in time order, or empty when the window is too
|
||||
/// short. One slicing, two weights.
|
||||
@@ -276,23 +335,53 @@ internal sealed record FgWindow
|
||||
int lo = start + (int)((long)n * b / _buckets);
|
||||
int hi = start + (int)((long)n * (b + 1) / _buckets);
|
||||
long sigma = 0;
|
||||
long displayed = 0;
|
||||
for (int i = lo; i < hi; i++)
|
||||
{
|
||||
sigma += weight(all[i]);
|
||||
displayed += 1 + Unseen(all[i]);
|
||||
}
|
||||
|
||||
factors.Add(sigma > 0 ? (hi - lo) / (double)sigma : double.PositiveInfinity);
|
||||
// The SAME numerator the window publishes: a DXGI-counted present belongs to the
|
||||
// bucket of the hooked present that read it, so a session where the 2.8 pacer
|
||||
// stopped mid-way fails uniformity exactly as one where tokens stopped would.
|
||||
factors.Add(sigma > 0 ? displayed / (double)sigma : double.PositiveInfinity);
|
||||
}
|
||||
|
||||
return factors;
|
||||
}
|
||||
|
||||
/// <summary><c>dxgiUnseen</c> where the record claims it, else 0 — an unclaimed byte is nobody's count.</summary>
|
||||
private static long Unseen(FlFrameRecord r) =>
|
||||
((FlMeasured)r.MeasuredMask).HasFlag(FlMeasured.DxgiPresents) ? r.DxgiUnseen : 0L;
|
||||
|
||||
/// <summary>The first reason a factor may not be published, or null.</summary>
|
||||
/// <remarks>
|
||||
/// Ordered so the most specific cause is named. Every one of these is a number this
|
||||
/// consumer would otherwise have printed as a measurement.
|
||||
/// </remarks>
|
||||
private static string? RefusalFor(FgWindow w)
|
||||
{
|
||||
if (RefusalForRecordSet(w) is string aboutTheRecords)
|
||||
{
|
||||
return aboutTheRecords;
|
||||
}
|
||||
|
||||
if (w.Evaluations == 0)
|
||||
{
|
||||
return "no application-frame token was counted in the window (slGetNewFrameToken, or an ffx-api "
|
||||
+ "PREPARE / UPSCALE dispatch) — a data gap, "
|
||||
+ "and treating it as 'no frame generation' is how fg_factor becomes 1.0";
|
||||
}
|
||||
|
||||
return RefusalForRatio(w);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Facts about the record SET that refuse a factor before anything is divided: attribution, and the
|
||||
/// two saturation sentinels.
|
||||
/// </summary>
|
||||
private static string? RefusalForRecordSet(FgWindow w)
|
||||
{
|
||||
// ATTRIBUTION FIRST, AND THE ORDER IS THE FIX. These two are facts about the record
|
||||
// set and hold whether or not anything was counted — but they used to sit BELOW the
|
||||
@@ -319,14 +408,19 @@ internal sealed record FgWindow
|
||||
+ "saturation sentinel rather than a count — dividing by it would report a floor";
|
||||
}
|
||||
|
||||
if (w.Evaluations == 0)
|
||||
if (w.DxgiSaturated > 0)
|
||||
{
|
||||
return "no application-frame token was counted in the window (slGetNewFrameToken, or an ffx-api "
|
||||
+ "PREPARE / UPSCALE dispatch) — a data gap, "
|
||||
+ "and treating it as 'no frame generation' is how fg_factor becomes 1.0";
|
||||
return $"{w.DxgiSaturated} record(s) hit the dxgiUnseen ceiling of 255, which is a saturation "
|
||||
+ "sentinel rather than a count — DXGI counted more presents than the byte can carry";
|
||||
}
|
||||
|
||||
string? nonUniform = NonUniform(w.BucketFactors, w.Presents / (double)w.Evaluations, w.Presents,
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>The refusals that need the ratio itself: uniformity, then the unnameable band.</summary>
|
||||
private static string? RefusalForRatio(FgWindow w)
|
||||
{
|
||||
string? nonUniform = NonUniform(w.BucketFactors, w.DisplayedPresents / (double)w.Evaluations, w.Presents,
|
||||
"the frame-generation state");
|
||||
if (nonUniform is not null)
|
||||
{
|
||||
@@ -346,7 +440,7 @@ internal sealed record FgWindow
|
||||
// What is still refused is the band between: a steady 1.05–1.5 is not a configuration
|
||||
// any vendor ships, and a window that mixed states would usually have failed the
|
||||
// uniformity check above. Naming it would be guessing.
|
||||
double factor = w.Presents / (double)w.Evaluations;
|
||||
double factor = w.DisplayedPresents / (double)w.Evaluations;
|
||||
return factor > NoneCeiling && factor < ActiveThreshold
|
||||
? $"presents/tokens = {factor.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture)} sits "
|
||||
+ $"between the `none` ceiling ({NoneCeiling.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture)}) "
|
||||
@@ -405,7 +499,7 @@ internal sealed record FgWindow
|
||||
+ "so a batch belonging to one stream can be drained by another's present";
|
||||
}
|
||||
|
||||
return NonUniform(w.BatchFactors, w.Presents / (double)w.Batches, w.Presents,
|
||||
return NonUniform(w.BatchFactors, w.DisplayedPresents / (double)w.Batches, w.Presents,
|
||||
"the presents-per-batch ratio");
|
||||
}
|
||||
|
||||
|
||||
@@ -89,6 +89,93 @@ internal sealed record MeasuredFacts
|
||||
/// <summary>The string <see cref="FgMode"/> carries for rung 3: active, vendor not identified.</summary>
|
||||
public const string FgActiveUnidentified = "Active (technology not identified)";
|
||||
|
||||
/// <summary>The prefix <see cref="FgMode"/> carries when a counted 1.0 is NOT allowed to become <c>none</c>.</summary>
|
||||
public const string FgNoneWithheldPrefix = "N/A (`none` withheld — ";
|
||||
|
||||
/// <summary>
|
||||
/// The Streamline interposer version from which a counted 1.0 beside a loaded DLSS-G plugin is
|
||||
/// withheld from <c>none</c>: Dying Light: The Beast ships 2.8.0 and measured that shape five times.
|
||||
/// </summary>
|
||||
public static readonly Version StreamlineNoneWithheldFrom = new(2, 8, 0);
|
||||
|
||||
/// <summary>
|
||||
/// Why a counted <c>none</c> was not published, or null when it was. <c>20_OPEN_QUESTIONS</c> §H5 case 3.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>The shape, measured five times on Dying Light: The Beast (Streamline 2.8.0, 2026-09-04/05):</b>
|
||||
/// DLSS Frame Generation ON in the title's menu, <c>presents = tokens</c> on every capture, and the
|
||||
/// report printed <c>frame generation: none</c>. The owner's reading on 2026-09-05: the title runs at
|
||||
/// DLSS ×4, the Steam overlay shows DLSS, and the frames this hook records are the native ones. So
|
||||
/// on that shape the count is right about the application frames and wrong about the presents —
|
||||
/// the generated ones never reach the <c>Present</c> bodies the Overlay patches — and a <c>none</c>
|
||||
/// computed from it is the affirmative negative CLAUDE.md rule 6 forbids.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>Keyed on <c>sl.dlss_g.dll</c>, the Streamline plugin that would be doing the presenting — NOT on
|
||||
/// <c>nvngx_dlssg.dll</c>.</b> Every validated <c>none</c> on this machine has the plugin bit CLEAR:
|
||||
/// Cyberpunk 2077 off / ×3 / ×4 on Streamline 2.7.1 (census <c>0x5793D</c>, <c>nvngx_dlssg.dll</c>
|
||||
/// loaded, ×3.99 visible to this hook), Expedition 33 and Lies of P with frame generation off
|
||||
/// (<c>0x27945</c>-shaped words). Every Dying Light: The Beast run has it SET (<c>0x25F0F</c> /
|
||||
/// <c>0x25F4F</c>). A key on <c>nvngx_dlssg.dll</c> would have turned three validated results into
|
||||
/// warnings; this key leaves every one of them byte-identical.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>And on the interposer's version, read from the file, ≥ 2.8.0.</b> A 2.7 title that loads the
|
||||
/// plugin keeps <c>none</c> — it is what Cyberpunk would be if it loaded it. A plugin loaded beside
|
||||
/// an interposer whose version could not be read is withheld with its own reason: an N/A over a
|
||||
/// <c>none</c> this consumer cannot discriminate.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>Narrowed 2026-09-06, on Leg 0.</b> The plugin IS a startup-time load on Dying Light: The Beast
|
||||
/// (frame generation off, census unchanged, twice), so the cost paragraph's fear was measured true —
|
||||
/// and the same morning's ×4 capture measured the discriminator the gate lacked: the 2.8.0 pacer's
|
||||
/// generated presents are DXGI presents on the hooked chain (§H5 row P1-DXGI, 2.90–2.97 per hooked
|
||||
/// present, <c>70.52 → 282.08 (×4)</c> counted through <c>dxgiUnseen</c>). So a counted 1.0 beside a
|
||||
/// READ counter is what it says: DXGI itself counted no present this hook did not. <c>none</c> is
|
||||
/// withheld on this shape only when the counter was not read at all.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public string? NoneWithheld { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// What DXGI's own present counter said beside a counted <c>none</c>, or null when it was not read. On the
|
||||
/// Streamline 2.8.0 shape this is the discriminator the gate lacked (Leg 0, 2026-09-06); on every other
|
||||
/// title it is a second witness printed beside the count.
|
||||
/// </summary>
|
||||
public string? NoneBesideDxgi { get; init; }
|
||||
|
||||
/// <summary>The Streamline interposer's file version, when a module snapshot saw it.</summary>
|
||||
public Version? InterposerVersion { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="FlWriterState.SlTagCensus"/>: which Streamline buffer types the title tagged, on which route.
|
||||
/// </summary>
|
||||
public uint SlTagCensus { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="FlWriterState.DxgiPresentsUnseen"/>: presents DXGI's own counter recorded on the hooked chain(s)
|
||||
/// between two consecutive hooked presents, beyond the one the hook saw.
|
||||
/// </summary>
|
||||
public uint DxgiPresentsUnseen { get; init; }
|
||||
|
||||
/// <summary><see cref="FlWriterState.DxgiPresentSamples"/>: hooked presents on which DXGI's counter was read.</summary>
|
||||
public uint DxgiPresentSamples { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Unseen presents per hooked present, or null before the counter was read. <c>0</c> means DXGI counted nothing this
|
||||
/// hook did not; <c>≈ N−1</c> beside a withheld count is a frame-generation pacer presenting on the hooked chain
|
||||
/// through a body the inline patches do not cover — i.e. the generated presents ARE DXGI presents.
|
||||
/// </summary>
|
||||
public double? DxgiUnseenPerHookedPresent => DxgiPresentSamples > 0 ? DxgiPresentsUnseen / (double)DxgiPresentSamples : null;
|
||||
|
||||
/// <summary>
|
||||
/// The title tagged a HUD-less or UI buffer through Streamline on some route — the inputs only DLSS Frame
|
||||
/// Generation consumes (DLSS-G programming guide §5.0). Identity, never a count: the title is FEEDING frame
|
||||
/// generation, and whether frames were generated is still the count's verdict.
|
||||
/// </summary>
|
||||
public bool DlssgInputsTagged => (FlSlTagRoute.Any(SlTagCensus) & FlSlTagType.DlssgInputs) != FlSlTagType.None;
|
||||
|
||||
/// <summary>Null when <see cref="FlMeasured.Upscaler"/> is clear or the value is UNKNOWN.</summary>
|
||||
public string? Upscaler { get; init; }
|
||||
|
||||
@@ -103,6 +190,115 @@ internal sealed record MeasuredFacts
|
||||
/// </remarks>
|
||||
public bool UpscalerHookRan { get; init; }
|
||||
|
||||
/// <summary>The driver's per-process NGX word, merged over the session; <see cref="NgxDriverState.NotRun"/> without a probe.</summary>
|
||||
public NgxDriverState NgxDriver { get; init; } = NgxDriverState.NotRun;
|
||||
|
||||
/// <summary>The string the <c>upscaler:</c> line carries when the identity is the driver's word and not a hook's.</summary>
|
||||
public const string UpscalerDlssDriverReported =
|
||||
"Dlss (driver-reported: the NVIDIA driver reports an NGX super-resolution feature created and evaluated in "
|
||||
+ "this process - not counted by this hook; 03_METRICS §Upscaling, the driver-reported rung)";
|
||||
|
||||
/// <summary>
|
||||
/// <c>03_METRICS</c> §Upscaling, the driver-reported rung (owner decision 2026-09-06): when NO hook named an
|
||||
/// upscaler and the driver says an NGX super-resolution feature was created and evaluated in this process,
|
||||
/// the identity is DLSS, attributed to the driver. Null whenever a hook answered, or the driver did not.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Identity and nothing else. Measured 2026-09-06 on Hell Is Us, Expedition 33 and Lies of P: the bits are
|
||||
/// set without an NVIDIA-app override; <c>scalingRatio</c> is 0 even with one; <c>performanceMode</c> and
|
||||
/// <c>renderPreset</c> are the override's values; the FG word is blind to Streamline DLSS-G. So this may name
|
||||
/// the vendor and the feature and may not state a quality, a ratio, a render size or a frame-generation mode.
|
||||
/// The negative is owed: a title with DLSS switched off should read the bit clear, and until it is measured
|
||||
/// this rung has only ever seen the positive — §H5 pre-commits its withdrawal if the bit stays set.
|
||||
/// </remarks>
|
||||
public string? UpscalerDriverReported => Upscaler is null && NgxDriver.SrCreatedAndEvaluated ? UpscalerDlssDriverReported : null;
|
||||
|
||||
/// <summary>The string <see cref="FgMode"/> carries when the count is active, no tag named the technology, and the driver did.</summary>
|
||||
public const string FgDlssGDriverReported =
|
||||
"DlssG (driver-reported: the NVIDIA driver reports an NGX frame-generation feature created and evaluated in this "
|
||||
+ "process - the identity only; the count above is the record)";
|
||||
|
||||
/// <summary>
|
||||
/// The FG line as printed: the resolved mode, promoted to <see cref="FgDlssGDriverReported"/> only on the one shape
|
||||
/// where the count is active and no tag named the technology (<c>03_METRICS</c>: identity decides the name, the
|
||||
/// count decides <c>none</c> — the driver's word is a second identity source, never a count).
|
||||
/// </summary>
|
||||
public string? FgModePrinted =>
|
||||
string.Equals(FgMode, FgActiveUnidentified, StringComparison.Ordinal) && NgxDriver.FgCreatedAndEvaluated
|
||||
? FgDlssGDriverReported
|
||||
: FgMode;
|
||||
|
||||
/// <summary>
|
||||
/// What the driver's FG word adds beside the FG line — agreement with a tagged DLSS-G, a disagreement printed
|
||||
/// rather than resolved, or the bare fact beside a count that read <c>none</c> — or null when it says nothing.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Corrected 2026-09-06 midday: the morning's reading called this word blind to Streamline DLSS-G; the captures
|
||||
/// beside the loop read <c>CREATED | EVALUATE</c> on every ×4 session (Hell Is Us, Onimusha, DL:TB), the word
|
||||
/// changing between readings as the feature came up. Identity only — the multiplier bits stay clear at ×4.
|
||||
/// </remarks>
|
||||
public string? FgDriverNote
|
||||
{
|
||||
get
|
||||
{
|
||||
if (NgxDriver.Outcome != NgxProbeOutcome.Answered)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
bool created = NgxDriver.FgCreatedAndEvaluated;
|
||||
bool dlssg = FgMode is not null && FgMode.StartsWith(nameof(FlFgMode.DlssG), StringComparison.Ordinal);
|
||||
if (dlssg)
|
||||
{
|
||||
return created
|
||||
? "the NVIDIA driver agrees: an NGX frame-generation feature was created and evaluated in this process"
|
||||
: "WARNING: the NVIDIA driver reports NO NGX frame-generation feature created in this process while the "
|
||||
+ "tags named DLSS-G - a disagreement, printed rather than resolved";
|
||||
}
|
||||
|
||||
return created
|
||||
? "the NVIDIA driver reports an NGX frame-generation feature created and evaluated in this process "
|
||||
+ "(driver-reported identity; the count above is the record and is not changed by it)"
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// What the driver's word adds beside a hook's identity — agreement, a disagreement printed rather than
|
||||
/// resolved, or the driver's negative beside an N/A — or null when the driver did not answer.
|
||||
/// </summary>
|
||||
public string? UpscalerDriverNote
|
||||
{
|
||||
get
|
||||
{
|
||||
if (NgxDriver.Outcome != NgxProbeOutcome.Answered)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
bool created = NgxDriver.SrCreatedAndEvaluated;
|
||||
if (Upscaler is null)
|
||||
{
|
||||
return created
|
||||
? null
|
||||
: "the NVIDIA driver reports no NGX super-resolution feature created in this process (driver-reported; "
|
||||
+ "it says nothing about FSR or XeSS)";
|
||||
}
|
||||
|
||||
if (string.Equals(Upscaler, nameof(FlUpscaler.Dlss), StringComparison.Ordinal))
|
||||
{
|
||||
return created
|
||||
? "the NVIDIA driver agrees: an NGX super-resolution feature was created and evaluated in this process"
|
||||
: "WARNING: the NVIDIA driver reports NO NGX super-resolution feature created in this process while the "
|
||||
+ "hook named DLSS - a disagreement, printed rather than resolved";
|
||||
}
|
||||
|
||||
return created
|
||||
? "the NVIDIA driver also reports an NGX super-resolution feature created and evaluated in this process"
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Whether a hook capable of naming the frame-generation mode was live.</summary>
|
||||
public bool FgHookRan { get; init; }
|
||||
|
||||
@@ -132,8 +328,24 @@ internal sealed record MeasuredFacts
|
||||
public bool CensusInconsistent =>
|
||||
!CensusRan && (RuntimeCensus & ~FlRuntimeCensus.Ran) != FlRuntimeCensus.None;
|
||||
|
||||
/// <summary>Null, because <c>renderW/H</c> are always 0 and the ratio would divide by zero.</summary>
|
||||
public double? UpscaleRatio { get; init; }
|
||||
/// <summary>
|
||||
/// The dominant render → output extent over the records that claim <see cref="FlMeasured.UpscalerParams"/>
|
||||
/// and carry an output size, or null when no record carried both.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <b>The ratio is <c>03_METRICS</c> §Upscaling's own formula — <c>sqrt((outW×outH)/(renW×renH))</c>
|
||||
/// — and nothing more.</b> A preset NAME derived from it ("58% ≈ Balanced") is HANDOFF item 7a's
|
||||
/// owner decision and is deliberately not printed here: the quality byte stays what the writer
|
||||
/// measured (<c>0xFF</c> on every title so far), and this line says what the title rendered at,
|
||||
/// which is a measurement, beside the ratio, which is arithmetic on two measurements. The modal
|
||||
/// tuple rather than a mean, because averaging across a settings change is the classic way a
|
||||
/// benchmark number stops meaning anything; <see cref="UpscaleExtent.DistinctGroups"/> says
|
||||
/// whether one happened.
|
||||
/// </remarks>
|
||||
public UpscaleExtent? Extent { get; init; }
|
||||
|
||||
/// <summary><c>sqrt((outW×outH)/(renW×renH))</c> of the dominant extent, or null.</summary>
|
||||
public double? UpscaleRatio => Extent?.Ratio;
|
||||
|
||||
public Tri RayTracing { get; init; }
|
||||
|
||||
@@ -169,7 +381,8 @@ internal sealed record MeasuredFacts
|
||||
/// overstates the factor. <see cref="FgWindow"/> owns that decision and its refusals.
|
||||
/// </remarks>
|
||||
public static MeasuredFacts From(IReadOnlyList<FlFrameRecord> stream, FlWriterState writer,
|
||||
long qpcFrequency, long totalGaps, long totalDropped, FgWindow? fg = null)
|
||||
long qpcFrequency, long totalGaps, long totalDropped, FgWindow? fg = null, RuntimeModuleSet? modules = null,
|
||||
NgxDriverState? ngx = null)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(stream);
|
||||
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(qpcFrequency);
|
||||
@@ -186,23 +399,31 @@ internal sealed record MeasuredFacts
|
||||
var entitled = EntitledBy((FlHookFamily)writer.HooksInstalledMask);
|
||||
int violations = stream.Count(r => !IsHonest(r, entitled));
|
||||
|
||||
var census = (FlRuntimeCensus)writer.RuntimeCensus;
|
||||
string? withheld = fg?.IsNone == true ? WithholdNone(census, modules, writer) : null;
|
||||
|
||||
return new MeasuredFacts
|
||||
{
|
||||
PresentsObserved = stream.Count,
|
||||
SecondsObserved = seconds,
|
||||
|
||||
Fg = fg,
|
||||
FgMode = FgModeOf(stream) ?? (fg?.IsNone == true ? FgNone : fg?.IsActive == true ? FgActiveUnidentified : null),
|
||||
FgMode = ResolveFgMode(FgModeOf(stream), fg, withheld),
|
||||
NoneWithheld = withheld,
|
||||
NoneBesideDxgi = fg?.IsNone == true && withheld is null ? DxgiBesideNone(writer) : null,
|
||||
InterposerVersion = modules?.VersionOf(_slInterposerFileName),
|
||||
SlTagCensus = writer.SlTagCensus,
|
||||
DxgiPresentsUnseen = writer.DxgiPresentsUnseen,
|
||||
DxgiPresentSamples = writer.DxgiPresentSamples,
|
||||
UpscalerHookRan = RecordWindow.ClaimedSuffixStart(
|
||||
stream, static r => ((FlMeasured)r.MeasuredMask).HasFlag(FlMeasured.Upscaler)) < stream.Count,
|
||||
FgHookRan = RecordWindow.ClaimedSuffixStart(
|
||||
stream, static r => ((FlMeasured)r.MeasuredMask).HasFlag(FlMeasured.Fg)) < stream.Count,
|
||||
RuntimeCensus = (FlRuntimeCensus)writer.RuntimeCensus,
|
||||
RuntimeCensus = census,
|
||||
|
||||
// Still a deliberate absence: renderW/H are 0 unless a params hook ran, and the
|
||||
// ratio would divide by zero. See the property doc.
|
||||
UpscaleRatio = null,
|
||||
Extent = UpscaleExtent.From(stream),
|
||||
Upscaler = UpscalerOf(stream),
|
||||
NgxDriver = ngx ?? NgxDriverState.NotRun,
|
||||
RayTracing = RayTracingOf(stream, writer),
|
||||
RayReconstruction = RayReconstructionOf(stream),
|
||||
Hdr = HdrOf(stream),
|
||||
@@ -248,7 +469,7 @@ internal sealed record MeasuredFacts
|
||||
var allowed = FlMeasured.None;
|
||||
if (hooks.HasFlag(FlHookFamily.Present))
|
||||
{
|
||||
allowed |= FlMeasured.OutputRes | FlMeasured.PresentArgs;
|
||||
allowed |= FlMeasured.OutputRes | FlMeasured.PresentArgs | FlMeasured.DxgiPresents;
|
||||
}
|
||||
|
||||
if (hooks.HasFlag(FlHookFamily.UpscalerIdentity))
|
||||
@@ -319,6 +540,13 @@ internal sealed record MeasuredFacts
|
||||
return false;
|
||||
}
|
||||
|
||||
// dxgiUnseen has no in-band sentinel either — 0 is DXGI agreeing with the hook — so a
|
||||
// value under a clear bit is the same defect as an unclaimed count.
|
||||
if (!mask.HasFlag(FlMeasured.DxgiPresents) && r.DxgiUnseen != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// fgEvaluations has no in-band sentinel — 0 is a real count — so only the mask bit
|
||||
// can say whether anyone counted. Added here to keep this in step with the native
|
||||
// twin in guard_test.cpp, which HANDOFF item 3 will make load-bearing.
|
||||
@@ -343,6 +571,99 @@ internal sealed record MeasuredFacts
|
||||
return mask.HasFlag(FlMeasured.Rt) || ((FlRtFlags)r.RtFlags == FlRtFlags.None && r.DispatchRaysVolume == 0);
|
||||
}
|
||||
|
||||
private const string _slInterposerFileName = "sl.interposer.dll";
|
||||
|
||||
/// <summary>The string <see cref="FgMode"/> carries when the count said <c>none</c> while DLSS-G inputs were tagged.</summary>
|
||||
public const string FgNoneInputsTagged =
|
||||
"None (DLSS-G inputs were tagged through Streamline; the count says every present carried an application frame)";
|
||||
|
||||
/// <summary>
|
||||
/// Identity and count, combined by one rule: <b>the count decides <c>none</c>, identity decides the name.</b>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Until 2026-09-05 identity won outright, which was right for the identities the writer could produce:
|
||||
/// <c>FsrFg</c> lands only on a present that drained a FRAMEGENERATION dispatch (a generated batch, a fact
|
||||
/// about generation), and <c>DlssG</c> from a <c>kFeatureDLSS_G</c> evaluation never landed at all. Now
|
||||
/// <c>DlssG</c> also lands on a present that drained a HUD-less or UI tag — the title FEEDING frame
|
||||
/// generation, which a title may do with the feature switched off in its menu. So a counted 1.0 beside a
|
||||
/// <c>DlssG</c> mark is <c>none</c> with the inputs noted, never <c>DlssG</c>; an active count beside it is
|
||||
/// <c>DlssG</c>, named for the first time on the titles that never evaluate the feature; and a withheld
|
||||
/// count (§H5) keeps its N/A, with the tags reported beside it in the census line.
|
||||
/// </para>
|
||||
/// <para><c>FsrFg</c> keeps precedence over the count: a generated batch drained is a generated batch.</para>
|
||||
/// </remarks>
|
||||
private static string? ResolveFgMode(string? identity, FgWindow? fg, string? withheld)
|
||||
{
|
||||
bool dlssg = string.Equals(identity, nameof(FlFgMode.DlssG), StringComparison.Ordinal);
|
||||
if (fg?.IsNone == true && withheld is null && (identity is null || dlssg))
|
||||
{
|
||||
return dlssg ? FgNoneInputsTagged : FgNone;
|
||||
}
|
||||
|
||||
if (fg?.IsNone == true && withheld is not null && (identity is null || dlssg))
|
||||
{
|
||||
return FgNoneWithheldPrefix + withheld + ")";
|
||||
}
|
||||
|
||||
return identity ?? (fg?.IsActive == true ? FgActiveUnidentified : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The one shape on which a counted 1.0 may not be published as <c>none</c> — see
|
||||
/// <see cref="NoneWithheld"/> for the measurement and the choice of key.
|
||||
/// </summary>
|
||||
private static string? WithholdNone(FlRuntimeCensus census, RuntimeModuleSet? modules, FlWriterState writer)
|
||||
{
|
||||
if (!census.HasFlag(FlRuntimeCensus.Ran) || !census.HasFlag(FlRuntimeCensus.SlDlssG))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// THE DISCRIMINATOR, since Leg 0 (2026-09-06): DXGI's own counter on the hooked chain. The
|
||||
// 2.8.0 pacer's generated presents ARE DXGI presents there (§H5 row P1-DXGI), so a counter that
|
||||
// was read and saw nothing unseen is DXGI saying what the count says. A counter that was read
|
||||
// and DID see presents while the count still sits at 1.0 is a contradiction between two words
|
||||
// of the same writer — the records should have carried them — and is refused as such.
|
||||
if (writer.DxgiPresentSamples > 0)
|
||||
{
|
||||
return writer.DxgiPresentsUnseen == 0
|
||||
? null
|
||||
: $"DXGI's present counter read {writer.DxgiPresentsUnseen} present(s) this hook never saw over "
|
||||
+ $"{writer.DxgiPresentSamples} hooked present(s) while the records carry none of them — the writer "
|
||||
+ "state and the records disagree, and neither may be read as `none`";
|
||||
}
|
||||
|
||||
const string notRead = "DXGI's present counter was not read this session, and on Streamline 2.8.0 the DLSS-G "
|
||||
+ "pacer's generated presents are DXGI presents this hook never sees (20_OPEN_QUESTIONS "
|
||||
+ "§H5 row P1-DXGI), so a 1.0 cannot be told from generation";
|
||||
Version? v = modules?.VersionOf(_slInterposerFileName);
|
||||
if (v is null)
|
||||
{
|
||||
return "sl.dlss_g.dll (Streamline's DLSS Frame Generation plugin) is loaded, sl.interposer.dll's file "
|
||||
+ "version could not be read, and " + notRead;
|
||||
}
|
||||
|
||||
return v >= StreamlineNoneWithheldFrom
|
||||
? $"sl.dlss_g.dll (Streamline's DLSS Frame Generation plugin) is loaded on sl.interposer.dll {v}; " + notRead
|
||||
: null;
|
||||
}
|
||||
|
||||
/// <summary>DXGI's counter as a second witness beside a counted <c>none</c>; null when it was not read.</summary>
|
||||
private static string? DxgiBesideNone(FlWriterState writer)
|
||||
{
|
||||
if (writer.DxgiPresentSamples == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string samples = writer.DxgiPresentSamples.ToString(System.Globalization.CultureInfo.InvariantCulture);
|
||||
return writer.DxgiPresentsUnseen == 0
|
||||
? $"DXGI's own present counter agrees: 0 unseen over {samples} hooked present(s)"
|
||||
: $"DXGI's own present counter read {writer.DxgiPresentsUnseen.ToString(System.Globalization.CultureInfo.InvariantCulture)} "
|
||||
+ $"unseen over {samples} hooked present(s), inside the `none` ceiling";
|
||||
}
|
||||
|
||||
/// <summary>Which frame-generation technology ran, or null. NEVER the string "none".</summary>
|
||||
/// <remarks>
|
||||
/// <c>03_METRICS</c>'s ladder ends "otherwise <c>fg_mode = none</c>", and rung 0 — added
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
using System.Globalization;
|
||||
|
||||
namespace FrameLedger.CaptureHost.Consume;
|
||||
|
||||
/// <summary>
|
||||
/// The NVIDIA driver's own per-process NGX bookkeeping — <c>NvAPI_NGX_GetNGXOverrideState</c>, read out of
|
||||
/// process by <c>fl-probe-nvapi --ngx-state</c> beside each module snapshot — merged over a session.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>A driver-reported fact, and the report says so wherever it uses one.</b> It is neither a hooked argument
|
||||
/// (CLAUDE.md rule 4) nor a static hint (<c>05_DETECTION</c>): the driver says a feature was created and
|
||||
/// evaluated in this process, and this host repeats that with the attribution. What it may stand in for is
|
||||
/// the super-resolution IDENTITY on a session where no hook saw an evaluation (<c>03_METRICS</c> §Upscaling,
|
||||
/// the driver-reported rung, owner decision 2026-09-06). What it may not stand in for: a quality, a ratio, a
|
||||
/// render size, a frame-generation mode or a multiplier — measured 2026-09-06 to be override fields or blind.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The last ANSWERED reading is the state; <see cref="Readings"/> counts probe runs, <see cref="Answered"/> the
|
||||
/// ones the driver answered, and <see cref="Changed"/> whether two answered readings disagreed on a mask — a
|
||||
/// title switching DLSS on mid-session would show as a change, and the report prints it rather than averaging.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
internal sealed record NgxDriverState(
|
||||
NgxProbeOutcome Outcome,
|
||||
ulong Sr,
|
||||
ulong Rr,
|
||||
ulong Fg,
|
||||
double ScalingRatio,
|
||||
uint PerformanceMode,
|
||||
uint RenderPreset,
|
||||
uint FgCount,
|
||||
uint FgPreset,
|
||||
uint FgMode,
|
||||
uint Driver,
|
||||
int Readings,
|
||||
int Answered,
|
||||
bool Changed,
|
||||
string? Detail)
|
||||
{
|
||||
/// <summary>The loop was built without a probe.</summary>
|
||||
public static readonly NgxDriverState NotRun = new(NgxProbeOutcome.NotRun, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, false, null);
|
||||
|
||||
/// <summary>The one reading this host acts on: the driver says an NGX super-resolution feature ran here.</summary>
|
||||
public bool SrCreatedAndEvaluated =>
|
||||
Outcome == NgxProbeOutcome.Answered && (Sr & NgxOverrideFlags.CreatedAndEvaluated) == NgxOverrideFlags.CreatedAndEvaluated;
|
||||
|
||||
/// <summary>The driver says an NGX frame-generation feature ran here — an IDENTITY witness, never a count.</summary>
|
||||
public bool FgCreatedAndEvaluated =>
|
||||
Outcome == NgxProbeOutcome.Answered && (Fg & NgxOverrideFlags.CreatedAndEvaluated) == NgxOverrideFlags.CreatedAndEvaluated;
|
||||
|
||||
/// <summary>One outcome with no masks — a probe that did not answer, and why.</summary>
|
||||
public static NgxDriverState Of(NgxProbeOutcome outcome, string? detail) =>
|
||||
NotRun with { Outcome = outcome, Readings = 1, Detail = detail };
|
||||
|
||||
/// <summary>
|
||||
/// The machine line the probe prints (<c>NGXSTATE status=… sr=0x… …</c>), or a <see cref="NgxProbeOutcome.ProbeFailed"/>
|
||||
/// when nothing in <paramref name="output"/> is one. Every other line of the probe's output is for a human.
|
||||
/// </summary>
|
||||
public static NgxDriverState Parse(string output)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(output);
|
||||
foreach (string raw in output.Split('\n'))
|
||||
{
|
||||
string line = raw.Trim();
|
||||
if (!line.StartsWith("NGXSTATE ", StringComparison.Ordinal))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Dictionary<string, string> kv = new(StringComparer.Ordinal);
|
||||
foreach (string token in line.Split(' ', StringSplitOptions.RemoveEmptyEntries).Skip(1))
|
||||
{
|
||||
int eq = token.IndexOf('=', StringComparison.Ordinal);
|
||||
if (eq > 0)
|
||||
{
|
||||
kv[token[..eq]] = token[(eq + 1)..];
|
||||
}
|
||||
}
|
||||
|
||||
return FromFields(kv, line);
|
||||
}
|
||||
|
||||
return Of(NgxProbeOutcome.ProbeFailed, "the probe printed no NGXSTATE line");
|
||||
}
|
||||
|
||||
private static NgxDriverState FromFields(Dictionary<string, string> kv, string line)
|
||||
{
|
||||
string status = kv.GetValueOrDefault("status", "");
|
||||
if (string.Equals(status, "ANSWERED", StringComparison.Ordinal))
|
||||
{
|
||||
try
|
||||
{
|
||||
return new NgxDriverState(NgxProbeOutcome.Answered, Hex(kv["sr"]), Hex(kv["rr"]), Hex(kv["fg"]),
|
||||
double.Parse(kv["ratio"], CultureInfo.InvariantCulture), U(kv["mode"]), U(kv["preset"]),
|
||||
U(kv["fgcount"]), U(kv["fgpreset"]), U(kv["fgmode"]), U(kv["driver"]), 1, 1, false, null);
|
||||
}
|
||||
catch (Exception e) when (e is KeyNotFoundException or FormatException or OverflowException)
|
||||
{
|
||||
return Of(NgxProbeOutcome.ProbeFailed, "an NGXSTATE line this host could not read: " + line);
|
||||
}
|
||||
}
|
||||
|
||||
return status switch
|
||||
{
|
||||
"UNANSWERED" => Of(NgxProbeOutcome.Unanswered, "NvAPI " + kv.GetValueOrDefault("nvapi", "?")),
|
||||
"DEGRADED" => Of(NgxProbeOutcome.Degraded, "NvAPI_Initialize " + kv.GetValueOrDefault("nvapi", "?")),
|
||||
_ => Of(NgxProbeOutcome.ProbeFailed, "an NGXSTATE status this host does not know: " + status),
|
||||
};
|
||||
}
|
||||
|
||||
private static ulong Hex(string v) =>
|
||||
ulong.Parse(v.StartsWith("0x", StringComparison.OrdinalIgnoreCase) ? v[2..] : v, NumberStyles.HexNumber,
|
||||
CultureInfo.InvariantCulture);
|
||||
|
||||
private static uint U(string v) => uint.Parse(v, CultureInfo.InvariantCulture);
|
||||
|
||||
/// <summary>Fold a later reading in: an answered one becomes the state, any one counts.</summary>
|
||||
public NgxDriverState Merge(NgxDriverState later)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(later);
|
||||
if (Outcome == NgxProbeOutcome.NotRun)
|
||||
{
|
||||
return later;
|
||||
}
|
||||
|
||||
int readings = Readings + later.Readings;
|
||||
int answered = Answered + later.Answered;
|
||||
if (later.Outcome != NgxProbeOutcome.Answered)
|
||||
{
|
||||
// An earlier answer outranks a later silence: the driver's words do not expire, and a
|
||||
// probe that failed once mid-session says nothing about what it had already read.
|
||||
return Outcome == NgxProbeOutcome.Answered
|
||||
? this with { Readings = readings }
|
||||
: later with { Readings = readings, Answered = answered };
|
||||
}
|
||||
|
||||
bool changed = Changed || (Outcome == NgxProbeOutcome.Answered && (Sr != later.Sr || Rr != later.Rr || Fg != later.Fg));
|
||||
return later with { Readings = readings, Answered = answered, Changed = changed };
|
||||
}
|
||||
|
||||
/// <summary>The report's line: the three words decoded, the override fields named as such, the caveats measured.</summary>
|
||||
public string Describe()
|
||||
{
|
||||
string head = " NVIDIA driver NGX state (NvAPI_NGX_GetNGXOverrideState, out of process): ";
|
||||
return Outcome switch
|
||||
{
|
||||
NgxProbeOutcome.NotRun => head + "not probed",
|
||||
NgxProbeOutcome.ProbeMissing => head + "probe not found - " + Detail,
|
||||
NgxProbeOutcome.ProbeFailed => head + "probe failed - " + Detail,
|
||||
NgxProbeOutcome.Degraded => head + "no usable NVIDIA driver on this machine (" + Detail + ")",
|
||||
NgxProbeOutcome.Unanswered => head + $"the driver did not answer for this process over {Readings} probe(s) ({Detail}) - "
|
||||
+ "not an NVIDIA-rendered process, a driver older than R570, or the API refusing the caller",
|
||||
_ => head + $"answered {Answered} of {Readings} probe(s){(Changed ? ", and the words CHANGED between readings" : "")}"
|
||||
+ $"; driver {Driver / 100}.{Driver % 100:00}\n"
|
||||
+ $" SR 0x{Sr:X} [{NgxOverrideFlags.Describe(Sr)}] RR 0x{Rr:X} [{NgxOverrideFlags.Describe(Rr)}] "
|
||||
+ $"FG 0x{Fg:X} [{NgxOverrideFlags.Describe(Fg)}]\n"
|
||||
+ $" override fields: scalingRatio={ScalingRatio.ToString("0.0000", CultureInfo.InvariantCulture)} "
|
||||
+ $"performanceMode={PerformanceMode} renderPreset={RenderPreset} fgCount={FgCount} fgPreset={FgPreset} fgMode={FgMode} "
|
||||
+ "- the OVERRIDE's values when an NVIDIA-app override is set, zero otherwise (measured 2026-09-06); "
|
||||
+ "the SR and FG words name a feature the driver saw created and evaluated - identity, never a count or a multiplier "
|
||||
+ "(FG_MODE / FG_MULTI_FRAME stay clear and fgCount is 0 at x4)",
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
namespace FrameLedger.CaptureHost.Consume;
|
||||
|
||||
/// <summary>
|
||||
/// The bits of <c>NV_NGX_DLSS_OVERRIDE_BITFIELD</c> (vendored <c>nvapi.h</c>, R570+), as the driver reports them per
|
||||
/// process through <c>NvAPI_NGX_GetNGXOverrideState</c>. Constants rather than a <c>[Flags]</c> enum because the
|
||||
/// masks are 64-bit words the probe prints raw, and a word is what the parser keeps.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <b>Measured 2026-09-06 (driver 616.64, <c>20_OPEN_QUESTIONS</c> §H5):</b> <see cref="Created"/> and
|
||||
/// <see cref="Evaluate"/> on the super-resolution word are set for a process with NO NVIDIA-app override
|
||||
/// (Hell Is Us, Lies of P), and CLEAR on Lies of P with upscaling switched off — the negative that keeps the rung.
|
||||
/// <b>The frame-generation word follows DLSS-G too, once the feature exists</b> — the morning's
|
||||
/// <see cref="Initialized"/> | <see cref="DllExists"/> on Hell Is Us was read before creation; the captures beside
|
||||
/// the loop read <see cref="Created"/> | <see cref="Evaluate"/> on Hell Is Us, Onimusha and Dying Light: The Beast at
|
||||
/// ×4, with the word CHANGING between the session's readings. <see cref="FgMode"/> and <see cref="FgMultiFrame"/>
|
||||
/// stay clear at ×4 and <c>frameGenerationCount</c> is 0, so the word names the feature and never the multiplier.
|
||||
/// </remarks>
|
||||
internal static class NgxOverrideFlags
|
||||
{
|
||||
public const ulong Initialized = 1UL << 0;
|
||||
public const ulong Enabled = 1UL << 1;
|
||||
public const ulong DllExists = 1UL << 2;
|
||||
public const ulong DllLoaded = 1UL << 3;
|
||||
public const ulong DllSelected = 1UL << 4;
|
||||
public const ulong Preset = 1UL << 5;
|
||||
public const ulong PerfMode = 1UL << 6;
|
||||
public const ulong ScalingRatio = 1UL << 7;
|
||||
public const ulong OptimalSettings = 1UL << 8;
|
||||
public const ulong Created = 1UL << 9;
|
||||
public const ulong Evaluate = 1UL << 10;
|
||||
public const ulong FgMode = 1UL << 13;
|
||||
public const ulong SrDlaaMode = 1UL << 14;
|
||||
public const ulong FgMultiFrame = 1UL << 15;
|
||||
public const ulong ErrFailed = 1UL << 16;
|
||||
public const ulong ErrDenied = 1UL << 17;
|
||||
public const ulong ErrDrs = 1UL << 18;
|
||||
public const ulong ErrNotFound = 1UL << 19;
|
||||
public const ulong ErrDllLoad = 1UL << 20;
|
||||
|
||||
/// <summary>The two bits that together say "this feature ran in this process": created, and evaluated.</summary>
|
||||
public const ulong CreatedAndEvaluated = Created | Evaluate;
|
||||
|
||||
private static readonly (ulong Bit, string Name)[] _names =
|
||||
[
|
||||
(Initialized, "INITIALIZED"), (Enabled, "ENABLED"), (DllExists, "DLL_EXISTS"), (DllLoaded, "DLL_LOADED"),
|
||||
(DllSelected, "DLL_SELECTED"), (Preset, "PRESET"), (PerfMode, "PERF_MODE"), (ScalingRatio, "SCALING_RATIO"),
|
||||
(OptimalSettings, "OPTIMAL_SETTINGS"), (Created, "CREATED"), (Evaluate, "EVALUATE"), (FgMode, "FG_MODE"),
|
||||
(SrDlaaMode, "SR_DLAA_MODE"), (FgMultiFrame, "FG_MULTI_FRAME"), (ErrFailed, "ERR_FAILED"),
|
||||
(ErrDenied, "ERR_DENIED"), (ErrDrs, "ERR_DRS"), (ErrNotFound, "ERR_NOT_FOUND"), (ErrDllLoad, "ERR_DLL_LOAD"),
|
||||
];
|
||||
|
||||
/// <summary>The probe's own spelling of a word's bits, unknown bits printed as hex so nothing is dropped.</summary>
|
||||
public static string Describe(ulong mask)
|
||||
{
|
||||
if (mask == 0)
|
||||
{
|
||||
return "-";
|
||||
}
|
||||
|
||||
List<string> parts = [];
|
||||
ulong seen = 0;
|
||||
foreach ((ulong bit, string name) in _names)
|
||||
{
|
||||
if ((mask & bit) != 0)
|
||||
{
|
||||
parts.Add(name);
|
||||
seen |= bit;
|
||||
}
|
||||
}
|
||||
|
||||
ulong unknown = mask & ~seen;
|
||||
if (unknown != 0)
|
||||
{
|
||||
parts.Add("0x" + unknown.ToString("X", System.Globalization.CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
return string.Join(' ', parts);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace FrameLedger.CaptureHost.Consume;
|
||||
|
||||
/// <summary>What one run of <c>fl-probe-nvapi --ngx-state</c> came back with.</summary>
|
||||
internal enum NgxProbeOutcome
|
||||
{
|
||||
/// <summary>The loop was built without a probe, or the probe never ran.</summary>
|
||||
NotRun,
|
||||
|
||||
/// <summary>The driver answered for this pid; the masks are the driver's.</summary>
|
||||
Answered,
|
||||
|
||||
/// <summary>NvAPI answered but not for this pid: not NVIDIA-rendered, an old driver, or the API refusing the caller.</summary>
|
||||
Unanswered,
|
||||
|
||||
/// <summary>No usable NVIDIA driver on this machine.</summary>
|
||||
Degraded,
|
||||
|
||||
/// <summary>The probe binary was not beside this host.</summary>
|
||||
ProbeMissing,
|
||||
|
||||
/// <summary>The probe could not be started, timed out, or printed nothing this host understands.</summary>
|
||||
ProbeFailed,
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace FrameLedger.CaptureHost.Consume;
|
||||
|
||||
/// <summary>One vendor runtime module the loader reported in the target, with its file version.</summary>
|
||||
/// <remarks>
|
||||
/// <b>The version is read from the FILE on disk, never from the process.</b> The only thing read
|
||||
/// out of the target is the loader's module list — the same documented read the anti-cheat guard
|
||||
/// performs on every target before injecting — and the path it names is then opened as a file.
|
||||
/// CLAUDE.md rule 4 is untouched: no game memory, no vendor object, no hook.
|
||||
/// </remarks>
|
||||
internal sealed record RuntimeModuleInfo(string FileName, string Path, string? FileVersion, Version? Parsed);
|
||||
@@ -0,0 +1,51 @@
|
||||
namespace FrameLedger.CaptureHost.Consume;
|
||||
|
||||
/// <summary>
|
||||
/// The census-named modules a session's target had loaded, with versions, merged over every
|
||||
/// snapshot the loop took.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>Why this exists.</b> <c>FlWriterState.runtimeCensus</c> says a module of a NAME was loaded and
|
||||
/// nothing else. Dying Light: The Beast and Cyberpunk 2077 both load a Streamline interposer; one
|
||||
/// ships 2.8.0 and the other 2.7.1, and <c>20_OPEN_QUESTIONS</c> §H5 case 3 turns on exactly that
|
||||
/// difference. The census cannot carry it without a layout change; this can, from outside the
|
||||
/// process, at no cost on the present path.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>First seen wins per name.</b> A module that unloads and reloads between snapshots keeps its
|
||||
/// first version; the report is about what the session ran, not about the last thing the loader
|
||||
/// said. <see cref="Snapshots"/> and <see cref="Unreadable"/> are counted rather than folded into
|
||||
/// one flag, because a target that exits before the final snapshot makes that snapshot fail
|
||||
/// without making the earlier ones wrong.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
internal sealed record RuntimeModuleSet(IReadOnlyList<RuntimeModuleInfo> Modules, int Snapshots, int Unreadable)
|
||||
{
|
||||
public static RuntimeModuleSet Empty { get; } = new([], 0, 0);
|
||||
|
||||
/// <summary>
|
||||
/// The parsed file version of <paramref name="fileName"/>, or null when the module was never
|
||||
/// seen or carries no version resource.
|
||||
/// </summary>
|
||||
public Version? VersionOf(string fileName) => Find(fileName)?.Parsed;
|
||||
|
||||
public RuntimeModuleInfo? Find(string fileName) =>
|
||||
Modules.FirstOrDefault(m => string.Equals(m.FileName, fileName, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
/// <summary>This set, then <paramref name="later"/>'s modules that this one did not already name.</summary>
|
||||
public RuntimeModuleSet Merge(RuntimeModuleSet later)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(later);
|
||||
var merged = new List<RuntimeModuleInfo>(Modules);
|
||||
foreach (RuntimeModuleInfo m in later.Modules)
|
||||
{
|
||||
if (!merged.Exists(x => string.Equals(x.FileName, m.FileName, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
merged.Add(m);
|
||||
}
|
||||
}
|
||||
|
||||
return new RuntimeModuleSet(merged, Snapshots + later.Snapshots, Unreadable + later.Unreadable);
|
||||
}
|
||||
}
|
||||
@@ -46,35 +46,33 @@ internal static class SessionReport
|
||||
sb.Append(" Native FPS: ").Append(Num(w.NativeFps))
|
||||
.Append(" -> Displayed FPS: ").Append(Num(w.DisplayedFps))
|
||||
.Append(" (x").Append(Num(w.Factor)).Append(" FG)")
|
||||
.Append(" over ").Append(Count(w.Presents)).AppendLine(" present(s)");
|
||||
.Append(" over ").Append(Count(w.DisplayedPresents)).AppendLine(" present(s)");
|
||||
if (w.DxgiCounted)
|
||||
{
|
||||
// A COUNT DXGI MADE, NOT THIS HOOK, and the line says so before anyone reads the
|
||||
// trio: those presents have no timestamps here, so they may stand in a rate and
|
||||
// a factor and never in a frame-time distribution (03_METRICS §Counting).
|
||||
sb.Append(" Displayed is DXGI-COUNTED: ").Append(Count(w.DxgiUnseen))
|
||||
.Append(" of those present(s) were counted by IDXGISwapChain::GetLastPresentCount on the hooked ")
|
||||
.Append("chain and never reached this hook (").Append(Count(w.Presents))
|
||||
.AppendLine(" hooked) — a count DXGI made, not this hook; 20_OPEN_QUESTIONS §H5 row P1-DXGI");
|
||||
}
|
||||
}
|
||||
else if (facts.Fg?.IsNone == true)
|
||||
else if (facts.Fg?.IsNone == true && facts.NoneWithheld is null)
|
||||
{
|
||||
// THE THIRD SHAPE, reachable since 2026-09-04: 08_UI's bare `144 FPS`. No pair, no
|
||||
// factor, no qualifier — the count measured that every present carried an
|
||||
// application frame, which is the one negative this report may state outright.
|
||||
FgWindow w = facts.Fg;
|
||||
sb.Append(" FPS: ").Append(Num(w.NativeFps))
|
||||
.Append(" over ").Append(Count(w.Presents)).AppendLine(" present(s)");
|
||||
sb.Append(" frame generation: none — ").Append(Count(w.Evaluations))
|
||||
.Append(" application frame(s) counted (slGetNewFrameToken, or an ffx-api PREPARE / UPSCALE dispatch) against ")
|
||||
.Append(Count(w.Presents))
|
||||
.AppendLine(" present(s); every present carried an application frame");
|
||||
//
|
||||
// UNLESS IT IS WITHHELD. On Streamline 2.8 with sl.dlss_g.dll loaded the same count read
|
||||
// 1.00 five times while the title was generating (§H5 case 3), so that shape falls
|
||||
// through to the Presented line and its qualifier says why. MeasuredFacts owns the
|
||||
// decision; this branch only honours it.
|
||||
AppendNone(sb, facts.Fg, facts);
|
||||
}
|
||||
else
|
||||
{
|
||||
// PRESENTED FPS, the name for the one number that stands alone (03_METRICS §Core
|
||||
// definitions, 2026-09-03). Numerically it is Displayed FPS; the name changes because
|
||||
// "Displayed" is half of a pair, and printing half a pair invites the reader to supply
|
||||
// the other half. The qualifier under it is mandatory, and which one is printed is the
|
||||
// census's whole job.
|
||||
sb.Append(" Presented FPS: ").Append(Num(facts.DisplayedFps))
|
||||
.Append(" over ").Append(Count(facts.PresentsObserved)).AppendLine(" present(s)");
|
||||
sb.Append(" ").AppendLine(FgQualifier(facts));
|
||||
if (facts.Fg?.Refusal is not null)
|
||||
{
|
||||
sb.Append(" no FG factor: ").AppendLine(facts.Fg.Refusal);
|
||||
}
|
||||
AppendPresented(sb, facts);
|
||||
}
|
||||
|
||||
AppendFgDiagnostics(sb, facts.Fg);
|
||||
@@ -84,6 +82,41 @@ internal static class SessionReport
|
||||
return sb.ToString().TrimEnd();
|
||||
}
|
||||
|
||||
/// <summary>The bare number and the counted negative, with DXGI's counter beside it when it was read.</summary>
|
||||
private static void AppendNone(StringBuilder sb, FgWindow w, MeasuredFacts facts)
|
||||
{
|
||||
sb.Append(" FPS: ").Append(Num(w.NativeFps))
|
||||
.Append(" over ").Append(Count(w.Presents)).AppendLine(" present(s)");
|
||||
sb.Append(" frame generation: none — ").Append(Count(w.Evaluations))
|
||||
.Append(" application frame(s) counted (slGetNewFrameToken, or an ffx-api PREPARE / UPSCALE dispatch) against ")
|
||||
.Append(Count(w.Presents))
|
||||
.Append(" present(s); every present carried an application frame")
|
||||
.AppendLine(facts.NoneBesideDxgi is string dxgi ? "; " + dxgi : "");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PRESENTED FPS, the name for the one number that stands alone (03_METRICS §Core definitions,
|
||||
/// 2026-09-03). Numerically it is Displayed FPS; the name changes because "Displayed" is half of
|
||||
/// a pair, and printing half a pair invites the reader to supply the other half. The qualifier
|
||||
/// under it is mandatory, and which one is printed is the census's whole job.
|
||||
/// </summary>
|
||||
private static void AppendPresented(StringBuilder sb, MeasuredFacts facts)
|
||||
{
|
||||
sb.Append(" Presented FPS: ").Append(Num(facts.DisplayedFps))
|
||||
.Append(" over ").Append(Count(facts.PresentsObserved)).AppendLine(" present(s)");
|
||||
sb.Append(" ").AppendLine(FgQualifier(facts));
|
||||
if (facts.NoneWithheld is not null)
|
||||
{
|
||||
sb.AppendLine(" frame generation: NOT stated — the FG counts below are the record; the discriminator "
|
||||
+ "is the title's own counter beside this line (§H5)");
|
||||
}
|
||||
|
||||
if (facts.Fg?.Refusal is not null)
|
||||
{
|
||||
sb.Append(" no FG factor: ").AppendLine(facts.Fg.Refusal);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Defects in the DATA, each attributed to where it came from, never averaged in.</summary>
|
||||
private static void AppendWarnings(StringBuilder sb, MeasuredFacts facts)
|
||||
{
|
||||
@@ -119,6 +152,40 @@ internal static class SessionReport
|
||||
/// </remarks>
|
||||
private static string FgQualifier(MeasuredFacts facts)
|
||||
{
|
||||
// THE WITHHELD SHAPE COMES FIRST, because the WARNING below it reads in the wrong
|
||||
// direction for this case. "MAY include generated frames; read it as Displayed" is right
|
||||
// when nothing was counted; here the count says the presents ARE the application frames
|
||||
// and the generated ones are the number nobody has. Displayed is what is unknown.
|
||||
if (facts.NoneWithheld is not null)
|
||||
{
|
||||
return "WARNING: the count read presents = application frames (1.00) and `none` is WITHHELD — "
|
||||
+ facts.NoneWithheld
|
||||
+ ". 20_OPEN_QUESTIONS §H5 case 3: on this shape the generated presents may never reach the "
|
||||
+ "Present bodies this hook patches, so this number counts APPLICATION frames; whether frames were "
|
||||
+ "generated, and the Displayed rate, are unknown. Read it as the application-frame rate, never "
|
||||
+ "as Displayed"
|
||||
+ (facts.DlssgInputsTagged
|
||||
? ". The title tagged DLSS-G inputs (HUD-less / UI) through Streamline this session — it is "
|
||||
+ "FEEDING frame generation, which is the identity; the count is still what it is"
|
||||
: "");
|
||||
}
|
||||
|
||||
// A COUNTED SESSION WHOSE FACTOR WAS REFUSED is not "no evaluation was observed". Measured
|
||||
// 2026-09-06 on DL:TB at FSR + DLSS-G: 4,415 tokens, 8,174 DXGI-counted presents, the tags naming
|
||||
// DLSS-G, and the factor refused because the last bucket read 1.96 against 2.85 — and this line
|
||||
// said a runtime was loaded and nothing was seen. The number is every hooked present over a
|
||||
// session that held more than one configuration, and it is neither Native nor Displayed.
|
||||
if (facts.Fg is { Refusal: not null, Evaluations: > 0 } counted)
|
||||
{
|
||||
return "WARNING: frame generation was counted (" + Count(counted.Evaluations) + " application-frame token(s)"
|
||||
+ (counted.DxgiCounted
|
||||
? ", and DXGI counted " + Count(counted.DxgiUnseen) + " present(s) this hook never saw, so the "
|
||||
+ "Displayed rate is ABOVE this number"
|
||||
: "")
|
||||
+ ") and its factor is REFUSED — see `no FG factor` below — so this number is every hooked present "
|
||||
+ "over a session that did not hold one configuration; read it as neither Native nor Displayed";
|
||||
}
|
||||
|
||||
if (!facts.CensusRan)
|
||||
{
|
||||
return "frame generation: NOT measured, and the runtime census did not run — this number is presents, "
|
||||
@@ -154,20 +221,33 @@ internal static class SessionReport
|
||||
// can tell that apart from a title driving DLSS through a path we do not hook — Black Myth:
|
||||
// Wukong loads sl.interposer.dll, runs DLSS-G, and calls it never — so the line names all
|
||||
// three rather than picking the one that flatters the hook.
|
||||
sb.Append(" upscaler: ").AppendLine(facts.Upscaler
|
||||
// A hook's name first; else the driver's word, attributed (03_METRICS §Upscaling, the
|
||||
// driver-reported rung); else the two N/As. The driver's note rides beside whichever printed.
|
||||
sb.Append(" upscaler: ").Append(facts.Upscaler
|
||||
?? facts.UpscalerDriverReported
|
||||
?? (facts.UpscalerHookRan
|
||||
? "N/A (an upscaler hook ran — Streamline's slEvaluateFeature and/or an ffx-api leaf's ffxDispatch — "
|
||||
+ "and no evaluation this build decodes arrived: "
|
||||
+ "upscaling is off in this title's settings, or it runs through a path this build does not "
|
||||
+ "hook — measured on 3 of 5 Streamline titles — or a vendor this build does not decode)"
|
||||
: NoHookRan("upscaler", facts.CensusRan, facts.UpscalerRuntimesLoaded)));
|
||||
sb.Append(" render -> output: ").AppendLine(facts.UpscaleRatio is null
|
||||
? "N/A (the ratio is not computed yet; the raw sizes are above)"
|
||||
: Num(facts.UpscaleRatio));
|
||||
sb.Append(" frame generation: ").AppendLine(facts.FgMode
|
||||
if (facts.UpscalerDriverNote is string driver)
|
||||
{
|
||||
sb.Append(" — ").Append(driver);
|
||||
}
|
||||
|
||||
sb.AppendLine();
|
||||
sb.Append(" render -> output: ").AppendLine(RenderToOutput(facts.Extent));
|
||||
sb.Append(" frame generation: ").Append(facts.FgModePrinted
|
||||
?? (facts.FgHookRan
|
||||
? "N/A (a hook ran and saw no frame-generation evaluation — see the FG counts above)"
|
||||
: NoHookRan("frame-generation", facts.CensusRan, facts.FgRuntimesLoaded)));
|
||||
if (facts.FgDriverNote is string fgDriver)
|
||||
{
|
||||
sb.Append(" — ").Append(fgDriver);
|
||||
}
|
||||
|
||||
sb.AppendLine();
|
||||
sb.Append(" ray tracing: ").AppendLine(facts.RayTracing.ToString());
|
||||
sb.Append(" ray reconstruction: ").AppendLine(facts.RayReconstruction.ToString());
|
||||
sb.Append(" path tracing: ").AppendLine(facts.PathTracing.ToString());
|
||||
@@ -213,6 +293,7 @@ internal static class SessionReport
|
||||
// record 0 while this one starts after the lazy-install prefix — and the resulting rate
|
||||
// moved across 78.6-83 on window choice alone, ten times the residual that draft quoted.
|
||||
sb.Append(" FG counts: presents=").Append(Count(w.Presents))
|
||||
.Append(" dxgi-unseen=").Append(Count(w.DxgiUnseen))
|
||||
.Append(" batches=").Append(Count(w.Batches))
|
||||
.Append(" tokens=").Append(Count(w.Evaluations))
|
||||
.Append(" streams=").Append(Count(w.Streams))
|
||||
@@ -307,6 +388,25 @@ internal static class SessionReport
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The extent line: two measured sizes, the ratio <c>03_METRICS</c> defines over them, and
|
||||
/// whether the window ran at one tuple. Never a preset name — that is HANDOFF 7a's owner call.
|
||||
/// </summary>
|
||||
private static string RenderToOutput(UpscaleExtent? e)
|
||||
{
|
||||
if (e is null)
|
||||
{
|
||||
return "N/A (no record carried both a render size and an output size)";
|
||||
}
|
||||
|
||||
string line = $"{e.RenderW}x{e.RenderH} -> {e.OutputW}x{e.OutputH} = {Num(e.Ratio)}x "
|
||||
+ $"({e.RenderScalePercent.ToString("0", CultureInfo.InvariantCulture)}% render scale) "
|
||||
+ $"on {Count(e.Records)} of {Count(e.Measured)} record(s)";
|
||||
return e.DistinctGroups > 1
|
||||
? line + $" — SETTINGS MOVED: {Count(e.DistinctGroups)} distinct extents in the window, this is the dominant one"
|
||||
: line;
|
||||
}
|
||||
|
||||
private static string Num(double? v) =>
|
||||
v is null ? "N/A" : v.Value.ToString("0.##", CultureInfo.InvariantCulture);
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
using System.Text;
|
||||
using FrameLedger.Shared;
|
||||
|
||||
namespace FrameLedger.CaptureHost.Consume;
|
||||
|
||||
/// <summary>
|
||||
/// The Streamline buffer-type names behind <see cref="FlWriterState.SlTagCensus"/> bits, per route, for the report.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Display only, like <see cref="CensusNames"/>. The authority is <c>FlSlTagType</c> in <c>fl_shm.h</c>; this
|
||||
/// copy exists so a real-title run can say <i>which</i> buffers the title tagged on <i>which</i> route rather than
|
||||
/// print a bit number — the input to §H5's question of whether a title feeds DLSS Frame Generation through the
|
||||
/// exports this build hooks.
|
||||
/// </remarks>
|
||||
internal static class SlTagCensusNames
|
||||
{
|
||||
private static readonly (FlSlTagType Bit, string Name)[] _names =
|
||||
[
|
||||
(FlSlTagType.Depth, "depth"),
|
||||
(FlSlTagType.MotionVectors, "mvec"),
|
||||
(FlSlTagType.Hudless, "hudless"),
|
||||
(FlSlTagType.ScalingInput, "scaling-in"),
|
||||
(FlSlTagType.ScalingOutput, "scaling-out"),
|
||||
(FlSlTagType.UiColorAlpha, "ui-color-alpha"),
|
||||
(FlSlTagType.UiAlpha, "ui-alpha"),
|
||||
(FlSlTagType.Backbuffer, "backbuffer"),
|
||||
(FlSlTagType.Other, "other"),
|
||||
];
|
||||
|
||||
/// <summary>Comma-separated names for one route's bits; <c>-</c> when none.</summary>
|
||||
public static string Describe(FlSlTagType bits)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
foreach ((FlSlTagType bit, string name) in _names)
|
||||
{
|
||||
if (bits.HasFlag(bit))
|
||||
{
|
||||
if (sb.Length > 0)
|
||||
{
|
||||
sb.Append(", ");
|
||||
}
|
||||
|
||||
sb.Append(name);
|
||||
}
|
||||
}
|
||||
|
||||
return sb.Length == 0 ? "-" : sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>The whole census, one bracket per route.</summary>
|
||||
public static string DescribeRoutes(uint census) =>
|
||||
$"global=[{Describe(FlSlTagRoute.Of(census, FlSlTagRoute.Global))}] "
|
||||
+ $"frame=[{Describe(FlSlTagRoute.Of(census, FlSlTagRoute.Frame))}] "
|
||||
+ $"local=[{Describe(FlSlTagRoute.Of(census, FlSlTagRoute.Local))}]";
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using FrameLedger.Shared;
|
||||
|
||||
namespace FrameLedger.CaptureHost.Consume;
|
||||
|
||||
/// <summary>
|
||||
/// The longest present-to-present intervals in a stream, each placed against the moments this host
|
||||
/// touched the target — so "the game dropped to 1 FPS for a second" can be read as ours or not ours.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>Why this exists.</b> The owner saw Cyberpunk 2077 fall to 1 FPS for about a second under capture
|
||||
/// (2026-09-05) and the report had nothing to say about it: no frame-time statistic is computed by this
|
||||
/// throwaway (P2's calculators own them), and nothing correlated a gap with what FrameLedger was doing.
|
||||
/// FrameLedger touches the target at known moments — the guard's 30 s re-scan enumerates its modules,
|
||||
/// and the module snapshot reads the same list beside it — and the records carry QPC, the same clock
|
||||
/// <see cref="System.Diagnostics.Stopwatch.GetTimestamp"/> reads. So a stall can be placed: within a
|
||||
/// touch window it is a suspect; far from every touch it is the title's own (a shader compile, a
|
||||
/// level stream, a menu).
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>Not a stutter metric.</b> <c>03_METRICS</c> defines stutter against a rolling median with edge
|
||||
/// rules and a sufficiency floor, and this prints none of that. It prints the few longest raw
|
||||
/// intervals and where they sit, which is a diagnostic, and it says so.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
internal sealed record StallReport
|
||||
{
|
||||
/// <summary>One long interval: where it starts in the session, how long it is, and the nearest touch.</summary>
|
||||
internal sealed record Stall(double AtSeconds, double Milliseconds, double? NearestTouchSeconds)
|
||||
{
|
||||
/// <summary>A touch inside the interval or within <see cref="TouchWindowSeconds"/> of it is a suspect.</summary>
|
||||
public bool NearATouch => NearestTouchSeconds is double d && Math.Abs(d) <= TouchWindowSeconds;
|
||||
}
|
||||
|
||||
/// <summary>How far a host touch may be from a stall and still be named beside it.</summary>
|
||||
public const double TouchWindowSeconds = 1.0;
|
||||
|
||||
/// <summary>Intervals at or above this are counted as stalls — ten presents' worth at 100 FPS.</summary>
|
||||
public const double StallThresholdMs = 100.0;
|
||||
|
||||
public required IReadOnlyList<Stall> Longest { get; init; }
|
||||
|
||||
public required int OverThreshold { get; init; }
|
||||
|
||||
public required int Intervals { get; init; }
|
||||
|
||||
public required int Touches { get; init; }
|
||||
|
||||
public static StallReport From(IReadOnlyList<FlFrameRecord> stream, long qpcFrequency, IReadOnlyList<long> touchQpc,
|
||||
int keep = 3)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(stream);
|
||||
ArgumentNullException.ThrowIfNull(touchQpc);
|
||||
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(qpcFrequency);
|
||||
|
||||
var stalls = new List<Stall>();
|
||||
int over = 0;
|
||||
int intervals = 0;
|
||||
if (stream.Count > 1)
|
||||
{
|
||||
long origin = (long)stream[0].Qpc;
|
||||
var candidates = new List<(long StartQpc, long DeltaQpc)>();
|
||||
for (int i = 1; i < stream.Count; i++)
|
||||
{
|
||||
long delta = (long)stream[i].Qpc - (long)stream[i - 1].Qpc;
|
||||
if (delta <= 0)
|
||||
{
|
||||
continue; // a torn or reordered record; the drain reports gaps separately
|
||||
}
|
||||
|
||||
intervals++;
|
||||
if (delta * 1000.0 / qpcFrequency >= StallThresholdMs)
|
||||
{
|
||||
over++;
|
||||
}
|
||||
|
||||
candidates.Add(((long)stream[i - 1].Qpc, delta));
|
||||
}
|
||||
|
||||
foreach ((long startQpc, long deltaQpc) in candidates.OrderByDescending(c => c.DeltaQpc).Take(keep))
|
||||
{
|
||||
double at = (startQpc - origin) / (double)qpcFrequency;
|
||||
double ms = deltaQpc * 1000.0 / qpcFrequency;
|
||||
double? nearest = null;
|
||||
foreach (long t in touchQpc)
|
||||
{
|
||||
// Distance from the touch to the interval [start, start + delta]: 0 when inside.
|
||||
double d = t < startQpc ? (t - startQpc) / (double)qpcFrequency
|
||||
: t > startQpc + deltaQpc ? (t - (startQpc + deltaQpc)) / (double)qpcFrequency
|
||||
: 0.0;
|
||||
if (nearest is null || Math.Abs(d) < Math.Abs(nearest.Value))
|
||||
{
|
||||
nearest = d;
|
||||
}
|
||||
}
|
||||
|
||||
stalls.Add(new Stall(at, ms, nearest));
|
||||
}
|
||||
}
|
||||
|
||||
return new StallReport { Longest = stalls, OverThreshold = over, Intervals = intervals, Touches = touchQpc.Count };
|
||||
}
|
||||
|
||||
/// <summary>The report lines. A diagnostic, and it names itself as one.</summary>
|
||||
public string Describe()
|
||||
{
|
||||
if (Intervals == 0)
|
||||
{
|
||||
return " stalls: no interval to read (fewer than two presents)";
|
||||
}
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(" stalls (diagnostic, not 03_METRICS' stutter): ").Append(Num(OverThreshold))
|
||||
.Append(" interval(s) of ").Append(Num(Intervals)).Append(" at or over ")
|
||||
.Append(Ms(StallThresholdMs)).Append("; host touches (guard scan + module snapshot): ").Append(Num(Touches));
|
||||
foreach (Stall s in Longest)
|
||||
{
|
||||
sb.AppendLine();
|
||||
sb.Append(" longest: ").Append(Ms(s.Milliseconds)).Append(" at t=").Append(Sec(s.AtSeconds)).Append(" — ");
|
||||
if (s.NearestTouchSeconds is not double d)
|
||||
{
|
||||
sb.Append("no host touch recorded");
|
||||
}
|
||||
else if (s.NearATouch)
|
||||
{
|
||||
sb.Append("A HOST TOUCH ").Append(d == 0 ? "INSIDE the interval" : (Math.Abs(d).ToString("0.00", CultureInfo.InvariantCulture) + " s "
|
||||
+ (d < 0 ? "before" : "after") + " it"))
|
||||
.Append(" — FrameLedger is a SUSPECT for this one; re-run with a longer --seconds and see whether it recurs on the 30 s cadence");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append("nearest host touch ").Append(Math.Abs(d).ToString("0.0", CultureInfo.InvariantCulture)).Append(" s away — not ours");
|
||||
}
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private static string Num(long v) => v.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
private static string Ms(double v) => v.ToString("0.#", CultureInfo.InvariantCulture) + " ms";
|
||||
|
||||
private static string Sec(double v) => v.ToString("0.00", CultureInfo.InvariantCulture) + " s";
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
using FrameLedger.Shared;
|
||||
|
||||
namespace FrameLedger.CaptureHost.Consume;
|
||||
|
||||
/// <summary>
|
||||
/// The render → output extent a session ran at, taken as the MODAL tuple over the records
|
||||
/// that claim <see cref="FlMeasured.UpscalerParams"/> and carry an output size.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>Two measurements, one piece of arithmetic.</b> <c>renderW/H</c> come off the upscaler's own
|
||||
/// dispatch (Streamline's scaling-input tag, or the ffx-api descriptor's <c>renderSize</c>) and
|
||||
/// <c>outputW/H</c> off the swapchain the present hook read; the ratio is <c>03_METRICS</c>
|
||||
/// §Upscaling's <c>sqrt((outW×outH)/(renW×renH))</c>, and the render scale is its reciprocal as
|
||||
/// a percentage. Measured on Cyberpunk 2077 at <c>DLSS = Balanced</c>: 1485×835 against 2560×1440
|
||||
/// is 1.72× and 58%, which is a number a writer that hardcoded a plausible resolution could not
|
||||
/// have produced.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>Modal, not mean, and the count of distinct tuples is published beside it.</b> Averaging
|
||||
/// across a settings change or a dynamic-resolution swing is the classic way a benchmark number
|
||||
/// stops meaning anything (<c>03_METRICS</c> §Upscaling, segments); until P2's segmenter cuts the
|
||||
/// session, the throwaway consumer reports the tuple most records ran at and says how many others
|
||||
/// it saw.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
internal sealed record UpscaleExtent
|
||||
{
|
||||
public required ushort RenderW { get; init; }
|
||||
|
||||
public required ushort RenderH { get; init; }
|
||||
|
||||
public required ushort OutputW { get; init; }
|
||||
|
||||
public required ushort OutputH { get; init; }
|
||||
|
||||
/// <summary>Records that ran at exactly this tuple.</summary>
|
||||
public required int Records { get; init; }
|
||||
|
||||
/// <summary>Records in the window that carried both sizes, whatever their tuple.</summary>
|
||||
public required int Measured { get; init; }
|
||||
|
||||
/// <summary>Distinct (render, output) tuples in the window. More than 1 means the settings moved.</summary>
|
||||
public required int DistinctGroups { get; init; }
|
||||
|
||||
/// <summary><c>sqrt((outW×outH)/(renW×renH))</c>.</summary>
|
||||
public double Ratio => Math.Sqrt((double)OutputW * OutputH / ((double)RenderW * RenderH));
|
||||
|
||||
/// <summary>The per-axis render scale as a percentage — <c>100 / Ratio</c>.</summary>
|
||||
public double RenderScalePercent => 100.0 / Ratio;
|
||||
|
||||
/// <summary>The dominant extent over the identity-claiming window, or null when no record in it carried both sizes.</summary>
|
||||
/// <remarks>
|
||||
/// <b>The window is the IDENTITY suffix, not the params suffix — measured 2026-09-05 on every
|
||||
/// frame-generation run.</b> The writer publishes <see cref="FlMeasured.UpscalerParams"/> only on
|
||||
/// the present that DRAINED a dispatch or tag, which under frame generation is one present in N;
|
||||
/// the other N−1 carry the identity bit and an honest zero. <see cref="RecordWindow.ClaimedSuffixStart"/>
|
||||
/// demands a clean suffix in which every record claims the bit, so keyed on params it returned
|
||||
/// "no window" for every FG-on capture — Cyberpunk at FSR 3 + FG printed <c>render -> output: N/A</c>
|
||||
/// two lines under its own raw block reading <c>render 1506x847 on 4332 record(s)</c>, and the
|
||||
/// 2026-09-04 build's "not computed yet" wording had hidden it. The identity bit IS per-record once
|
||||
/// its family is live (both routes set it on every present), so it is the install window; inside
|
||||
/// it, every record that carries both sizes counts, whichever present it landed on.
|
||||
/// </remarks>
|
||||
public static UpscaleExtent? From(IReadOnlyList<FlFrameRecord> stream)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(stream);
|
||||
|
||||
int start = RecordWindow.ClaimedSuffixStart(
|
||||
stream, static r => ((FlMeasured)r.MeasuredMask).HasFlag(FlMeasured.Upscaler));
|
||||
if (start == stream.Count)
|
||||
{
|
||||
// No identity window: fall back to the params bit itself, which is what a
|
||||
// params-only writer would publish per record.
|
||||
start = RecordWindow.ClaimedSuffixStart(
|
||||
stream, static r => ((FlMeasured)r.MeasuredMask).HasFlag(FlMeasured.UpscalerParams));
|
||||
}
|
||||
|
||||
if (start == stream.Count)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var groups = new Dictionary<(ushort, ushort, ushort, ushort), int>();
|
||||
int measured = 0;
|
||||
for (int i = start; i < stream.Count; i++)
|
||||
{
|
||||
FlFrameRecord r = stream[i];
|
||||
var mask = (FlMeasured)r.MeasuredMask;
|
||||
// BOTH bits, not just the values: a value set while its bit is clear is the writer's
|
||||
// defect (IsHonest counts it), and this must not quietly average it in.
|
||||
if (!mask.HasFlag(FlMeasured.UpscalerParams) || !mask.HasFlag(FlMeasured.OutputRes)
|
||||
|| r.RenderW == 0 || r.RenderH == 0 || r.OutputW == 0 || r.OutputH == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
measured++;
|
||||
(ushort, ushort, ushort, ushort) key = (r.RenderW, r.RenderH, r.OutputW, r.OutputH);
|
||||
groups[key] = groups.GetValueOrDefault(key) + 1;
|
||||
}
|
||||
|
||||
if (measured == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
KeyValuePair<(ushort, ushort, ushort, ushort), int> modal = groups.MaxBy(static g => g.Value);
|
||||
return new UpscaleExtent
|
||||
{
|
||||
RenderW = modal.Key.Item1,
|
||||
RenderH = modal.Key.Item2,
|
||||
OutputW = modal.Key.Item3,
|
||||
OutputH = modal.Key.Item4,
|
||||
Records = modal.Value,
|
||||
Measured = measured,
|
||||
DistinctGroups = groups.Count,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -83,4 +83,21 @@
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\FrameLedger.Rules.targets" />
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\FrameLedger.Overlay.targets" />
|
||||
|
||||
<!--
|
||||
fl-probe-nvapi.exe beside the host, the way the Overlay is: NgxDriverProbe spawns it
|
||||
by absolute path from AppContext.BaseDirectory and reports ProbeMissing rather than
|
||||
searching. Warn-not-fail for the same reason the Overlay targets do: build.ps1 runs
|
||||
the native build first. UNSHIPPED with this host; the Agent would call NVAPI through
|
||||
Infrastructure, not a child process.
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<FlNativeProbeDir>$(MSBuildThisFileDirectory)..\..\build\native\x64-release\tools\fl-probe-nvapi\</FlNativeProbeDir>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="$(FlNativeProbeDir)fl-probe-nvapi.exe" Condition="Exists('$(FlNativeProbeDir)fl-probe-nvapi.exe')">
|
||||
<Link>fl-probe-nvapi.exe</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -10,6 +10,7 @@
|
||||
// flag on a shipped one.
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using FrameLedger.Application.AntiCheat;
|
||||
using FrameLedger.Application.Consent;
|
||||
using FrameLedger.Application.Rules;
|
||||
@@ -183,12 +184,16 @@ internal static class Program
|
||||
// and refuses outright when the span holds more than one stream.
|
||||
FgWindow fg = FgWindow.From(result.Records, Stopwatch.Frequency);
|
||||
MeasuredFacts facts = MeasuredFacts.From(
|
||||
dominant, result.WriterState, Stopwatch.Frequency, result.TotalGaps, result.TotalDropped, fg);
|
||||
dominant, result.WriterState, Stopwatch.Frequency, result.TotalGaps, result.TotalDropped, fg,
|
||||
result.RuntimeModules, result.NgxDriver);
|
||||
|
||||
HostConsole.Line($" guard ticks published: {result.GuardTicksPublished}");
|
||||
HostConsole.Line($" records: {result.Records.Count} ({dominant.Count} on the dominant stream), " +
|
||||
$"{segments.Count} segment(s), gaps {result.TotalGaps}, dropped {result.TotalDropped}");
|
||||
HostConsole.Line(FocusNote(result));
|
||||
// The longest raw intervals, placed against the moments this host touched the target: the
|
||||
// owner saw a one-second drop to 1 FPS under capture and nothing here could say whose it was.
|
||||
HostConsole.Line(StallReport.From(dominant, Stopwatch.Frequency, result.TouchQpc).Describe());
|
||||
|
||||
// WHICH HOOKS THE WRITER ACTUALLY INSTALLED, and it is not cosmetic.
|
||||
//
|
||||
@@ -201,12 +206,7 @@ internal static class Program
|
||||
int withParams = dominant.Count(r => ((FlMeasured)r.MeasuredMask).HasFlag(FlMeasured.UpscalerParams));
|
||||
HostConsole.Line($" hooks installed: {(FlHookFamily)result.WriterState.HooksInstalledMask}" +
|
||||
$" apiMask=0x{result.WriterState.ApiMask:X} rtTier={result.WriterState.RtTier}");
|
||||
// The census, raw and named, beside the hooks: a real-title run has to be able to say
|
||||
// which module names the loader answered for, not just which qualifier was chosen.
|
||||
var census = (FlRuntimeCensus)result.WriterState.RuntimeCensus;
|
||||
HostConsole.Line($" runtime census: 0x{result.WriterState.RuntimeCensus:X} ran={census.HasFlag(FlRuntimeCensus.Ran)} " +
|
||||
$"fg=[{CensusNames.Describe(census & FlRuntimeCensusFamilies.Fg)}] " +
|
||||
$"upscaler=[{CensusNames.Describe(census & FlRuntimeCensusFamilies.Upscaler)}]");
|
||||
PrintCensus(result);
|
||||
|
||||
HostConsole.Line(WriterNote(result));
|
||||
HostConsole.Line($" records carrying Upscaler={withUpscaler}/{dominant.Count} " +
|
||||
@@ -232,6 +232,64 @@ internal static class Program
|
||||
HostConsole.Line(SessionReport.Render(facts));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The census, raw and named, beside the hooks — a real-title run has to be able to say which
|
||||
/// module names the loader answered for, not just which qualifier was chosen — and then the same
|
||||
/// modules with their FILE versions and paths, from outside the process: the census cannot tell
|
||||
/// 2.7.1 from 2.8.0, and §H5 case 3 turns on exactly that. A path under the driver store rather
|
||||
/// than the game directory is how a DLSS override shows up here.
|
||||
/// </summary>
|
||||
private static void PrintCensus(CaptureResult result)
|
||||
{
|
||||
var census = (FlRuntimeCensus)result.WriterState.RuntimeCensus;
|
||||
HostConsole.Line($" runtime census: 0x{result.WriterState.RuntimeCensus:X} ran={census.HasFlag(FlRuntimeCensus.Ran)} " +
|
||||
$"fg=[{CensusNames.Describe(census & FlRuntimeCensusFamilies.Fg)}] " +
|
||||
$"upscaler=[{CensusNames.Describe(census & FlRuntimeCensusFamilies.Upscaler)}]");
|
||||
PrintRuntimeModules(result.RuntimeModules);
|
||||
// The driver's own word on this process, out of process: the super-resolution identity the
|
||||
// hooks cannot see on NGX-direct titles (03_METRICS §Upscaling, the driver-reported rung).
|
||||
HostConsole.Line(result.NgxDriver.Describe());
|
||||
// Which Streamline buffer types the title tagged, on which route: the identity half of
|
||||
// frame generation (fl_shm.h §slTagCensus). A DLSS-G title tags hudless and UI every
|
||||
// frame; a super-resolution-only title tags neither.
|
||||
HostConsole.Line($" Streamline tag census: 0x{result.WriterState.SlTagCensus:X} " +
|
||||
SlTagCensusNames.DescribeRoutes(result.WriterState.SlTagCensus));
|
||||
// DXGI's own present counter against this hook's, on the hooked chain(s): the in-process
|
||||
// answer to whether a pacer's generated presents are DXGI presents this hook misses (§H5).
|
||||
HostConsole.Line(DxgiCounterNote(result.WriterState));
|
||||
}
|
||||
|
||||
/// <summary>DXGI's counter against ours, and what a ratio means; never a count of anything by itself.</summary>
|
||||
private static string DxgiCounterNote(FlWriterState writer)
|
||||
{
|
||||
if (writer.DxgiPresentSamples == 0)
|
||||
{
|
||||
return " DXGI present counter: not read (no hooked present sampled it)";
|
||||
}
|
||||
|
||||
double per = writer.DxgiPresentsUnseen / (double)writer.DxgiPresentSamples;
|
||||
string reading = writer.DxgiPresentsUnseen == 0
|
||||
? "DXGI counted nothing this hook did not: frame generation was off, or whatever generates frames on this title presents below DXGI or on another object"
|
||||
: per >= 0.5
|
||||
? "DXGI counted presents this hook never saw on the SAME chain - a pacer presenting through a body the inline patches do not cover; the generated presents ARE DXGI presents here and Displayed above is DXGI-counted from them"
|
||||
: "a few presents reached DXGI outside this hook - too few for a pacer, read the number rather than the ratio";
|
||||
return $" DXGI present counter: unseen={writer.DxgiPresentsUnseen} over samples={writer.DxgiPresentSamples} " +
|
||||
$"({per.ToString("0.00", CultureInfo.InvariantCulture)} unseen per hooked present) - {reading}";
|
||||
}
|
||||
|
||||
/// <summary>One line per census-named module the target had loaded, version and path beside it.</summary>
|
||||
private static void PrintRuntimeModules(RuntimeModuleSet modules)
|
||||
{
|
||||
HostConsole.Line($" runtime modules: {modules.Modules.Count} of {CensusNames.ModuleFileNames.Count} " +
|
||||
$"census-named modules resolved over {modules.Snapshots} snapshot(s), " +
|
||||
$"{modules.Unreadable} unreadable");
|
||||
foreach (RuntimeModuleInfo m in modules.Modules.OrderBy(m => m.FileName, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
string version = m.Parsed?.ToString() ?? "(no version resource)";
|
||||
HostConsole.Line($" module: {m.FileName} {version} {m.Path}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Which vendor dispatches actually arrived, one census per vendor route.</summary>
|
||||
/// <remarks>
|
||||
/// The Streamline census is §S30's "print them first". The AMD census is the second count
|
||||
@@ -272,7 +330,9 @@ internal static class Program
|
||||
// --seconds is an operator taking a bounded measurement, and CaptureLoop
|
||||
// already honoured MaxDuration -- nothing could set it.
|
||||
MaxDuration = seconds > 0 ? TimeSpan.FromSeconds(seconds) : TimeSpan.Zero,
|
||||
});
|
||||
},
|
||||
pid => RuntimeModuleSnapshot.Take(pid, CensusNames.ModuleFileNames),
|
||||
NgxDriverProbe.Run);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -289,6 +289,51 @@ public enum FlRuntimeCensus : uint
|
||||
AmdFfxDx12 = 1u << 18,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mirror of <c>FlSlTagType</c>: the Streamline buffer types the tag detours and the local inputs walk record, as
|
||||
/// bits within one route's field of <see cref="FlWriterState.SlTagCensus"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <b>The identity half of frame generation, from an argument already hooked.</b> Streamline's DLSS-G programming
|
||||
/// guide §5.0 requires a title running DLSS Frame Generation to tag the HUD-less colour and UI buffers every frame
|
||||
/// through <c>slSetTag</c> / <c>slSetTagForFrame</c> / <c>slEvaluateFeature</c>'s inputs; a title running
|
||||
/// super-resolution alone never tags them. So <see cref="DlssgInputs"/> tagged says the title is FEEDING frame
|
||||
/// generation — identity, never a count: whether frames were generated stays the count's verdict.
|
||||
/// </remarks>
|
||||
[Flags]
|
||||
public enum FlSlTagType : uint
|
||||
{
|
||||
None = 0,
|
||||
Depth = 1u << 0,
|
||||
MotionVectors = 1u << 1,
|
||||
Hudless = 1u << 2,
|
||||
ScalingInput = 1u << 3,
|
||||
ScalingOutput = 1u << 4,
|
||||
UiColorAlpha = 1u << 5,
|
||||
UiAlpha = 1u << 6,
|
||||
Backbuffer = 1u << 7,
|
||||
Other = 1u << 8,
|
||||
|
||||
/// <summary>Mirror of <c>FL_SL_TAG_DLSSG_INPUTS</c>: the buffers only DLSS Frame Generation consumes.</summary>
|
||||
DlssgInputs = Hudless | UiColorAlpha | UiAlpha,
|
||||
}
|
||||
|
||||
/// <summary>Mirror of the <c>FL_SL_TAG_ROUTE_*</c> shifts and the per-route width.</summary>
|
||||
public static class FlSlTagRoute
|
||||
{
|
||||
public const int TypeBits = 9;
|
||||
public const uint TypeMask = (1u << TypeBits) - 1u;
|
||||
public const int Global = 0;
|
||||
public const int Frame = TypeBits;
|
||||
public const int Local = 2 * TypeBits;
|
||||
|
||||
/// <summary>The <see cref="FlSlTagType"/> bits one route contributed to a census word.</summary>
|
||||
public static FlSlTagType Of(uint census, int route) => (FlSlTagType)((census >> route) & TypeMask);
|
||||
|
||||
/// <summary>The union of every route's bits.</summary>
|
||||
public static FlSlTagType Any(uint census) => Of(census, Global) | Of(census, Frame) | Of(census, Local);
|
||||
}
|
||||
|
||||
/// <summary>The two groups of <see cref="FlRuntimeCensus"/>, mirroring <c>FL_CENSUS_FG_FAMILIES</c> and <c>FL_CENSUS_UPSCALER_FAMILIES</c>.</summary>
|
||||
public static class FlRuntimeCensusFamilies
|
||||
{
|
||||
@@ -408,7 +453,14 @@ public enum FlMeasured : ushort
|
||||
/// </summary>
|
||||
FgCounts = 1 << 10,
|
||||
|
||||
// Bits 11-15 reserved. Writers leave them zero; readers IGNORE them rather than validating them as
|
||||
/// <summary>
|
||||
/// <c>dxgiUnseen</c> (2026-09-05, <c>20_OPEN_QUESTIONS</c> §H5 row P1-DXGI): the present hook read
|
||||
/// <c>IDXGISwapChain::GetLastPresentCount</c> at this present and at the previous hooked present on the
|
||||
/// same chain, so the byte is a measurement, a zero included. Clear on a chain's first hooked present.
|
||||
/// </summary>
|
||||
DxgiPresents = 1 << 11,
|
||||
|
||||
// Bits 12-15 reserved. Writers leave them zero; readers IGNORE them rather than validating them as
|
||||
// zero. That does NOT make a future field bump-free — recordSize and layoutVersion are compared
|
||||
// first, so an old reader refuses a new writer outright.
|
||||
}
|
||||
@@ -495,8 +547,25 @@ public unsafe struct FlWriterState
|
||||
/// <summary><see cref="FlRuntimeCensus"/> bits. Watchdog-published, OR-only. Took <c>reserved[0]</c> on 2026-09-03.</summary>
|
||||
public uint RuntimeCensus;
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="FlSlTagType"/> bits per route (<see cref="FlSlTagRoute"/>): which Streamline buffer types the
|
||||
/// title tagged, on which of the three tag routes. Watchdog-published, OR-only. Took <c>reserved[0]</c> on
|
||||
/// 2026-09-05 the way <see cref="RuntimeCensus"/> took it — additive, no layout bump.
|
||||
/// </summary>
|
||||
public uint SlTagCensus;
|
||||
|
||||
/// <summary>
|
||||
/// Presents DXGI's own counter (<c>IDXGISwapChain::GetLastPresentCount</c>) recorded between two consecutive
|
||||
/// hooked presents on the same chain, beyond the one the hook saw — presents that reached DXGI through a body
|
||||
/// the inline patches do not cover. Watchdog-published. Took <c>reserved[0]</c> on 2026-09-05.
|
||||
/// </summary>
|
||||
public uint DxgiPresentsUnseen;
|
||||
|
||||
/// <summary>Hooked presents on which the DXGI counter was read. Took <c>reserved[1]</c> on 2026-09-05.</summary>
|
||||
public uint DxgiPresentSamples;
|
||||
|
||||
/// <summary>Must be zero; room for additive fields.</summary>
|
||||
public fixed uint Reserved[5];
|
||||
public fixed uint Reserved[2];
|
||||
|
||||
// WHY THE COUNTERS ARE PUBLISHED AT 1 Hz AND NOT ACCUMULATED HERE PER FRAME: this struct is
|
||||
// region 2, which the Overlay writes on the present path, and the regions are separate cache lines
|
||||
@@ -536,7 +605,7 @@ public unsafe struct FlControlBlock
|
||||
|
||||
/// <summary>Region 4 — the ring. Exactly 64 bytes, no implicit padding.</summary>
|
||||
[StructLayout(LayoutKind.Sequential, Size = 64)]
|
||||
public struct FlFrameRecord
|
||||
public unsafe struct FlFrameRecord
|
||||
{
|
||||
/// <summary>Present entry timestamp.</summary>
|
||||
public ulong Qpc;
|
||||
@@ -626,8 +695,18 @@ public struct FlFrameRecord
|
||||
/// <summary>0 = unavailable.</summary>
|
||||
public uint ReflexLatencyUs;
|
||||
|
||||
/// <summary>
|
||||
/// Presents DXGI's own counter recorded on this record's chain since the previous hooked present, beyond
|
||||
/// that one — the per-present form of <see cref="FlWriterState.DxgiPresentsUnseen"/>, under
|
||||
/// <see cref="FlMeasured.DxgiPresents"/>. Measured 2.90 / 2.95 per hooked present on Dying Light: The
|
||||
/// Beast (Streamline 2.8.0, DLSS FG ×4) and 0 on Streamline 2.7.3 and 2.10.3 titles, so on that shape
|
||||
/// the generated presents ARE DXGI presents and the consumer counts <c>Displayed = hooked + this</c>,
|
||||
/// labelled DXGI-COUNTED. Saturates at 255, which the consumer refuses as a sentinel.
|
||||
/// </summary>
|
||||
public byte DxgiUnseen;
|
||||
|
||||
/// <summary>Must be zero. Slack, so the next addition does not start from none.</summary>
|
||||
public uint Reserved;
|
||||
public fixed byte Reserved[3];
|
||||
|
||||
/// <summary>
|
||||
/// Seqlock counter. Monotonic per slot and NEVER reset, so a full lap of the ring always changes it —
|
||||
|
||||
@@ -26,7 +26,7 @@ add_library(FrameLedger.Overlay SHARED src/dllmain.cpp)
|
||||
# fails to load in every game that ships no such module, in the loader, silently.
|
||||
# hookinventory-check Pass C reads the built DLL's import AND export tables.
|
||||
target_link_libraries(FrameLedger.Overlay PRIVATE FrameLedger.Shm fl_dxgi_vtable fl_native_flags fl_hostile_env_flags minhook
|
||||
fl_streamline_headers fl_fidelityfx_headers
|
||||
fl_streamline_headers fl_fidelityfx_headers fl_fsr3_host_headers
|
||||
Advapi32 d3d11 d3d12 dxgi)
|
||||
set_target_properties(FrameLedger.Overlay PROPERTIES OUTPUT_NAME "FrameLedger.Overlay")
|
||||
|
||||
|
||||
@@ -202,6 +202,38 @@ static_assert(kFamilyFfxDispatch != kFamilyEvaluateFeature &&
|
||||
"InstallByFamily binds a row by EQUALITY on this value -- a collision would hand a Streamline detour "
|
||||
"body to an AMD export, which is the neighbour's-body defect the installer exists to stop");
|
||||
|
||||
// --- AMD FidelityFX, the FSR 3.0 HOST API (2026-09-05, the route HANDOFF 7c deferred) ---
|
||||
//
|
||||
// Cyberpunk 2077 at FSR 3 upscales through ffx_fsr3_x64.dll's NAMED exports -- the
|
||||
// SDK 1.0.x host API, tag fsr3-v3.0.4 -- while its frame generation goes through the
|
||||
// 1.1.x monolith's ffxDispatch above. Measured 2026-09-04: `FsrFg` printed, `upscaler:
|
||||
// N/A`. One row, ffxFsr3ContextDispatchUpscale, whose descriptor carries renderSize
|
||||
// at an offset the vendored header vouches for; identity is FSR3 as a fact (the 3.0
|
||||
// host hosts nothing else) and the UPSCALE count feeds the SAME drain word the
|
||||
// ffx-api rows feed.
|
||||
//
|
||||
// THE SAME FAMILY VALUE AS THE ffx-api ROWS, ON PURPOSE. The row's UPSCALE goes into
|
||||
// g_ffxSeen's count, which RecordPresent drains into fgEvaluations when Streamline has
|
||||
// never issued a token and no PREPARE ever arrived -- so a row claiming IDENTITY|PARAMS
|
||||
// alone would feed a field its family does not entitle, and every record on a
|
||||
// host-only title would be an honesty violation. The installer's ffx arm binds on the
|
||||
// family and then keys on the MODULE (FfxLeafOf for the four ffxDispatch modules, this
|
||||
// name for the host), exactly as the params arm keys on the symbol -- so the equality
|
||||
// collision the asserts above forbid between DIFFERENT detour bodies is not one here:
|
||||
// one family, one publish point (PublishFfxFamilyIfWhole), one live latch.
|
||||
//
|
||||
// ffxFsr3DispatchFrameGeneration IS NOT A ROW. On the one title that ships the host
|
||||
// DLLs, frame generation is dispatched through the monolith's ffxDispatch (4261
|
||||
// FRAMEGENERATION batches, 2026-09-04) and the count comes from Streamline tokens; the
|
||||
// host's FG export fires per GENERATED batch, so it is not a count producer either.
|
||||
// It becomes a row only if a title appears generating through the host DLL with no
|
||||
// monolith in the census -- `Active (technology not identified)` beside
|
||||
// FL_CENSUS_FFX_FSR3. Pre-committed in 20_OPEN_QUESTIONS §H11.
|
||||
inline constexpr uint32_t kFamilyFsr3Host = kFamilyFfxDispatch;
|
||||
static_assert(kFamilyFsr3Host == kFamilyFfxDispatch,
|
||||
"one family, one publish point, one live latch: the host row shares the ffx-api rows' drain word and "
|
||||
"must share their claims, or fgEvaluations would be fed by a row that does not claim FG_EVALUATIONS");
|
||||
|
||||
// The leaves, in the order dllmain's per-leaf trampoline and latch arrays are indexed.
|
||||
enum FfxLeaf : uint32_t {
|
||||
kFfxLeafMonolith = 0, // amd_fidelityfx_dx12.dll -- SDK 1.1.x, FSR 3.1 only
|
||||
@@ -279,14 +311,60 @@ inline int FfxLeafOf(const wchar_t* module) noexcept {
|
||||
// because Pass A's parser reads literals; the static_asserts under the table bind
|
||||
// these spellings to kFfxLeafModules in both directions, so neither list can gain or
|
||||
// lose a module alone.
|
||||
// TWO ROWS, ONE FAMILY, TWO DETOURS -- the params family has a second row since
|
||||
// 2026-09-04. Streamline 2.8 (Dying Light: The Beast ships 2.8.0) deprecates slSetTag
|
||||
// in favour of slSetTagForFrame, which takes the frame token first and the same tag
|
||||
// list after; a 2.8 title that tags per frame never calls slSetTag, and the first
|
||||
// title measured on 2.8 published DLSS identity on 4,575 of 4,575 batches with
|
||||
// UpscalerParams on ZERO of them. The two rows share the family bit because they
|
||||
// produce the same fields from the same ResourceTag list; the installer tells them
|
||||
// apart by SYMBOL (kSymbolSlSetTagForFrame below), never by family, because their
|
||||
// signatures differ and the neighbour's body would read a FrameToken as a viewport.
|
||||
// And the family is published WHEN WHOLE -- once every one of these two symbols the
|
||||
// loaded interposer exports is patched -- not on the first row: published on the
|
||||
// first, it entitled records the second row was not yet producing (measured 38 of
|
||||
// 41 on the frame-based fixture), which is the ffx leaves' defect from #110 again.
|
||||
#define FL_HOOK_INVENTORY(X) \
|
||||
X(L"sl.interposer.dll", "slEvaluateFeature", fl::inventory::kFamilyEvaluateFeature) \
|
||||
X(L"sl.interposer.dll", "slSetTag", fl::FL_HOOK_UPSCALER_PARAMS) \
|
||||
X(L"sl.interposer.dll", "slSetTagForFrame", fl::FL_HOOK_UPSCALER_PARAMS) \
|
||||
X(L"sl.interposer.dll", "slGetNewFrameToken", fl::FL_HOOK_FG_EVALUATIONS) \
|
||||
X(L"amd_fidelityfx_dx12.dll", "ffxDispatch", fl::inventory::kFamilyFfxDispatch) \
|
||||
X(L"amd_fidelityfx_upscaler_dx12.dll", "ffxDispatch", fl::inventory::kFamilyFfxDispatch) \
|
||||
X(L"amd_fidelityfx_framegeneration_dx12.dll", "ffxDispatch", fl::inventory::kFamilyFfxDispatch) \
|
||||
X(L"amd_fidelityfx_loader_dx12.dll", "ffxDispatch", fl::inventory::kFamilyFfxDispatch)
|
||||
X(L"amd_fidelityfx_loader_dx12.dll", "ffxDispatch", fl::inventory::kFamilyFfxDispatch) \
|
||||
X(L"ffx_fsr3_x64.dll", "ffxFsr3ContextDispatchUpscale", fl::inventory::kFamilyFsr3Host)
|
||||
|
||||
// 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.
|
||||
inline constexpr const wchar_t* kModuleFfxFsr3Host = L"ffx_fsr3_x64.dll";
|
||||
inline constexpr const char* kSymbolFfxFsr3DispatchUpscale = "ffxFsr3ContextDispatchUpscale";
|
||||
|
||||
// The module and the two symbols dllmain's params arm keys on: the frame-based
|
||||
// symbol picks the detour, and all three name what "whole" means when the family is
|
||||
// published. Named constants HERE, because Pass B forbids the symbol literals
|
||||
// anywhere else in the Overlay -- and bound to the table below, so a row and the
|
||||
// arm that installs it cannot drift apart.
|
||||
inline constexpr const wchar_t* kModuleSlInterposer = L"sl.interposer.dll";
|
||||
inline constexpr const char* kSymbolSlSetTag = "slSetTag";
|
||||
inline constexpr const char* kSymbolSlSetTagForFrame = "slSetTagForFrame";
|
||||
|
||||
constexpr bool InventoryHasRow(const wchar_t* module, const char* symbol) noexcept {
|
||||
#define FL_ROW_HAS(mod, sym, family) \
|
||||
if (SameW(mod, module) && SameA(sym, symbol)) { \
|
||||
return true; \
|
||||
}
|
||||
FL_HOOK_INVENTORY(FL_ROW_HAS)
|
||||
#undef FL_ROW_HAS
|
||||
return false;
|
||||
}
|
||||
static_assert(InventoryHasRow(kModuleSlInterposer, kSymbolSlSetTag),
|
||||
"the params arm keys on slSetTag by this constant, and the table no longer has that row");
|
||||
static_assert(InventoryHasRow(kModuleSlInterposer, kSymbolSlSetTagForFrame),
|
||||
"the params arm keys on slSetTagForFrame by this constant, and the table no longer has that row");
|
||||
static_assert(InventoryHasRow(kModuleFfxFsr3Host, kSymbolFfxFsr3DispatchUpscale),
|
||||
"the ffx arm keys on the FSR 3.0 host row by these constants, and the table no longer has that row");
|
||||
|
||||
// THE LEAF TABLE AND THE ROWS ARE BOUND TO EACH OTHER AT COMPILE TIME, BOTH WAYS.
|
||||
// A leaf without a row would be a trampoline slot nothing installs into; a row
|
||||
@@ -336,6 +414,13 @@ static_assert(AnyRowNames(kFfxLoaderModule),
|
||||
"amd_fidelityfx_loader_dx12.dll is the game's entry on a loader-shipping title (Dying Light: The "
|
||||
"Beast, KCD2, Wukong measured 2026-09-04: zero dispatches at any leaf export while FSR ran), so "
|
||||
"without a row those titles read N/A");
|
||||
// The host is NOT a leaf: it has no ffxDispatch, its own detour body, its own latch.
|
||||
// FfxLeafOf returning -1 for it is what routes the installer's ffx arm to the host
|
||||
// branch, so a leaf-table entry for it would hand the host the ffxDispatch trampoline.
|
||||
static_assert(FfxLeafOfExact(kModuleFfxFsr3Host) < 0,
|
||||
"the FSR 3.0 host facade is not an ffxDispatch leaf; the installer keys it by module name");
|
||||
static_assert(!FfxDispatchRowExistsFor(kModuleFfxFsr3Host),
|
||||
"the host exports no ffxDispatch; a row claiming one would resolve nothing and install nothing");
|
||||
|
||||
// Does this module speak the Streamline 2 ABI the vendored headers describe?
|
||||
//
|
||||
@@ -405,6 +490,24 @@ inline bool SpeaksFfxApi(HMODULE h) noexcept {
|
||||
GetProcAddress(h, "ffxQuery") != nullptr && GetProcAddress(h, "ffxDispatch") != nullptr;
|
||||
}
|
||||
|
||||
// Does this module speak the FSR 3.0 HOST ABI the vendored fsr3-v3.0.4 headers describe?
|
||||
//
|
||||
// A NAME CHECK, like SpeaksFfxApi's, on four of the twelve ffxFsr3* names the shipped
|
||||
// module exports (docs/vendor-exports.json): the create, the one export hooked, the
|
||||
// frame-generation dispatch and SkipPresent -- the last two being the 3.0 host's own
|
||||
// and exported by no ffx-api module, so a 1.1.x monolith of the wrong NAME cannot pass.
|
||||
// Deliberately not a generation check: 3.0.3, 3.0.4 and 1.1.4 share the descriptor
|
||||
// prefix through renderSize, which is the only field read, and dllmain pins that
|
||||
// offset at compile time; a name a later generation ADDS is not evidence the field
|
||||
// moved. Probe-only names, never resolved into a row, never called; this file because
|
||||
// Pass B exempts exactly this file.
|
||||
inline bool SpeaksFsr3Host(HMODULE h) noexcept {
|
||||
return h != nullptr && GetProcAddress(h, "ffxFsr3ContextCreate") != nullptr &&
|
||||
GetProcAddress(h, "ffxFsr3ContextDispatchUpscale") != nullptr &&
|
||||
GetProcAddress(h, "ffxFsr3DispatchFrameGeneration") != nullptr &&
|
||||
GetProcAddress(h, "ffxFsr3SkipPresent") != nullptr;
|
||||
}
|
||||
|
||||
inline bool SpeaksExpectedAbi(const wchar_t* module, HMODULE h) noexcept {
|
||||
if (module == nullptr) {
|
||||
return false;
|
||||
@@ -412,6 +515,9 @@ inline bool SpeaksExpectedAbi(const wchar_t* module, HMODULE h) noexcept {
|
||||
if (_wcsicmp(module, L"sl.interposer.dll") == 0) {
|
||||
return SpeaksStreamline2(h);
|
||||
}
|
||||
if (_wcsicmp(module, kModuleFfxFsr3Host) == 0) {
|
||||
return SpeaksFsr3Host(h);
|
||||
}
|
||||
// THE AMD ARM, by leaf name, for the same reason the Streamline arm is by name:
|
||||
// the loader also exports all five and is not a leaf, so a prefix test would
|
||||
// approve a module the inventory deliberately does not hook.
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#define FRAMELEDGER_FL_SL_INPUTS_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <fl_shm.h>
|
||||
#include <sl.h>
|
||||
// AFTER sl.h, deliberately: sl_dlss.h has NO includes of its own -- verified on
|
||||
// the upstream file, its closure is empty -- and relies on sl.h having been
|
||||
@@ -51,11 +52,43 @@ inline constexpr uint32_t kMaxInputs = 32;
|
||||
// frozen game with our DLL in it.
|
||||
inline constexpr uint32_t kMaxChain = 8;
|
||||
|
||||
// Which FlSlTagType bit a Streamline BufferType maps to. Every type maps to SOMETHING
|
||||
// -- FL_SL_TAG_OTHER for the ones the census does not name -- so a tag list of any
|
||||
// content leaves a mark, and "no bits" can only mean "no tags".
|
||||
inline constexpr uint32_t TagTypeBit(sl::BufferType type) noexcept {
|
||||
switch (type) {
|
||||
case sl::kBufferTypeDepth:
|
||||
return fl::FL_SL_TAG_DEPTH;
|
||||
case sl::kBufferTypeMotionVectors:
|
||||
return fl::FL_SL_TAG_MOTION_VECTORS;
|
||||
case sl::kBufferTypeHUDLessColor:
|
||||
return fl::FL_SL_TAG_HUDLESS;
|
||||
case sl::kBufferTypeScalingInputColor:
|
||||
return fl::FL_SL_TAG_SCALING_INPUT;
|
||||
case sl::kBufferTypeScalingOutputColor:
|
||||
return fl::FL_SL_TAG_SCALING_OUTPUT;
|
||||
case sl::kBufferTypeUIColorAndAlpha:
|
||||
return fl::FL_SL_TAG_UI_COLOR_ALPHA;
|
||||
case sl::kBufferTypeUIAlpha:
|
||||
return fl::FL_SL_TAG_UI_ALPHA;
|
||||
case sl::kBufferTypeBackbuffer:
|
||||
return fl::FL_SL_TAG_BACKBUFFER;
|
||||
default:
|
||||
return fl::FL_SL_TAG_OTHER;
|
||||
}
|
||||
}
|
||||
static_assert(TagTypeBit(sl::kBufferTypeHUDLessColor) == fl::FL_SL_TAG_HUDLESS, "the DLSS-G input maps to its bit");
|
||||
static_assert(TagTypeBit(static_cast<sl::BufferType>(9999)) == fl::FL_SL_TAG_OTHER, "an unknown type still marks");
|
||||
|
||||
struct ScanResult {
|
||||
uint16_t renderW = 0;
|
||||
uint16_t renderH = 0;
|
||||
bool found = false;
|
||||
|
||||
// Every readable ResourceTag's type, as FlSlTagType bits -- the local route's
|
||||
// contribution to FlWriterState::slTagCensus and to the per-present DLSS-G mark.
|
||||
uint32_t tagTypes = 0;
|
||||
|
||||
// The vendor's own DLSSMode value, or 0xFF for "a hook ran and could not
|
||||
// tell". NEVER 0: fl_shm.h has no in-band "not measured" for
|
||||
// upscalerQuality, so 0 would publish DLSSMode::eMaxPerformance -- "DLSS
|
||||
@@ -105,6 +138,41 @@ inline bool IsReadableResourceTag(const sl::BaseStructure* s) noexcept {
|
||||
return IsReadable<sl::ResourceTag>(s);
|
||||
}
|
||||
|
||||
// The size a scaling-input tag states, from EITHER of the two places the vendor
|
||||
// struct can carry it. Shared by the local walk below and by the global-tag detours
|
||||
// (slSetTag, slSetTagForFrame), so the three routes cannot disagree about what a
|
||||
// tag says.
|
||||
//
|
||||
// 1. `extent` -- "the area of the tagged resource to use". Set by titles that
|
||||
// render into a buffer larger than the render resolution (dynamic resolution
|
||||
// on an output-sized target). Cyberpunk 2077 sets it: 1485x835.
|
||||
// 2. `resource->width/height` when the extent is ZERO. sl_core_types.h documents a
|
||||
// zero extent as "using the entire resource" and the Resource's own size as
|
||||
// "MANDATORY only when using Vulkan" -- so on D3D12 it MAY be filled and may not
|
||||
// be, and a filled one is the title's statement of the buffer's size, which for a
|
||||
// whole-resource tag IS the render resolution. Both are fields of the argument
|
||||
// the hooked API received (CLAUDE.md rule 4), nothing is dereferenced beyond the
|
||||
// struct the title passed, and the Resource is GUID-checked the way every other
|
||||
// Streamline structure is before a field is read.
|
||||
//
|
||||
// A tag with neither is the honest unknown fl_shm.h already defines for renderW/H:
|
||||
// reported as not-found rather than as a resolution of zero. Measured need: Dying
|
||||
// Light: The Beast (SL 2.8.0) published DLSS identity on every batch and no extent
|
||||
// from either global-tag route on four captures; the whole-resource shape is the
|
||||
// remaining reading the record can distinguish, and this is how it is tested.
|
||||
inline bool TagSize(const sl::ResourceTag& tag, uint32_t& w, uint32_t& h) noexcept {
|
||||
w = tag.extent.width;
|
||||
h = tag.extent.height;
|
||||
if (w == 0 || h == 0) {
|
||||
if (!IsReadable<sl::Resource>(tag.resource)) {
|
||||
return false;
|
||||
}
|
||||
w = tag.resource->width;
|
||||
h = tag.resource->height;
|
||||
}
|
||||
return w != 0 && h != 0 && w <= 0xFFFFu && h <= 0xFFFFu;
|
||||
}
|
||||
|
||||
// Find the extent a title tagged as the upscaler's INPUT colour buffer.
|
||||
//
|
||||
// kBufferTypeScalingInputColor is the render target the upscaler reads, so its
|
||||
@@ -114,9 +182,10 @@ inline bool IsReadableResourceTag(const sl::BaseStructure* s) noexcept {
|
||||
// A ZERO EXTENT IS NOT AN ERROR AND NOT A MEASUREMENT. sl_core_types.h documents
|
||||
// `extent` as "the area of the tagged resource to use (if using the entire
|
||||
// resource leave as null)", and it is a value member defaulting to all-zero. So
|
||||
// a title tagging whole resources yields 0, which is the in-band unknown
|
||||
// fl_shm.h already defines for renderW/H. Reported as not-found rather than as
|
||||
// a resolution of zero.
|
||||
// a title tagging whole resources yields 0 from the extent -- and TagSize then
|
||||
// reads the Resource's own declared size, which is the in-band unknown fl_shm.h
|
||||
// already defines for renderW/H when the title left that zero too. Reported as
|
||||
// not-found rather than as a resolution of zero.
|
||||
inline ScanResult FindScalingInputExtent(const sl::BaseStructure** inputs, uint32_t numInputs) noexcept {
|
||||
ScanResult out;
|
||||
if (inputs == nullptr || numInputs == 0) {
|
||||
@@ -142,17 +211,18 @@ inline ScanResult FindScalingInputExtent(const sl::BaseStructure** inputs, uint3
|
||||
// property of the title rather than of what it is doing.
|
||||
if (IsReadableResourceTag(s)) {
|
||||
const auto* tag = static_cast<const sl::ResourceTag*>(s);
|
||||
out.tagTypes |= TagTypeBit(tag->type);
|
||||
if (tag->type == sl::kBufferTypeScalingInputColor && !out.found) {
|
||||
const uint32_t w = tag->extent.width;
|
||||
const uint32_t h = tag->extent.height;
|
||||
if (w != 0 && h != 0 && w <= 0xFFFFu && h <= 0xFFFFu) {
|
||||
uint32_t w = 0;
|
||||
uint32_t h = 0;
|
||||
if (TagSize(*tag, w, h)) {
|
||||
out.renderW = static_cast<uint16_t>(w);
|
||||
out.renderH = static_cast<uint16_t>(h);
|
||||
out.found = true;
|
||||
}
|
||||
// Otherwise a whole-resource tag, or a size that cannot be a
|
||||
// render target. Keep looking: a title may chain several tags
|
||||
// and only one of them carries an extent.
|
||||
// Otherwise a whole-resource tag whose Resource states no size,
|
||||
// or a size that cannot be a render target. Keep looking: a title
|
||||
// may chain several tags and only one of them carries a size.
|
||||
}
|
||||
} else if (IsReadable<sl::DLSSOptions>(s) && !out.qualityFound) {
|
||||
// `mode` is the FIRST member of DLSSOptions and has been since
|
||||
|
||||
@@ -71,6 +71,19 @@
|
||||
#include <ffx_api.h>
|
||||
#include <ffx_framegeneration.h>
|
||||
#include <ffx_upscale.h>
|
||||
// The FSR 3.0 HOST API (tag fsr3-v3.0.4), the same rule again, for exactly two things:
|
||||
// FfxFsr3DispatchUpscaleDescription::renderSize and the type of the one export hooked.
|
||||
// FFX_API is __declspec(dllexport) with no switch at all at that tag; nothing here
|
||||
// defines or takes the address of a name, so nothing is exported, and Pass C's
|
||||
// forbidden-export pattern already covers ffxFsr3*. A separate tree from ffx-api's
|
||||
// (third_party/fidelityfx-fsr3/README.md), INCLUDED INSIDE A NAMESPACE: the two trees
|
||||
// each define a struct named FfxFrameGenerationConfig, and wrapping the include is the
|
||||
// one way to keep both headers verbatim in one TU. Legal C++: the entry points keep
|
||||
// their C linkage, so fsr3host::ffxFsr3ContextDispatchUpscale names the same function
|
||||
// the module exports, and every struct read here is still the vendor's declaration.
|
||||
namespace fsr3host {
|
||||
#include <FidelityFX/host/ffx_fsr3.h>
|
||||
} // namespace fsr3host
|
||||
|
||||
using namespace fl;
|
||||
|
||||
@@ -278,12 +291,18 @@ void NoteFault() noexcept {
|
||||
// ---------------------------------------------------------------------------
|
||||
constexpr size_t kMaxSwapChains = 16;
|
||||
|
||||
// The last GetLastPresentCount value read at a hooked present on this chain, and whether
|
||||
// one has been read at all (fl_shm.h §dxgiPresentsUnseen). Per chain, because the
|
||||
// counter is per chain.
|
||||
struct SwapChainSlot {
|
||||
void* ptr = nullptr;
|
||||
uint32_t id = 0;
|
||||
uint16_t outW = 0;
|
||||
uint16_t outH = 0;
|
||||
uint8_t api = FL_API_UNKNOWN;
|
||||
bool haveDxgiCount = false;
|
||||
uint32_t lastDxgiCount = 0;
|
||||
uint32_t dxgiEpoch = 0; // g_dxgiEpoch when lastDxgiCount was read; a mismatch means presents went by unrecorded
|
||||
};
|
||||
|
||||
// Ask the device whether it can ray-trace, once, and publish it as FlRtTier.
|
||||
@@ -716,6 +735,18 @@ std::atomic<uint32_t> g_upscalerParamsLive{0};
|
||||
using PFN_SlSetTag = ::PFun_slSetTag*;
|
||||
PFN_SlSetTag g_origSlSetTag = nullptr;
|
||||
|
||||
// The frame-based twin (Streamline 2.8: slSetTag is deprecated in favour of it).
|
||||
// Its own trampoline; and the two rows carry PATCHED flags of their own while the
|
||||
// family keeps ONE published latch (g_upscalerParamsLive), because the family is
|
||||
// published when whole -- PublishParamsFamilyIfWhole -- and not by whichever row
|
||||
// installed first. InstallRow's latch would have done both jobs wrongly: shared, the
|
||||
// first row would have claimed it and the second would never patch; separate, the
|
||||
// first row would have published a family the second was not yet producing.
|
||||
using PFN_SlSetTagForFrame = ::PFun_slSetTagForFrame*;
|
||||
PFN_SlSetTagForFrame g_origSlSetTagForFrame = nullptr;
|
||||
std::atomic<uint32_t> g_slSetTagPatched{0};
|
||||
std::atomic<uint32_t> g_slSetTagForFramePatched{0};
|
||||
|
||||
// The application-frame count (HANDOFF item 3, decided 2026-09-03). Streamline
|
||||
// hands a title one FrameToken per frame through slGetNewFrameToken, and a title
|
||||
// has to ask for it -- so the number of DISTINCT tokens handed out between two
|
||||
@@ -837,6 +868,40 @@ PFN_FfxDispatch g_origFfxDispatch[fl::inventory::kFfxLeafCount] = {};
|
||||
std::atomic<uint32_t> g_ffxPatched[fl::inventory::kFfxLeafCount] = {};
|
||||
std::atomic<uint32_t> g_ffxLive{0};
|
||||
|
||||
// --- The FSR 3.0 HOST API: ffx_fsr3_x64.dll!ffxFsr3ContextDispatchUpscale ----------
|
||||
//
|
||||
// The fifth AMD target, and NOT a leaf: a different export with a different signature,
|
||||
// hooked at its own address with its own trampoline and latch, feeding the SAME drain
|
||||
// word as the ffx-api UPSCALE arm -- so the count, the extent and the identity byte all
|
||||
// flow through the paths above unchanged, and PublishFfxFamilyIfWhole is its publish
|
||||
// point. Which source the last UPSCALE came from is recorded in g_ffxUpscaleLeaf as
|
||||
// leaf + 1; the host takes the value past every leaf.
|
||||
//
|
||||
// WHAT IS READ (CLAUDE.md rule 4): renderSize of the descriptor the title passed, and
|
||||
// nothing else -- never the context, never a resource, never the command list.
|
||||
using PFN_FfxFsr3ContextDispatchUpscale = decltype(&fsr3host::ffxFsr3ContextDispatchUpscale);
|
||||
PFN_FfxFsr3ContextDispatchUpscale g_origFfxFsr3DispatchUpscale = nullptr;
|
||||
std::atomic<uint32_t> g_fsr3HostPatched{0};
|
||||
constexpr uint32_t kFfxUpscaleSourceFsr3Host = fl::inventory::kFfxLeafCount + 1u;
|
||||
static_assert(kFfxUpscaleSourceFsr3Host > fl::inventory::kFfxLeafCount,
|
||||
"the host's source value must sit past every leaf's (leaf + 1) so the identity arm can tell them apart");
|
||||
|
||||
// THE ONE OFFSET THE HOST DETOUR DEPENDS ON, PINNED TO A LITERAL. commandList (8) +
|
||||
// seven FfxResource (176 each: a pointer, the 32-byte description, the 4-byte state,
|
||||
// 128 bytes of name, padded to 8) + jitterOffset (8) + motionVectorScale (8). The
|
||||
// prefix through renderSize is identical at fsr3-v3.0.3, fsr3-v3.0.4 and v1.1.4 (1.1.4
|
||||
// appends upscaleSize, flags and frameID AFTER it), and the literal is the point: a
|
||||
// re-vendoring that moved the field fails here rather than reading the wrong bytes off
|
||||
// a descriptor Cyberpunk's 3.0 module actually passed.
|
||||
static_assert(sizeof(fsr3host::FfxDimensions2D) == 8u && offsetof(fsr3host::FfxDimensions2D, height) == 4u,
|
||||
"FfxDimensions2D is two uint32_t");
|
||||
static_assert(offsetof(fsr3host::FfxFsr3DispatchUpscaleDescription, renderSize) == 1256u,
|
||||
"FfxFsr3DispatchUpscaleDescription::renderSize moved -- the vendored tag no longer matches the prefix "
|
||||
"3.0.3 / 3.0.4 / 1.1.4 share, and the detour would read the wrong bytes");
|
||||
static_assert(offsetof(fsr3host::FfxFsr3DispatchUpscaleDescription, renderSize) + sizeof(fsr3host::FfxDimensions2D) <=
|
||||
sizeof(fsr3host::FfxFsr3DispatchUpscaleDescription),
|
||||
"the field read must lie inside the descriptor");
|
||||
|
||||
// WHY THIS PERSISTS RATHER THAN BEING exchange(0)'d LIKE g_slSeen.
|
||||
//
|
||||
// g_slSeen answers "did an upscaler run THIS FRAME", so a sample that outlived
|
||||
@@ -850,7 +915,37 @@ std::atomic<uint32_t> g_ffxLive{0};
|
||||
// stands -- is handled at the consumer end in RecordPresent: renderW/H are only
|
||||
// published on a frame where an evaluation was actually seen. Tag alone is never
|
||||
// enough.
|
||||
void NoteTags(const sl::ResourceTag* tags, uint32_t numTags) noexcept {
|
||||
// WHICH TYPES the title tagged, on which route -- the identity half of frame
|
||||
// generation (fl_shm.h §slTagCensus). Two words: the per-present one, drained with
|
||||
// exchange(0) in RecordPresent like g_slSeen so a HUD-less tag cannot outlive the
|
||||
// frame it was set for (Streamline's lifecycle for it is eValidUntilPresent), and the
|
||||
// session one, OR-only, published by the watchdog like the runtime census.
|
||||
std::atomic<uint32_t> g_slTagTypes{0};
|
||||
std::atomic<uint32_t> g_slTagCensus{0};
|
||||
|
||||
// DXGI's own present counter against ours (fl_shm.h §dxgiPresentsUnseen): hook-local,
|
||||
// watchdog-published, monotonic.
|
||||
std::atomic<uint32_t> g_dxgiUnseen{0};
|
||||
std::atomic<uint32_t> g_dxgiSamples{0};
|
||||
|
||||
// A PRESENT THIS HOOK SAW AND DECLINED TO RECORD IS NOT ONE IT NEVER SAW. While a
|
||||
// session is paused (MayObserve false) the title keeps presenting and DXGI keeps
|
||||
// counting, so the first record after the resume would otherwise claim the whole
|
||||
// pause as unseen presents -- measured 0x55 on the paused-session integration case.
|
||||
// Every declined present bumps this epoch; a slot whose last read is from an older
|
||||
// epoch differences nothing and starts again. DXGI_PRESENT_TEST presents do not bump
|
||||
// it: they do not move the counter (#35), so there is nothing to invalidate.
|
||||
std::atomic<uint32_t> g_dxgiEpoch{0};
|
||||
|
||||
void NoteTagTypes(uint32_t typeBits, uint32_t routeShift) noexcept {
|
||||
if (typeBits == 0u) {
|
||||
return;
|
||||
}
|
||||
g_slTagTypes.fetch_or(typeBits, std::memory_order_relaxed);
|
||||
g_slTagCensus.fetch_or((typeBits & FL_SL_TAG_TYPE_MASK) << routeShift, std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
void NoteTags(const sl::ResourceTag* tags, uint32_t numTags, uint32_t routeShift) noexcept {
|
||||
// A null list REMOVES tags (sl_core_api.h: "set to null to remove the
|
||||
// specified tag"). Forgetting this is how renderW/H would latch a stale
|
||||
// resolution across a settings change.
|
||||
@@ -865,32 +960,40 @@ void NoteTags(const sl::ResourceTag* tags, uint32_t numTags) noexcept {
|
||||
constexpr uint32_t kMaxTags = 64;
|
||||
const uint32_t n = numTags < kMaxTags ? numTags : kMaxTags;
|
||||
|
||||
// EVERY tag's TYPE is recorded, and only the scaling input's SIZE is read. The
|
||||
// first version of this walked to the scaling input and returned, dropping every
|
||||
// other tag on the floor -- and the HUD-less and UI tags it dropped are the ones
|
||||
// that say a title is feeding DLSS Frame Generation (fl_shm.h §slTagCensus).
|
||||
uint32_t types = 0;
|
||||
bool extentDone = false;
|
||||
for (uint32_t i = 0; i < n; ++i) {
|
||||
const sl::ResourceTag& t = tags[i];
|
||||
if (t.type != sl::kBufferTypeScalingInputColor) {
|
||||
types |= fl::slinputs::TagTypeBit(t.type);
|
||||
if (t.type != sl::kBufferTypeScalingInputColor || extentDone) {
|
||||
continue;
|
||||
}
|
||||
// extent is by VALUE and defaults to all-zero, which the vendor header
|
||||
// documents as "using the entire resource". That is the honest unknown
|
||||
// fl_shm.h already defines for renderW/H, so it is stored as such rather
|
||||
// than guessed at from the resource description -- which for D3D12 is
|
||||
// itself unset (sl_core_types.h: mandatory only for Vulkan).
|
||||
const uint64_t w = t.extent.width;
|
||||
const uint64_t h = t.extent.height;
|
||||
if (w == 0 || h == 0 || w > 0xFFFFu || h > 0xFFFFu) {
|
||||
extentDone = true;
|
||||
// The extent, or -- when the title tagged the whole resource -- the size the
|
||||
// Resource itself declares; fl_sl_inputs.h's TagSize is the one reading of a
|
||||
// tag all three routes share. Neither present is the honest unknown fl_shm.h
|
||||
// already defines for renderW/H, stored as such rather than guessed.
|
||||
uint32_t w = 0;
|
||||
uint32_t h = 0;
|
||||
if (!fl::slinputs::TagSize(t, w, h)) {
|
||||
g_tagExtent.store(0, std::memory_order_release);
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
g_tagExtent.store(w | (h << 16) | kTagValid, std::memory_order_release);
|
||||
return;
|
||||
g_tagExtent.store(static_cast<uint64_t>(w) | (static_cast<uint64_t>(h) << 16) | kTagValid,
|
||||
std::memory_order_release);
|
||||
}
|
||||
NoteTagTypes(types, routeShift);
|
||||
}
|
||||
|
||||
sl::Result STDMETHODCALLTYPE Hook_SlSetTag(const sl::ViewportHandle& viewport, const sl::ResourceTag* tags,
|
||||
uint32_t numTags, sl::CommandBuffer* cmdBuffer) {
|
||||
FL_HOOK_GUARD({
|
||||
if (MayObserve()) {
|
||||
NoteTags(tags, numTags);
|
||||
NoteTags(tags, numTags, FL_SL_TAG_ROUTE_GLOBAL);
|
||||
}
|
||||
})
|
||||
// ALWAYS exactly once, on every path including the fault path, with every
|
||||
@@ -898,6 +1001,21 @@ sl::Result STDMETHODCALLTYPE Hook_SlSetTag(const sl::ViewportHandle& viewport, c
|
||||
return g_origSlSetTag(viewport, tags, numTags, cmdBuffer);
|
||||
}
|
||||
|
||||
// slSetTagForFrame: the FrameToken first, then the same list slSetTag takes. The
|
||||
// token is not read -- the frame count comes from slGetNewFrameToken -- and the tag
|
||||
// list is handed to the same NoteTags, because a per-frame tag and a viewport tag
|
||||
// state the same thing about the input buffer. Forwarded exactly once on every path.
|
||||
sl::Result STDMETHODCALLTYPE Hook_SlSetTagForFrame(const sl::FrameToken& frame, const sl::ViewportHandle& viewport,
|
||||
const sl::ResourceTag* tags, uint32_t numTags,
|
||||
sl::CommandBuffer* cmdBuffer) {
|
||||
FL_HOOK_GUARD({
|
||||
if (MayObserve()) {
|
||||
NoteTags(tags, numTags, FL_SL_TAG_ROUTE_FRAME);
|
||||
}
|
||||
})
|
||||
return g_origSlSetTagForFrame(frame, viewport, tags, numTags, cmdBuffer);
|
||||
}
|
||||
|
||||
sl::Result STDMETHODCALLTYPE Hook_SlEvaluateFeature(sl::Feature feature, const sl::FrameToken& frame,
|
||||
const sl::BaseStructure** inputs, uint32_t numInputs,
|
||||
sl::CommandBuffer* cmdBuffer) {
|
||||
@@ -959,6 +1077,8 @@ sl::Result STDMETHODCALLTYPE Hook_SlEvaluateFeature(sl::Feature feature, const s
|
||||
// rather than to the viewport, so it cannot be older than the frame
|
||||
// being measured.
|
||||
const auto scan = fl::slinputs::FindScalingInputExtent(inputs, numInputs);
|
||||
// Every tag TYPE the walk saw, on the local route (fl_shm.h §slTagCensus).
|
||||
NoteTagTypes(scan.tagTypes, FL_SL_TAG_ROUTE_LOCAL);
|
||||
if (scan.found) {
|
||||
g_tagExtent.store(static_cast<uint64_t>(scan.renderW) | (static_cast<uint64_t>(scan.renderH) << 16) |
|
||||
kTagValid,
|
||||
@@ -1067,9 +1187,7 @@ static_assert(offsetof(ffxDispatchDescFrameGenerationPrepare, renderSize) + size
|
||||
// The render extent, from an UPSCALE or PREPARE descriptor. Same packing and the same
|
||||
// in-band unknown as NoteTags: a zero or absurd size clears the sample rather than
|
||||
// publishing a resolution nobody rendered at.
|
||||
void NoteFfxExtent(const FfxApiDimensions2D& size) noexcept {
|
||||
const uint64_t w = size.width;
|
||||
const uint64_t h = size.height;
|
||||
void NoteFfxExtent(uint64_t w, uint64_t h) noexcept {
|
||||
if (w == 0 || h == 0 || w > 0xFFFFu || h > 0xFFFFu) {
|
||||
g_ffxExtent.store(0, std::memory_order_release);
|
||||
return;
|
||||
@@ -1077,6 +1195,10 @@ void NoteFfxExtent(const FfxApiDimensions2D& size) noexcept {
|
||||
g_ffxExtent.store(w | (h << 16) | kTagValid, std::memory_order_release);
|
||||
}
|
||||
|
||||
void NoteFfxExtent(const FfxApiDimensions2D& size) noexcept {
|
||||
NoteFfxExtent(size.width, size.height);
|
||||
}
|
||||
|
||||
void ObserveFfxDispatch(uint32_t leaf, const ffxDispatchDescHeader* desc) noexcept {
|
||||
if (desc == nullptr) {
|
||||
return;
|
||||
@@ -1137,6 +1259,20 @@ ffxReturnCode_t Hook_FfxDispatchT(ffxContext* context, const ffxDispatchDescHead
|
||||
return g_origFfxDispatch[Leaf](context, desc);
|
||||
}
|
||||
|
||||
// The FSR 3.0 host detour: the UPSCALE arm of ObserveFfxDispatch, verbatim, on a
|
||||
// descriptor of the host API's shape. Original called exactly once on every path.
|
||||
fsr3host::FfxErrorCode Hook_FfxFsr3ContextDispatchUpscale(fsr3host::FfxFsr3Context* context,
|
||||
const fsr3host::FfxFsr3DispatchUpscaleDescription* desc) {
|
||||
FL_HOOK_GUARD({
|
||||
if (MayObserve() && desc != nullptr) {
|
||||
NoteFfxExtent(desc->renderSize.width, desc->renderSize.height);
|
||||
g_ffxUpscaleLeaf.store(kFfxUpscaleSourceFsr3Host, std::memory_order_relaxed);
|
||||
g_ffxSeen.fetch_add(fl::slseen::kCountOne, std::memory_order_relaxed);
|
||||
}
|
||||
})
|
||||
return g_origFfxFsr3DispatchUpscale(context, desc);
|
||||
}
|
||||
|
||||
void* FfxDispatchDetour(uint32_t leaf) noexcept {
|
||||
switch (leaf) {
|
||||
case fl::inventory::kFfxLeafMonolith:
|
||||
@@ -1323,6 +1459,33 @@ void PublishRuntimeCensus() noexcept {
|
||||
census.fetch_or(seen, std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
// The tag census, on the same tick and by the same rule: OR-only, from the
|
||||
// process-local word the three tag routes accumulate into, so region 2 takes one
|
||||
// write a second rather than one per tag list (fl_shm.h §slTagCensus).
|
||||
// DXGI's counter against ours, published on the same tick. Monotonic, so a plain store
|
||||
// of the hook-local value is the whole publish.
|
||||
void PublishDxgiPresentCounters() noexcept {
|
||||
if (g_state == nullptr) {
|
||||
return;
|
||||
}
|
||||
std::atomic_ref<uint32_t> unseen{g_state->dxgiPresentsUnseen};
|
||||
std::atomic_ref<uint32_t> samples{g_state->dxgiPresentSamples};
|
||||
unseen.store(g_dxgiUnseen.load(std::memory_order_relaxed), std::memory_order_relaxed);
|
||||
samples.store(g_dxgiSamples.load(std::memory_order_relaxed), std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
void PublishSlTagCensus() noexcept {
|
||||
if (g_state == nullptr) {
|
||||
return;
|
||||
}
|
||||
const uint32_t seen = g_slTagCensus.load(std::memory_order_relaxed);
|
||||
if (seen == 0u) {
|
||||
return;
|
||||
}
|
||||
std::atomic_ref<uint32_t> census{g_state->slTagCensus};
|
||||
census.fetch_or(seen, std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
bool InstallRow(const wchar_t* module, const char* symbol, uint32_t family, void* detour, void** original,
|
||||
std::atomic<uint32_t>& live) noexcept {
|
||||
if (live.load(std::memory_order_acquire) != 0) {
|
||||
@@ -1360,8 +1523,33 @@ bool InstallByFamily(const wchar_t* module, const char* symbol, uint32_t family)
|
||||
reinterpret_cast<void**>(&g_origSlEvaluateFeature), g_upscalerIdentityLive);
|
||||
}
|
||||
if (family == static_cast<uint32_t>(fl::FL_HOOK_UPSCALER_PARAMS)) {
|
||||
return InstallRow(module, symbol, family, reinterpret_cast<void*>(&Hook_SlSetTag),
|
||||
reinterpret_cast<void**>(&g_origSlSetTag), g_upscalerParamsLive);
|
||||
// TWO ROWS IN THIS FAMILY WITH DIFFERENT SIGNATURES, so the family alone would
|
||||
// bind the wrong body to one of them. The symbol decides, through the constant
|
||||
// the inventory header binds to its own row -- no literal here, which is what
|
||||
// keeps hookinventory-check Pass B able to see every resolver in the Overlay.
|
||||
//
|
||||
// PATCHED WITHOUT PUBLISHING, as the ffx leaves are. The family is published by
|
||||
// PublishParamsFamilyIfWhole once every row this interposer exports is in;
|
||||
// published on the first row, it entitled records the second was not yet
|
||||
// producing -- 38 of 41 records claiming params on the frame-based fixture.
|
||||
const bool frameRow = fl::inventory::SameA(symbol, fl::inventory::kSymbolSlSetTagForFrame);
|
||||
std::atomic<uint32_t>& patched = frameRow ? g_slSetTagForFramePatched : g_slSetTagPatched;
|
||||
if (patched.load(std::memory_order_acquire) != 0) {
|
||||
return true;
|
||||
}
|
||||
void* target = fl::inventory::ResolveScoped(module, symbol);
|
||||
if (target == nullptr) {
|
||||
return false; // not loaded, a generation without this export, or an ABI we do not speak
|
||||
}
|
||||
void* detour =
|
||||
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)) {
|
||||
return false;
|
||||
}
|
||||
patched.store(1, std::memory_order_release);
|
||||
return true;
|
||||
}
|
||||
if (family == static_cast<uint32_t>(fl::FL_HOOK_FG_EVALUATIONS)) {
|
||||
return InstallRow(module, symbol, family, reinterpret_cast<void*>(&Hook_SlGetNewFrameToken),
|
||||
@@ -1380,12 +1568,29 @@ bool InstallByFamily(const wchar_t* module, const char* symbol, uint32_t family)
|
||||
// on a 2.x title, so a family published on the first leaf entitles records the
|
||||
// second leaf is not yet producing.
|
||||
//
|
||||
// A module the leaf table does not know installs NOTHING. fl_hook_inventory.h's
|
||||
// static_asserts make that unreachable for the rows as written; this is the
|
||||
// installer's safe direction for a row somebody adds later.
|
||||
// A module the leaf table does not know is either the FSR 3.0 HOST -- its own
|
||||
// export, its own body, its own latch, the same family and publish point -- or
|
||||
// nothing: fl_hook_inventory.h's static_asserts make the latter unreachable for
|
||||
// the rows as written, and installing nothing is the safe direction for a row
|
||||
// somebody adds later.
|
||||
const int leaf = fl::inventory::FfxLeafOf(module);
|
||||
if (leaf < 0) {
|
||||
return false;
|
||||
if (_wcsicmp(module, fl::inventory::kModuleFfxFsr3Host) != 0) {
|
||||
return false;
|
||||
}
|
||||
if (g_fsr3HostPatched.load(std::memory_order_acquire) != 0) {
|
||||
return true;
|
||||
}
|
||||
void* target = fl::inventory::ResolveScoped(module, symbol);
|
||||
if (target == nullptr) {
|
||||
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))) {
|
||||
return false;
|
||||
}
|
||||
g_fsr3HostPatched.store(1, std::memory_order_release);
|
||||
return true;
|
||||
}
|
||||
const auto slot = static_cast<uint32_t>(leaf);
|
||||
if (g_ffxPatched[slot].load(std::memory_order_acquire) != 0) {
|
||||
@@ -1426,16 +1631,57 @@ void PublishFfxFamilyIfWhole() noexcept {
|
||||
return; // loaded and not yet patched: the family is not whole
|
||||
}
|
||||
}
|
||||
// The FSR 3.0 host is the fifth target under the same rule. On Cyberpunk it lives
|
||||
// beside the 1.1.x monolith, and the family's FsrFg claim comes from the monolith
|
||||
// while the identity comes from the host -- published on whichever patched first,
|
||||
// the other's records would be entitled before they were produced (#110's window).
|
||||
if (g_fsr3HostPatched.load(std::memory_order_acquire) != 0) {
|
||||
anyPatched = true;
|
||||
} else if (fl::inventory::IsModuleLoaded(fl::inventory::kModuleFfxFsr3Host)) {
|
||||
return;
|
||||
}
|
||||
if (anyPatched) {
|
||||
PublishHookFamily(fl::inventory::kFamilyFfxDispatch, g_ffxLive);
|
||||
}
|
||||
}
|
||||
|
||||
// Publish FL_HOOK_UPSCALER_PARAMS once EVERY TAG EXPORT THE LOADED INTERPOSER HAS is
|
||||
// patched, and at least one is. "Has" is the export table, not the module list: a
|
||||
// 2.7 interposer exports slSetTag alone and is whole with that one row patched; a
|
||||
// 2.8 interposer exports both, and is whole only with both. Runs after the rows on
|
||||
// every watchdog tick, so a row whose patch failed once holds the family back until
|
||||
// it is in rather than letting the other row publish over it.
|
||||
void PublishParamsFamilyIfWhole() noexcept {
|
||||
if (g_upscalerParamsLive.load(std::memory_order_acquire) != 0) {
|
||||
return;
|
||||
}
|
||||
struct Row {
|
||||
const char* symbol;
|
||||
std::atomic<uint32_t>* patched;
|
||||
};
|
||||
const Row rows[] = {{fl::inventory::kSymbolSlSetTag, &g_slSetTagPatched},
|
||||
{fl::inventory::kSymbolSlSetTagForFrame, &g_slSetTagForFramePatched}};
|
||||
bool anyPatched = false;
|
||||
for (const Row& r : rows) {
|
||||
if (r.patched->load(std::memory_order_acquire) != 0) {
|
||||
anyPatched = true;
|
||||
continue;
|
||||
}
|
||||
if (fl::inventory::ResolveScoped(fl::inventory::kModuleSlInterposer, r.symbol) != nullptr) {
|
||||
return; // exported and not yet patched: the family is not whole
|
||||
}
|
||||
}
|
||||
if (anyPatched) {
|
||||
PublishHookFamily(static_cast<uint32_t>(fl::FL_HOOK_UPSCALER_PARAMS), g_upscalerParamsLive);
|
||||
}
|
||||
}
|
||||
|
||||
bool InstallUpscalerHooks() noexcept {
|
||||
bool any = false;
|
||||
#define FL_INSTALL_ROW(mod, sym, family) any = InstallByFamily(mod, sym, static_cast<uint32_t>(family)) || any;
|
||||
FL_HOOK_INVENTORY(FL_INSTALL_ROW)
|
||||
#undef FL_INSTALL_ROW
|
||||
PublishParamsFamilyIfWhole();
|
||||
PublishFfxFamilyIfWhole();
|
||||
return any;
|
||||
}
|
||||
@@ -1641,6 +1887,8 @@ DWORD WINAPI WatchdogThread(LPVOID) noexcept {
|
||||
// The census, on the same tick. After the installers so that a module which
|
||||
// appeared this second is both hooked and counted in the same pass.
|
||||
PublishRuntimeCensus();
|
||||
PublishSlTagCensus();
|
||||
PublishDxgiPresentCounters();
|
||||
|
||||
// Supervision loss. guardTicks counts COMPLETED guard evaluations, not
|
||||
// seconds, so a stalled guard loop stops it advancing even while the
|
||||
@@ -1671,6 +1919,9 @@ DWORD WINAPI WatchdogThread(LPVOID) noexcept {
|
||||
// lock, no logging (NFR-1, target <= 1 us; a bare vtable detour measured 8.4 ns).
|
||||
void RecordPresent(IDXGISwapChain* sc, UINT syncInterval, UINT flags) noexcept {
|
||||
if (!MayObserve()) {
|
||||
if ((flags & DXGI_PRESENT_TEST) == 0u) {
|
||||
g_dxgiEpoch.fetch_add(1u, std::memory_order_relaxed); // see the declaration
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1705,6 +1956,35 @@ void RecordPresent(IDXGISwapChain* sc, UINT syncInterval, UINT flags) noexcept {
|
||||
SwapChainSlot* slot = FindOrAdd(sc);
|
||||
PublishAdapterOnce(sc);
|
||||
|
||||
// DXGI'S OWN COUNT OF THIS CHAIN'S PRESENTS, read here on the object the title passed
|
||||
// (the same class of read as GetDesc above), BEFORE this present is forwarded: the
|
||||
// value is therefore the number of presents completed before this one, and the
|
||||
// delta from the previous hooked present on the same chain is 1 + whatever DXGI
|
||||
// counted that this hook never saw -- a pacer presenting through a body the inline
|
||||
// patches do not cover. A delta of exactly 1 every time says DXGI saw nothing more
|
||||
// than we did. DXGI_PRESENT_TEST presents are already filtered above and do not
|
||||
// move this counter (measured, #35), so they cannot read as unseen presents.
|
||||
bool dxgiDelta = false;
|
||||
uint8_t dxgiUnseenHere = 0;
|
||||
if (slot != nullptr) {
|
||||
UINT dxgiCount = 0;
|
||||
const uint32_t epoch = g_dxgiEpoch.load(std::memory_order_relaxed);
|
||||
if (SUCCEEDED(sc->GetLastPresentCount(&dxgiCount))) {
|
||||
if (slot->haveDxgiCount && slot->dxgiEpoch == epoch) {
|
||||
const uint32_t delta = dxgiCount - slot->lastDxgiCount;
|
||||
dxgiDelta = true;
|
||||
if (delta > 1u) {
|
||||
g_dxgiUnseen.fetch_add(delta - 1u, std::memory_order_relaxed);
|
||||
dxgiUnseenHere = fl::slseen::SaturateToByte(delta - 1u);
|
||||
}
|
||||
}
|
||||
slot->lastDxgiCount = dxgiCount;
|
||||
slot->dxgiEpoch = epoch;
|
||||
slot->haveDxgiCount = true;
|
||||
g_dxgiSamples.fetch_add(1u, std::memory_order_relaxed);
|
||||
}
|
||||
}
|
||||
|
||||
FlFrameRecord rec{};
|
||||
rec.qpc = static_cast<uint64_t>(qpc.QuadPart);
|
||||
rec.frameIndex = g_frameIndex++;
|
||||
@@ -1746,6 +2026,14 @@ void RecordPresent(IDXGISwapChain* sc, UINT syncInterval, UINT flags) noexcept {
|
||||
const uint16_t haveOutputRes = (rec.outputW != 0 && rec.outputH != 0) ? FL_MEASURED_OUTPUT_RES : 0u;
|
||||
rec.measuredMask = static_cast<uint16_t>(haveOutputRes | FL_MEASURED_PRESENT_ARGS);
|
||||
|
||||
// The per-present form of the DXGI counter read above (fl_shm.h §dxgiUnseen). The
|
||||
// bit says a delta EXISTED -- a zero under it is DXGI agreeing with this hook, not
|
||||
// silence -- which is why the first present of a chain claims nothing.
|
||||
if (dxgiDelta) {
|
||||
rec.dxgiUnseen = dxgiUnseenHere;
|
||||
rec.measuredMask = static_cast<uint16_t>(rec.measuredMask | FL_MEASURED_DXGI_PRESENTS);
|
||||
}
|
||||
|
||||
// --- Upscaler identity, and the three states it must keep apart ----------
|
||||
//
|
||||
// The counter is CONSUMED here, once per present, so the record describes
|
||||
@@ -1754,6 +2042,10 @@ void RecordPresent(IDXGISwapChain* sc, UINT syncInterval, UINT flags) noexcept {
|
||||
// after the user turned it off mid-session, which is precisely the
|
||||
// mid-session settings change 03_METRICS §Upscaling segments on.
|
||||
const uint32_t seen = g_slSeen.exchange(0, std::memory_order_acq_rel);
|
||||
// The tag TYPES set since the last present, on any route. ALWAYS drained, like the
|
||||
// AMD word below: a HUD-less tag is valid until the frame it was set for is
|
||||
// presented, and a word that outlived that frame would mark the wrong present.
|
||||
const uint32_t tagged = g_slTagTypes.exchange(0, std::memory_order_acq_rel);
|
||||
|
||||
// The AMD word and count, drained beside the Streamline word and for the same
|
||||
// reason. ALWAYS drained, whether or not anything below reads them: a count that
|
||||
@@ -1807,18 +2099,21 @@ void RecordPresent(IDXGISwapChain* sc, UINT syncInterval, UINT flags) noexcept {
|
||||
// it, the honest byte is "FSR, version not named" (fl_shm.h
|
||||
// §FL_UPSCALER_FSR_UNVERSIONED): FSR3 would be right on every non-RDNA4
|
||||
// machine and a fabrication on one, and UNKNOWN would print the very N/A
|
||||
// this arm exists to remove.
|
||||
rec.upscaler = g_ffxUpscaleLeaf.load(std::memory_order_relaxed) == fl::inventory::kFfxLeafMonolith + 1u
|
||||
// this arm exists to remove. The FSR 3.0 HOST (ffx_fsr3_x64.dll, Cyberpunk's
|
||||
// copy) hosts FSR 3.0 and nothing else, so it is FSR3 as a fact too.
|
||||
const uint32_t src = g_ffxUpscaleLeaf.load(std::memory_order_relaxed);
|
||||
rec.upscaler = src == fl::inventory::kFfxLeafMonolith + 1u || src == kFfxUpscaleSourceFsr3Host
|
||||
? static_cast<uint8_t>(FL_UPSCALER_FSR3)
|
||||
: static_cast<uint8_t>(FL_UPSCALER_FSR_UNVERSIONED);
|
||||
} else {
|
||||
// UNKNOWN, AND NEVER `NONE`. FL_UPSCALER_NONE means "a hook ran and
|
||||
// there was genuinely no upscaler" -- the one state fl_shm.h allows
|
||||
// to be aggregated as a negative. This writer hooks Streamline and the
|
||||
// ffx-api leaves and nothing else, so an XeSS, NGX-direct or FSR 3.0
|
||||
// (ffx_fsr3_x64.dll) title evaluates its upscaler somewhere we are not
|
||||
// looking -- and so does an FSR title on a present that drained no
|
||||
// dispatch, which under frame generation is every generated present.
|
||||
// to be aggregated as a negative. This writer hooks Streamline, the
|
||||
// ffx-api leaves and the FSR 3.0 host facade and nothing else, so an XeSS
|
||||
// or NGX-direct title, or an FSR 3.0 title calling ffx_fsr3upscaler_x64.dll
|
||||
// directly, evaluates its upscaler somewhere we are not looking -- and so
|
||||
// does an FSR title on a present that drained no dispatch, which under
|
||||
// frame generation is every generated present.
|
||||
// Reporting NONE would turn "we do not cover that vendor" into a measured
|
||||
// fact about the title. UNKNOWN says the true thing: our coverage is short.
|
||||
//
|
||||
@@ -2000,6 +2295,17 @@ void RecordPresent(IDXGISwapChain* sc, UINT syncInterval, UINT flags) noexcept {
|
||||
mode = FL_FG_FSR_FG;
|
||||
} else if (evals != 0u) {
|
||||
mode = FL_FG_DLSS_G;
|
||||
} else if ((tagged & FL_SL_TAG_DLSSG_INPUTS) != 0u) {
|
||||
// THE TAGS SAY IT, since 2026-09-05. A HUD-less or UI buffer tagged through
|
||||
// Streamline since the last present is an input to DLSS Frame Generation and
|
||||
// to nothing else the title evaluates through Streamline that generates
|
||||
// frames (fl_shm.h §slTagCensus; the DLSS-G programming guide §5.0 requires
|
||||
// them). Read off the argument of an API already hooked, on whichever of the
|
||||
// three tag routes the title uses -- which is what kFeatureDLSS_G evaluations
|
||||
// were supposed to give and gave on no measured title. IDENTITY ONLY: whether
|
||||
// frames were generated is still the consumer's verdict from the COUNT, and a
|
||||
// count of 1.0 beside this mark prints `none` (inputs fed, nothing generated).
|
||||
mode = FL_FG_DLSS_G;
|
||||
}
|
||||
rec.fgMode = mode;
|
||||
rec.measuredMask = static_cast<uint16_t>(rec.measuredMask | FL_MEASURED_FG);
|
||||
|
||||
@@ -433,6 +433,52 @@ constexpr uint32_t FL_CENSUS_UPSCALER_FAMILIES = FL_CENSUS_SL_INTERPOSER | FL_CE
|
||||
static_assert((FL_CENSUS_FG_FAMILIES & FL_CENSUS_UPSCALER_FAMILIES) == 0u, "a runtime is one kind or the other");
|
||||
static_assert(((FL_CENSUS_FG_FAMILIES | FL_CENSUS_UPSCALER_FAMILIES) & FL_CENSUS_RAN) == 0u, "RAN is not a family");
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// FlWriterState::slTagCensus — WHICH Streamline buffer types the title tagged, on
|
||||
// WHICH route (2026-09-05, 20_OPEN_QUESTIONS §H5).
|
||||
//
|
||||
// WHY. The two global-tag detours (slSetTag, slSetTagForFrame) and the local walk
|
||||
// through slEvaluateFeature's inputs read one tag type -- kBufferTypeScalingInputColor,
|
||||
// for renderW/H -- and dropped every other tag on the floor. Streamline's DLSS-G
|
||||
// programming guide §5.0 says a title running DLSS Frame Generation MUST tag the
|
||||
// HUD-less colour and UI buffers every frame through exactly those calls; a title
|
||||
// running super-resolution alone never tags them (they are inputs to nothing else the
|
||||
// title evaluates through Streamline except Reflex 2's late warp, which generates no
|
||||
// frames). So the types a title tags are a per-frame statement, from an argument of
|
||||
// an API already hooked (CLAUDE.md rule 4), of WHICH Streamline feature it is
|
||||
// feeding -- which is the identity `kFeatureDLSS_G` evaluations were supposed to
|
||||
// give and never did on any measured title. The session word here says which types
|
||||
// arrived on which route; the per-present half lands in fgMode (FL_FG_DLSS_G on a
|
||||
// present that drained a HUD-less or UI tag) and the consumer combines it with the
|
||||
// COUNT, which alone decides `none`.
|
||||
//
|
||||
// OR-only, watchdog-published from a process-local word, like runtimeCensus. Nine
|
||||
// type bits per route, three routes. Took reserved[0] additively (no layout bump):
|
||||
// a writer from before it is refused by the build-id handshake before any reader
|
||||
// could see a 0 here, and 0 means "no tag of any type was seen".
|
||||
// ---------------------------------------------------------------------------
|
||||
enum FlSlTagType : uint32_t {
|
||||
FL_SL_TAG_DEPTH = 1u << 0, // kBufferTypeDepth
|
||||
FL_SL_TAG_MOTION_VECTORS = 1u << 1, // kBufferTypeMotionVectors
|
||||
FL_SL_TAG_HUDLESS = 1u << 2, // kBufferTypeHUDLessColor -- a DLSS-G input
|
||||
FL_SL_TAG_SCALING_INPUT = 1u << 3, // kBufferTypeScalingInputColor -- renderW/H's source
|
||||
FL_SL_TAG_SCALING_OUTPUT = 1u << 4, // kBufferTypeScalingOutputColor
|
||||
FL_SL_TAG_UI_COLOR_ALPHA = 1u << 5, // kBufferTypeUIColorAndAlpha -- a DLSS-G input
|
||||
FL_SL_TAG_UI_ALPHA = 1u << 6, // kBufferTypeUIAlpha -- a DLSS-G input (newer SDKs)
|
||||
FL_SL_TAG_BACKBUFFER = 1u << 7, // kBufferTypeBackbuffer
|
||||
FL_SL_TAG_OTHER = 1u << 8, // any other BufferType
|
||||
};
|
||||
constexpr uint32_t FL_SL_TAG_TYPE_BITS = 9;
|
||||
constexpr uint32_t FL_SL_TAG_TYPE_MASK = (1u << FL_SL_TAG_TYPE_BITS) - 1u;
|
||||
// The routes, as bit-field shifts into slTagCensus.
|
||||
constexpr uint32_t FL_SL_TAG_ROUTE_GLOBAL = 0; // slSetTag
|
||||
constexpr uint32_t FL_SL_TAG_ROUTE_FRAME = FL_SL_TAG_TYPE_BITS; // slSetTagForFrame
|
||||
constexpr uint32_t FL_SL_TAG_ROUTE_LOCAL = 2u * FL_SL_TAG_TYPE_BITS; // slEvaluateFeature's inputs
|
||||
// The DLSS-G-only inputs: tagged, they say the title is feeding frame generation.
|
||||
constexpr uint32_t FL_SL_TAG_DLSSG_INPUTS = FL_SL_TAG_HUDLESS | FL_SL_TAG_UI_COLOR_ALPHA | FL_SL_TAG_UI_ALPHA;
|
||||
static_assert(3u * FL_SL_TAG_TYPE_BITS <= 32u, "three routes of type bits must fit the census word");
|
||||
static_assert((FL_SL_TAG_DLSSG_INPUTS & ~FL_SL_TAG_TYPE_MASK) == 0u, "the DLSS-G inputs are type bits");
|
||||
|
||||
// bits in FlFrameRecord::measuredMask — which fields were MEASURED this frame.
|
||||
//
|
||||
// The zero-defaults elsewhere in the record are affirmative negatives:
|
||||
@@ -522,13 +568,20 @@ enum FlMeasured : uint16_t {
|
||||
// must be able to say so.
|
||||
FL_MEASURED_FG_COUNTS = 1u << 10,
|
||||
|
||||
// bits 11-15 reserved. Writers leave them zero; readers must IGNORE them
|
||||
// dxgiUnseen @52 (2026-09-05, 20_OPEN_QUESTIONS §H5 row P1-DXGI): the present hook
|
||||
// read IDXGISwapChain::GetLastPresentCount at this present AND at the previous
|
||||
// hooked present on the same chain, so the byte is a measurement -- a zero
|
||||
// included. Clear on the first hooked present of every chain, where there is no
|
||||
// previous value to difference against, and whenever the read failed.
|
||||
FL_MEASURED_DXGI_PRESENTS = 1u << 11,
|
||||
|
||||
// bits 12-15 reserved. Writers leave them zero; readers must IGNORE them
|
||||
// rather than validate them as zero.
|
||||
//
|
||||
// BE PRECISE ABOUT WHAT THAT BUYS, because the tempting claim is false: it
|
||||
// does NOT mean a future field can be added without a layout bump. Any new
|
||||
// field also needs a byte, and every byte of this record is allocated except
|
||||
// `reserved` @52 -- and FlShmHandshake::recordSize plus the layout version are
|
||||
// `reserved` @53..55 -- and FlShmHandshake::recordSize plus the layout version are
|
||||
// compared before a reader looks at anything, so an old reader refuses a new
|
||||
// writer outright and never gets as far as an unknown bit. What the reserve
|
||||
// actually buys is that existing offsets do not move, which keeps the diff,
|
||||
@@ -636,7 +689,26 @@ struct alignas(64) FlWriterState {
|
||||
// before any reader could see a 0 here.
|
||||
uint32_t runtimeCensus; // @40
|
||||
|
||||
uint32_t reserved[5]; // @44..63 must be zero; room for additive fields
|
||||
// FlSlTagType bits per route (see the enum). Watchdog-published, OR-only. Took
|
||||
// reserved[0] on 2026-09-05 the way runtimeCensus took it on 2026-09-03: additive,
|
||||
// no layout bump, refused-before-read by the build-id handshake.
|
||||
uint32_t slTagCensus; // @44
|
||||
|
||||
// DXGI'S OWN PRESENT COUNTER AGAINST THIS HOOK'S, on the hooked swapchain(s)
|
||||
// (2026-09-05, 20_OPEN_QUESTIONS §H5 case 3). On every present the hook sees it
|
||||
// reads IDXGISwapChain::GetLastPresentCount on the object the title passed -- the
|
||||
// same class of read as GetDesc in FindOrAdd -- and compares it with the value at
|
||||
// the previous hooked present on the same chain. Exactly one present (the previous
|
||||
// hooked one) is expected in between; every present beyond that is one DXGI
|
||||
// counted and this hook did not. A frame-generation pacer that presents on this
|
||||
// chain through a body the inline patches do not cover shows up here; one that
|
||||
// presents below DXGI, or on another object, does not. Hook-local counters,
|
||||
// watchdog-published (the region-2 cache-line rule above). Took reserved[0..1],
|
||||
// additive, no layout bump.
|
||||
uint32_t dxgiPresentsUnseen; // @48 presents DXGI counted between two hooked presents, beyond the one seen
|
||||
uint32_t dxgiPresentSamples; // @52 hooked presents on which the counter was read
|
||||
|
||||
uint32_t reserved[2]; // @56..63 must be zero; room for additive fields
|
||||
|
||||
// NOTE: there is deliberately no droppedRecords here. The writer has no
|
||||
// reader index and cannot know whether the slot it overwrites was ever
|
||||
@@ -767,7 +839,22 @@ struct alignas(64) FlFrameRecord {
|
||||
// and layoutVersion are compared before a reader looks at anything, so an old
|
||||
// reader refuses a new writer and never reaches an unknown field. What it buys
|
||||
// is that existing offsets do not move, which keeps the next diff small.
|
||||
uint32_t reserved; // @52
|
||||
// @52 -- DXGI'S OWN COUNT OF THIS CHAIN'S PRESENTS SINCE THE PREVIOUS HOOKED ONE,
|
||||
// beyond that one (2026-09-05, 20_OPEN_QUESTIONS §H5 row P1-DXGI). The per-present
|
||||
// form of FlWriterState.dxgiPresentsUnseen: the delta of GetLastPresentCount between
|
||||
// two consecutive hooked presents on the same chain, minus the one present the hook
|
||||
// saw. Measured 2.90 and 2.95 per hooked present on Dying Light: The Beast
|
||||
// (Streamline 2.8.0, DLSS Frame Generation x4) and 0 on every other title (Streamline
|
||||
// 2.7.3 and 2.10.3 present their generated frames through the patched bodies) -- so
|
||||
// on that shape the generated presents ARE DXGI presents, reaching a body the inline
|
||||
// patches do not cover, and the consumer counts Displayed = hooked + this, labelled
|
||||
// DXGI-COUNTED. Per record rather than per session so the consumer's uniformity
|
||||
// buckets see it. SATURATES AT 255: a NUMERATOR, so a wrap would read low rather than
|
||||
// high, but 255 is still a sentinel the consumer refuses rather than a count. Took the
|
||||
// first byte of v3's reserved word; additive, no offset moved, no layout bump.
|
||||
uint8_t dxgiUnseen; // @52
|
||||
|
||||
uint8_t reserved[3]; // @53..55 MUST BE ZERO
|
||||
|
||||
// Seqlock counter. Monotonic per slot and NEVER reset, so a full lap of
|
||||
// the ring always changes it — otherwise a reader stalled exactly one lap
|
||||
@@ -826,7 +913,10 @@ static_assert(offsetof(FlWriterState, hooksInstalledMask) == 28);
|
||||
static_assert(offsetof(FlWriterState, rtStateObjectsCreated) == 32);
|
||||
static_assert(offsetof(FlWriterState, rasterPsoCreated) == 36);
|
||||
static_assert(offsetof(FlWriterState, runtimeCensus) == 40);
|
||||
static_assert(offsetof(FlWriterState, reserved) == 44);
|
||||
static_assert(offsetof(FlWriterState, slTagCensus) == 44);
|
||||
static_assert(offsetof(FlWriterState, dxgiPresentsUnseen) == 48);
|
||||
static_assert(offsetof(FlWriterState, dxgiPresentSamples) == 52);
|
||||
static_assert(offsetof(FlWriterState, reserved) == 56);
|
||||
|
||||
static_assert(offsetof(FlControlBlock, pauseRequested) == 0);
|
||||
static_assert(offsetof(FlControlBlock, unhookRequested) == 4);
|
||||
@@ -856,7 +946,8 @@ static_assert(offsetof(FlFrameRecord, upscalerSharpness) == 42);
|
||||
static_assert(offsetof(FlFrameRecord, fgEvaluations) == 43);
|
||||
static_assert(offsetof(FlFrameRecord, vramUsedMb) == 44);
|
||||
static_assert(offsetof(FlFrameRecord, reflexLatencyUs) == 48);
|
||||
static_assert(offsetof(FlFrameRecord, reserved) == 52);
|
||||
static_assert(offsetof(FlFrameRecord, dxgiUnseen) == 52);
|
||||
static_assert(offsetof(FlFrameRecord, reserved) == 53);
|
||||
static_assert(offsetof(FlFrameRecord, seq) == 56);
|
||||
static_assert(offsetof(FlFrameRecord, swapchainId) == 60);
|
||||
|
||||
@@ -872,7 +963,6 @@ static_assert(offsetof(FlFrameRecord, swapchainId) == 60, "07_IPC pins the paylo
|
||||
static_assert(offsetof(FlFrameRecord, qpc) % 8 == 0);
|
||||
static_assert(offsetof(FlFrameRecord, measuredMask) % 2 == 0);
|
||||
static_assert(offsetof(FlFrameRecord, vramUsedMb) % 4 == 0);
|
||||
static_assert(offsetof(FlFrameRecord, reserved) % 4 == 0);
|
||||
static_assert(offsetof(FlFrameRecord, seq) % 4 == 0);
|
||||
|
||||
// The regions must not overlap, and the ring must stay 64-aligned.
|
||||
|
||||
@@ -1179,7 +1179,8 @@ bool StartHarness(Child& child) {
|
||||
uint16_t EntitledBy(uint32_t hooks) noexcept {
|
||||
uint16_t allowed = 0;
|
||||
if ((hooks & fl::FL_HOOK_PRESENT) != 0u) {
|
||||
allowed |= static_cast<uint16_t>(fl::FL_MEASURED_OUTPUT_RES | fl::FL_MEASURED_PRESENT_ARGS);
|
||||
allowed |= static_cast<uint16_t>(fl::FL_MEASURED_OUTPUT_RES | fl::FL_MEASURED_PRESENT_ARGS |
|
||||
fl::FL_MEASURED_DXGI_PRESENTS);
|
||||
}
|
||||
if ((hooks & fl::FL_HOOK_UPSCALER_IDENTITY) != 0u) {
|
||||
allowed |= static_cast<uint16_t>(fl::FL_MEASURED_UPSCALER | fl::FL_MEASURED_FG);
|
||||
@@ -1225,6 +1226,11 @@ bool IsHonest(const fl::FlFrameRecord& r, uint16_t entitled) noexcept {
|
||||
if ((r.measuredMask & fl::FL_MEASURED_FG_COUNTS) == 0u && r.fgEvaluations != 0u) {
|
||||
return false;
|
||||
}
|
||||
// dxgiUnseen has no in-band sentinel either -- 0 is DXGI agreeing with the hook -- so
|
||||
// a value under a clear bit is the same defect as an unclaimed count.
|
||||
if ((r.measuredMask & fl::FL_MEASURED_DXGI_PRESENTS) == 0u && r.dxgiUnseen != 0u) {
|
||||
return false;
|
||||
}
|
||||
// featureFlags carries Ray Reconstruction's fact and OBSERVED bits, produced by the
|
||||
// same Streamline detour as the upscaler identity. A writer not entitled to claim
|
||||
// an upscaler is not entitled to say anything about RR either.
|
||||
@@ -2919,6 +2925,156 @@ TEST_CASE("the injected Overlay measures an upscaler it can identify", "[guard][
|
||||
CloseHandle(mapping);
|
||||
}
|
||||
|
||||
// The global-tag routes, injected: tag through the given harness flags, wait for
|
||||
// the params family, and assert the EXACT tagged size on every record after the
|
||||
// backlog. Shared by the two cases below so the assertion cannot drift between the
|
||||
// export a title uses and the shape of the tag it passes.
|
||||
void AssertGlobalTagRoutePublishesExactExtent(const wchar_t* harnessFlags, bool expectDlssgIdentity = false) {
|
||||
Child child;
|
||||
std::wstring cmd =
|
||||
std::wstring(L"\"") + FL_HARNESS_EXE + L"\" --real " + harnessFlags + L" --hold-presenting-upscaled 12";
|
||||
STARTUPINFOW si{};
|
||||
si.cb = sizeof(si);
|
||||
REQUIRE(CreateProcessW(FL_HARNESS_EXE, cmd.data(), nullptr, nullptr, FALSE, CREATE_NO_WINDOW, nullptr, nullptr, &si,
|
||||
&child.pi));
|
||||
Sleep(800);
|
||||
REQUIRE(WaitForSingleObject(child.pi.hProcess, 0) == WAIT_TIMEOUT);
|
||||
ResetFake();
|
||||
g.modules = {"kernel32.dll"};
|
||||
g.scanSet = {child.pi.dwProcessId};
|
||||
REQUIRE(GuardedInjectWithSources(child.pi.dwProcessId, FL_OVERLAY_DLL, FakeSources()).Allowed());
|
||||
wchar_t name[128]{};
|
||||
REQUIRE(_snwprintf_s(name, _TRUNCATE, L"Local\\FrameLedger.Ring.%lu", child.pi.dwProcessId) > 0);
|
||||
HANDLE mapping = nullptr;
|
||||
for (int i = 0; i < 100 && mapping == nullptr; ++i) {
|
||||
mapping = OpenFileMappingW(FILE_MAP_READ, FALSE, name);
|
||||
if (mapping == nullptr) {
|
||||
Sleep(50);
|
||||
}
|
||||
}
|
||||
REQUIRE(mapping != nullptr);
|
||||
const void* base = MapViewOfFile(mapping, FILE_MAP_READ, 0, 0, 0);
|
||||
REQUIRE(base != nullptr);
|
||||
const auto* st =
|
||||
reinterpret_cast<const fl::FlWriterState*>(static_cast<const unsigned char*>(base) + FL_SHM_WRITER_OFFSET);
|
||||
for (int i = 0; i < 100 && st->status != fl::FL_STATUS_READY; ++i) {
|
||||
Sleep(50);
|
||||
}
|
||||
REQUIRE(st->status == fl::FL_STATUS_READY);
|
||||
REQUIRE(WaitForIdentityHook(st));
|
||||
REQUIRE(WaitForHookFamily(st, static_cast<uint32_t>(fl::FL_HOOK_UPSCALER_PARAMS)));
|
||||
fl::RingReader rd;
|
||||
REQUIRE(rd.Init(base, FL_SHM_DEFAULT_CAPACITY));
|
||||
DiscardBacklog(rd);
|
||||
const std::vector<fl::FlFrameRecord> all = DrainAtLeast(rd, 40, 8000);
|
||||
REQUIRE(all.size() > 20);
|
||||
int claimedParams = 0;
|
||||
int wrongExtent = 0;
|
||||
int identified = 0;
|
||||
int dlssgMarked = 0;
|
||||
int fsrFgMarked = 0;
|
||||
for (const auto& r : all) {
|
||||
if (r.upscaler == fl::FL_UPSCALER_DLSS) {
|
||||
++identified;
|
||||
}
|
||||
if (r.fgMode == fl::FL_FG_DLSS_G) {
|
||||
++dlssgMarked;
|
||||
}
|
||||
if (r.fgMode == fl::FL_FG_FSR_FG) {
|
||||
++fsrFgMarked;
|
||||
}
|
||||
if ((r.measuredMask & fl::FL_MEASURED_UPSCALER_PARAMS) != 0u) {
|
||||
++claimedParams;
|
||||
if (r.renderW != FL_TAGGED_RENDER_W || r.renderH != FL_TAGGED_RENDER_H) {
|
||||
++wrongExtent;
|
||||
}
|
||||
}
|
||||
}
|
||||
INFO("identified " << identified << ", params on " << claimedParams << " of " << all.size());
|
||||
CHECK(identified > static_cast<int>(all.size()) - 3);
|
||||
// Every record once BOTH rows' family is live and the backlog is gone -- the same
|
||||
// equality the slSetTag case asserts, from the other export.
|
||||
CHECK(claimedParams == static_cast<int>(all.size()));
|
||||
CHECK(wrongExtent == 0);
|
||||
CHECK(st->faultCount == 0);
|
||||
|
||||
// THE IDENTITY HALF OF FRAME GENERATION, FROM THE TAGS' TYPES (fl_shm.h §slTagCensus).
|
||||
// This fixture never evaluates kFeatureDLSS_G, so a record naming DLSS_G can only
|
||||
// have come from a HUD-less or UI tag in the list -- and without those tags NO
|
||||
// record may name it, or a scaling-input tag alone would read as frame generation.
|
||||
// The tag census must say which route carried them and must not say the local route
|
||||
// did, since this fixture tags globally only.
|
||||
// POLL FOR THE CENSUS, do not read it once. It is published by the watchdog on its
|
||||
// 1 Hz tick, while the records above were drained ~330 ms after the family went
|
||||
// live -- on CI the first read came back 0 with DLSS_G already on 41 of 41 records.
|
||||
// The state to wait for is the one every fixture here produces (a scaling-input tag
|
||||
// on a global route); the timeout keeps failing, so a census that never publishes
|
||||
// is still red rather than skipped (HANDOFF §Traps: a writer state read once).
|
||||
const auto routeBits = [st](uint32_t route) { return (st->slTagCensus >> route) & fl::FL_SL_TAG_TYPE_MASK; };
|
||||
for (int i = 0; i < 80 && ((routeBits(fl::FL_SL_TAG_ROUTE_GLOBAL) | routeBits(fl::FL_SL_TAG_ROUTE_FRAME)) &
|
||||
fl::FL_SL_TAG_SCALING_INPUT) == 0u;
|
||||
++i) {
|
||||
Sleep(50);
|
||||
}
|
||||
const uint32_t census = st->slTagCensus;
|
||||
const uint32_t global = (census >> fl::FL_SL_TAG_ROUTE_GLOBAL) & fl::FL_SL_TAG_TYPE_MASK;
|
||||
const uint32_t frame = (census >> fl::FL_SL_TAG_ROUTE_FRAME) & fl::FL_SL_TAG_TYPE_MASK;
|
||||
const uint32_t local = (census >> fl::FL_SL_TAG_ROUTE_LOCAL) & fl::FL_SL_TAG_TYPE_MASK;
|
||||
INFO("DLSS_G on " << dlssgMarked << " of " << all.size() << ", tag census " << census);
|
||||
CHECK(fsrFgMarked == 0);
|
||||
CHECK(local == 0u);
|
||||
CHECK(((global | frame) & fl::FL_SL_TAG_SCALING_INPUT) != 0u);
|
||||
if (expectDlssgIdentity) {
|
||||
// Every record once the family is live: the list is re-tagged before every
|
||||
// present, so every present drains the mark -- the same equality as params.
|
||||
CHECK(dlssgMarked == static_cast<int>(all.size()));
|
||||
CHECK(((global | frame) & fl::FL_SL_TAG_HUDLESS) != 0u);
|
||||
CHECK(((global | frame) & fl::FL_SL_TAG_UI_COLOR_ALPHA) != 0u);
|
||||
CHECK(((global | frame) & fl::FL_SL_TAG_DEPTH) != 0u);
|
||||
} else {
|
||||
CHECK(dlssgMarked == 0);
|
||||
CHECK(((global | frame) & fl::FL_SL_TAG_DLSSG_INPUTS) == 0u);
|
||||
}
|
||||
UnmapViewOfFile(base);
|
||||
CloseHandle(mapping);
|
||||
}
|
||||
TEST_CASE("a Streamline 2.8 title that tags through slSetTagForFrame still publishes the extent",
|
||||
"[guard][inject][shm][upscaler]") {
|
||||
// THE ROW THAT DID NOT EXIST ON 2026-09-04 MORNING. Dying Light: The Beast ships
|
||||
// Streamline 2.8.0, which deprecates slSetTag for slSetTagForFrame; the title
|
||||
// published DLSS identity on every batch and the params bit on none, because the
|
||||
// only tag row hooked the deprecated export. This fixture tags ONLY through the
|
||||
// frame-based export, so an extent in the record can only have come from the new
|
||||
// row -- and the exact tagged size is asserted, not "non-zero".
|
||||
AssertGlobalTagRoutePublishesExactExtent(L"--sl-tag-for-frame");
|
||||
}
|
||||
|
||||
TEST_CASE("DLSS-G inputs tagged through Streamline name DLSS_G on the present that drained them, with no "
|
||||
"kFeatureDLSS_G evaluation",
|
||||
"[guard][inject][shm][upscaler][fg]") {
|
||||
// THE IDENTITY FIVE REAL TITLES COULD NOT GIVE. kFeatureDLSS_G is never evaluated
|
||||
// through slEvaluateFeature on Streamline 2.x (measured, five titles), so the only
|
||||
// per-frame statement a title makes about DLSS Frame Generation through an API this
|
||||
// build hooks is the HUD-less and UI tags the DLSS-G guide §5.0 requires. This
|
||||
// fixture sends that list through slSetTag and evaluates kFeatureDLSS only; the
|
||||
// record must name DLSS_G on every present, and the census must show the two inputs
|
||||
// on the global route. Its twin below sends the same list through the 2.8 export.
|
||||
AssertGlobalTagRoutePublishesExactExtent(L"--sl-tag-dlssg-inputs", /*expectDlssgIdentity=*/true);
|
||||
}
|
||||
|
||||
TEST_CASE("the DLSS-G inputs through slSetTagForFrame name DLSS_G too", "[guard][inject][shm][upscaler][fg]") {
|
||||
AssertGlobalTagRoutePublishesExactExtent(L"--sl-tag-for-frame --sl-tag-dlssg-inputs", /*expectDlssgIdentity=*/true);
|
||||
}
|
||||
|
||||
TEST_CASE("a title that tags the WHOLE input resource publishes the size the Resource declares",
|
||||
"[guard][inject][shm][upscaler]") {
|
||||
// The shape left after the row above landed and DL:TB still read no extent: a
|
||||
// zero extent ("use the entire resource") with the size on the Resource. Tagged
|
||||
// through the 2.8 export, as that title would. An extent in the record can only
|
||||
// have come from Resource::width/height, and it must be the exact tagged size.
|
||||
AssertGlobalTagRoutePublishesExactExtent(L"--sl-tag-for-frame --sl-tag-whole-resource");
|
||||
}
|
||||
|
||||
TEST_CASE("an upscaler the Overlay cannot identify is UNKNOWN, never NONE", "[guard][inject][shm][upscaler]") {
|
||||
// THE OTHER DIRECTION, and the one that makes the case above mean anything.
|
||||
// A writer that simply hardcoded FL_UPSCALER_DLSS would pass every assertion
|
||||
@@ -3025,8 +3181,12 @@ namespace {
|
||||
// What one --hold-presenting-fg run yields, drained after the identity hook is live.
|
||||
struct FgObservation {
|
||||
std::uint32_t census = 0;
|
||||
std::uint32_t dxgiUnseen = 0;
|
||||
std::uint32_t dxgiSamples = 0;
|
||||
std::size_t drained = 0;
|
||||
std::uint64_t sigma = 0; // sum of fgEvaluations over the window
|
||||
std::uint64_t sigma = 0; // sum of fgEvaluations over the window
|
||||
std::uint64_t dxgiRecUnseen = 0; // sum of dxgiUnseen over records claiming it
|
||||
std::size_t dxgiRecClaiming = 0; // records carrying FL_MEASURED_DXGI_PRESENTS
|
||||
std::uint32_t hooks = 0;
|
||||
std::uint32_t faults = 0;
|
||||
bool everyRecordClaimsCounts = true;
|
||||
@@ -3106,6 +3266,10 @@ bool ObserveFg(int presentsPerEval, FgObservation& out) {
|
||||
out.drained = all.size();
|
||||
for (const auto& r : all) {
|
||||
out.sigma += r.fgEvaluations;
|
||||
if ((r.measuredMask & fl::FL_MEASURED_DXGI_PRESENTS) != 0u) {
|
||||
++out.dxgiRecClaiming;
|
||||
out.dxgiRecUnseen += r.dxgiUnseen;
|
||||
}
|
||||
if ((r.measuredMask & fl::FL_MEASURED_FG_COUNTS) == 0u) {
|
||||
out.everyRecordClaimsCounts = false;
|
||||
}
|
||||
@@ -3128,6 +3292,13 @@ bool ObserveFg(int presentsPerEval, FgObservation& out) {
|
||||
}
|
||||
}
|
||||
out.hooks = st->hooksInstalledMask;
|
||||
// DXGI's counter against ours: published by the watchdog on its 1 Hz tick, so poll for
|
||||
// the samples to reach the window rather than reading the words once (HANDOFF §Traps).
|
||||
for (int i = 0; i < 80 && st->dxgiPresentSamples < out.drained; ++i) {
|
||||
Sleep(50);
|
||||
}
|
||||
out.dxgiUnseen = st->dxgiPresentsUnseen;
|
||||
out.dxgiSamples = st->dxgiPresentSamples;
|
||||
out.census = st->runtimeCensus;
|
||||
out.faults = st->faultCount;
|
||||
|
||||
@@ -3204,6 +3375,20 @@ TEST_CASE("application-frame tokens are COUNTED, and the count tracks the fixtur
|
||||
// is in this process. The second check is the one that matters: it is what
|
||||
// keeps a title with Streamline loaded and no evaluation observed from being
|
||||
// printed as "no frame-generation runtime was loaded".
|
||||
// DXGI'S COUNTER AGAINST OURS, the negative control: this fixture presents only through
|
||||
// the body the inline patch covers, so DXGI must count exactly the presents the hook
|
||||
// saw -- zero unseen -- and the counter must have been read on every hooked present.
|
||||
// A real title where DXGI counts MORE is the §H5 question this word exists to answer.
|
||||
CAPTURE(obs.dxgiUnseen);
|
||||
CAPTURE(obs.dxgiSamples);
|
||||
CHECK(obs.dxgiUnseen == 0u);
|
||||
CHECK(obs.dxgiSamples >= static_cast<std::uint32_t>(obs.drained));
|
||||
// And per record, in the form the consumer's buckets read: every drained record
|
||||
// claims the bit (the chain's first present, which cannot, is in the discarded
|
||||
// backlog) and carries a zero byte.
|
||||
CAPTURE(obs.dxgiRecClaiming);
|
||||
CHECK(obs.dxgiRecUnseen == 0u);
|
||||
CHECK(obs.dxgiRecClaiming == obs.drained);
|
||||
CHECK((obs.census & fl::FL_CENSUS_RAN) != 0u);
|
||||
CHECK((obs.census & fl::FL_CENSUS_SL_INTERPOSER) != 0u);
|
||||
CHECK((obs.census & fl::FL_CENSUS_FG_FAMILIES) == 0u);
|
||||
@@ -3474,6 +3659,46 @@ TEST_CASE("the SDK 1.1.x monolith is FSR3; with no PREPARE the count falls back
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("the FSR 3.0 host facade: Fsr3 identity and the count from its upscale, alone and beside the 1.1.x "
|
||||
"monolith generating",
|
||||
"[guard][inject][shm][ffx]") {
|
||||
// THE FIFTH AMD TARGET, AND NOT A LEAF: Cyberpunk 2077 at FSR 3 upscales through
|
||||
// ffx_fsr3_x64.dll's NAMED export and generates through the 1.1.x monolith's
|
||||
// ffxDispatch, and the leaf-only build printed `upscaler: N/A` beside `FsrFg`.
|
||||
//
|
||||
// (a) The host ALONE at K = 1 with no PREPARE anywhere: the application-frame count
|
||||
// must come from the host's UPSCALE and read 1.0 -- the double-count control for the
|
||||
// row (a writer that counted the call at two addresses reads 2.0), and the proof that
|
||||
// the host's count reaches fgEvaluations at all (a row claiming IDENTITY|PARAMS alone
|
||||
// would fail the floor here). Identity is FSR3 as a fact -- the 3.0 host hosts
|
||||
// nothing else -- and the census sees the host and NOT the monolith.
|
||||
{
|
||||
FfxObservation obs;
|
||||
REQUIRE(ObserveFfx(1, L"fsr3host", /*prepare=*/false, fl::FL_UPSCALER_FSR3, obs));
|
||||
AssertFfxWindow(obs, 1);
|
||||
|
||||
CHECK((obs.census & fl::FL_CENSUS_FFX_FSR3) != 0u);
|
||||
CHECK((obs.census & fl::FL_CENSUS_AMD_FFX_DX12) == 0u);
|
||||
}
|
||||
|
||||
// (b) Cyberpunk's shape: the host upscales while the monolith prepares (pre-V2, twice
|
||||
// per frame) and, at K = 4, generates. Identity can only have come from the host --
|
||||
// the monolith receives no UPSCALE -- while FsrFg at K = 4 and the count from the
|
||||
// PREPARE latch come from the monolith, and the family is published once BOTH are
|
||||
// patched (a family published on the first would entitle records the other module
|
||||
// was not yet producing).
|
||||
for (const int k : {1, 4}) {
|
||||
CAPTURE(k);
|
||||
FfxObservation obs;
|
||||
REQUIRE(ObserveFfx(k, L"fsr3host+mono", /*prepare=*/k > 1, fl::FL_UPSCALER_FSR3, obs));
|
||||
AssertFfxWindow(obs, k);
|
||||
|
||||
CHECK((obs.census & fl::FL_CENSUS_FFX_FSR3) != 0u);
|
||||
CHECK((obs.census & fl::FL_CENSUS_AMD_FFX_DX12) != 0u);
|
||||
CHECK((obs.census & fl::FL_CENSUS_AMD_FFX_UPSCALER) == 0u);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("the UE5 shape: the two SDK 2.x leaves called directly, no loader in the process",
|
||||
"[guard][inject][shm][ffx]") {
|
||||
// Hell Is Us and Expedition 33 -- the engine plugin compiles the MIT loader in and
|
||||
|
||||
+28
@@ -243,3 +243,31 @@ target_include_directories(fl_fidelityfx_headers SYSTEM INTERFACE
|
||||
# declaration that exports nothing unless something DEFINES it. FrameLedger.Overlay
|
||||
# must never define or take the address of one; hookinventory-check Pass C reads
|
||||
# the built DLL's export table as well as its imports for exactly that.
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# AMD FidelityFX SDK -- the FSR 3.0 HOST API headers (MIT) -- VENDORED, ten files,
|
||||
# at tag fsr3-v3.0.4, in a directory of their own beside the ffx-api tree above.
|
||||
#
|
||||
# WHAT THIS BUYS. Cyberpunk 2077 upscales at FSR 3 through ffx_fsr3_x64.dll's NAMED
|
||||
# exports rather than the ffx-api facade, so the row set above sees its frame
|
||||
# generation (the 1.1.x monolith) and not its upscaler. ffxFsr3ContextDispatchUpscale
|
||||
# takes a descriptor whose renderSize field is at an offset only the vendor's own
|
||||
# header can vouch for; this target makes that read a declaration. The tag is the
|
||||
# one whose declarations match the module the title SHIPS -- twelve ffxFsr3* exports,
|
||||
# fsr3-v3.0.4's exact set -- not the v1.1.4 the docs first named, whose dispatch
|
||||
# struct appends fields after renderSize and declares three exports the module lacks
|
||||
# (third_party/fidelityfx-fsr3/README.md).
|
||||
#
|
||||
# A SEPARATE DIRECTORY BECAUSE THE LICENCE SHAPE DIFFERS: a root LICENSE.txt that IS
|
||||
# the MIT grant, with every header carrying it inline -- not v2.3.0's exception list.
|
||||
# tools/license-check.ps1 §2e asserts that per file; §2d would have walked past it.
|
||||
#
|
||||
# ONE INCLUDE DIRECTORY: the headers include each other as <FidelityFX/host/...>, so
|
||||
# sdk/include is the root and upstream's layout is kept, unmodified.
|
||||
add_library(fl_fsr3_host_headers INTERFACE)
|
||||
target_include_directories(fl_fsr3_host_headers SYSTEM INTERFACE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/fidelityfx-fsr3/sdk/include"
|
||||
)
|
||||
# Never linked, same rule as above. FFX_API here is __declspec(dllexport) with no
|
||||
# switch at all (ffx_types.h at this tag); the Overlay defines none of the names and
|
||||
# Pass C's forbidden-export pattern (^ffx[A-Z]) already covers ffxFsr3*.
|
||||
@@ -0,0 +1,19 @@
|
||||
Copyright © 2023 Advanced Micro Devices, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files(the “Software”), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and /or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions :
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
# AMD FidelityFX SDK — FSR 3.0 host API headers (vendored)
|
||||
|
||||
Copied from <https://github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK>, tag
|
||||
**`fsr3-v3.0.4`** (commit `55ff22bb6981a9b9c087b9465101769fc0acd447`). **Ten headers and the
|
||||
licence file.** A second vendoring directory beside `../fidelityfx/` (tag `v2.3.0`, the ffx-api
|
||||
facade), because the two tags carry two different licence *shapes* and `tools/license-check.ps1`
|
||||
asserts each per file: §2d walks `fidelityfx/Kits/` against the exception list inside its
|
||||
`license.md`; **§2e walks this directory's `sdk/` against the root `LICENSE.txt`**, which at this
|
||||
tag is the MIT grant verbatim, with every header carrying the same grant in its own banner.
|
||||
|
||||
## Why this tag — and why not `v1.1.4`, which three documents named
|
||||
|
||||
The one installed title that ships the FSR 3.0 **host** DLLs is Cyberpunk 2077
|
||||
(`ffx_fsr3_x64.dll`, `ffx_fsr3upscaler_x64.dll`, `ffx_frameinterpolation_x64.dll`,
|
||||
`ffx_opticalflow_x64.dll`, `ffx_backend_dx12_x64.dll`). `docs/vendor-exports.json` records
|
||||
`ffx_fsr3_x64.dll` exporting **twelve** `ffxFsr3*` names: `ContextCreate`, `ContextDestroy`,
|
||||
`ContextDispatchUpscale`, `ContextGenerateReactiveMask`, `DispatchFrameGeneration`,
|
||||
`ConfigureFrameGeneration`, `GetJitterOffset`, `GetJitterPhaseCount`,
|
||||
`GetRenderResolutionFromQualityMode`, `GetUpscaleRatioFromQualityMode`, `ResourceIsNull`,
|
||||
`SkipPresent`. Read off the upstream tags through the GitHub API on 2026-09-05:
|
||||
|
||||
- **`fsr3-v3.0.4`** (and `fsr3-v3.0.3`) declares exactly those twelve. Its
|
||||
`FfxFsr3DispatchUpscaleDescription` ends at `viewSpaceToMetersFactor`.
|
||||
- **`v1.1.4`** declares fifteen — it adds `ContextGetGpuMemoryUsage`,
|
||||
`ContextDispatchFrameGenerationPrepare` and `GetEffectVersion`, none of which the shipped
|
||||
module exports — and its `FfxFsr3DispatchUpscaleDescription` appends `upscaleSize`, `flags`
|
||||
and `frameID` **after `renderSize`**. A detour typed against 1.1.4 would read
|
||||
`enableSharpening`/`sharpness` bytes as an output size on Cyberpunk's 3.0 module.
|
||||
- The prefix through `renderSize` — `commandList`, seven `FfxResource`s, `jitterOffset`,
|
||||
`motionVectorScale`, `renderSize` — is **identical** in 3.0.3, 3.0.4 and 1.1.4, and it is the
|
||||
only field the Overlay reads. `dllmain.cpp` pins `offsetof(FfxFsr3DispatchUpscaleDescription,
|
||||
renderSize)` to a literal so a re-vendoring that moved it fails to compile rather than reading
|
||||
the wrong bytes.
|
||||
|
||||
So the declarations vendored are the ones the shipped module exports, and the corrections to
|
||||
`docs/18_GPU_VENDOR_APIS.md`, `docs/HANDOFF.md` and `docs/20_OPEN_QUESTIONS.md` — all of which
|
||||
said `v1.1.4` — landed with this directory.
|
||||
|
||||
## The include closure, measured — and `<mutex>` is not in it
|
||||
|
||||
Those same documents said the closure was "ten headers reaching `<mutex>` / `<shared_mutex>`
|
||||
through `ffx_types.h`". That is true of **1.1.x**, where `ffx_types.h` includes them behind
|
||||
`#ifndef FFX_MUTEX`. At `fsr3-v3.0.4` **`ffx_types.h` includes `<stdint.h>` and nothing else**,
|
||||
and no file below pulls in the STL or `<windows.h>`:
|
||||
|
||||
```
|
||||
ffx_fsr3.h
|
||||
├── ffx_interface.h
|
||||
│ ├── ffx_assert.h → ffx_types.h, ffx_util.h (→ ffx_types.h)
|
||||
│ ├── ffx_types.h → <stdint.h>
|
||||
│ └── ffx_error.h → ffx_types.h
|
||||
├── ffx_fsr3upscaler.h → ffx_interface.h, ../gpu/fsr3upscaler/ffx_fsr3upscaler_resources.h (defines only)
|
||||
├── ffx_frameinterpolation.h → ffx_interface.h
|
||||
└── ffx_opticalflow.h → ffx_interface.h
|
||||
```
|
||||
|
||||
Ten files, no `ffx_message.h` (that file exists at 1.1.x, not here). The Overlay is built with
|
||||
`_HAS_EXCEPTIONS=0` and no C++ exceptions on hook paths; a closure with no STL in it has nothing
|
||||
to audit for `throw`, which is the property the Streamline closure had to be measured for.
|
||||
|
||||
## `FFX_API` is `__declspec(dllexport)` unconditionally
|
||||
|
||||
`ffx_types.h` defines `FFX_API` as `__declspec(dllexport)` on every non-GCC compiler — there is
|
||||
no import switch at this tag (the `FFX_BUILD_AS_DLL` switch arrives in 1.1.x). That is the same
|
||||
hazard `ffx_api.h`'s `FFX_API_ENTRY` carries and it has the same answer: a declaration exports
|
||||
nothing unless something *defines* it. `FrameLedger.Overlay` includes `ffx_fsr3.h` for types and
|
||||
`decltype` only and defines none of the names; `tools/hookinventory-check.ps1` Pass C reads the
|
||||
built DLL's export table (forbidden pattern `^ffx[A-Z]`) to keep that true, and the
|
||||
`ffx_fsr3_x64.dll` fixture in `tools/vendor-stubs` — which *does* define four of them through the
|
||||
vendor's own macro — is the parser's second positive control.
|
||||
|
||||
## Coexistence with `../fidelityfx/` in one translation unit
|
||||
|
||||
Both trees are included by `dllmain.cpp` and by `hook-harness`. Measured at the first build: the
|
||||
type names are disjoint (`FfxApiResource` / `FfxApiDimensions2D` there, `FfxResource` /
|
||||
`FfxDimensions2D` here) **except one** — both trees define a struct named
|
||||
`FfxFrameGenerationConfig` (2.3.0's `ffx_framegeneration.h`, 3.0.4's `ffx_interface.h`) — and the
|
||||
one macro both define, `FFX_RESOURCE_NAME_SIZE`, is `64` in each, a legal identical redefinition.
|
||||
So the consumers include this tree **inside a namespace** (`namespace fsr3host { #include
|
||||
<FidelityFX/host/ffx_fsr3.h> }`): the headers stay verbatim, the entry points keep their C
|
||||
linkage (a C-linkage function declared in two namespace scopes is one function), and every field
|
||||
the Overlay reads is still the vendor's own declaration, spelled `fsr3host::…`.
|
||||
|
||||
## Unmodified, and checked rather than claimed
|
||||
|
||||
`git hash-object` on each vendored file equals the blob sha the GitHub tree API reports for the
|
||||
same path at the tag. Upstream ships **LF**; `.gitattributes` (`* text=auto eol=crlf`) stores LF
|
||||
in the index and materialises CRLF in the working tree, so `git ls-files -s` agrees with the table
|
||||
below and a checked-out file differs from upstream in line endings only — the same shape as the
|
||||
`../fidelityfx/` tree:
|
||||
|
||||
| File | Blob sha |
|
||||
|---|---|
|
||||
| `LICENSE.txt` | `3c5c80518fc83a2532f8445f925d46677eca7782` |
|
||||
| `sdk/include/FidelityFX/host/ffx_fsr3.h` | `62bf127fcbf0625d057b2f6ff0d72cdee9716f74` |
|
||||
| `sdk/include/FidelityFX/host/ffx_interface.h` | `3a7277afae65bd651d1ae8ea4a356bc122df052c` |
|
||||
| `sdk/include/FidelityFX/host/ffx_fsr3upscaler.h` | `83bee5d9cdf84ed32dd974cc447599d30d62be82` |
|
||||
| `sdk/include/FidelityFX/host/ffx_frameinterpolation.h` | `4a98ad05eee506fed7ed17e79dfece37a6aeca77` |
|
||||
| `sdk/include/FidelityFX/host/ffx_opticalflow.h` | `f18a6ddabb9c89cb8eede03c00d92869ca1a3764` |
|
||||
| `sdk/include/FidelityFX/host/ffx_assert.h` | `11718eca730e0eae6a7b9f6db5070a649bab31ef` |
|
||||
| `sdk/include/FidelityFX/host/ffx_types.h` | `64494df9eff3f14d29f97e9add9d85e83e8a4c07` |
|
||||
| `sdk/include/FidelityFX/host/ffx_error.h` | `d1d466fec4ba3964ce9121850a51cdc42d0aa685` |
|
||||
| `sdk/include/FidelityFX/host/ffx_util.h` | `123cd1969f6307601be8d94e902fe6e5a2b0d77c` |
|
||||
| `sdk/include/FidelityFX/gpu/fsr3upscaler/ffx_fsr3upscaler_resources.h` | `d98cfcc0602c7dd59ece0960fd02dbdaef0bb897` |
|
||||
|
||||
## What is here, and what is not
|
||||
|
||||
Kept in upstream's `sdk/include/FidelityFX/…` layout because the headers include each other by
|
||||
`<FidelityFX/host/…>` path; the CMake target `fl_fsr3_host_headers` adds `sdk/include` as a
|
||||
`SYSTEM` include directory and links nothing.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| **Here** | the ten-file closure of `ffx_fsr3.h` above, and `LICENSE.txt` |
|
||||
| **Not here** | everything else under `sdk/` — the backends (`ffx_dx12.h`, `ffx_vk.h`), every `.cpp`, every shader, every other effect's host header, the samples and `Kits/`. Nothing is vendored ahead of a consumer (`docs/18_GPU_VENDOR_APIS.md`) |
|
||||
|
||||
## How it is consumed
|
||||
|
||||
**Types and `decltype` only, never linked.** The Overlay reads exactly one field of the argument
|
||||
the title passes to one export — `FfxFsr3DispatchUpscaleDescription::renderSize` on
|
||||
`ffx_fsr3_x64.dll!ffxFsr3ContextDispatchUpscale` — for the upscaler's identity (`FL_UPSCALER_FSR3`)
|
||||
and render extent. Never the context, never a resource, never the command list (CLAUDE.md
|
||||
rule 4). `ffxFsr3DispatchFrameGeneration` and `ffxFsr3SkipPresent` are probe-only names
|
||||
(`SpeaksFsr3Host` in `fl_hook_inventory.h`): checked for existence, never resolved, never called.
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
// This file is part of the FidelityFX SDK.
|
||||
//
|
||||
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
|
||||
#ifndef FFX_FSR3UPSCALER_RESOURCES_H
|
||||
#define FFX_FSR3UPSCALER_RESOURCES_H
|
||||
|
||||
#if defined(FFX_CPU) || defined(FFX_GPU)
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_NULL 0
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INPUT_OPAQUE_ONLY 1
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INPUT_COLOR 2
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INPUT_MOTION_VECTORS 3
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INPUT_DEPTH 4
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INPUT_EXPOSURE 5
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INPUT_REACTIVE_MASK 6
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INPUT_TRANSPARENCY_AND_COMPOSITION_MASK 7
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_RECONSTRUCTED_PREVIOUS_NEAREST_DEPTH 8
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_DILATED_MOTION_VECTORS 9
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_DILATED_DEPTH 10
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INTERNAL_UPSCALED_COLOR 11
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_LOCK_STATUS 12
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_NEW_LOCKS 13
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_PREPARED_INPUT_COLOR 14
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_LUMA_HISTORY 15
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_DEBUG_OUTPUT 16
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_LANCZOS_LUT 17
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SPD_ATOMIC_COUNT 18
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_UPSCALED_OUTPUT 19
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_RCAS_INPUT 20
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_LOCK_STATUS_1 21
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_LOCK_STATUS_2 22
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INTERNAL_UPSCALED_COLOR_1 23
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INTERNAL_UPSCALED_COLOR_2 24
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INTERNAL_DEFAULT_REACTIVITY 25
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INTERNAL_DEFAULT_TRANSPARENCY_AND_COMPOSITION 26
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTITIER_UPSAMPLE_MAXIMUM_BIAS_LUT 27
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_DILATED_REACTIVE_MASKS 28
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE 29 // same as FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_0
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_0 29
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_1 30
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_2 31
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_3 32
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_4 33
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_5 34
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_6 35
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_7 36
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_8 37
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_9 38
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_10 39
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_11 40
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_12 41
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INTERNAL_DEFAULT_EXPOSURE 42
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_AUTO_EXPOSURE 43
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_AUTOREACTIVE 44
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_AUTOCOMPOSITION_DEPRECATED 45
|
||||
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_PREV_PRE_ALPHA_COLOR 46
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_PREV_POST_ALPHA_COLOR 47
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_PREV_PRE_ALPHA_COLOR_1 48
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_PREV_POST_ALPHA_COLOR_1 49
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_PREV_PRE_ALPHA_COLOR_2 50
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_PREV_POST_ALPHA_COLOR_2 51
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_PREVIOUS_DILATED_MOTION_VECTORS 52
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_LUMA_HISTORY_1 53
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_LUMA_HISTORY_2 54
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_LOCK_INPUT_LUMA 55
|
||||
|
||||
// Shading change detection mip level setting, value must be in the range [FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_0, FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_12]
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_SHADING_CHANGE FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_4
|
||||
#define FFX_FSR3UPSCALER_SHADING_CHANGE_MIP_LEVEL (FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_SHADING_CHANGE - FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE)
|
||||
|
||||
#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_COUNT 56
|
||||
|
||||
#define FFX_FSR3UPSCALER_CONSTANTBUFFER_IDENTIFIER_FSR3UPSCALER 0
|
||||
#define FFX_FSR3UPSCALER_CONSTANTBUFFER_IDENTIFIER_SPD 1
|
||||
#define FFX_FSR3UPSCALER_CONSTANTBUFFER_IDENTIFIER_RCAS 2
|
||||
#define FFX_FSR3UPSCALER_CONSTANTBUFFER_IDENTIFIER_GENREACTIVE 3
|
||||
|
||||
#define FFX_FSR3UPSCALER_AUTOREACTIVEFLAGS_APPLY_TONEMAP 1
|
||||
#define FFX_FSR3UPSCALER_AUTOREACTIVEFLAGS_APPLY_INVERSETONEMAP 2
|
||||
#define FFX_FSR3UPSCALER_AUTOREACTIVEFLAGS_APPLY_THRESHOLD 4
|
||||
#define FFX_FSR3UPSCALER_AUTOREACTIVEFLAGS_USE_COMPONENTS_MAX 8
|
||||
|
||||
#endif // #if defined(FFX_CPU) || defined(FFX_GPU)
|
||||
|
||||
#endif //!defined( FFX_FSR3UPSCALER_RESOURCES_H )
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
// This file is part of the FidelityFX SDK.
|
||||
//
|
||||
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <FidelityFX/host/ffx_types.h>
|
||||
#include <FidelityFX/host/ffx_util.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // #ifdef __cplusplus
|
||||
|
||||
/// @defgroup Asserts Asserts
|
||||
/// Asserts used by FidelityFX SDK functions
|
||||
///
|
||||
/// @ingroup ffxHost
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef _WIN32
|
||||
|
||||
#ifdef DISABLE_FFX_DEBUG_BREAK
|
||||
#define FFX_DEBUG_BREAK \
|
||||
{ \
|
||||
}
|
||||
#else
|
||||
/// Macro to force the debugger to break at this point in the code.
|
||||
///
|
||||
/// @ingroup Asserts
|
||||
#define FFX_DEBUG_BREAK __debugbreak();
|
||||
#endif
|
||||
#else
|
||||
#define FFX_DEBUG_BREAK \
|
||||
{ \
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
// don't allow debug break in release builds.
|
||||
#define FFX_DEBUG_BREAK
|
||||
#endif
|
||||
|
||||
/// A typedef for the callback function for assert printing.
|
||||
///
|
||||
/// This can be used to re-route printing of assert messages from the FFX backend
|
||||
/// to another destination. For example instead of the default behaviour of printing
|
||||
/// the assert messages to the debugger's TTY the message can be re-routed to a
|
||||
/// MessageBox in a GUI application.
|
||||
///
|
||||
/// @param [in] message The message generated by the assert.
|
||||
///
|
||||
/// @ingroup Asserts
|
||||
typedef void (*FfxAssertCallback)(const char* message);
|
||||
|
||||
/// Function to report an assert.
|
||||
///
|
||||
/// @param [in] file The name of the file as a string.
|
||||
/// @param [in] line The index of the line in the file.
|
||||
/// @param [in] condition The boolean condition that was tested.
|
||||
/// @param [in] msg The optional message to print.
|
||||
///
|
||||
/// @returns
|
||||
/// Always returns true.
|
||||
///
|
||||
/// @ingroup Asserts
|
||||
FFX_API bool ffxAssertReport(const char* file, int32_t line, const char* condition, const char* msg);
|
||||
|
||||
/// Provides the ability to set a callback for assert messages.
|
||||
///
|
||||
/// @param [in] callback The callback function that will receive assert messages.
|
||||
///
|
||||
/// @ingroup Asserts
|
||||
FFX_API void ffxAssertSetPrintingCallback(FfxAssertCallback callback);
|
||||
|
||||
#ifdef _DEBUG
|
||||
/// Standard assert macro.
|
||||
///
|
||||
/// @ingroup Asserts
|
||||
#define FFX_ASSERT(condition) \
|
||||
do \
|
||||
{ \
|
||||
if (!(condition) && ffxAssertReport(__FILE__, __LINE__, #condition, NULL)) \
|
||||
FFX_DEBUG_BREAK \
|
||||
} while (0)
|
||||
|
||||
/// Assert macro with message.
|
||||
///
|
||||
/// @ingroup Asserts
|
||||
#define FFX_ASSERT_MESSAGE(condition, msg) \
|
||||
do \
|
||||
{ \
|
||||
if (!(condition) && ffxAssertReport(__FILE__, __LINE__, #condition, msg)) \
|
||||
FFX_DEBUG_BREAK \
|
||||
} while (0)
|
||||
|
||||
/// Assert macro that always fails.
|
||||
///
|
||||
/// @ingroup Asserts
|
||||
#define FFX_ASSERT_FAIL(message) \
|
||||
do \
|
||||
{ \
|
||||
ffxAssertReport(__FILE__, __LINE__, NULL, message); \
|
||||
FFX_DEBUG_BREAK \
|
||||
} while (0)
|
||||
#else
|
||||
// asserts disabled
|
||||
#define FFX_ASSERT(condition) \
|
||||
do \
|
||||
{ \
|
||||
FFX_UNUSED(condition); \
|
||||
} while (0)
|
||||
|
||||
#define FFX_ASSERT_MESSAGE(condition, message) \
|
||||
do \
|
||||
{ \
|
||||
FFX_UNUSED(condition); \
|
||||
FFX_UNUSED(message); \
|
||||
} while (0)
|
||||
|
||||
#define FFX_ASSERT_FAIL(message) \
|
||||
do \
|
||||
{ \
|
||||
FFX_UNUSED(message); \
|
||||
} while (0)
|
||||
#endif // #if _DEBUG
|
||||
|
||||
/// Simple static assert.
|
||||
///
|
||||
/// @ingroup Asserts
|
||||
#define FFX_STATIC_ASSERT(condition) static_assert(condition, #condition)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // #ifdef __cplusplus
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
// This file is part of the FidelityFX SDK.
|
||||
//
|
||||
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <FidelityFX/host/ffx_types.h>
|
||||
|
||||
/// @defgroup Errors Error Codes
|
||||
/// Error codes returned from FidelityFX SDK functions
|
||||
///
|
||||
/// @ingroup ffxHost
|
||||
|
||||
/// Typedef for error codes returned from functions in the FidelityFX SDK.
|
||||
///
|
||||
/// @ingroup Errors
|
||||
typedef int32_t FfxErrorCode;
|
||||
|
||||
/// Error codes and their meaning
|
||||
///
|
||||
/// @ingroup Errors
|
||||
typedef enum FfxErrorCodes {
|
||||
|
||||
FFX_OK = 0, ///< The operation completed successfully.
|
||||
FFX_ERROR_INVALID_POINTER = 0x80000000, ///< The operation failed due to an invalid pointer.
|
||||
FFX_ERROR_INVALID_ALIGNMENT = 0x80000001, ///< The operation failed due to an invalid alignment.
|
||||
FFX_ERROR_INVALID_SIZE = 0x80000002, ///< The operation failed due to an invalid size.
|
||||
FFX_EOF = 0x80000003, ///< The end of the file was encountered.
|
||||
FFX_ERROR_INVALID_PATH = 0x80000004, ///< The operation failed because the specified path was invalid.
|
||||
FFX_ERROR_EOF = 0x80000005, ///< The operation failed because end of file was reached.
|
||||
FFX_ERROR_MALFORMED_DATA = 0x80000006, ///< The operation failed because of some malformed data.
|
||||
FFX_ERROR_OUT_OF_MEMORY = 0x80000007, ///< The operation failed because it ran out memory.
|
||||
FFX_ERROR_INCOMPLETE_INTERFACE = 0x80000008, ///< The operation failed because the interface was not fully configured.
|
||||
FFX_ERROR_INVALID_ENUM = 0x80000009, ///< The operation failed because of an invalid enumeration value.
|
||||
FFX_ERROR_INVALID_ARGUMENT = 0x8000000a, ///< The operation failed because an argument was invalid.
|
||||
FFX_ERROR_OUT_OF_RANGE = 0x8000000b, ///< The operation failed because a value was out of range.
|
||||
FFX_ERROR_NULL_DEVICE = 0x8000000c, ///< The operation failed because a device was null.
|
||||
FFX_ERROR_BACKEND_API_ERROR = 0x8000000d, ///< The operation failed because the backend API returned an error code.
|
||||
FFX_ERROR_INSUFFICIENT_MEMORY = 0x8000000e, ///< The operation failed because there was not enough memory.
|
||||
|
||||
}FfxErrorCodes;
|
||||
|
||||
/// Helper macro to return error code y from a function when a specific condition, x, is not met.
|
||||
///
|
||||
/// @ingroup Errors
|
||||
#define FFX_RETURN_ON_ERROR(x, y) \
|
||||
if (!(x)) \
|
||||
{ \
|
||||
return (y); \
|
||||
}
|
||||
|
||||
/// Helper macro to return error code x from a function when it is not FFX_OK.
|
||||
///
|
||||
/// @ingroup Errors
|
||||
#define FFX_VALIDATE(x) \
|
||||
{ \
|
||||
FfxErrorCode ret = x; \
|
||||
FFX_RETURN_ON_ERROR(ret == FFX_OK, ret); \
|
||||
}
|
||||
Vendored
+242
@@ -0,0 +1,242 @@
|
||||
// This file is part of the FidelityFX SDK.
|
||||
//
|
||||
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
|
||||
// @defgroup FRAMEINTERPOLATION
|
||||
|
||||
#pragma once
|
||||
|
||||
// Include the interface for the backend of the Frameinterpolation API.
|
||||
#include <FidelityFX/host/ffx_interface.h>
|
||||
|
||||
/// FidelityFX Frameinterpolation major version.
|
||||
///
|
||||
/// @ingroup FRAMEINTERPOLATIONFRAMEINTERPOLATION
|
||||
#define FFX_FRAMEINTERPOLATION_VERSION_MAJOR (1)
|
||||
|
||||
/// FidelityFX Frameinterpolation minor version.
|
||||
///
|
||||
/// @ingroup FRAMEINTERPOLATIONFRAMEINTERPOLATION
|
||||
#define FFX_FRAMEINTERPOLATION_VERSION_MINOR (0)
|
||||
|
||||
/// FidelityFX Frameinterpolation patch version.
|
||||
///
|
||||
/// @ingroup FRAMEINTERPOLATIONFRAMEINTERPOLATION
|
||||
#define FFX_FRAMEINTERPOLATION_VERSION_PATCH (1)
|
||||
|
||||
/// FidelityFX Frame Interpolation context count
|
||||
///
|
||||
/// Defines the number of internal effect contexts required by Frame Interpolation
|
||||
///
|
||||
/// @ingroup ffxFrameInterpolation
|
||||
#define FFX_FRAMEINTERPOLATION_CONTEXT_COUNT (1)
|
||||
|
||||
/// The size of the context specified in 32bit values.
|
||||
///
|
||||
/// @ingroup FRAMEINTERPOLATIONFRAMEINTERPOLATION
|
||||
#define FFX_FRAMEINTERPOLATION_CONTEXT_SIZE (FFX_SDK_DEFAULT_CONTEXT_SIZE)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
||||
/// An enumeration of all the passes which constitute the FSR3 algorithm.
|
||||
///
|
||||
/// FSR3 is implemented as a composite of several compute passes each
|
||||
/// computing a key part of the final result. Each call to the
|
||||
/// <c><i>FfxFsr3ScheduleGpuJobFunc</i></c> callback function will
|
||||
/// correspond to a single pass included in <c><i>FfxFsr3Pass</i></c>. For a
|
||||
/// more comprehensive description of each pass, please refer to the FSR3
|
||||
/// reference documentation.
|
||||
///
|
||||
/// Please note in some cases e.g.: <c><i>FFX_FSR3_PASS_ACCUMULATE</i></c>
|
||||
/// and <c><i>FFX_FSR3_PASS_ACCUMULATE_SHARPEN</i></c> either one pass or the
|
||||
/// other will be used (they are mutually exclusive). The choice of which will
|
||||
/// depend on the way the <c><i>FfxFsr3Context</i></c> is created and the
|
||||
/// precise contents of <c><i>FfxFsr3DispatchParamters</i></c> each time a call
|
||||
/// is made to <c><i>ffxFsr3ContextDispatch</i></c>.
|
||||
///
|
||||
/// @ingroup FRAMEINTERPOLATIONFRAMEINTERPOLATION
|
||||
typedef enum FfxFrameInterpolationPass
|
||||
{
|
||||
FFX_FRAMEINTERPOLATION_PASS_SETUP,
|
||||
FFX_FRAMEINTERPOLATION_PASS_RECONSTRUCT_PREV_DEPTH,
|
||||
FFX_FRAMEINTERPOLATION_PASS_GAME_MOTION_VECTOR_FIELD,
|
||||
FFX_FRAMEINTERPOLATION_PASS_OPTICAL_FLOW_VECTOR_FIELD,
|
||||
FFX_FRAMEINTERPOLATION_PASS_DISOCCLUSION_MASK,
|
||||
FFX_FRAMEINTERPOLATION_PASS_INTERPOLATION,
|
||||
FFX_FRAMEINTERPOLATION_PASS_INPAINTING_PYRAMID,
|
||||
FFX_FRAMEINTERPOLATION_PASS_INPAINTING,
|
||||
FFX_FRAMEINTERPOLATION_PASS_GAME_VECTOR_FIELD_INPAINTING_PYRAMID,
|
||||
FFX_FRAMEINTERPOLATION_PASS_DEBUG_VIEW,
|
||||
FFX_FRAMEINTERPOLATION_PASS_COUNT ///< The number of passes performed by FrameInterpolation.
|
||||
} FfxFrameInterpolationPass;
|
||||
|
||||
// forward declarations
|
||||
struct FfxFrameInterpolationContext;
|
||||
|
||||
/// An enumeration of bit flags used when creating a
|
||||
/// <c><i>FfxFrameInterpolationContext</i></c>. See <c><i>FfxFrameInterpolationContextDescription</i></c>.
|
||||
///
|
||||
/// @ingroup FRAMEINTERPOLATIONFRAMEINTERPOLATION
|
||||
typedef enum FfxFrameInterpolationInitializationFlagBits {
|
||||
|
||||
FFX_FRAMEINTERPOLATION_ENABLE_DEPTH_INVERTED = (1<<0), ///< A bit indicating that the input depth buffer data provided is inverted [1..0].
|
||||
FFX_FRAMEINTERPOLATION_ENABLE_DEPTH_INFINITE = (1<<1), ///< A bit indicating that the input depth buffer data provided is using an infinite far plane.
|
||||
FFX_FRAMEINTERPOLATION_ENABLE_TEXTURE1D_USAGE = (1<<2), ///< A bit indicating that the backend should use 1D textures.
|
||||
FFX_FRAMEINTERPOLATION_ENABLE_HDR_COLOR_INPUT = (1<<3) ///< A bit indicating that HDR values are present in the imaging pipeline.
|
||||
} FfxFrameInterpolationInitializationFlagBits;
|
||||
|
||||
/// A structure encapsulating the parameters required to initialize
|
||||
/// FidelityFX Frameinterpolation upscaling.
|
||||
///
|
||||
/// @ingroup FRAMEINTERPOLATION
|
||||
typedef struct FfxFrameInterpolationContextDescription {
|
||||
|
||||
FfxInterface backendInterface; ///< A set of pointers to the backend implementation for FidelityFX SDK
|
||||
|
||||
uint32_t flags; ///< A collection of <c><i>FfxFrameInterpolationInitializationFlagBits</i></c>.
|
||||
FfxDimensions2D maxRenderSize; ///< The maximum size that rendering will be performed at.
|
||||
FfxDimensions2D displaySize; ///< The size of the presentation resolution
|
||||
FfxSurfaceFormat backBufferFormat;
|
||||
} FfxFrameInterpolationContextDescription;
|
||||
|
||||
/// A structure encapsulating the FidelityFX Super Resolution 2 context.
|
||||
///
|
||||
/// This sets up an object which contains all persistent internal data and
|
||||
/// resources that are required by FSR3.
|
||||
///
|
||||
/// The <c><i>FfxFsr3Context</i></c> object should have a lifetime matching
|
||||
/// your use of FSR3. Before destroying the FSR3 context care should be taken
|
||||
/// to ensure the GPU is not accessing the resources created or used by FSR3.
|
||||
/// It is therefore recommended that the GPU is idle before destroying the
|
||||
/// FSR3 context.
|
||||
///
|
||||
/// @ingroup FRAMEINTERPOLATION
|
||||
typedef struct FfxFrameInterpolationContext
|
||||
{
|
||||
uint32_t data[FFX_FRAMEINTERPOLATION_CONTEXT_SIZE]; ///< An opaque set of <c>uint32_t</c> which contain the data for the context.
|
||||
} FfxFrameInterpolationContext;
|
||||
|
||||
|
||||
/// Create a FidelityFX Super Resolution 2 context from the parameters
|
||||
/// programmed to the <c><i>FfxFsr3CreateParams</i></c> structure.
|
||||
///
|
||||
/// The context structure is the main object used to interact with the FSR3
|
||||
/// API, and is responsible for the management of the internal resources used
|
||||
/// by the FSR3 algorithm. When this API is called, multiple calls will be
|
||||
/// made via the pointers contained in the <c><i>callbacks</i></c> structure.
|
||||
/// These callbacks will attempt to retreive the device capabilities, and
|
||||
/// create the internal resources, and pipelines required by FSR3's
|
||||
/// frame-to-frame function. Depending on the precise configuration used when
|
||||
/// creating the <c><i>FfxFsr3Context</i></c> a different set of resources and
|
||||
/// pipelines might be requested via the callback functions.
|
||||
///
|
||||
/// The flags included in the <c><i>flags</i></c> field of
|
||||
/// <c><i>FfxFsr3Context</i></c> how match the configuration of your
|
||||
/// application as well as the intended use of FSR3. It is important that these
|
||||
/// flags are set correctly (as well as a correct programmed
|
||||
/// <c><i>FfxFsr3DispatchDescription</i></c>) to ensure correct operation. It is
|
||||
/// recommended to consult the overview documentation for further details on
|
||||
/// how FSR3 should be integerated into an application.
|
||||
///
|
||||
/// When the <c><i>FfxFsr3Context</i></c> is created, you should use the
|
||||
/// <c><i>ffxFsr3ContextDispatch</i></c> function each frame where FSR3
|
||||
/// upscaling should be applied. See the documentation of
|
||||
/// <c><i>ffxFsr3ContextDispatch</i></c> for more details.
|
||||
///
|
||||
/// The <c><i>FfxFsr3Context</i></c> should be destroyed when use of it is
|
||||
/// completed, typically when an application is unloaded or FSR3 upscaling is
|
||||
/// disabled by a user. To destroy the FSR3 context you should call
|
||||
/// <c><i>ffxFsr3ContextDestroy</i></c>.
|
||||
///
|
||||
/// @param [out] context A pointer to a <c><i>FfxFsr3Context</i></c> structure to populate.
|
||||
/// @param [in] contextDescription A pointer to a <c><i>FfxFsr3ContextDescription</i></c> structure.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either <c><i>context</i></c> or <c><i>contextDescription</i></c> was <c><i>NULL</i></c>.
|
||||
/// @retval
|
||||
/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the <c><i>FfxFsr3ContextDescription.callbacks</i></c> was not fully specified.
|
||||
/// @retval
|
||||
/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend.
|
||||
///
|
||||
/// @ingroup FRAMEINTERPOLATION
|
||||
FFX_API FfxErrorCode ffxFrameInterpolationContextCreate(FfxFrameInterpolationContext* context, FfxFrameInterpolationContextDescription* contextDescription);
|
||||
|
||||
typedef enum FfxFrameInterpolationDispatchFlags
|
||||
{
|
||||
FFX_FRAMEINTERPOLATION_DISPATCH_DRAW_DEBUG_TEAR_LINES = (1 << 0), ///< A bit indicating that the debug tear lines will be drawn to the interpolated output.
|
||||
FFX_FRAMEINTERPOLATION_DISPATCH_DRAW_DEBUG_VIEW = (1 << 1), ///< A bit indicating that the interpolated output resource will contain debug views with relevant information.
|
||||
} FfxFrameInterpolationDispatchFlags;
|
||||
|
||||
typedef struct FfxFrameInterpolationDispatchDescription {
|
||||
|
||||
uint32_t flags; ///< combination of FfxFrameInterpolationDispatchFlags
|
||||
FfxCommandList commandList; ///< The <c><i>FfxCommandList</i></c> to record frame interpolation commands into.
|
||||
FfxDimensions2D displaySize; ///< The destination output dimensions
|
||||
FfxDimensions2D renderSize; ///< The dimensions used to render game content, dilatedDepth, dilatedMotionVectors are expected to be of ths size.
|
||||
FfxResource currentBackBuffer; ///< The current presentation color, if currentBackBuffer_HUDLess is not used, this will be used as interpolation source data.
|
||||
FfxResource currentBackBuffer_HUDLess; ///< The current presentation color without HUD content, when use it will be used as interpolation source data.
|
||||
FfxResource output; ///< The output resource where to store the interpolated result.
|
||||
FfxResource dilatedDepth; ///< The dilated depth buffer data (see example computation in the FfxFsr3Upscaler effect)
|
||||
FfxResource dilatedMotionVectors; ///< The dilated motion vector data (see example computation in the FfxFsr3Upscaler effect)
|
||||
FfxResource reconstructPrevNearDepth; ///< The estimated previous frame depth buffer (see example computation in the FfxFsr3Upscaler effect)
|
||||
|
||||
FfxRect2D interpolationRect; ///< The area of the backbuffer that should be used for interpolation in case only a part of the screen is used e.g. due to movie bars
|
||||
|
||||
FfxResource opticalFlowVector; ///< The optical flow motion vectors (see example computation in the FfxOpticalFlow effect)
|
||||
FfxResource opticalFlowSceneChangeDetection; ///< The optical flow scene change detection data
|
||||
FfxDimensions2D opticalFlowBufferSize; ///< The optical flow motion vector resource dimensions
|
||||
FfxFloatCoords2D opticalFlowScale; ///< The optical flow motion vector scale factor, used to scale resoure values into [0.0,1.0] range.
|
||||
int opticalFlowBlockSize; ///< The optical flow block dimension size
|
||||
|
||||
float cameraNear; ///< The distance to the near plane of the camera.
|
||||
float cameraFar; ///< The distance to the far plane of the camera. This is used only used in case of non infinite depth.
|
||||
float cameraFovAngleVertical; ///< The camera angle field of view in the vertical direction (expressed in radians).
|
||||
float viewSpaceToMetersFactor; ///< The unit to scale view space coordinates to meters.
|
||||
|
||||
float frameTimeDelta; ///< The time elapsed since the last frame (expressed in milliseconds).
|
||||
bool reset; ///< A boolean value which when set to true, indicates the camera has moved discontinuously.
|
||||
|
||||
FfxBackbufferTransferFunction backBufferTransferFunction; ///< The transfer function use to convert interpolation source color data to linear RGB.
|
||||
float minMaxLuminance[2]; ///< Min and max luminance values, used when converting HDR colors to linear RGB
|
||||
|
||||
} FfxFrameInterpolationDispatchDescription;
|
||||
|
||||
FFX_API FfxErrorCode ffxFrameInterpolationDispatch(FfxFrameInterpolationContext* context, const FfxFrameInterpolationDispatchDescription* params);
|
||||
|
||||
/// Destroy the FidelityFX Super Resolution context.
|
||||
///
|
||||
/// @param [out] context A pointer to a <c><i>FfxFsr3Context</i></c> structure to destroy.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either <c><i>context</i></c> was <c><i>NULL</i></c>.
|
||||
///
|
||||
/// @ingroup FRAMEINTERPOLATION
|
||||
FFX_API FfxErrorCode ffxFrameInterpolationContextDestroy(FfxFrameInterpolationContext* context);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif // #if defined(__cplusplus)
|
||||
+503
@@ -0,0 +1,503 @@
|
||||
// This file is part of the FidelityFX SDK.
|
||||
//
|
||||
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
|
||||
// @defgroup FSR3
|
||||
|
||||
#pragma once
|
||||
|
||||
// Include the interface for the backend of the FSR3 API.
|
||||
#include <FidelityFX/host/ffx_interface.h>
|
||||
#include <FidelityFX/host/ffx_fsr3upscaler.h>
|
||||
#include <FidelityFX/host/ffx_frameinterpolation.h>
|
||||
#include <FidelityFX/host/ffx_opticalflow.h>
|
||||
|
||||
/// FidelityFX Super Resolution 3 major version.
|
||||
///
|
||||
/// @ingroup FSR3
|
||||
#define FFX_FSR3_VERSION_MAJOR (3)
|
||||
|
||||
/// FidelityFX Super Resolution 0 minor version.
|
||||
///
|
||||
/// @ingroup FSR3
|
||||
#define FFX_FSR3_VERSION_MINOR (0)
|
||||
|
||||
/// FidelityFX Super Resolution 0 patch version.
|
||||
///
|
||||
/// @ingroup FSR3
|
||||
#define FFX_FSR3_VERSION_PATCH (4)
|
||||
|
||||
/// FidelityFX Super Resolution 3 context count
|
||||
///
|
||||
/// Defines the number of internal effect contexts required by FSR3 (+1 for proxy swapchain)
|
||||
///
|
||||
/// @ingroup ffxFsr3
|
||||
#define FFX_FSR3_CONTEXT_COUNT (FFX_FSR3UPSCALER_CONTEXT_COUNT + FFX_OPTICALFLOW_CONTEXT_COUNT + FFX_FRAMEINTERPOLATION_CONTEXT_COUNT + 1)
|
||||
|
||||
/// The size of the context specified in 32bit values.
|
||||
///
|
||||
/// @ingroup FSR3
|
||||
#define FFX_FSR3_CONTEXT_SIZE (16536)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
||||
///// An enumeration of all the passes which constitute the FSR3 algorithm.
|
||||
/////
|
||||
///// FSR3 is implemented as a composite of several compute passes each
|
||||
///// computing a key part of the final result. Each call to the
|
||||
///// <c><i>FfxFsr3ScheduleGpuJobFunc</i></c> callback function will
|
||||
///// correspond to a single pass included in <c><i>FfxFsr3Pass</i></c>. For a
|
||||
///// more comprehensive description of each pass, please refer to the FSR3
|
||||
///// reference documentation.
|
||||
/////
|
||||
///// Please note in some cases e.g.: <c><i>FFX_FSR3_PASS_ACCUMULATE</i></c>
|
||||
///// and <c><i>FFX_FSR3_PASS_ACCUMULATE_SHARPEN</i></c> either one pass or the
|
||||
///// other will be used (they are mutually exclusive). The choice of which will
|
||||
///// depend on the way the <c><i>FfxFsr3Context</i></c> is created and the
|
||||
///// precise contents of <c><i>FfxFsr3DispatchParamters</i></c> each time a call
|
||||
///// is made to <c><i>ffxFsr3ContextDispatch</i></c>.
|
||||
/////
|
||||
///// @ingroup FSR3
|
||||
//typedef enum FfxFsr3Pass
|
||||
//{
|
||||
// // no special FSR3 pipelines
|
||||
//
|
||||
// FFX_FSR3_PASS_COUNT ///< The number of passes performed by FSR3.
|
||||
//} FfxFsr3Pass;
|
||||
|
||||
/// An enumeration of all the quality modes supported by FidelityFX Super
|
||||
/// Resolution 2 upscaling.
|
||||
///
|
||||
/// In order to provide a consistent user experience across multiple
|
||||
/// applications which implement FSR3. It is strongly recommended that the
|
||||
/// following preset scaling factors are made available through your
|
||||
/// application's user interface.
|
||||
///
|
||||
/// If your application does not expose the notion of preset scaling factors
|
||||
/// for upscaling algorithms (perhaps instead implementing a fixed ratio which
|
||||
/// is immutable) or implementing a more dynamic scaling scheme (such as
|
||||
/// dynamic resolution scaling), then there is no need to use these presets.
|
||||
///
|
||||
/// Please note that <c><i>FFX_FSR3_QUALITY_MODE_ULTRA_PERFORMANCE</i></c> is
|
||||
/// an optional mode which may introduce significant quality degradation in the
|
||||
/// final image. As such it is recommended that you evaluate the final results
|
||||
/// of using this scaling mode before deciding if you should include it in your
|
||||
/// application.
|
||||
///
|
||||
/// @ingroup FSR3
|
||||
typedef enum FfxFsr3QualityMode {
|
||||
|
||||
FFX_FSR3_QUALITY_MODE_QUALITY = 1, ///< Perform upscaling with a per-dimension upscaling ratio of 1.5x.
|
||||
FFX_FSR3_QUALITY_MODE_BALANCED = 2, ///< Perform upscaling with a per-dimension upscaling ratio of 1.7x.
|
||||
FFX_FSR3_QUALITY_MODE_PERFORMANCE = 3, ///< Perform upscaling with a per-dimension upscaling ratio of 2.0x.
|
||||
FFX_FSR3_QUALITY_MODE_ULTRA_PERFORMANCE = 4 ///< Perform upscaling with a per-dimension upscaling ratio of 3.0x.
|
||||
} FfxFsr3QualityMode;
|
||||
|
||||
/// An enumeration of bit flags used when creating a
|
||||
/// <c><i>FfxFsr3Context</i></c>. See <c><i>FfxFsr3ContextDescription</i></c>.
|
||||
///
|
||||
/// @ingroup FSR3
|
||||
typedef enum FfxFsr3InitializationFlagBits {
|
||||
|
||||
FFX_FSR3_ENABLE_HIGH_DYNAMIC_RANGE = (1<<0), ///< A bit indicating if the input color data provided to all inputs is using a high-dynamic range.
|
||||
FFX_FSR3_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS = (1<<1), ///< A bit indicating if the motion vectors are rendered at display resolution.
|
||||
FFX_FSR3_ENABLE_MOTION_VECTORS_JITTER_CANCELLATION = (1<<2), ///< A bit indicating that the motion vectors have the jittering pattern applied to them.
|
||||
FFX_FSR3_ENABLE_DEPTH_INVERTED = (1<<3), ///< A bit indicating that the input depth buffer data provided is inverted [1..0].
|
||||
FFX_FSR3_ENABLE_DEPTH_INFINITE = (1<<4), ///< A bit indicating that the input depth buffer data provided is using an infinite far plane.
|
||||
FFX_FSR3_ENABLE_AUTO_EXPOSURE = (1<<5), ///< A bit indicating if automatic exposure should be applied to input color data.
|
||||
FFX_FSR3_ENABLE_DYNAMIC_RESOLUTION = (1<<6), ///< A bit indicating that the application uses dynamic resolution scaling.
|
||||
FFX_FSR3_ENABLE_TEXTURE1D_USAGE = (1<<7), ///< A bit indicating that the backend should use 1D textures.
|
||||
FFX_FSR3_ENABLE_DEBUG_CHECKING = (1<<8), ///< A bit indicating that the runtime should check some API values and report issues.
|
||||
FFX_FSR3_ENABLE_UPSCALING_ONLY = (1<<9), ///, A bit indicating that the context will only be used for upscaling
|
||||
FFX_FSR3_ENABLE_HDR_UPSCALE_SDR_FINALOUTPUT = (1<<10), ///, A bit indicating if the input color data provided to UPSCALE is using a high-dynamic range, final output SDR.
|
||||
FFX_FSR3_ENABLE_SDR_UPSCALE_HDR_FINALOUTPUT = (1<<11), ///, A bit indicating if the input color data provided to UPSCALE is using SDR, final output is high-dynamic range.
|
||||
FFX_FSR3_ENABLE_ASYNC_WORKLOAD_SUPPORT = (1<<12),
|
||||
} FfxFsr3InitializationFlagBits;
|
||||
|
||||
typedef enum FfxFsr3FrameGenerationFlags
|
||||
{
|
||||
FFX_FSR3_FRAME_GENERATION_FLAG_DRAW_DEBUG_TEAR_LINES = FFX_FRAMEINTERPOLATION_DISPATCH_DRAW_DEBUG_TEAR_LINES, ///< A bit indicating that the debug tear lines will be drawn to the interpolated output.
|
||||
FFX_FSR3_FRAME_GENERATION_FLAG_DRAW_DEBUG_VIEW = FFX_FRAMEINTERPOLATION_DISPATCH_DRAW_DEBUG_VIEW, ///< A bit indicating that the interpolated output resource will contain debug views with relevant information.
|
||||
} FfxFsr3FrameGenerationFlags;
|
||||
|
||||
/// A structure encapsulating the parameters required to initialize FidelityFX
|
||||
/// Super Resolution 3 upscaling.
|
||||
///
|
||||
/// @ingroup FSR3
|
||||
typedef struct FfxFsr3ContextDescription {
|
||||
uint32_t flags; ///< A collection of <c><i>FfxFsr3InitializationFlagBits</i></c>.
|
||||
FfxDimensions2D maxRenderSize; ///< The maximum size that rendering will be performed at.
|
||||
FfxDimensions2D upscaleOutputSize; ///< The size of the presentation resolution targeted by the upscaling process.
|
||||
FfxDimensions2D displaySize; ///< The size of the presentation resolution targeted by the frame interpolation process.
|
||||
FfxInterface backendInterfaceSharedResources; ///< A set of pointers to the backend implementation for FidelityFX SDK
|
||||
FfxInterface backendInterfaceUpscaling; ///< A set of pointers to the backend implementation for FidelityFX SDK
|
||||
FfxInterface backendInterfaceFrameInterpolation; ///< A set of pointers to the backend implementation for FidelityFX SDK
|
||||
FfxFsr3UpscalerMessage fpMessage; ///< A pointer to a function that can recieve messages from the runtime.
|
||||
|
||||
FfxSurfaceFormat backBufferFormat; ///< The format of the swapchain surface
|
||||
|
||||
} FfxFsr3ContextDescription;
|
||||
|
||||
/// A structure encapsulating the parameters for dispatching the various passes
|
||||
/// of FidelityFX Super Resolution 3.
|
||||
///
|
||||
/// @ingroup FSR3
|
||||
typedef struct FfxFsr3DispatchUpscaleDescription {
|
||||
|
||||
FfxCommandList commandList; ///< The <c><i>FfxCommandList</i></c> to record FSR2 rendering commands into.
|
||||
FfxResource color; ///< A <c><i>FfxResource</i></c> containing the color buffer for the current frame (at render resolution).
|
||||
FfxResource depth; ///< A <c><i>FfxResource</i></c> containing 32bit depth values for the current frame (at render resolution).
|
||||
FfxResource motionVectors; ///< A <c><i>FfxResource</i></c> containing 2-dimensional motion vectors (at render resolution if <c><i>FFX_FSR2_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS</i></c> is not set).
|
||||
FfxResource exposure; ///< A optional <c><i>FfxResource</i></c> containing a 1x1 exposure value.
|
||||
FfxResource reactive; ///< A optional <c><i>FfxResource</i></c> containing alpha value of reactive objects in the scene.
|
||||
FfxResource transparencyAndComposition; ///< A optional <c><i>FfxResource</i></c> containing alpha value of special objects in the scene.
|
||||
FfxResource upscaleOutput; ///< A <c><i>FfxResource</i></c> containing the output color buffer for the current frame (at presentation resolution).
|
||||
FfxFloatCoords2D jitterOffset; ///< The subpixel jitter offset applied to the camera.
|
||||
FfxFloatCoords2D motionVectorScale; ///< The scale factor to apply to motion vectors.
|
||||
FfxDimensions2D renderSize; ///< The resolution that was used for rendering the input resources.
|
||||
bool enableSharpening; ///< Enable an additional sharpening pass.
|
||||
float sharpness; ///< The sharpness value between 0 and 1, where 0 is no additional sharpness and 1 is maximum additional sharpness.
|
||||
float frameTimeDelta; ///< The time elapsed since the last frame (expressed in milliseconds).
|
||||
float preExposure; ///< The pre exposure value (must be > 0.0f)
|
||||
bool reset; ///< A boolean value which when set to true, indicates the camera has moved discontinuously.
|
||||
float cameraNear; ///< The distance to the near plane of the camera.
|
||||
float cameraFar; ///< The distance to the far plane of the camera. This is used only used in case of non infinite depth.
|
||||
float cameraFovAngleVertical; ///< The camera angle field of view in the vertical direction (expressed in radians).
|
||||
float viewSpaceToMetersFactor; ///< The scale factor to convert view space units to meters
|
||||
} FfxFsr3DispatchUpscaleDescription;
|
||||
|
||||
FFX_API FfxErrorCode ffxFsr3DispatchFrameGeneration(const FfxFrameGenerationDispatchDescription* desc);
|
||||
|
||||
/// A structure encapsulating the parameters for automatic generation of a reactive mask
|
||||
///
|
||||
/// @ingroup FSR3
|
||||
typedef struct FfxFsr3GenerateReactiveDescription {
|
||||
|
||||
FfxCommandList commandList; ///< The <c><i>FfxCommandList</i></c> to record FSR3 rendering commands into.
|
||||
FfxResource colorOpaqueOnly; ///< A <c><i>FfxResource</i></c> containing the opaque only color buffer for the current frame (at render resolution).
|
||||
FfxResource colorPreUpscale; ///< A <c><i>FfxResource</i></c> containing the opaque+translucent color buffer for the current frame (at render resolution).
|
||||
FfxResource outReactive; ///< A <c><i>FfxResource</i></c> containing the surface to generate the reactive mask into.
|
||||
FfxDimensions2D renderSize; ///< The resolution that was used for rendering the input resources.
|
||||
float scale; ///< A value to scale the output
|
||||
float cutoffThreshold; ///< A threshold value to generate a binary reactive mask
|
||||
float binaryValue;
|
||||
uint32_t flags; ///< Flags to determine how to generate the reactive mask
|
||||
} FfxFsr3GenerateReactiveDescription;
|
||||
|
||||
/// A structure encapsulating the FidelityFX Super Resolution 3 context.
|
||||
///
|
||||
/// This sets up an object which contains all persistent internal data and
|
||||
/// resources that are required by FSR3.
|
||||
///
|
||||
/// The <c><i>FfxFsr3Context</i></c> object should have a lifetime matching
|
||||
/// your use of FSR3. Before destroying the FSR3 context care should be taken
|
||||
/// to ensure the GPU is not accessing the resources created or used by FSR3.
|
||||
/// It is therefore recommended that the GPU is idle before destroying the
|
||||
/// FSR3 context.
|
||||
///
|
||||
/// @ingroup FSR3
|
||||
typedef struct FfxFsr3Context
|
||||
{
|
||||
uint32_t data[ FFX_FSR3UPSCALER_CONTEXT_SIZE
|
||||
+ FFX_OPTICALFLOW_CONTEXT_SIZE
|
||||
+ FFX_FRAMEINTERPOLATION_CONTEXT_SIZE
|
||||
+ (16536)]; ///< An opaque set of <c>uint32_t</c> which contain the data for the context.
|
||||
} FfxFsr3Context;
|
||||
|
||||
/// Create a FidelityFX Super Resolution 3 context from the parameters
|
||||
/// programmed to the <c><i>FfxFsr3CreateParams</i></c> structure.
|
||||
///
|
||||
/// The context structure is the main object used to interact with the FSR3
|
||||
/// API, and is responsible for the management of the internal resources used
|
||||
/// by the FSR3 algorithm. When this API is called, multiple calls will be
|
||||
/// made via the pointers contained in the <c><i>callbacks</i></c> structure.
|
||||
/// These callbacks will attempt to retreive the device capabilities, and
|
||||
/// create the internal resources, and pipelines required by FSR3's
|
||||
/// frame-to-frame function. Depending on the precise configuration used when
|
||||
/// creating the <c><i>FfxFsr3Context</i></c> a different set of resources and
|
||||
/// pipelines might be requested via the callback functions.
|
||||
///
|
||||
/// The flags included in the <c><i>flags</i></c> field of
|
||||
/// <c><i>FfxFsr3Context</i></c> how match the configuration of your
|
||||
/// application as well as the intended use of FSR3. It is important that these
|
||||
/// flags are set correctly (as well as a correct programmed
|
||||
/// <c><i>FfxFsr3DispatchDescription</i></c>) to ensure correct operation. It is
|
||||
/// recommended to consult the overview documentation for further details on
|
||||
/// how FSR3 should be integerated into an application.
|
||||
///
|
||||
/// When the <c><i>FfxFsr3Context</i></c> is created, you should use the
|
||||
/// <c><i>ffxFsr3ContextDispatch</i></c> function each frame where FSR3
|
||||
/// upscaling should be applied. See the documentation of
|
||||
/// <c><i>ffxFsr3ContextDispatch</i></c> for more details.
|
||||
///
|
||||
/// The <c><i>FfxFsr3Context</i></c> should be destroyed when use of it is
|
||||
/// completed, typically when an application is unloaded or FSR3 upscaling is
|
||||
/// disabled by a user. To destroy the FSR3 context you should call
|
||||
/// <c><i>ffxFsr3ContextDestroy</i></c>.
|
||||
///
|
||||
/// @param [out] context A pointer to a <c><i>FfxFsr3Context</i></c> structure to populate.
|
||||
/// @param [in] contextDescription A pointer to a <c><i>FfxFsr3ContextDescription</i></c> structure.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either <c><i>context</i></c> or <c><i>contextDescription</i></c> was <c><i>NULL</i></c>.
|
||||
/// @retval
|
||||
/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the <c><i>FfxFsr3ContextDescription.callbacks</i></c> was not fully specified.
|
||||
/// @retval
|
||||
/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend.
|
||||
///
|
||||
/// @ingroup FSR3
|
||||
FFX_API FfxErrorCode ffxFsr3ContextCreate(FfxFsr3Context* context, FfxFsr3ContextDescription* contextDescription);
|
||||
|
||||
|
||||
/// Dispatch the various passes that constitute FidelityFX Super Resolution 3 Upscaling.
|
||||
///
|
||||
/// FSR3 is a composite effect, meaning that it is compromised of multiple
|
||||
/// constituent passes (implemented as one or more clears, copies and compute
|
||||
/// dispatches). The <c><i>ffxFsr3ContextDispatchUpscale</i></c> function is the
|
||||
/// function which (via the use of the functions contained in the
|
||||
/// <c><i>callbacks</i></c> field of the <c><i>FfxFsr3Context</i></c>
|
||||
/// structure) utlimately generates the sequence of graphics API calls required
|
||||
/// each frame.
|
||||
///
|
||||
/// As with the creation of the <c><i>FfxFsr3Context</i></c> correctly
|
||||
/// programming the <c><i>dispatchParams</i></c> is key to ensuring
|
||||
/// the correct operation of FSR3. It is particularly important to ensure that
|
||||
/// camera jitter is correctly applied to your application's projection matrix
|
||||
/// (or camera origin for raytraced applications). FSR3 provides the
|
||||
/// <c><i>ffxFsr3GetJitterPhaseCount</i></c> and
|
||||
/// <c><i>ffxFsr3GetJitterOffset</i></c> entry points to help applications
|
||||
/// correctly compute the camera jitter. Whatever jitter pattern is used by the
|
||||
/// application it should be correctly programmed to the
|
||||
/// <c><i>jitterOffset</i></c> field of the <c><i>dispatchParams</i></c>
|
||||
/// structure. For more guidance on camera jitter please consult the
|
||||
/// documentation for <c><i>ffxFsr3GetJitterOffset</i></c> as well as the
|
||||
/// accompanying overview documentation for FSR3.
|
||||
///
|
||||
/// @param [in] context A pointer to a <c><i>FfxFsr3Context</i></c> structure.
|
||||
/// @param [in] dispatchParams A pointer to a <c><i>FfxFsr3DispatchUpscaleDescription</i></c> structure.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either <c><i>context</i></c> or <c><i>dispatchParams</i></c> was <c><i>NULL</i></c>.
|
||||
/// @retval
|
||||
/// FFX_ERROR_OUT_OF_RANGE The operation failed because <c><i>dispatchParams.renderSize</i></c> was larger than the maximum render resolution.
|
||||
/// @retval
|
||||
/// FFX_ERROR_NULL_DEVICE The operation failed because the device inside the context was <c><i>NULL</i></c>.
|
||||
/// @retval
|
||||
/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend.
|
||||
///
|
||||
/// @ingroup FSR3
|
||||
FFX_API FfxErrorCode ffxFsr3ContextDispatchUpscale(FfxFsr3Context* context, const FfxFsr3DispatchUpscaleDescription* dispatchParams);
|
||||
|
||||
FFX_API FfxErrorCode ffxFsr3SkipPresent(FfxFsr3Context* context);
|
||||
|
||||
/// A helper function generate a Reactive mask from an opaque only texure and one containing translucent objects.
|
||||
///
|
||||
/// @param [in] context A pointer to a <c><i>FfxFsr3Context</i></c> structure.
|
||||
/// @param [in] params A pointer to a <c><i>FfxFsr3GenerateReactiveDescription</i></c> structure
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
///
|
||||
/// @ingroup FSR3
|
||||
FFX_API FfxErrorCode ffxFsr3ContextGenerateReactiveMask(FfxFsr3Context* context, const FfxFsr3GenerateReactiveDescription* params);
|
||||
|
||||
FFX_API FfxErrorCode ffxFsr3ConfigureFrameGeneration(FfxFsr3Context* context, const FfxFrameGenerationConfig* config);
|
||||
|
||||
/// Destroy the FidelityFX Super Resolution context.
|
||||
///
|
||||
/// @param [out] context A pointer to a <c><i>FfxFsr3Context</i></c> structure to destroy.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either <c><i>context</i></c> was <c><i>NULL</i></c>.
|
||||
///
|
||||
/// @ingroup FSR3
|
||||
FFX_API FfxErrorCode ffxFsr3ContextDestroy(FfxFsr3Context* context);
|
||||
|
||||
/// Get the upscale ratio from the quality mode.
|
||||
///
|
||||
/// The following table enumerates the mapping of the quality modes to
|
||||
/// per-dimension scaling ratios.
|
||||
///
|
||||
/// Quality preset | Scale factor
|
||||
/// ----------------------------------------------------- | -------------
|
||||
/// <c><i>FFX_FSR3_QUALITY_MODE_NATIVEAA</i></c> | 1.0x
|
||||
/// <c><i>FFX_FSR3_QUALITY_MODE_QUALITY</i></c> | 1.5x
|
||||
/// <c><i>FFX_FSR3_QUALITY_MODE_BALANCED</i></c> | 1.7x
|
||||
/// <c><i>FFX_FSR3_QUALITY_MODE_PERFORMANCE</i></c> | 2.0x
|
||||
/// <c><i>FFX_FSR3_QUALITY_MODE_ULTRA_PERFORMANCE</i></c> | 3.0x
|
||||
///
|
||||
/// Passing an invalid <c><i>qualityMode</i></c> will return 0.0f.
|
||||
///
|
||||
/// @param [in] qualityMode The quality mode preset.
|
||||
///
|
||||
/// @returns
|
||||
/// The upscaling the per-dimension upscaling ratio for
|
||||
/// <c><i>qualityMode</i></c> according to the table above.
|
||||
///
|
||||
/// @ingroup FSR3
|
||||
FFX_API float ffxFsr3GetUpscaleRatioFromQualityMode(FfxFsr3QualityMode qualityMode);
|
||||
|
||||
/// A helper function to calculate the rendering resolution from a target
|
||||
/// resolution and desired quality level.
|
||||
///
|
||||
/// This function applies the scaling factor returned by
|
||||
/// <c><i>ffxFsr3GetUpscaleRatioFromQualityMode</i></c> to each dimension.
|
||||
///
|
||||
/// @param [out] renderWidth A pointer to a <c>uint32_t</c> which will hold the calculated render resolution width.
|
||||
/// @param [out] renderHeight A pointer to a <c>uint32_t</c> which will hold the calculated render resolution height.
|
||||
/// @param [in] displayWidth The target display resolution width.
|
||||
/// @param [in] displayHeight The target display resolution height.
|
||||
/// @param [in] qualityMode The desired quality mode for FSR 2 upscaling.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// FFX_ERROR_INVALID_POINTER Either <c><i>renderWidth</i></c> or <c><i>renderHeight</i></c> was <c>NULL</c>.
|
||||
/// @retval
|
||||
/// FFX_ERROR_INVALID_ENUM An invalid quality mode was specified.
|
||||
///
|
||||
/// @ingroup FSR3
|
||||
FFX_API FfxErrorCode ffxFsr3GetRenderResolutionFromQualityMode(
|
||||
uint32_t* renderWidth,
|
||||
uint32_t* renderHeight,
|
||||
uint32_t displayWidth,
|
||||
uint32_t displayHeight,
|
||||
FfxFsr3QualityMode qualityMode);
|
||||
|
||||
/// A helper function to calculate the jitter phase count from display
|
||||
/// resolution.
|
||||
///
|
||||
/// For more detailed information about the application of camera jitter to
|
||||
/// your application's rendering please refer to the
|
||||
/// <c><i>ffxFsr3GetJitterOffset</i></c> function.
|
||||
///
|
||||
/// The table below shows the jitter phase count which this function
|
||||
/// would return for each of the quality presets.
|
||||
///
|
||||
/// Quality preset | Scale factor | Phase count
|
||||
/// ----------------------------------------------------- | ------------- | ---------------
|
||||
/// <c><i>FFX_FSR3_QUALITY_MODE_QUALITY</i></c> | 1.5x | 18
|
||||
/// <c><i>FFX_FSR3_QUALITY_MODE_BALANCED</i></c> | 1.7x | 23
|
||||
/// <c><i>FFX_FSR3_QUALITY_MODE_PERFORMANCE</i></c> | 2.0x | 32
|
||||
/// <c><i>FFX_FSR3_QUALITY_MODE_ULTRA_PERFORMANCE</i></c> | 3.0x | 72
|
||||
/// Custom | [1..n]x | ceil(8*n^2)
|
||||
///
|
||||
/// @param [in] renderWidth The render resolution width.
|
||||
/// @param [in] displayWidth The display resolution width.
|
||||
///
|
||||
/// @returns
|
||||
/// The jitter phase count for the scaling factor between <c><i>renderWidth</i></c> and <c><i>displayWidth</i></c>.
|
||||
///
|
||||
/// @ingroup FSR3
|
||||
FFX_API int32_t ffxFsr3GetJitterPhaseCount(int32_t renderWidth, int32_t displayWidth);
|
||||
|
||||
/// A helper function to calculate the subpixel jitter offset.
|
||||
///
|
||||
/// FSR3 relies on the application to apply sub-pixel jittering while rendering.
|
||||
/// This is typically included in the projection matrix of the camera. To make
|
||||
/// the application of camera jitter simple, the FSR3 API provides a small set
|
||||
/// of utility function which computes the sub-pixel jitter offset for a
|
||||
/// particular frame within a sequence of separate jitter offsets. To begin, the
|
||||
/// index within the jitter phase must be computed. To calculate the
|
||||
/// sequence's length, you can call the <c><i>ffxFsr3GetJitterPhaseCount</i></c>
|
||||
/// function. The index should be a value which is incremented each frame modulo
|
||||
/// the length of the sequence computed by <c><i>ffxFsr3GetJitterPhaseCount</i></c>.
|
||||
/// The index within the jitter phase is passed to
|
||||
/// <c><i>ffxFsr3GetJitterOffset</i></c> via the <c><i>index</i></c> parameter.
|
||||
///
|
||||
/// This function uses a Halton(2,3) sequence to compute the jitter offset.
|
||||
/// The ultimate index used for the sequence is <c><i>index</i></c> %
|
||||
/// <c><i>phaseCount</i></c>.
|
||||
///
|
||||
/// It is important to understand that the values returned from the
|
||||
/// <c><i>ffxFsr3GetJitterOffset</i></c> function are in unit pixel space, and
|
||||
/// in order to composite this correctly into a projection matrix we must
|
||||
/// convert them into projection offsets. This is done as per the pseudo code
|
||||
/// listing which is shown below.
|
||||
///
|
||||
/// const int32_t jitterPhaseCount = ffxFsr3GetJitterPhaseCount(renderWidth, displayWidth);
|
||||
///
|
||||
/// float jitterX = 0;
|
||||
/// float jitterY = 0;
|
||||
/// ffxFsr3GetJitterOffset(&jitterX, &jitterY, index, jitterPhaseCount);
|
||||
///
|
||||
/// const float jitterX = 2.0f * jitterX / (float)renderWidth;
|
||||
/// const float jitterY = -2.0f * jitterY / (float)renderHeight;
|
||||
/// const Matrix4 jitterTranslationMatrix = translateMatrix(Matrix3::identity, Vector3(jitterX, jitterY, 0));
|
||||
/// const Matrix4 jitteredProjectionMatrix = jitterTranslationMatrix * projectionMatrix;
|
||||
///
|
||||
/// Jitter should be applied to all rendering. This includes opaque, alpha
|
||||
/// transparent, and raytraced objects. For rasterized objects, the sub-pixel
|
||||
/// jittering values calculated by the <c><i>iffxFsr3GetJitterOffset</i></c>
|
||||
/// function can be applied to the camera projection matrix which is ultimately
|
||||
/// used to perform transformations during vertex shading. For raytraced
|
||||
/// rendering, the sub-pixel jitter should be applied to the ray's origin,
|
||||
/// often the camera's position.
|
||||
///
|
||||
/// Whether you elect to use the <c><i>ffxFsr3GetJitterOffset</i></c> function
|
||||
/// or your own sequence generator, you must program the
|
||||
/// <c><i>jitterOffset</i></c> field of the
|
||||
/// <c><i>FfxFsr3DispatchParameters</i></c> structure in order to inform FSR3
|
||||
/// of the jitter offset that has been applied in order to render each frame.
|
||||
///
|
||||
/// If not using the recommended <c><i>ffxFsr3GetJitterOffset</i></c> function,
|
||||
/// care should be taken that your jitter sequence never generates a null vector;
|
||||
/// that is value of 0 in both the X and Y dimensions.
|
||||
///
|
||||
/// @param [out] outX A pointer to a <c>float</c> which will contain the subpixel jitter offset for the x dimension.
|
||||
/// @param [out] outY A pointer to a <c>float</c> which will contain the subpixel jitter offset for the y dimension.
|
||||
/// @param [in] index The index within the jitter sequence.
|
||||
/// @param [in] phaseCount The length of jitter phase. See <c><i>ffxFsr3GetJitterPhaseCount</i></c>.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// FFX_ERROR_INVALID_POINTER Either <c><i>outX</i></c> or <c><i>outY</i></c> was <c>NULL</c>.
|
||||
/// @retval
|
||||
/// FFX_ERROR_INVALID_ARGUMENT Argument <c><i>phaseCount</i></c> must be greater than 0.
|
||||
///
|
||||
/// @ingroup FSR3
|
||||
FFX_API FfxErrorCode ffxFsr3GetJitterOffset(float* outX, float* outY, int32_t index, int32_t phaseCount);
|
||||
|
||||
/// A helper function to check if a resource is
|
||||
/// <c><i>FFX_FSR3_RESOURCE_IDENTIFIER_NULL</i></c>.
|
||||
///
|
||||
/// @param [in] resource A <c><i>FfxResource</i></c>.
|
||||
///
|
||||
/// @returns
|
||||
/// true The <c><i>resource</i></c> was not <c><i>FFX_FSR3_RESOURCE_IDENTIFIER_NULL</i></c>.
|
||||
/// @returns
|
||||
/// false The <c><i>resource</i></c> was <c><i>FFX_FSR3_RESOURCE_IDENTIFIER_NULL</i></c>.
|
||||
///
|
||||
/// @ingroup FSR3
|
||||
FFX_API bool ffxFsr3ResourceIsNull(FfxResource resource);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif // #if defined(__cplusplus)
|
||||
+527
@@ -0,0 +1,527 @@
|
||||
// This file is part of the FidelityFX SDK.
|
||||
//
|
||||
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
// Include the interface for the backend of the FSR3 API.
|
||||
#include <FidelityFX/host/ffx_interface.h>
|
||||
#include <FidelityFX/gpu/fsr3upscaler/ffx_fsr3upscaler_resources.h>
|
||||
|
||||
/// @defgroup ffxFsr3Upscaler FidelityFX FSR3
|
||||
/// FidelityFX Super Resolution 3 runtime library
|
||||
///
|
||||
/// @ingroup SDKComponents
|
||||
|
||||
/// FidelityFX Super Resolution 3 major version.
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
#define FFX_FSR3UPSCALER_VERSION_MAJOR (3)
|
||||
|
||||
/// FidelityFX Super Resolution 3 minor version.
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
#define FFX_FSR3UPSCALER_VERSION_MINOR (0)
|
||||
|
||||
/// FidelityFX Super Resolution 3 patch version.
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
#define FFX_FSR3UPSCALER_VERSION_PATCH (3)
|
||||
|
||||
/// FidelityFX Super Resolution 3 context count
|
||||
///
|
||||
/// Defines the number of internal effect contexts required by FSR3
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
#define FFX_FSR3UPSCALER_CONTEXT_COUNT 1
|
||||
|
||||
/// The size of the context specified in 32bit values.
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
#define FFX_FSR3UPSCALER_CONTEXT_SIZE (FFX_SDK_DEFAULT_CONTEXT_SIZE)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
||||
/// An enumeration of all the passes which constitute the FSR3 algorithm.
|
||||
///
|
||||
/// FSR3 is implemented as a composite of several compute passes each
|
||||
/// computing a key part of the final result. Each call to the
|
||||
/// <c><i>FfxFsr3UpscalerScheduleGpuJobFunc</i></c> callback function will
|
||||
/// correspond to a single pass included in <c><i>FfxFsr3UpscalerPass</i></c>. For a
|
||||
/// more comprehensive description of each pass, please refer to the FSR3
|
||||
/// reference documentation.
|
||||
///
|
||||
/// Please note in some cases e.g.: <c><i>FFX_FSR3UPSCALER_PASS_ACCUMULATE</i></c>
|
||||
/// and <c><i>FFX_FSR3UPSCALER_PASS_ACCUMULATE_SHARPEN</i></c> either one pass or the
|
||||
/// other will be used (they are mutually exclusive). The choice of which will
|
||||
/// depend on the way the <c><i>FfxFsr3UpscalerContext</i></c> is created and the
|
||||
/// precise contents of <c><i>FfxFsr3UpscalerDispatchParamters</i></c> each time a call
|
||||
/// is made to <c><i>ffxFsr3UpscalerContextDispatch</i></c>.
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
typedef enum FfxFsr3UpscalerPass
|
||||
{
|
||||
|
||||
FFX_FSR3UPSCALER_PASS_DEPTH_CLIP, ///< A pass which performs depth clipping.
|
||||
FFX_FSR3UPSCALER_PASS_RECONSTRUCT_PREVIOUS_DEPTH, ///< A pass which performs reconstruction of previous frame's depth.
|
||||
FFX_FSR3UPSCALER_PASS_LOCK, ///< A pass which calculates pixel locks.
|
||||
FFX_FSR3UPSCALER_PASS_ACCUMULATE, ///< A pass which performs upscaling.
|
||||
FFX_FSR3UPSCALER_PASS_ACCUMULATE_SHARPEN, ///< A pass which performs upscaling when sharpening is used.
|
||||
FFX_FSR3UPSCALER_PASS_RCAS, ///< A pass which performs sharpening.
|
||||
FFX_FSR3UPSCALER_PASS_COMPUTE_LUMINANCE_PYRAMID, ///< A pass which generates the luminance mipmap chain for the current frame.
|
||||
FFX_FSR3UPSCALER_PASS_GENERATE_REACTIVE, ///< An optional pass to generate a reactive mask.
|
||||
FFX_FSR3UPSCALER_PASS_TCR_AUTOGENERATE, ///< DEPRECATED - NO LONGER SUPPORTED
|
||||
|
||||
FFX_FSR3UPSCALER_PASS_COUNT ///< The number of passes performed by FSR3.
|
||||
} FfxFsr3UpscalerPass;
|
||||
|
||||
/// An enumeration of all the quality modes supported by FidelityFX Super
|
||||
/// Resolution 3 upscaling.
|
||||
///
|
||||
/// In order to provide a consistent user experience across multiple
|
||||
/// applications which implement FSR3. It is strongly recommended that the
|
||||
/// following preset scaling factors are made available through your
|
||||
/// application's user interface.
|
||||
///
|
||||
/// If your application does not expose the notion of preset scaling factors
|
||||
/// for upscaling algorithms (perhaps instead implementing a fixed ratio which
|
||||
/// is immutable) or implementing a more dynamic scaling scheme (such as
|
||||
/// dynamic resolution scaling), then there is no need to use these presets.
|
||||
///
|
||||
/// Please note that <c><i>FFX_FSR3UPSCALER_QUALITY_MODE_ULTRA_PERFORMANCE</i></c> is
|
||||
/// an optional mode which may introduce significant quality degradation in the
|
||||
/// final image. As such it is recommended that you evaluate the final results
|
||||
/// of using this scaling mode before deciding if you should include it in your
|
||||
/// application.
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
typedef enum FfxFsr3UpscalerQualityMode {
|
||||
FFX_FSR3UPSCALER_QUALITY_MODE_NATIVEAA = 0, ///< Perform upscaling with a per-dimension upscaling ratio of 1.0x.
|
||||
FFX_FSR3UPSCALER_QUALITY_MODE_QUALITY = 1, ///< Perform upscaling with a per-dimension upscaling ratio of 1.5x.
|
||||
FFX_FSR3UPSCALER_QUALITY_MODE_BALANCED = 2, ///< Perform upscaling with a per-dimension upscaling ratio of 1.7x.
|
||||
FFX_FSR3UPSCALER_QUALITY_MODE_PERFORMANCE = 3, ///< Perform upscaling with a per-dimension upscaling ratio of 2.0x.
|
||||
FFX_FSR3UPSCALER_QUALITY_MODE_ULTRA_PERFORMANCE = 4 ///< Perform upscaling with a per-dimension upscaling ratio of 3.0x.
|
||||
} FfxFsr3UpscalerQualityMode;
|
||||
|
||||
/// An enumeration of bit flags used when creating a
|
||||
/// <c><i>FfxFsr3UpscalerContext</i></c>. See <c><i>FfxFsr3UpscalerContextDescription</i></c>.
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
typedef enum FfxFsr3UpscalerInitializationFlagBits {
|
||||
|
||||
FFX_FSR3UPSCALER_ENABLE_HIGH_DYNAMIC_RANGE = (1<<0), ///< A bit indicating if the input color data provided is using a high-dynamic range.
|
||||
FFX_FSR3UPSCALER_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS = (1<<1), ///< A bit indicating if the motion vectors are rendered at display resolution.
|
||||
FFX_FSR3UPSCALER_ENABLE_MOTION_VECTORS_JITTER_CANCELLATION = (1<<2), ///< A bit indicating that the motion vectors have the jittering pattern applied to them.
|
||||
FFX_FSR3UPSCALER_ENABLE_DEPTH_INVERTED = (1<<3), ///< A bit indicating that the input depth buffer data provided is inverted [1..0].
|
||||
FFX_FSR3UPSCALER_ENABLE_DEPTH_INFINITE = (1<<4), ///< A bit indicating that the input depth buffer data provided is using an infinite far plane.
|
||||
FFX_FSR3UPSCALER_ENABLE_AUTO_EXPOSURE = (1<<5), ///< A bit indicating if automatic exposure should be applied to input color data.
|
||||
FFX_FSR3UPSCALER_ENABLE_DYNAMIC_RESOLUTION = (1<<6), ///< A bit indicating that the application uses dynamic resolution scaling.
|
||||
FFX_FSR3UPSCALER_ENABLE_TEXTURE1D_USAGE = (1<<7), ///< A bit indicating that the backend should use 1D textures.
|
||||
FFX_FSR3UPSCALER_ENABLE_DEBUG_CHECKING = (1<<8), ///< A bit indicating that the runtime should check some API values and report issues.
|
||||
} FfxFsr3UpscalerInitializationFlagBits;
|
||||
|
||||
/// Pass a string message
|
||||
///
|
||||
/// Used for debug messages.
|
||||
///
|
||||
/// @param [in] type The type of message.
|
||||
/// @param [in] message A string message to pass.
|
||||
///
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
typedef void(*FfxFsr3UpscalerMessage)(
|
||||
FfxMsgType type,
|
||||
const wchar_t* message);
|
||||
|
||||
/// A structure encapsulating the parameters required to initialize FidelityFX
|
||||
/// Super Resolution 3 upscaling.
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
typedef struct FfxFsr3UpscalerContextDescription {
|
||||
|
||||
uint32_t flags; ///< A collection of <c><i>FfxFsr3UpscalerInitializationFlagBits</i></c>.
|
||||
FfxDimensions2D maxRenderSize; ///< The maximum size that rendering will be performed at.
|
||||
FfxDimensions2D displaySize; ///< The size of the presentation resolution targeted by the upscaling process.
|
||||
FfxInterface backendInterface; ///< A set of pointers to the backend implementation for FidelityFX SDK
|
||||
FfxFsr3UpscalerMessage fpMessage; ///< A pointer to a function that can receive messages from the runtime.
|
||||
} FfxFsr3UpscalerContextDescription;
|
||||
|
||||
/// A structure encapsulating the parameters for dispatching the various passes
|
||||
/// of FidelityFX Super Resolution 3.
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
typedef struct FfxFsr3UpscalerDispatchDescription {
|
||||
|
||||
FfxCommandList commandList; ///< The <c><i>FfxCommandList</i></c> to record FSR3 rendering commands into.
|
||||
FfxResource color; ///< A <c><i>FfxResource</i></c> containing the color buffer for the current frame (at render resolution).
|
||||
FfxResource depth; ///< A <c><i>FfxResource</i></c> containing 32bit depth values for the current frame (at render resolution).
|
||||
FfxResource motionVectors; ///< A <c><i>FfxResource</i></c> containing 2-dimensional motion vectors (at render resolution if <c><i>FFX_FSR3UPSCALER_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS</i></c> is not set).
|
||||
FfxResource exposure; ///< A optional <c><i>FfxResource</i></c> containing a 1x1 exposure value.
|
||||
FfxResource reactive; ///< A optional <c><i>FfxResource</i></c> containing alpha value of reactive objects in the scene.
|
||||
FfxResource transparencyAndComposition; ///< A optional <c><i>FfxResource</i></c> containing alpha value of special objects in the scene.
|
||||
FfxResource dilatedDepth; ///< A <c><i>FfxResource</i></c> allocated as described in <c><i>FfxFsr3UpscalerSharedResourceDescriptions</i></c> that is used to emit dilated depth and share with following effects.
|
||||
FfxResource dilatedMotionVectors; ///< A <c><i>FfxResource</i></c> allocated as described in <c><i>FfxFsr3UpscalerSharedResourceDescriptions</i></c> that is used to emit dilated motion vectors and share with following effects.
|
||||
FfxResource reconstructedPrevNearestDepth; ///< A <c><i>FfxResource</i></c> allocated as described in <c><i>FfxFsr3UpscalerSharedResourceDescriptions</i></c> that is used to emit reconstructed previous nearest depth and share with following effects.
|
||||
FfxResource output; ///< A <c><i>FfxResource</i></c> containing the output color buffer for the current frame (at presentation resolution).
|
||||
FfxFloatCoords2D jitterOffset; ///< The subpixel jitter offset applied to the camera.
|
||||
FfxFloatCoords2D motionVectorScale; ///< The scale factor to apply to motion vectors.
|
||||
FfxDimensions2D renderSize; ///< The resolution that was used for rendering the input resources.
|
||||
bool enableSharpening; ///< Enable an additional sharpening pass.
|
||||
float sharpness; ///< The sharpness value between 0 and 1, where 0 is no additional sharpness and 1 is maximum additional sharpness.
|
||||
float frameTimeDelta; ///< The time elapsed since the last frame (expressed in milliseconds).
|
||||
float preExposure; ///< The pre exposure value (must be > 0.0f)
|
||||
bool reset; ///< A boolean value which when set to true, indicates the camera has moved discontinuously.
|
||||
float cameraNear; ///< The distance to the near plane of the camera.
|
||||
float cameraFar; ///< The distance to the far plane of the camera.
|
||||
float cameraFovAngleVertical; ///< The camera angle field of view in the vertical direction (expressed in radians).
|
||||
float viewSpaceToMetersFactor; ///< The scale factor to convert view space units to meters
|
||||
} FfxFsr3UpscalerDispatchDescription;
|
||||
|
||||
/// A structure encapsulating the parameters for automatic generation of a reactive mask
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
typedef struct FfxFsr3UpscalerGenerateReactiveDescription {
|
||||
|
||||
FfxCommandList commandList; ///< The <c><i>FfxCommandList</i></c> to record FSR3 rendering commands into.
|
||||
FfxResource colorOpaqueOnly; ///< A <c><i>FfxResource</i></c> containing the opaque only color buffer for the current frame (at render resolution).
|
||||
FfxResource colorPreUpscale; ///< A <c><i>FfxResource</i></c> containing the opaque+translucent color buffer for the current frame (at render resolution).
|
||||
FfxResource outReactive; ///< A <c><i>FfxResource</i></c> containing the surface to generate the reactive mask into.
|
||||
FfxDimensions2D renderSize; ///< The resolution that was used for rendering the input resources.
|
||||
float scale; ///< A value to scale the output
|
||||
float cutoffThreshold; ///< A threshold value to generate a binary reactive mask
|
||||
float binaryValue; ///< A value to set for the binary reactive mask
|
||||
uint32_t flags; ///< Flags to determine how to generate the reactive mask
|
||||
} FfxFsr3UpscalerGenerateReactiveDescription;
|
||||
|
||||
/// A structure encapsulating the resource descriptions for shared resources for this effect.
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
typedef struct FfxFsr3UpscalerSharedResourceDescriptions {
|
||||
|
||||
FfxCreateResourceDescription reconstructedPrevNearestDepth; ///< The <c><i>FfxCreateResourceDescription</i></c> for allocating the <c><i>reconstructedPrevNearestDepth</i></c> shared resource.
|
||||
FfxCreateResourceDescription dilatedDepth; ///< The <c><i>FfxCreateResourceDescription</i></c> for allocating the <c><i>dilatedDepth</i></c> shared resource.
|
||||
FfxCreateResourceDescription dilatedMotionVectors; ///< The <c><i>FfxCreateResourceDescription</i></c> for allocating the <c><i>dilatedMotionVectors</i></c> shared resource.
|
||||
} FfxFsr3UpscalerSharedResourceDescriptions;
|
||||
|
||||
/// A structure encapsulating the FidelityFX Super Resolution 3 context.
|
||||
///
|
||||
/// This sets up an object which contains all persistent internal data and
|
||||
/// resources that are required by FSR3.
|
||||
///
|
||||
/// The <c><i>FfxFsr3UpscalerContext</i></c> object should have a lifetime matching
|
||||
/// your use of FSR3. Before destroying the FSR3 context care should be taken
|
||||
/// to ensure the GPU is not accessing the resources created or used by FSR3.
|
||||
/// It is therefore recommended that the GPU is idle before destroying the
|
||||
/// FSR3 context.
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
typedef struct FfxFsr3UpscalerContext
|
||||
{
|
||||
uint32_t data[FFX_FSR3UPSCALER_CONTEXT_SIZE]; ///< An opaque set of <c>uint32_t</c> which contain the data for the context.
|
||||
} FfxFsr3UpscalerContext;
|
||||
|
||||
|
||||
/// Create a FidelityFX Super Resolution 3 context from the parameters
|
||||
/// programmed to the <c><i>FfxFsr3UpscalerCreateParams</i></c> structure.
|
||||
///
|
||||
/// The context structure is the main object used to interact with the FSR3
|
||||
/// API, and is responsible for the management of the internal resources used
|
||||
/// by the FSR3 algorithm. When this API is called, multiple calls will be
|
||||
/// made via the pointers contained in the <c><i>callbacks</i></c> structure.
|
||||
/// These callbacks will attempt to retreive the device capabilities, and
|
||||
/// create the internal resources, and pipelines required by FSR3's
|
||||
/// frame-to-frame function. Depending on the precise configuration used when
|
||||
/// creating the <c><i>FfxFsr3UpscalerContext</i></c> a different set of resources and
|
||||
/// pipelines might be requested via the callback functions.
|
||||
///
|
||||
/// The flags included in the <c><i>flags</i></c> field of
|
||||
/// <c><i>FfxFsr3UpscalerContext</i></c> how match the configuration of your
|
||||
/// application as well as the intended use of FSR3. It is important that these
|
||||
/// flags are set correctly (as well as a correct programmed
|
||||
/// <c><i>FfxFsr3UpscalerDispatchDescription</i></c>) to ensure correct operation. It is
|
||||
/// recommended to consult the overview documentation for further details on
|
||||
/// how FSR3 should be integerated into an application.
|
||||
///
|
||||
/// When the <c><i>FfxFsr3UpscalerContext</i></c> is created, you should use the
|
||||
/// <c><i>ffxFsr3UpscalerContextDispatch</i></c> function each frame where FSR3
|
||||
/// upscaling should be applied. See the documentation of
|
||||
/// <c><i>ffxFsr3UpscalerContextDispatch</i></c> for more details.
|
||||
///
|
||||
/// The <c><i>FfxFsr3UpscalerContext</i></c> should be destroyed when use of it is
|
||||
/// completed, typically when an application is unloaded or FSR3 upscaling is
|
||||
/// disabled by a user. To destroy the FSR3 context you should call
|
||||
/// <c><i>ffxFsr3UpscalerContextDestroy</i></c>.
|
||||
///
|
||||
/// @param [out] pContext A pointer to a <c><i>FfxFsr3UpscalerContext</i></c> structure to populate.
|
||||
/// @param [in] pContextDescription A pointer to a <c><i>FfxFsr3UpscalerContextDescription</i></c> structure.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either <c><i>context</i></c> or <c><i>contextDescription</i></c> was <c><i>NULL</i></c>.
|
||||
/// @retval
|
||||
/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the <c><i>FfxFsr3UpscalerContextDescription.callbacks</i></c> was not fully specified.
|
||||
/// @retval
|
||||
/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend.
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
FFX_API FfxErrorCode ffxFsr3UpscalerContextCreate(FfxFsr3UpscalerContext* pContext, const FfxFsr3UpscalerContextDescription* pContextDescription);
|
||||
|
||||
/// Provides the descriptions for shared resources that must be allocated for this effect.
|
||||
///
|
||||
/// @param [in] context A pointer to a <c><i>FfxFsr3UpscalerContext</i></c> structure.
|
||||
/// @param [out] SharedResources A pointer to a <c><i>FfxFsr3UpscalerSharedResourceDescriptions</i></c> to populate.
|
||||
///
|
||||
/// @returns
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @returns
|
||||
/// Anything else The operation failed.
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
FFX_API FfxErrorCode ffxFsr3UpscalerGetSharedResourceDescriptions(FfxFsr3UpscalerContext* context, FfxFsr3UpscalerSharedResourceDescriptions* SharedResources);
|
||||
|
||||
/// Dispatch the various passes that constitute FidelityFX Super Resolution 3.
|
||||
///
|
||||
/// FSR3 is a composite effect, meaning that it is compromised of multiple
|
||||
/// constituent passes (implemented as one or more clears, copies and compute
|
||||
/// dispatches). The <c><i>ffxFsr3UpscalerContextDispatch</i></c> function is the
|
||||
/// function which (via the use of the functions contained in the
|
||||
/// <c><i>callbacks</i></c> field of the <c><i>FfxFsr3UpscalerContext</i></c>
|
||||
/// structure) utlimately generates the sequence of graphics API calls required
|
||||
/// each frame.
|
||||
///
|
||||
/// As with the creation of the <c><i>FfxFsr3UpscalerContext</i></c> correctly
|
||||
/// programming the <c><i>FfxFsr3UpscalerDispatchDescription</i></c> is key to ensuring
|
||||
/// the correct operation of FSR3. It is particularly important to ensure that
|
||||
/// camera jitter is correctly applied to your application's projection matrix
|
||||
/// (or camera origin for raytraced applications). FSR3 provides the
|
||||
/// <c><i>ffxFsr3UpscalerGetJitterPhaseCount</i></c> and
|
||||
/// <c><i>ffxFsr3UpscalerGetJitterOffset</i></c> entry points to help applications
|
||||
/// correctly compute the camera jitter. Whatever jitter pattern is used by the
|
||||
/// application it should be correctly programmed to the
|
||||
/// <c><i>jitterOffset</i></c> field of the <c><i>dispatchDescription</i></c>
|
||||
/// structure. For more guidance on camera jitter please consult the
|
||||
/// documentation for <c><i>ffxFsr3UpscalerGetJitterOffset</i></c> as well as the
|
||||
/// accompanying overview documentation for FSR3.
|
||||
///
|
||||
/// @param [in] pContext A pointer to a <c><i>FfxFsr3UpscalerContext</i></c> structure.
|
||||
/// @param [in] pDispatchDescription A pointer to a <c><i>FfxFsr3UpscalerDispatchDescription</i></c> structure.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either <c><i>context</i></c> or <c><i>dispatchDescription</i></c> was <c><i>NULL</i></c>.
|
||||
/// @retval
|
||||
/// FFX_ERROR_OUT_OF_RANGE The operation failed because <c><i>dispatchDescription.renderSize</i></c> was larger than the maximum render resolution.
|
||||
/// @retval
|
||||
/// FFX_ERROR_NULL_DEVICE The operation failed because the device inside the context was <c><i>NULL</i></c>.
|
||||
/// @retval
|
||||
/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend.
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
FFX_API FfxErrorCode ffxFsr3UpscalerContextDispatch(FfxFsr3UpscalerContext* pContext, const FfxFsr3UpscalerDispatchDescription* pDispatchDescription);
|
||||
|
||||
/// A helper function generate a Reactive mask from an opaque only texure and one containing translucent objects.
|
||||
///
|
||||
/// @param [in] pContext A pointer to a <c><i>FfxFsr3UpscalerContext</i></c> structure.
|
||||
/// @param [in] pParams A pointer to a <c><i>FfxFsr3UpscalerGenerateReactiveDescription</i></c> structure
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
FFX_API FfxErrorCode ffxFsr3UpscalerContextGenerateReactiveMask(FfxFsr3UpscalerContext* pContext, const FfxFsr3UpscalerGenerateReactiveDescription* pParams);
|
||||
|
||||
/// Destroy the FidelityFX Super Resolution context.
|
||||
///
|
||||
/// @param [out] pContext A pointer to a <c><i>FfxFsr3UpscalerContext</i></c> structure to destroy.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either <c><i>context</i></c> was <c><i>NULL</i></c>.
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
FFX_API FfxErrorCode ffxFsr3UpscalerContextDestroy(FfxFsr3UpscalerContext* pContext);
|
||||
|
||||
/// Get the upscale ratio from the quality mode.
|
||||
///
|
||||
/// The following table enumerates the mapping of the quality modes to
|
||||
/// per-dimension scaling ratios.
|
||||
///
|
||||
/// Quality preset | Scale factor
|
||||
/// ----------------------------------------------------- | -------------
|
||||
/// <c><i>FFX_FSR3UPSCALER_QUALITY_MODE_QUALITY</i></c> | 1.5x
|
||||
/// <c><i>FFX_FSR3UPSCALER_QUALITY_MODE_BALANCED</i></c> | 1.7x
|
||||
/// <c><i>FFX_FSR3UPSCALER_QUALITY_MODE_PERFORMANCE</i></c> | 2.0x
|
||||
/// <c><i>FFX_FSR3UPSCALER_QUALITY_MODE_ULTRA_PERFORMANCE</i></c> | 3.0x
|
||||
///
|
||||
/// Passing an invalid <c><i>qualityMode</i></c> will return 0.0f.
|
||||
///
|
||||
/// @param [in] qualityMode The quality mode preset.
|
||||
///
|
||||
/// @returns
|
||||
/// The upscaling the per-dimension upscaling ratio for
|
||||
/// <c><i>qualityMode</i></c> according to the table above.
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
FFX_API float ffxFsr3UpscalerGetUpscaleRatioFromQualityMode(FfxFsr3UpscalerQualityMode qualityMode);
|
||||
|
||||
/// A helper function to calculate the rendering resolution from a target
|
||||
/// resolution and desired quality level.
|
||||
///
|
||||
/// This function applies the scaling factor returned by
|
||||
/// <c><i>ffxFsr3UpscalerGetUpscaleRatioFromQualityMode</i></c> to each dimension.
|
||||
///
|
||||
/// @param [out] pRenderWidth A pointer to a <c>uint32_t</c> which will hold the calculated render resolution width.
|
||||
/// @param [out] pRenderHeight A pointer to a <c>uint32_t</c> which will hold the calculated render resolution height.
|
||||
/// @param [in] displayWidth The target display resolution width.
|
||||
/// @param [in] displayHeight The target display resolution height.
|
||||
/// @param [in] qualityMode The desired quality mode for FSR 2 upscaling.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// FFX_ERROR_INVALID_POINTER Either <c><i>renderWidth</i></c> or <c><i>renderHeight</i></c> was <c>NULL</c>.
|
||||
/// @retval
|
||||
/// FFX_ERROR_INVALID_ENUM An invalid quality mode was specified.
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
FFX_API FfxErrorCode ffxFsr3UpscalerGetRenderResolutionFromQualityMode(
|
||||
uint32_t* pRenderWidth,
|
||||
uint32_t* pRenderHeight,
|
||||
uint32_t displayWidth,
|
||||
uint32_t displayHeight,
|
||||
FfxFsr3UpscalerQualityMode qualityMode);
|
||||
|
||||
/// A helper function to calculate the jitter phase count from display
|
||||
/// resolution.
|
||||
///
|
||||
/// For more detailed information about the application of camera jitter to
|
||||
/// your application's rendering please refer to the
|
||||
/// <c><i>ffxFsr3UpscalerGetJitterOffset</i></c> function.
|
||||
///
|
||||
/// The table below shows the jitter phase count which this function
|
||||
/// would return for each of the quality presets.
|
||||
///
|
||||
/// Quality preset | Scale factor | Phase count
|
||||
/// ----------------------------------------------------- | ------------- | ---------------
|
||||
/// <c><i>FFX_FSR3UPSCALER_QUALITY_MODE_QUALITY</i></c> | 1.5x | 18
|
||||
/// <c><i>FFX_FSR3UPSCALER_QUALITY_MODE_BALANCED</i></c> | 1.7x | 23
|
||||
/// <c><i>FFX_FSR3UPSCALER_QUALITY_MODE_PERFORMANCE</i></c> | 2.0x | 32
|
||||
/// <c><i>FFX_FSR3UPSCALER_QUALITY_MODE_ULTRA_PERFORMANCE</i></c> | 3.0x | 72
|
||||
/// Custom | [1..n]x | ceil(8*n^2)
|
||||
///
|
||||
/// @param [in] renderWidth The render resolution width.
|
||||
/// @param [in] displayWidth The display resolution width.
|
||||
///
|
||||
/// @returns
|
||||
/// The jitter phase count for the scaling factor between <c><i>renderWidth</i></c> and <c><i>displayWidth</i></c>.
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
FFX_API int32_t ffxFsr3UpscalerGetJitterPhaseCount(int32_t renderWidth, int32_t displayWidth);
|
||||
|
||||
/// A helper function to calculate the subpixel jitter offset.
|
||||
///
|
||||
/// FSR3 relies on the application to apply sub-pixel jittering while rendering.
|
||||
/// This is typically included in the projection matrix of the camera. To make
|
||||
/// the application of camera jitter simple, the FSR3 API provides a small set
|
||||
/// of utility function which computes the sub-pixel jitter offset for a
|
||||
/// particular frame within a sequence of separate jitter offsets. To begin, the
|
||||
/// index within the jitter phase must be computed. To calculate the
|
||||
/// sequence's length, you can call the <c><i>ffxFsr3UpscalerGetJitterPhaseCount</i></c>
|
||||
/// function. The index should be a value which is incremented each frame modulo
|
||||
/// the length of the sequence computed by <c><i>ffxFsr3UpscalerGetJitterPhaseCount</i></c>.
|
||||
/// The index within the jitter phase is passed to
|
||||
/// <c><i>ffxFsr3UpscalerGetJitterOffset</i></c> via the <c><i>index</i></c> parameter.
|
||||
///
|
||||
/// This function uses a Halton(2,3) sequence to compute the jitter offset.
|
||||
/// The ultimate index used for the sequence is <c><i>index</i></c> %
|
||||
/// <c><i>phaseCount</i></c>.
|
||||
///
|
||||
/// It is important to understand that the values returned from the
|
||||
/// <c><i>ffxFsr3UpscalerGetJitterOffset</i></c> function are in unit pixel space, and
|
||||
/// in order to composite this correctly into a projection matrix we must
|
||||
/// convert them into projection offsets. This is done as per the pseudo code
|
||||
/// listing which is shown below.
|
||||
///
|
||||
/// const int32_t jitterPhaseCount = ffxFsr3UpscalerGetJitterPhaseCount(renderWidth, displayWidth);
|
||||
///
|
||||
/// float jitterX = 0;
|
||||
/// float jitterY = 0;
|
||||
/// ffxFsr3UpscalerGetJitterOffset(&jitterX, &jitterY, index, jitterPhaseCount);
|
||||
///
|
||||
/// const float jitterX = 2.0f * jitterX / (float)renderWidth;
|
||||
/// const float jitterY = -2.0f * jitterY / (float)renderHeight;
|
||||
/// const Matrix4 jitterTranslationMatrix = translateMatrix(Matrix3::identity, Vector3(jitterX, jitterY, 0));
|
||||
/// const Matrix4 jitteredProjectionMatrix = jitterTranslationMatrix * projectionMatrix;
|
||||
///
|
||||
/// Jitter should be applied to all rendering. This includes opaque, alpha
|
||||
/// transparent, and raytraced objects. For rasterized objects, the sub-pixel
|
||||
/// jittering values calculated by the <c><i>iffxFsr3UpscalerGetJitterOffset</i></c>
|
||||
/// function can be applied to the camera projection matrix which is ultimately
|
||||
/// used to perform transformations during vertex shading. For raytraced
|
||||
/// rendering, the sub-pixel jitter should be applied to the ray's origin,
|
||||
/// often the camera's position.
|
||||
///
|
||||
/// Whether you elect to use the <c><i>ffxFsr3UpscalerGetJitterOffset</i></c> function
|
||||
/// or your own sequence generator, you must program the
|
||||
/// <c><i>jitterOffset</i></c> field of the
|
||||
/// <c><i>FfxFsr3UpscalerDispatchParameters</i></c> structure in order to inform FSR3
|
||||
/// of the jitter offset that has been applied in order to render each frame.
|
||||
///
|
||||
/// If not using the recommended <c><i>ffxFsr3UpscalerGetJitterOffset</i></c> function,
|
||||
/// care should be taken that your jitter sequence never generates a null vector;
|
||||
/// that is value of 0 in both the X and Y dimensions.
|
||||
///
|
||||
/// @param [out] pOutX A pointer to a <c>float</c> which will contain the subpixel jitter offset for the x dimension.
|
||||
/// @param [out] pOutY A pointer to a <c>float</c> which will contain the subpixel jitter offset for the y dimension.
|
||||
/// @param [in] index The index within the jitter sequence.
|
||||
/// @param [in] phaseCount The length of jitter phase. See <c><i>ffxFsr3UpscalerGetJitterPhaseCount</i></c>.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// FFX_ERROR_INVALID_POINTER Either <c><i>outX</i></c> or <c><i>outY</i></c> was <c>NULL</c>.
|
||||
/// @retval
|
||||
/// FFX_ERROR_INVALID_ARGUMENT Argument <c><i>phaseCount</i></c> must be greater than 0.
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
FFX_API FfxErrorCode ffxFsr3UpscalerGetJitterOffset(float* pOutX, float* pOutY, int32_t index, int32_t phaseCount);
|
||||
|
||||
/// A helper function to check if a resource is
|
||||
/// <c><i>FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_NULL</i></c>.
|
||||
///
|
||||
/// @param [in] resource A <c><i>FfxResource</i></c>.
|
||||
///
|
||||
/// @returns
|
||||
/// true The <c><i>resource</i></c> was not <c><i>FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_NULL</i></c>.
|
||||
/// @returns
|
||||
/// false The <c><i>resource</i></c> was <c><i>FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_NULL</i></c>.
|
||||
///
|
||||
/// @ingroup ffxFsr3Upscaler
|
||||
FFX_API bool ffxFsr3UpscalerResourceIsNull(FfxResource resource);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif // #if defined(__cplusplus)
|
||||
+465
@@ -0,0 +1,465 @@
|
||||
// This file is part of the FidelityFX SDK.
|
||||
//
|
||||
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <FidelityFX/host/ffx_assert.h>
|
||||
#include <FidelityFX/host/ffx_types.h>
|
||||
#include <FidelityFX/host/ffx_error.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#define FFX_CPU
|
||||
extern "C" {
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
||||
/// @defgroup Backends Backends
|
||||
/// Core interface declarations and natively supported backends
|
||||
///
|
||||
/// @ingroup ffxSDK
|
||||
|
||||
/// @defgroup FfxInterface FfxInterface
|
||||
/// FidelityFX SDK function signatures and core defines requiring
|
||||
/// overrides for backend implementation.
|
||||
///
|
||||
/// @ingroup Backends
|
||||
FFX_FORWARD_DECLARE(FfxInterface);
|
||||
|
||||
/// FidelityFX SDK major version.
|
||||
///
|
||||
/// @ingroup FfxInterface
|
||||
#define FFX_SDK_VERSION_MAJOR (1)
|
||||
|
||||
/// FidelityFX SDK minor version.
|
||||
///
|
||||
/// @ingroup FfxInterface
|
||||
#define FFX_SDK_VERSION_MINOR (0)
|
||||
|
||||
/// FidelityFX SDK patch version.
|
||||
///
|
||||
/// @ingroup FfxInterface
|
||||
#define FFX_SDK_VERSION_PATCH (1)
|
||||
|
||||
/// Macro to pack a FidelityFX SDK version id together.
|
||||
///
|
||||
/// @ingroup FfxInterface
|
||||
#define FFX_SDK_MAKE_VERSION( major, minor, patch ) ( ( major << 22 ) | ( minor << 12 ) | patch )
|
||||
|
||||
/// Stand in type for FfxPass
|
||||
///
|
||||
/// These will be defined for each effect individually (i.e. FfxFsr2Pass).
|
||||
/// They are used to fetch the proper blob index to build effect shaders
|
||||
///
|
||||
/// @ingroup FfxInterface
|
||||
typedef uint32_t FfxPass;
|
||||
|
||||
/// Get the SDK version of the backend context.
|
||||
///
|
||||
/// Newer effects may require support that legacy versions of the SDK will not be
|
||||
/// able to provide. A version query is thus required to ensure an effect component
|
||||
/// will always be paired with a backend which will support all needed functionality.
|
||||
///
|
||||
/// @param [in] backendInterface A pointer to the backend interface.
|
||||
///
|
||||
/// @returns
|
||||
/// The SDK version a backend was built with.
|
||||
///
|
||||
/// @ingroup FfxInterface
|
||||
typedef FfxUInt32(*FfxGetSDKVersionFunc)(
|
||||
FfxInterface* backendInterface);
|
||||
|
||||
/// Create and initialize the backend context.
|
||||
///
|
||||
/// The callback function sets up the backend context for rendering.
|
||||
/// It will create or reference the device and create required internal data structures.
|
||||
///
|
||||
/// @param [in] backendInterface A pointer to the backend interface.
|
||||
/// @param [out] effectContextId The context space to be used for the effect in question.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// Anything else The operation failed.
|
||||
///
|
||||
/// @ingroup FfxInterface
|
||||
typedef FfxErrorCode (*FfxCreateBackendContextFunc)(
|
||||
FfxInterface* backendInterface,
|
||||
FfxUInt32* effectContextId);
|
||||
|
||||
/// Get a list of capabilities of the device.
|
||||
///
|
||||
/// When creating an <c><i>FfxEffectContext</i></c> it is desirable for the FFX
|
||||
/// core implementation to be aware of certain characteristics of the platform
|
||||
/// that is being targetted. This is because some optimizations which FFX SDK
|
||||
/// attempts to perform are more effective on certain classes of hardware than
|
||||
/// others, or are not supported by older hardware. In order to avoid cases
|
||||
/// where optimizations actually have the effect of decreasing performance, or
|
||||
/// reduce the breadth of support provided by FFX SDK, the FFX interface queries the
|
||||
/// capabilities of the device to make such decisions.
|
||||
///
|
||||
/// For target platforms with fixed hardware support you need not implement
|
||||
/// this callback function by querying the device, but instead may hardcore
|
||||
/// what features are available on the platform.
|
||||
///
|
||||
/// @param [in] backendInterface A pointer to the backend interface.
|
||||
/// @param [out] outDeviceCapabilities The device capabilities structure to fill out.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// Anything else The operation failed.
|
||||
///
|
||||
/// @ingroup FfxInterface
|
||||
typedef FfxErrorCode(*FfxGetDeviceCapabilitiesFunc)(
|
||||
FfxInterface* backendInterface,
|
||||
FfxDeviceCapabilities* outDeviceCapabilities);
|
||||
|
||||
/// Destroy the backend context and dereference the device.
|
||||
///
|
||||
/// This function is called when the <c><i>FfxEffectContext</i></c> is destroyed.
|
||||
///
|
||||
/// @param [in] backendInterface A pointer to the backend interface.
|
||||
/// @param [in] effectContextId The context space to be used for the effect in question.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// Anything else The operation failed.
|
||||
///
|
||||
/// @ingroup FfxInterface
|
||||
typedef FfxErrorCode(*FfxDestroyBackendContextFunc)(
|
||||
FfxInterface* backendInterface,
|
||||
FfxUInt32 effectContextId);
|
||||
|
||||
/// Create a resource.
|
||||
///
|
||||
/// This callback is intended for the backend to create internal resources.
|
||||
///
|
||||
/// Please note: It is also possible that the creation of resources might
|
||||
/// itself cause additional resources to be created by simply calling the
|
||||
/// <c><i>FfxCreateResourceFunc</i></c> function pointer again. This is
|
||||
/// useful when handling the initial creation of resources which must be
|
||||
/// initialized. The flow in such a case would be an initial call to create the
|
||||
/// CPU-side resource, another to create the GPU-side resource, and then a call
|
||||
/// to schedule a copy render job to move the data between the two. Typically
|
||||
/// this type of function call flow is only seen during the creation of an
|
||||
/// <c><i>FfxEffectContext</i></c>.
|
||||
///
|
||||
/// @param [in] backendInterface A pointer to the backend interface.
|
||||
/// @param [in] createResourceDescription A pointer to a <c><i>FfxCreateResourceDescription</i></c>.
|
||||
/// @param [in] effectContextId The context space to be used for the effect in question.
|
||||
/// @param [out] outResource A pointer to a <c><i>FfxResource</i></c> object.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// Anything else The operation failed.
|
||||
///
|
||||
/// @ingroup FfxInterface
|
||||
typedef FfxErrorCode (*FfxCreateResourceFunc)(
|
||||
FfxInterface* backendInterface,
|
||||
const FfxCreateResourceDescription* createResourceDescription,
|
||||
FfxUInt32 effectContextId,
|
||||
FfxResourceInternal* outResource);
|
||||
|
||||
/// Register a resource in the backend for the current frame.
|
||||
///
|
||||
/// Since the FfxInterface and the backends are not aware how many different
|
||||
/// resources will get passed in over time, it's not safe
|
||||
/// to register all resources simultaneously in the backend.
|
||||
/// Also passed resources may not be valid after the dispatch call.
|
||||
/// As a result it's safest to register them as FfxResourceInternal
|
||||
/// and clear them at the end of the dispatch call.
|
||||
///
|
||||
/// @param [in] backendInterface A pointer to the backend interface.
|
||||
/// @param [in] inResource A pointer to a <c><i>FfxResource</i></c>.
|
||||
/// @param [in] effectContextId The context space to be used for the effect in question.
|
||||
/// @param [out] outResource A pointer to a <c><i>FfxResourceInternal</i></c> object.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// Anything else The operation failed.
|
||||
///
|
||||
/// @ingroup FfxInterface
|
||||
typedef FfxErrorCode(*FfxRegisterResourceFunc)(
|
||||
FfxInterface* backendInterface,
|
||||
const FfxResource* inResource,
|
||||
FfxUInt32 effectContextId,
|
||||
FfxResourceInternal* outResource);
|
||||
|
||||
|
||||
/// Get an FfxResource from an FfxResourceInternal resource.
|
||||
///
|
||||
/// At times it is necessary to create an FfxResource representation
|
||||
/// of an internally created resource in order to register it with a
|
||||
/// child effect context. This function sets up the FfxResource needed
|
||||
/// to register.
|
||||
///
|
||||
/// @param [in] backendInterface A pointer to the backend interface.
|
||||
/// @param [in] resource The <c><i>FfxResourceInternal</i></c> for which to setup an FfxResource.
|
||||
///
|
||||
/// @returns
|
||||
/// An FfxResource built from the internal resource
|
||||
///
|
||||
/// @ingroup FfxInterface
|
||||
typedef FfxResource(*FfxGetResourceFunc)(
|
||||
FfxInterface* backendInterface,
|
||||
FfxResourceInternal resource);
|
||||
|
||||
/// Unregister all temporary FfxResourceInternal from the backend.
|
||||
///
|
||||
/// Unregister FfxResourceInternal referencing resources passed to
|
||||
/// a function as a parameter.
|
||||
///
|
||||
/// @param [in] backendInterface A pointer to the backend interface.
|
||||
/// @param [in] commandList A pointer to a <c><i>FfxCommandList</i></c> structure.
|
||||
/// @param [in] effectContextId The context space to be used for the effect in question.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// Anything else The operation failed.
|
||||
///
|
||||
/// @ingroup FfxInterface
|
||||
typedef FfxErrorCode(*FfxUnregisterResourcesFunc)(
|
||||
FfxInterface* backendInterface,
|
||||
FfxCommandList commandList,
|
||||
FfxUInt32 effectContextId);
|
||||
|
||||
/// Retrieve a <c><i>FfxResourceDescription</i></c> matching a
|
||||
/// <c><i>FfxResource</i></c> structure.
|
||||
///
|
||||
/// @param [in] backendInterface A pointer to the backend interface.
|
||||
/// @param [in] resource A pointer to a <c><i>FfxResource</i></c> object.
|
||||
///
|
||||
/// @returns
|
||||
/// A description of the resource.
|
||||
///
|
||||
/// @ingroup FfxInterface
|
||||
typedef FfxResourceDescription (*FfxGetResourceDescriptionFunc)(
|
||||
FfxInterface* backendInterface,
|
||||
FfxResourceInternal resource);
|
||||
|
||||
/// Destroy a resource
|
||||
///
|
||||
/// This callback is intended for the backend to release an internal resource.
|
||||
///
|
||||
/// @param [in] backendInterface A pointer to the backend interface.
|
||||
/// @param [in] resource A pointer to a <c><i>FfxResource</i></c> object.
|
||||
/// @param [in] effectContextId The context space to be used for the effect in question.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// Anything else The operation failed.
|
||||
///
|
||||
/// @ingroup FfxInterface
|
||||
typedef FfxErrorCode (*FfxDestroyResourceFunc)(
|
||||
FfxInterface* backendInterface,
|
||||
FfxResourceInternal resource,
|
||||
FfxUInt32 effectContextId);
|
||||
|
||||
/// Create a render pipeline.
|
||||
///
|
||||
/// A rendering pipeline contains the shader as well as resource bindpoints
|
||||
/// and samplers.
|
||||
///
|
||||
/// @param [in] backendInterface A pointer to the backend interface.
|
||||
/// @param [in] pass The identifier for the pass.
|
||||
/// @param [in] pipelineDescription A pointer to a <c><i>FfxPipelineDescription</i></c> describing the pipeline to be created.
|
||||
/// @param [in] effectContextId The context space to be used for the effect in question.
|
||||
/// @param [out] outPipeline A pointer to a <c><i>FfxPipelineState</i></c> structure which should be populated.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// Anything else The operation failed.
|
||||
///
|
||||
/// @ingroup FfxInterface
|
||||
typedef FfxErrorCode (*FfxCreatePipelineFunc)(
|
||||
FfxInterface* backendInterface,
|
||||
FfxEffect effect,
|
||||
FfxPass pass,
|
||||
uint32_t permutationOptions,
|
||||
const FfxPipelineDescription* pipelineDescription,
|
||||
FfxUInt32 effectContextId,
|
||||
FfxPipelineState* outPipeline);
|
||||
|
||||
typedef FfxErrorCode(*FfxGetPermutationBlobByIndexFunc)(FfxEffect effectId,
|
||||
FfxPass passId,
|
||||
FfxBindStage bindStage,
|
||||
uint32_t permutationOptions,
|
||||
FfxShaderBlob* outBlob);
|
||||
|
||||
/// Destroy a render pipeline.
|
||||
///
|
||||
/// @param [in] backendInterface A pointer to the backend interface.
|
||||
/// @param [in] effectContextId The context space to be used for the effect in question.
|
||||
/// @param [out] pipeline A pointer to a <c><i>FfxPipelineState</i></c> structure which should be released.
|
||||
/// @param [in] effectContextId The context space to be used for the effect in question.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// Anything else The operation failed.
|
||||
///
|
||||
/// @ingroup FfxInterface
|
||||
typedef FfxErrorCode (*FfxDestroyPipelineFunc)(
|
||||
FfxInterface* backendInterface,
|
||||
FfxPipelineState* pipeline,
|
||||
FfxUInt32 effectContextId);
|
||||
|
||||
/// Schedule a render job to be executed on the next call of
|
||||
/// <c><i>FfxExecuteGpuJobsFunc</i></c>.
|
||||
///
|
||||
/// Render jobs can perform one of three different tasks: clear, copy or
|
||||
/// compute dispatches.
|
||||
///
|
||||
/// @param [in] backendInterface A pointer to the backend interface.
|
||||
/// @param [in] job A pointer to a <c><i>FfxGpuJobDescription</i></c> structure.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// Anything else The operation failed.
|
||||
///
|
||||
/// @ingroup FfxInterface
|
||||
typedef FfxErrorCode (*FfxScheduleGpuJobFunc)(
|
||||
FfxInterface* backendInterface,
|
||||
const FfxGpuJobDescription* job);
|
||||
|
||||
/// Execute scheduled render jobs on the <c><i>comandList</i></c> provided.
|
||||
///
|
||||
/// The recording of the graphics API commands should take place in this
|
||||
/// callback function, the render jobs which were previously enqueued (via
|
||||
/// callbacks made to <c><i>FfxScheduleGpuJobFunc</i></c>) should be
|
||||
/// processed in the order they were received. Advanced users might choose to
|
||||
/// reorder the rendering jobs, but should do so with care to respect the
|
||||
/// resource dependencies.
|
||||
///
|
||||
/// Depending on the precise contents of <c><i>FfxDispatchDescription</i></c> a
|
||||
/// different number of render jobs might have previously been enqueued (for
|
||||
/// example if sharpening is toggled on and off).
|
||||
///
|
||||
/// @param [in] backendInterface A pointer to the backend interface.
|
||||
/// @param [in] commandList A pointer to a <c><i>FfxCommandList</i></c> structure.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// Anything else The operation failed.
|
||||
///
|
||||
/// @ingroup FfxInterface
|
||||
typedef FfxErrorCode (*FfxExecuteGpuJobsFunc)(
|
||||
FfxInterface* backendInterface,
|
||||
FfxCommandList commandList);
|
||||
|
||||
typedef FfxErrorCode(*FfxPresentCallbackFunc)(const FfxPresentCallbackDescription* params);
|
||||
typedef FfxErrorCode(*FfxFrameGenerationDispatchFunc)(const FfxFrameGenerationDispatchDescription* params);
|
||||
|
||||
typedef struct FfxFrameGenerationConfig
|
||||
{
|
||||
FfxSwapchain swapChain;
|
||||
FfxPresentCallbackFunc presentCallback;
|
||||
FfxFrameGenerationDispatchFunc frameGenerationCallback;
|
||||
bool frameGenerationEnabled;
|
||||
bool allowAsyncWorkloads;
|
||||
FfxResource HUDLessColor;
|
||||
FfxUInt32 flags;
|
||||
bool onlyPresentInterpolated;
|
||||
} FfxFrameGenerationConfig;
|
||||
|
||||
typedef FfxErrorCode (*ffxSwapChainConfigureFrameGenerationFunc)(FfxFrameGenerationConfig const* config);
|
||||
|
||||
/// A structure encapsulating the interface between the core implementation of
|
||||
/// the FfxInterface and any graphics API that it should ultimately call.
|
||||
///
|
||||
/// This set of functions serves as an abstraction layer between FfxInterfae and the
|
||||
/// API used to implement it. While the FidelityFX SDK ships with backends for DirectX12 and
|
||||
/// Vulkan, it is possible to implement your own backend for other platforms
|
||||
/// which sit on top of your engine's own abstraction layer. For details on the
|
||||
/// expectations of what each function should do you should refer the
|
||||
/// description of the following function pointer types:
|
||||
///
|
||||
/// <c><i>FfxCreateDeviceFunc</i></c>
|
||||
/// <c><i>FfxGetDeviceCapabilitiesFunc</i></c>
|
||||
/// <c><i>FfxDestroyDeviceFunc</i></c>
|
||||
/// <c><i>FfxCreateResourceFunc</i></c>
|
||||
/// <c><i>FfxRegisterResourceFunc</i></c>
|
||||
/// <c><i>FfxGetResourceFunc</i></c>
|
||||
/// <c><i>FfxUnregisterResourcesFunc</i></c>
|
||||
/// <c><i>FfxGetResourceDescriptionFunc</i></c>
|
||||
/// <c><i>FfxDestroyResourceFunc</i></c>
|
||||
/// <c><i>FfxCreatePipelineFunc</i></c>
|
||||
/// <c><i>FfxDestroyPipelineFunc</i></c>
|
||||
/// <c><i>FfxScheduleGpuJobFunc</i></c>
|
||||
/// <c><i>FfxExecuteGpuJobsFunc</i></c>
|
||||
///
|
||||
/// Depending on the graphics API that is abstracted by the backend, it may be
|
||||
/// required that the backend is to some extent stateful. To ensure that
|
||||
/// applications retain full control to manage the memory used by the FidelityFX SDK, the
|
||||
/// <c><i>scratchBuffer</i></c> and <c><i>scratchBufferSize</i></c> fields are
|
||||
/// provided. A backend should provide a means of specifying how much scratch
|
||||
/// memory is required for its internal implementation (e.g: via a function
|
||||
/// or constant value). The application is then responsible for allocating that
|
||||
/// memory and providing it when setting up the SDK backend. Backends provided
|
||||
/// with the FidelityFX SDK do not perform dynamic memory allocations, and instead
|
||||
/// sub-allocate all memory from the scratch buffers provided.
|
||||
///
|
||||
/// The <c><i>scratchBuffer</i></c> and <c><i>scratchBufferSize</i></c> fields
|
||||
/// should be populated according to the requirements of each backend. For
|
||||
/// example, if using the DirectX 12 backend you should call the
|
||||
/// <c><i>ffxGetScratchMemorySizeDX12</i></c> function. It is not required
|
||||
/// that custom backend implementations use a scratch buffer.
|
||||
///
|
||||
/// Any functional addition to this interface mandates a version
|
||||
/// bump to ensure full functionality across effects and backends.
|
||||
///
|
||||
/// @ingroup FfxInterface
|
||||
typedef struct FfxInterface {
|
||||
|
||||
FfxGetSDKVersionFunc fpGetSDKVersion; ///< A callback function to query the SDK version.
|
||||
FfxCreateBackendContextFunc fpCreateBackendContext; ///< A callback function to create and initialize the backend context.
|
||||
FfxGetDeviceCapabilitiesFunc fpGetDeviceCapabilities; ///< A callback function to query device capabilities.
|
||||
FfxDestroyBackendContextFunc fpDestroyBackendContext; ///< A callback function to destroy the backend context. This also dereferences the device.
|
||||
FfxCreateResourceFunc fpCreateResource; ///< A callback function to create a resource.
|
||||
FfxRegisterResourceFunc fpRegisterResource; ///< A callback function to register an external resource.
|
||||
FfxGetResourceFunc fpGetResource; ///< A callback function to convert an internal resource to external resource type
|
||||
FfxUnregisterResourcesFunc fpUnregisterResources; ///< A callback function to unregister external resource.
|
||||
FfxGetResourceDescriptionFunc fpGetResourceDescription; ///< A callback function to retrieve a resource description.
|
||||
FfxDestroyResourceFunc fpDestroyResource; ///< A callback function to destroy a resource.
|
||||
FfxCreatePipelineFunc fpCreatePipeline; ///< A callback function to create a render or compute pipeline.
|
||||
FfxGetPermutationBlobByIndexFunc fpGetPermutationBlobByIndex;
|
||||
FfxDestroyPipelineFunc fpDestroyPipeline; ///< A callback function to destroy a render or compute pipeline.
|
||||
FfxScheduleGpuJobFunc fpScheduleGpuJob; ///< A callback function to schedule a render job.
|
||||
FfxExecuteGpuJobsFunc fpExecuteGpuJobs; ///< A callback function to execute all queued render jobs.
|
||||
ffxSwapChainConfigureFrameGenerationFunc fpSwapChainConfigureFrameGeneration; ///< A callback function to configure swap chain present callback.
|
||||
|
||||
void* scratchBuffer; ///< A preallocated buffer for memory utilized internally by the backend.
|
||||
size_t scratchBufferSize; ///< Size of the buffer pointed to by <c><i>scratchBuffer</i></c>.
|
||||
FfxDevice device; ///< A backend specific device
|
||||
|
||||
} FfxInterface;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif // #if defined(__cplusplus)
|
||||
+202
@@ -0,0 +1,202 @@
|
||||
// This file is part of the FidelityFX SDK.
|
||||
//
|
||||
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
|
||||
// @defgroup OpticalFlow
|
||||
|
||||
#pragma once
|
||||
|
||||
// Include the interface for the backend of the OpticalFlow API.
|
||||
#include <FidelityFX/host/ffx_interface.h>
|
||||
|
||||
/// FidelityFX OpticalFlow major version.
|
||||
///
|
||||
/// @ingroup ffxOpticalflow
|
||||
#define FFX_OPTICALFLOW_VERSION_MAJOR (1)
|
||||
|
||||
/// FidelityFX OpticalFlow minor version.
|
||||
///
|
||||
/// @ingroup ffxOpticalflow
|
||||
#define FFX_OPTICALFLOW_VERSION_MINOR (0)
|
||||
|
||||
/// FidelityFX OpticalFlow patch version.
|
||||
///
|
||||
/// @ingroup ffxOpticalflow
|
||||
#define FFX_OPTICALFLOW_VERSION_PATCH (0)
|
||||
|
||||
/// FidelityFX Optical Flow context count
|
||||
///
|
||||
/// Defines the number of internal effect contexts required by Optical Flow
|
||||
///
|
||||
/// @ingroup ffxOpticalFlow
|
||||
#define FFX_OPTICALFLOW_CONTEXT_COUNT (1)
|
||||
|
||||
/// The size of the context specified in 32bit size units.
|
||||
///
|
||||
/// @ingroup ffxOpticalflow
|
||||
#define FFX_OPTICALFLOW_CONTEXT_SIZE (FFX_SDK_DEFAULT_CONTEXT_SIZE)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
||||
/// An enumeration of all the passes which constitute the OpticalFlow algorithm.
|
||||
///
|
||||
/// @ingroup ffxOpticalflow
|
||||
typedef enum FfxOpticalflowPass
|
||||
{
|
||||
FFX_OPTICALFLOW_PASS_PREPARE_LUMA = 0,
|
||||
FFX_OPTICALFLOW_PASS_GENERATE_OPTICAL_FLOW_INPUT_PYRAMID,
|
||||
FFX_OPTICALFLOW_PASS_GENERATE_SCD_HISTOGRAM,
|
||||
FFX_OPTICALFLOW_PASS_COMPUTE_SCD_DIVERGENCE,
|
||||
FFX_OPTICALFLOW_PASS_COMPUTE_OPTICAL_FLOW_ADVANCED_V5,
|
||||
FFX_OPTICALFLOW_PASS_FILTER_OPTICAL_FLOW_V5,
|
||||
FFX_OPTICALFLOW_PASS_SCALE_OPTICAL_FLOW_ADVANCED_V5,
|
||||
|
||||
FFX_OPTICALFLOW_PASS_COUNT
|
||||
} FfxOpticalflowPass;
|
||||
|
||||
/// An enumeration of bit flags used when creating a
|
||||
/// <c><i>FfxOpticalflowContext</i></c>. See <c><i>FfxOpticalflowDispatchDescription</i></c>.
|
||||
///
|
||||
/// @ingroup ffxOpticalflow
|
||||
typedef enum FfxOpticalflowInitializationFlagBits
|
||||
{
|
||||
FFX_OPTICALFLOW_ENABLE_TEXTURE1D_USAGE = (1 << 0),
|
||||
|
||||
} FfxOpticalflowInitializationFlagBits;
|
||||
|
||||
/// A structure encapsulating the parameters required to initialize
|
||||
/// FidelityFX OpticalFlow.
|
||||
///
|
||||
/// @ingroup ffxOpticalflow
|
||||
typedef struct FfxOpticalflowContextDescription {
|
||||
|
||||
FfxInterface backendInterface; ///< A set of pointers to the backend implementation for FidelityFX SDK
|
||||
uint32_t flags; ///< A collection of <c><i>FfxOpticalflowInitializationFlagBits</i></c>.
|
||||
FfxDimensions2D resolution;
|
||||
} FfxOpticalflowContextDescription;
|
||||
|
||||
/// A structure encapsulating the parameters for dispatching the various passes
|
||||
/// of FidelityFX Opticalflow.
|
||||
///
|
||||
/// @ingroup ffxOpticalflow
|
||||
typedef struct FfxOpticalflowDispatchDescription
|
||||
{
|
||||
FfxCommandList commandList; ///< The <c><i>FfxCommandList</i></c> to record rendering commands into.
|
||||
FfxResource color; ///< A <c><i>FfxResource</i></c> containing the input color buffer
|
||||
FfxResource opticalFlowVector; ///< A <c><i>FfxResource</i></c> containing the output motion buffer
|
||||
FfxResource opticalFlowSCD; ///< A <c><i>FfxResource</i></c> containing the output scene change detection buffer
|
||||
bool reset; ///< A boolean value which when set to true, indicates the camera has moved discontinuously.
|
||||
int backbufferTransferFunction;
|
||||
FfxFloatCoords2D minMaxLuminance;
|
||||
} FfxOpticalflowDispatchDescription;
|
||||
|
||||
typedef struct FfxOpticalflowSharedResourceDescriptions {
|
||||
|
||||
FfxCreateResourceDescription opticalFlowVector;
|
||||
FfxCreateResourceDescription opticalFlowSCD;
|
||||
|
||||
} FfxOpticalflowSharedResourceDescriptions;
|
||||
|
||||
/// A structure encapsulating the FidelityFX OpticalFlow context.
|
||||
///
|
||||
/// This sets up an object which contains all persistent internal data and
|
||||
/// resources that are required by OpticalFlow.
|
||||
///
|
||||
/// The <c><i>FfxOpticalflowContext</i></c> object should have a lifetime matching
|
||||
/// your use of OpticalFlow. Before destroying the OpticalFlow context care should be taken
|
||||
/// to ensure the GPU is not accessing the resources created or used by OpticalFlow.
|
||||
/// It is therefore recommended that the GPU is idle before destroying OpticalFlow
|
||||
/// OpticalFlow context.
|
||||
///
|
||||
/// @ingroup ffxOpticalflow
|
||||
typedef struct FfxOpticalflowContext
|
||||
{
|
||||
uint32_t data[FFX_OPTICALFLOW_CONTEXT_SIZE]; ///< An opaque set of <c>uint32_t</c> which contain the data for the context.
|
||||
} FfxOpticalflowContext;
|
||||
|
||||
|
||||
/// Create a FidelityFX OpticalFlow context from the parameters
|
||||
/// programmed to the <c><i>FfxOpticalflowContextDescription</i></c> structure.
|
||||
///
|
||||
/// The context structure is the main object used to interact with the OpticalFlow
|
||||
/// API, and is responsible for the management of the internal resources used
|
||||
/// by the OpticalFlow algorithm. When this API is called, multiple calls will be
|
||||
/// made via the pointers contained in the <c><i>callbacks</i></c> structure.
|
||||
/// These callbacks will attempt to retreive the device capabilities, and
|
||||
/// create the internal resources, and pipelines required by OpticalFlow's
|
||||
/// frame-to-frame function. Depending on the precise configuration used when
|
||||
/// creating the <c><i>FfxOpticalflowContext</i></c> a different set of resources and
|
||||
/// pipelines might be requested via the callback functions.
|
||||
///
|
||||
/// The flags included in the <c><i>flags</i></c> field of
|
||||
/// <c><i>FfxOpticalflowContext</i></c> how match the configuration of your
|
||||
/// application as well as the intended use of OpticalFlow. It is important that these
|
||||
/// flags are set correctly (as well as a correct programmed
|
||||
/// <c><i>FfxOpticalflowContextDescription</i></c>) to ensure correct operation. It is
|
||||
/// recommended to consult the overview documentation for further details on
|
||||
/// how OpticalFlow should be integerated into an application.
|
||||
///
|
||||
/// When the <c><i>FfxOpticalflowContext</i></c> is created, you should use the
|
||||
/// <c><i>ffxOpticalflowContextDispatch</i></c> function each frame where FSR3
|
||||
/// upscaling should be applied. See the documentation of
|
||||
/// <c><i>ffxOpticalflowContextDispatch</i></c> for more details.
|
||||
///
|
||||
/// The <c><i>FfxOpticalflowContext</i></c> should be destroyed when use of it is
|
||||
/// completed, typically when an application is unloaded or OpticalFlow is
|
||||
/// disabled by a user. To destroy the OpticalFlow context you should call
|
||||
/// <c><i>ffxOpticalflowContextDestroy</i></c>.
|
||||
///
|
||||
/// @param [out] context A pointer to a <c><i>FfxOpticalflowContext</i></c> structure to populate.
|
||||
/// @param [in] contextDescription A pointer to a <c><i>FfxOpticalflowContextDescription</i></c> structure.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either <c><i>context</i></c> or <c><i>contextDescription</i></c> was <c><i>NULL</i></c>.
|
||||
/// @retval
|
||||
/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the <c><i>FfxOpticalflowContextDescription.callbacks</i></c> was not fully specified.
|
||||
/// @retval
|
||||
/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend.
|
||||
///
|
||||
/// @ingroup ffxOpticalflow
|
||||
FFX_API FfxErrorCode ffxOpticalflowContextCreate(FfxOpticalflowContext* context, FfxOpticalflowContextDescription* contextDescription);
|
||||
|
||||
FFX_API FfxErrorCode ffxOpticalflowGetSharedResourceDescriptions(FfxOpticalflowContext* context, FfxOpticalflowSharedResourceDescriptions* SharedResources);
|
||||
|
||||
FFX_API FfxErrorCode ffxOpticalflowContextDispatch(FfxOpticalflowContext* context, const FfxOpticalflowDispatchDescription* dispatchDescription);
|
||||
|
||||
/// Destroy the FidelityFX OpticalFlow context.
|
||||
///
|
||||
/// @param [out] context A pointer to a <c><i>FfxOpticalflowContext</i></c> structure to destroy.
|
||||
///
|
||||
/// @retval
|
||||
/// FFX_OK The operation completed successfully.
|
||||
/// @retval
|
||||
/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either <c><i>context</i></c> was <c><i>NULL</i></c>.
|
||||
///
|
||||
/// @ingroup ffxOpticalflow
|
||||
FFX_API FfxErrorCode ffxOpticalflowContextDestroy(FfxOpticalflowContext* context);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif // #if defined(__cplusplus)
|
||||
+937
@@ -0,0 +1,937 @@
|
||||
// This file is part of the FidelityFX SDK.
|
||||
//
|
||||
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
///
|
||||
/// @defgroup ffxSDK SDK
|
||||
/// The FidelityFX SDK
|
||||
///
|
||||
|
||||
/// @defgroup ffxHost Host
|
||||
/// The FidelityFX SDK host (CPU-side) References
|
||||
///
|
||||
/// @ingroup ffxSDK
|
||||
|
||||
/// @defgroup Defines Defines
|
||||
/// Top level defines used by the FidelityFX SDK
|
||||
///
|
||||
/// @ingroup ffxHost
|
||||
|
||||
#if defined (FFX_GCC)
|
||||
/// FidelityFX exported functions
|
||||
///
|
||||
/// @ingroup Defines
|
||||
#define FFX_API
|
||||
#else
|
||||
/// FidelityFX exported functions
|
||||
///
|
||||
/// @ingroup Defines
|
||||
#define FFX_API __declspec(dllexport)
|
||||
#endif // #if defined (FFX_GCC)
|
||||
|
||||
#define FFX_SDK_DEFAULT_CONTEXT_SIZE (1024 * 128)
|
||||
|
||||
/// Maximum supported number of simultaneously bound SRVs.
|
||||
///
|
||||
/// @ingroup Defines
|
||||
#define FFX_MAX_NUM_SRVS 16
|
||||
|
||||
/// Maximum supported number of simultaneously bound UAVs.
|
||||
///
|
||||
/// @ingroup Defines
|
||||
#define FFX_MAX_NUM_UAVS 16
|
||||
|
||||
/// Maximum number of constant buffers bound.
|
||||
///
|
||||
/// @ingroup Defines
|
||||
#define FFX_MAX_NUM_CONST_BUFFERS 3
|
||||
|
||||
/// Maximum size of bound constant buffers.
|
||||
#define FFX_MAX_CONST_SIZE 256
|
||||
|
||||
/// Maximum number of characters in a resource name
|
||||
///
|
||||
/// @ingroup Defines
|
||||
#define FFX_RESOURCE_NAME_SIZE 64
|
||||
|
||||
/// Maximum number of queued frames in the backend
|
||||
///
|
||||
/// @ingroup Defines
|
||||
#define FFX_MAX_QUEUED_FRAMES (4)
|
||||
|
||||
/// Maximum number of resources per effect context
|
||||
///
|
||||
/// @ingroup Defines
|
||||
#define FFX_MAX_RESOURCE_COUNT (128)
|
||||
|
||||
/// Maximum number of passes per effect component
|
||||
///
|
||||
/// @ingroup Defines
|
||||
#define FFX_MAX_PASS_COUNT (50)
|
||||
|
||||
/// Total ring buffer size needed for a single effect context
|
||||
///
|
||||
/// @ingroup Defines
|
||||
#define FFX_RING_BUFFER_SIZE (FFX_MAX_QUEUED_FRAMES * FFX_MAX_PASS_COUNT * FFX_MAX_RESOURCE_COUNT)
|
||||
|
||||
/// Size of constant buffer entry in the ring buffer table
|
||||
///
|
||||
/// @ingroup Defines
|
||||
#define FFX_BUFFER_SIZE (768)
|
||||
|
||||
/// Total ring buffer memory size for a single effect context
|
||||
///
|
||||
/// @ingroup Defines
|
||||
#define FFX_RING_BUFFER_MEM_BLOCK_SIZE (FFX_RING_BUFFER_SIZE * FFX_BUFFER_SIZE)
|
||||
|
||||
/// Maximum number of barriers per flush
|
||||
///
|
||||
/// @ingroup Defines
|
||||
#define FFX_MAX_BARRIERS (16)
|
||||
|
||||
/// Maximum number of GPU jobs per submission
|
||||
///
|
||||
/// @ingroup Defines
|
||||
#define FFX_MAX_GPU_JOBS (64)
|
||||
|
||||
/// Maximum number of samplers supported
|
||||
///
|
||||
/// @ingroup Defines
|
||||
#define FFX_MAX_SAMPLERS (16)
|
||||
|
||||
/// Maximum number of simultaneous upload jobs
|
||||
///
|
||||
/// @ingroup Defines
|
||||
#define UPLOAD_JOB_COUNT (16)
|
||||
|
||||
// Off by default warnings
|
||||
#pragma warning(disable : 4365 4710 4820 5039)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // #ifdef __cplusplus
|
||||
|
||||
/// @defgroup CPUTypes CPU Types
|
||||
/// CPU side type defines for all commonly used variables
|
||||
///
|
||||
/// @ingroup ffxHost
|
||||
|
||||
/// A typedef for a boolean value.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef bool FfxBoolean;
|
||||
|
||||
/// A typedef for a unsigned 8bit integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef uint8_t FfxUInt8;
|
||||
|
||||
/// A typedef for a unsigned 16bit integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef uint16_t FfxUInt16;
|
||||
|
||||
/// A typedef for a unsigned 32bit integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef uint32_t FfxUInt32;
|
||||
|
||||
/// A typedef for a unsigned 64bit integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef uint64_t FfxUInt64;
|
||||
|
||||
/// A typedef for a signed 8bit integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef int8_t FfxInt8;
|
||||
|
||||
/// A typedef for a signed 16bit integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef int16_t FfxInt16;
|
||||
|
||||
/// A typedef for a signed 32bit integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef int32_t FfxInt32;
|
||||
|
||||
/// A typedef for a signed 64bit integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef int64_t FfxInt64;
|
||||
|
||||
/// A typedef for a floating point value.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef float FfxFloat32;
|
||||
|
||||
/// A typedef for a 2-dimensional floating point value.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef float FfxFloat32x2[2];
|
||||
|
||||
/// A typedef for a 3-dimensional floating point value.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef float FfxFloat32x3[3];
|
||||
|
||||
/// A typedef for a 4-dimensional floating point value.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef float FfxFloat32x4[4];
|
||||
|
||||
/// A typedef for a 2-dimensional 32bit unsigned integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef uint32_t FfxUInt32x2[2];
|
||||
|
||||
/// A typedef for a 3-dimensional 32bit unsigned integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef uint32_t FfxUInt32x3[3];
|
||||
|
||||
/// A typedef for a 4-dimensional 32bit unsigned integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef uint32_t FfxUInt32x4[4];
|
||||
|
||||
/// @defgroup SDKTypes SDK Types
|
||||
/// Structure and Enumeration definitions used by the FidelityFX SDK
|
||||
///
|
||||
/// @ingroup ffxHost
|
||||
|
||||
|
||||
/// An enumeration of surface formats.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef enum FfxSurfaceFormat {
|
||||
|
||||
FFX_SURFACE_FORMAT_UNKNOWN, ///< Unknown format
|
||||
FFX_SURFACE_FORMAT_R32G32B32A32_TYPELESS, ///< 32 bit per channel, 4 channel typeless format
|
||||
FFX_SURFACE_FORMAT_R32G32B32A32_UINT, ///< 32 bit per channel, 4 channel uint format
|
||||
FFX_SURFACE_FORMAT_R32G32B32A32_FLOAT, ///< 32 bit per channel, 4 channel float format
|
||||
FFX_SURFACE_FORMAT_R16G16B16A16_FLOAT, ///< 16 bit per channel, 4 channel float format
|
||||
FFX_SURFACE_FORMAT_R32G32_FLOAT, ///< 32 bit per channel, 2 channel float format
|
||||
FFX_SURFACE_FORMAT_R8_UINT, ///< 8 bit per channel, 1 channel float format
|
||||
FFX_SURFACE_FORMAT_R32_UINT, ///< 32 bit per channel, 1 channel float format
|
||||
FFX_SURFACE_FORMAT_R10G10B10A2_UNORM, ///< 10 bit per RGB channel with 2 bit alpha, 4 channel unsigned normalized format
|
||||
FFX_SURFACE_FORMAT_R8G8B8A8_TYPELESS, ///< 8 bit per channel, 4 channel float format
|
||||
FFX_SURFACE_FORMAT_R8G8B8A8_UNORM, ///< 8 bit per channel, 4 channel unsigned normalized format
|
||||
FFX_SURFACE_FORMAT_R8G8B8A8_SNORM, ///< 8 bit per channel, 4 channel signed normalized format
|
||||
FFX_SURFACE_FORMAT_R8G8B8A8_SRGB, ///< 8 bit per channel, 4 channel srgb normalized
|
||||
FFX_SURFACE_FORMAT_R11G11B10_FLOAT, ///< 32 bit 3 channel float format
|
||||
FFX_SURFACE_FORMAT_R16G16_FLOAT, ///< 16 bit per channel, 2 channel float format
|
||||
FFX_SURFACE_FORMAT_R16G16_UINT, ///< 16 bit per channel, 2 channel unsigned int format
|
||||
FFX_SURFACE_FORMAT_R16G16_SINT, ///< 16 bit per channel, 2 channel signed int format
|
||||
FFX_SURFACE_FORMAT_R16_FLOAT, ///< 16 bit per channel, 1 channel float format
|
||||
FFX_SURFACE_FORMAT_R16_UINT, ///< 16 bit per channel, 1 channel unsigned int format
|
||||
FFX_SURFACE_FORMAT_R16_UNORM, ///< 16 bit per channel, 1 channel unsigned normalized format
|
||||
FFX_SURFACE_FORMAT_R16_SNORM, ///< 16 bit per channel, 1 channel signed normalized format
|
||||
FFX_SURFACE_FORMAT_R8_UNORM, ///< 8 bit per channel, 1 channel unsigned normalized format
|
||||
FFX_SURFACE_FORMAT_R8G8_UNORM, ///< 8 bit per channel, 2 channel unsigned normalized format
|
||||
FFX_SURFACE_FORMAT_R8G8_UINT, ///< 8 bit per channel, 2 channel unsigned integer format
|
||||
FFX_SURFACE_FORMAT_R32_FLOAT ///< 32 bit per channel, 1 channel float format
|
||||
} FfxSurfaceFormat;
|
||||
|
||||
/// An enumeration of resource usage.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef enum FfxResourceUsage {
|
||||
|
||||
FFX_RESOURCE_USAGE_READ_ONLY = 0, ///< No usage flags indicate a resource is read only.
|
||||
FFX_RESOURCE_USAGE_RENDERTARGET = (1<<0), ///< Indicates a resource will be used as render target.
|
||||
FFX_RESOURCE_USAGE_UAV = (1<<1), ///< Indicates a resource will be used as UAV.
|
||||
FFX_RESOURCE_USAGE_DEPTHTARGET = (1<<2), ///< Indicates a resource will be used as depth target.
|
||||
FFX_RESOURCE_USAGE_INDIRECT = (1<<3), ///< Indicates a resource will be used as indirect argument buffer
|
||||
FFX_RESOURCE_USAGE_ARRAYVIEW = (1<<4), ///< Indicates a resource that will generate array views. Works on 2D and cubemap textures
|
||||
} FfxResourceUsage;
|
||||
|
||||
/// An enumeration of resource states.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef enum FfxResourceStates {
|
||||
|
||||
FFX_RESOURCE_STATE_COMMON = (1 << 0),
|
||||
FFX_RESOURCE_STATE_UNORDERED_ACCESS = (1 << 1), ///< Indicates a resource is in the state to be used as UAV.
|
||||
FFX_RESOURCE_STATE_COMPUTE_READ = (1 << 2), ///< Indicates a resource is in the state to be read by compute shaders.
|
||||
FFX_RESOURCE_STATE_PIXEL_READ = (1 << 3), ///< Indicates a resource is in the state to be read by pixel shaders.
|
||||
FFX_RESOURCE_STATE_PIXEL_COMPUTE_READ = (FFX_RESOURCE_STATE_PIXEL_READ | FFX_RESOURCE_STATE_COMPUTE_READ), ///< Indicates a resource is in the state to be read by pixel or compute shaders.
|
||||
FFX_RESOURCE_STATE_COPY_SRC = (1 << 4), ///< Indicates a resource is in the state to be used as source in a copy command.
|
||||
FFX_RESOURCE_STATE_COPY_DEST = (1 << 5), ///< Indicates a resource is in the state to be used as destination in a copy command.
|
||||
FFX_RESOURCE_STATE_GENERIC_READ = (FFX_RESOURCE_STATE_COPY_SRC | FFX_RESOURCE_STATE_COMPUTE_READ), ///< Indicates a resource is in generic (slow) read state.
|
||||
FFX_RESOURCE_STATE_INDIRECT_ARGUMENT = (1 << 6), ///< Indicates a resource is in the state to be used as an indirect command argument
|
||||
FFX_RESOURCE_STATE_PRESENT = (1 << 7), ///< Indicates a resource is in the state to be used to present to the swap chain
|
||||
FFX_RESOURCE_STATE_RENDER_TARGET = (1 << 8), ///< Indicates a resource is in the state to be used as render target
|
||||
} FfxResourceStates;
|
||||
|
||||
/// An enumeration of surface dimensions.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef enum FfxResourceDimension {
|
||||
|
||||
FFX_RESOURCE_DIMENSION_TEXTURE_1D, ///< A resource with a single dimension.
|
||||
FFX_RESOURCE_DIMENSION_TEXTURE_2D, ///< A resource with two dimensions.
|
||||
} FfxResourceDimension;
|
||||
|
||||
/// An enumeration of resource view dimensions.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef enum FfxResourceViewDimension
|
||||
{
|
||||
FFX_RESOURCE_VIEW_DIMENSION_BUFFER, ///< A resource view on a buffer.
|
||||
FFX_RESOURCE_VIEW_DIMENSION_TEXTURE_1D, ///< A resource view on a single dimension.
|
||||
FFX_RESOURCE_VIEW_DIMENSION_TEXTURE_1D_ARRAY, ///< A resource view on a single dimensional array.
|
||||
FFX_RESOURCE_VIEW_DIMENSION_TEXTURE_2D, ///< A resource view on two dimensions.
|
||||
FFX_RESOURCE_VIEW_DIMENSION_TEXTURE_2D_ARRAY, ///< A resource view on two dimensional array.
|
||||
FFX_RESOURCE_VIEW_DIMENSION_TEXTURE_3D, ///< A resource view on three dimensions.
|
||||
} FfxResourceViewDimension;
|
||||
|
||||
/// An enumeration of surface dimensions.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef enum FfxResourceFlags {
|
||||
|
||||
FFX_RESOURCE_FLAGS_NONE = 0, ///< No flags.
|
||||
FFX_RESOURCE_FLAGS_ALIASABLE = (1 << 0), ///< A bit indicating a resource does not need to persist across frames.
|
||||
FFX_RESOURCE_FLAGS_UNDEFINED = (1 << 1), ///< Special case flag used internally when importing resources that require additional setup
|
||||
} FfxResourceFlags;
|
||||
|
||||
/// An enumeration of all resource view types.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef enum FfxResourceViewType {
|
||||
|
||||
FFX_RESOURCE_VIEW_UNORDERED_ACCESS, ///< The resource view is an unordered access view (UAV).
|
||||
FFX_RESOURCE_VIEW_SHADER_READ, ///< The resource view is a shader resource view (SRV).
|
||||
} FfxResourceViewType;
|
||||
|
||||
/// The type of filtering to perform when reading a texture.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef enum FfxFilterType {
|
||||
|
||||
FFX_FILTER_TYPE_MINMAGMIP_POINT, ///< Point sampling.
|
||||
FFX_FILTER_TYPE_MINMAGMIP_LINEAR, ///< Sampling with interpolation.
|
||||
FFX_FILTER_TYPE_MINMAGLINEARMIP_POINT, ///< Use linear interpolation for minification and magnification; use point sampling for mip-level sampling.
|
||||
} FfxFilterType;
|
||||
|
||||
/// The address mode used when reading a texture.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef enum FfxAddressMode {
|
||||
|
||||
FFX_ADDRESS_MODE_WRAP, ///< Wrap when reading texture.
|
||||
FFX_ADDRESS_MODE_MIRROR, ///< Mirror when reading texture.
|
||||
FFX_ADDRESS_MODE_CLAMP, ///< Clamp when reading texture.
|
||||
FFX_ADDRESS_MODE_BORDER, ///< Border color when reading texture.
|
||||
FFX_ADDRESS_MODE_MIRROR_ONCE, ///< Mirror once when reading texture.
|
||||
} FfxAddressMode;
|
||||
|
||||
/// An enumeration of all supported shader models.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef enum FfxShaderModel {
|
||||
|
||||
FFX_SHADER_MODEL_5_1, ///< Shader model 5.1.
|
||||
FFX_SHADER_MODEL_6_0, ///< Shader model 6.0.
|
||||
FFX_SHADER_MODEL_6_1, ///< Shader model 6.1.
|
||||
FFX_SHADER_MODEL_6_2, ///< Shader model 6.2.
|
||||
FFX_SHADER_MODEL_6_3, ///< Shader model 6.3.
|
||||
FFX_SHADER_MODEL_6_4, ///< Shader model 6.4.
|
||||
FFX_SHADER_MODEL_6_5, ///< Shader model 6.5.
|
||||
FFX_SHADER_MODEL_6_6, ///< Shader model 6.6.
|
||||
FFX_SHADER_MODEL_6_7, ///< Shader model 6.7.
|
||||
} FfxShaderModel;
|
||||
|
||||
// An enumeration for different resource types
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef enum FfxResourceType {
|
||||
|
||||
FFX_RESOURCE_TYPE_BUFFER, ///< The resource is a buffer.
|
||||
FFX_RESOURCE_TYPE_TEXTURE1D, ///< The resource is a 1-dimensional texture.
|
||||
FFX_RESOURCE_TYPE_TEXTURE2D, ///< The resource is a 2-dimensional texture.
|
||||
FFX_RESOURCE_TYPE_TEXTURE_CUBE, ///< The resource is a cube map.
|
||||
FFX_RESOURCE_TYPE_TEXTURE3D, ///< The resource is a 3-dimensional texture.
|
||||
} FfxResourceType;
|
||||
|
||||
/// An enumeration for different heap types
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef enum FfxHeapType {
|
||||
|
||||
FFX_HEAP_TYPE_DEFAULT = 0, ///< Local memory.
|
||||
FFX_HEAP_TYPE_UPLOAD ///< Heap used for uploading resources.
|
||||
} FfxHeapType;
|
||||
|
||||
/// An enumeration for different render job types
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef enum FfxGpuJobType {
|
||||
|
||||
FFX_GPU_JOB_CLEAR_FLOAT = 0, ///< The GPU job is performing a floating-point clear.
|
||||
FFX_GPU_JOB_COPY = 1, ///< The GPU job is performing a copy.
|
||||
FFX_GPU_JOB_COMPUTE = 2, ///< The GPU job is performing a compute dispatch.
|
||||
FFX_GPU_JOB_BARRIER = 3, ///< The GPU job is performing a barrier.
|
||||
|
||||
} FfxGpuJobType;
|
||||
|
||||
/// An enumeration for various descriptor types
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef enum FfxDescriptorType {
|
||||
|
||||
//FFX_DESCRIPTOR_CBV = 0, // All CBVs currently mapped to root signature
|
||||
//FFX_DESCRIPTOR_SAMPLER, // All samplers currently static
|
||||
FFX_DESCRIPTOR_TEXTURE_SRV = 0,
|
||||
FFX_DESCRIPTOR_BUFFER_SRV,
|
||||
FFX_DESCRIPTOR_TEXTURE_UAV,
|
||||
FFX_DESCRIPTOR_BUFFER_UAV,
|
||||
} FfxDescriptiorType;
|
||||
|
||||
/// An enumeration for view binding stages
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef enum FfxBindStage {
|
||||
|
||||
FFX_BIND_PIXEL_SHADER_STAGE = 1 << 0,
|
||||
FFX_BIND_VERTEX_SHADER_STAGE = 1 << 1,
|
||||
FFX_BIND_COMPUTE_SHADER_STAGE = 1 << 2,
|
||||
|
||||
} FfxBindStage;
|
||||
|
||||
/// An enumeration for barrier types
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef enum FfxBarrierType
|
||||
{
|
||||
FFX_BARRIER_TYPE_TRANSITION = 0,
|
||||
FFX_BARRIER_TYPE_UAV,
|
||||
} FfxBarrierType;
|
||||
|
||||
/// An enumeration for message types that can be passed
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef enum FfxMsgType {
|
||||
FFX_MESSAGE_TYPE_ERROR = 0,
|
||||
FFX_MESSAGE_TYPE_WARNING = 1,
|
||||
FFX_MESSAGE_TYPE_COUNT
|
||||
} FfxMsgType;
|
||||
|
||||
/// An enumeration of all the effects which constitute the FidelityFX SDK.
|
||||
///
|
||||
/// Dictates what effect shader blobs to fetch for pipeline creation
|
||||
///
|
||||
/// @ingroup FfxInterface
|
||||
typedef enum FfxEffect
|
||||
{
|
||||
|
||||
FFX_EFFECT_FSR2 = 0, ///< FidelityFX Super Resolution v2
|
||||
FFX_EFFECT_FSR1, ///< FidelityFX Super Resolution
|
||||
FFX_EFFECT_SPD, ///< FidelityFX Single Pass Downsampler
|
||||
FFX_EFFECT_BLUR, ///< FidelityFX Blur
|
||||
FFX_EFFECT_CACAO, ///< FidelityFX Combined Adaptive Compute Ambient Occlusion
|
||||
FFX_EFFECT_CAS, ///< FidelityFX Contrast Adaptive Sharpening
|
||||
FFX_EFFECT_DENOISER, ///< FidelityFX Denoiser
|
||||
FFX_EFFECT_LENS, ///< FidelityFX Lens
|
||||
FFX_EFFECT_PARALLEL_SORT, ///< FidelityFX Parallel Sort
|
||||
FFX_EFFECT_SSSR, ///< FidelityFX Stochastic Screen Space Reflections
|
||||
FFX_EFFECT_VARIABLE_SHADING, ///< FidelityFX Variable Shading
|
||||
FFX_EFFECT_LPM, ///< FidelityFX Luma Preserving Mapper
|
||||
FFX_EFFECT_DOF, ///< FidelityFX Depth of Field
|
||||
FFX_EFFECT_CLASSIFIER, ///< FidelityFX Classifier
|
||||
FFX_EFFECT_FSR3UPSCALER, ///< FidelityFX Super Resolution v3
|
||||
FFX_EFFECT_FRAMEINTERPOLATION, ///< FidelityFX Frame Interpolation, part of FidelityFX Super Resolution v3
|
||||
FFX_EFFECT_OPTICALFLOW, ///< FidelityFX Optical Flow, part of FidelityFX Super Resolution v3
|
||||
|
||||
} FfxEffect;
|
||||
|
||||
typedef enum FfxBackbufferTransferFunction {
|
||||
FFX_BACKBUFFER_TRANSFER_FUNCTION_SRGB,
|
||||
FFX_BACKBUFFER_TRANSFER_FUNCTION_PQ,
|
||||
FFX_BACKBUFFER_TRANSFER_FUNCTION_SCRGB
|
||||
} FfxBackbufferTransferFunction;
|
||||
|
||||
/// A typedef representing the graphics device.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef void* FfxDevice;
|
||||
|
||||
typedef void* FfxCommandQueue;
|
||||
|
||||
typedef void* FfxSwapchain;
|
||||
|
||||
/// A typedef representing a command list or command buffer.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef void* FfxCommandList;
|
||||
|
||||
/// A typedef for a root signature.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef void* FfxRootSignature;
|
||||
|
||||
/// A typedef for a command signature, used for indirect workloads
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef void* FfxCommandSignature;
|
||||
|
||||
/// A typedef for a pipeline state object.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef void* FfxPipeline;
|
||||
|
||||
/// A structure encapsulating a collection of device capabilities.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxDeviceCapabilities {
|
||||
|
||||
FfxShaderModel minimumSupportedShaderModel; ///< The minimum shader model supported by the device.
|
||||
uint32_t waveLaneCountMin; ///< The minimum supported wavefront width.
|
||||
uint32_t waveLaneCountMax; ///< The maximum supported wavefront width.
|
||||
bool fp16Supported; ///< The device supports FP16 in hardware.
|
||||
bool raytracingSupported; ///< The device supports ray tracing.
|
||||
} FfxDeviceCapabilities;
|
||||
|
||||
/// A structure encapsulating a 2-dimensional point, using 32bit unsigned integers.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxDimensions2D {
|
||||
|
||||
uint32_t width; ///< The width of a 2-dimensional range.
|
||||
uint32_t height; ///< The height of a 2-dimensional range.
|
||||
} FfxDimensions2D;
|
||||
|
||||
/// A structure encapsulating a 2-dimensional point.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxIntCoords2D {
|
||||
|
||||
int32_t x; ///< The x coordinate of a 2-dimensional point.
|
||||
int32_t y; ///< The y coordinate of a 2-dimensional point.
|
||||
} FfxIntCoords2D;
|
||||
|
||||
/// A structure encapsulating a 2-dimensional rect.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxRect2D
|
||||
{
|
||||
int32_t left;
|
||||
int32_t top;
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
} FfxRect2D;
|
||||
|
||||
/// A structure encapsulating a 2-dimensional set of floating point coordinates.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxFloatCoords2D {
|
||||
|
||||
float x; ///< The x coordinate of a 2-dimensional point.
|
||||
float y; ///< The y coordinate of a 2-dimensional point.
|
||||
} FfxFloatCoords2D;
|
||||
|
||||
/// A structure describing a resource.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxResourceDescription {
|
||||
|
||||
FfxResourceType type; ///< The type of the resource.
|
||||
FfxSurfaceFormat format; ///< The surface format.
|
||||
union {
|
||||
uint32_t width; ///< The width of the texture resource.
|
||||
uint32_t size; ///< The size of the buffer resource.
|
||||
};
|
||||
|
||||
union {
|
||||
uint32_t height; ///< The height of the texture resource.
|
||||
uint32_t stride; ///< The stride of the buffer resource.
|
||||
};
|
||||
|
||||
union {
|
||||
uint32_t depth; ///< The depth of the texture resource.
|
||||
uint32_t alignment; ///< The alignment of the buffer resource.
|
||||
};
|
||||
|
||||
uint32_t mipCount; ///< Number of mips (or 0 for full mipchain).
|
||||
FfxResourceFlags flags; ///< A set of <c><i>FfxResourceFlags</i></c> flags.
|
||||
FfxResourceUsage usage; ///< Resource usage flags.
|
||||
} FfxResourceDescription;
|
||||
|
||||
/// An outward facing structure containing a resource
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxResource {
|
||||
void* resource; ///< pointer to the resource.
|
||||
FfxResourceDescription description;
|
||||
FfxResourceStates state;
|
||||
wchar_t name[FFX_RESOURCE_NAME_SIZE]; ///< (optional) Resource name.
|
||||
} FfxResource;
|
||||
|
||||
/// An internal structure containing a handle to a resource and resource views
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxResourceInternal {
|
||||
int32_t internalIndex; ///< The index of the resource.
|
||||
} FfxResourceInternal;
|
||||
|
||||
/// An internal structure housing all that is needed for backend resource descriptions
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxInternalResourceDescription {
|
||||
|
||||
uint32_t id;
|
||||
const wchar_t* name;
|
||||
FfxResourceType type;
|
||||
FfxResourceUsage usage;
|
||||
FfxSurfaceFormat format;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t mipCount;
|
||||
FfxResourceFlags flags;
|
||||
uint32_t initDataSize;
|
||||
void* initData;
|
||||
} FfxInternalResourceDescription;
|
||||
|
||||
/// A structure defining the view to create
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxViewDescription
|
||||
{
|
||||
bool uavView; ///< Indicates that the view is a UAV.
|
||||
FfxResourceViewDimension viewDimension; ///< The view dimension to map
|
||||
union {
|
||||
int32_t mipLevel; ///< The mip level of the view, (-1) for default
|
||||
int32_t firstElement; ///< The first element of a buffer view, (-1) for default
|
||||
};
|
||||
|
||||
union {
|
||||
int32_t arraySize; ///< The array size of the view, (-1) for full depth/array size
|
||||
int32_t elementCount; ///< The number of elements in a buffer view, (-1) for full depth/array size
|
||||
};
|
||||
|
||||
int32_t firstSlice; ///< The first slice to map to, (-1) for default first slice
|
||||
wchar_t name[64];
|
||||
} FfxViewDescription;
|
||||
|
||||
static FfxViewDescription s_FfxViewDescInit = { false, FFX_RESOURCE_VIEW_DIMENSION_TEXTURE_2D, -1, -1, -1, L"" };
|
||||
|
||||
/// A structure defining a resource bind point
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxResourceBinding
|
||||
{
|
||||
uint32_t slotIndex;
|
||||
uint32_t resourceIdentifier;
|
||||
uint32_t bindCount;
|
||||
wchar_t name[64];
|
||||
}FfxResourceBinding;
|
||||
|
||||
/// A structure encapsulating a single pass of an algorithm.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxPipelineState {
|
||||
|
||||
FfxRootSignature rootSignature; ///< The pipelines rootSignature
|
||||
FfxCommandSignature cmdSignature; ///< The command signature used for indirect workloads
|
||||
FfxPipeline pipeline; ///< The pipeline object
|
||||
uint32_t uavTextureCount; ///< Count of Texture UAVs used in this pipeline
|
||||
uint32_t srvTextureCount; ///< Count of Texture SRVs used in this pipeline
|
||||
uint32_t srvBufferCount; ///< Count of Buffer SRV used in this pipeline
|
||||
uint32_t uavBufferCount; ///< Count of Buffer UAVs used in this pipeline
|
||||
uint32_t constCount; ///< Count of constant buffers used in this pipeline
|
||||
|
||||
FfxResourceBinding uavTextureBindings[FFX_MAX_NUM_UAVS]; ///< Array of ResourceIdentifiers bound as texture UAVs
|
||||
FfxResourceBinding srvTextureBindings[FFX_MAX_NUM_SRVS]; ///< Array of ResourceIdentifiers bound as texture SRVs
|
||||
FfxResourceBinding srvBufferBindings[FFX_MAX_NUM_SRVS]; ///< Array of ResourceIdentifiers bound as buffer SRVs
|
||||
FfxResourceBinding uavBufferBindings[FFX_MAX_NUM_UAVS]; ///< Array of ResourceIdentifiers bound as buffer UAVs
|
||||
FfxResourceBinding constantBufferBindings[FFX_MAX_NUM_CONST_BUFFERS]; ///< Array of ResourceIdentifiers bound as CBs
|
||||
} FfxPipelineState;
|
||||
|
||||
/// A structure containing the data required to create a resource.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxCreateResourceDescription {
|
||||
|
||||
FfxHeapType heapType; ///< The heap type to hold the resource, typically <c><i>FFX_HEAP_TYPE_DEFAULT</i></c>.
|
||||
FfxResourceDescription resourceDescription; ///< A resource description.
|
||||
FfxResourceStates initalState; ///< The initial resource state.
|
||||
uint32_t initDataSize; ///< Size of initial data buffer.
|
||||
void* initData; ///< Buffer containing data to fill the resource.
|
||||
const wchar_t* name; ///< Name of the resource.
|
||||
uint32_t id; ///< Internal resource ID.
|
||||
} FfxCreateResourceDescription;
|
||||
|
||||
/// A structure containing the data required to create sampler mappings
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxSamplerDescription {
|
||||
|
||||
FfxFilterType filter;
|
||||
FfxAddressMode addressModeU;
|
||||
FfxAddressMode addressModeV;
|
||||
FfxAddressMode addressModeW;
|
||||
FfxBindStage stage;
|
||||
} FfxSamplerDescription;
|
||||
|
||||
/// A structure containing the data required to create root constant buffer mappings
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxRootConstantDescription
|
||||
{
|
||||
uint32_t size;
|
||||
FfxBindStage stage;
|
||||
} FfxRootConstantDescription;
|
||||
|
||||
/// A structure containing the description used to create a
|
||||
/// <c><i>FfxPipeline</i></c> structure.
|
||||
///
|
||||
/// A pipeline is the name given to a shader and the collection of state that
|
||||
/// is required to dispatch it. In the context of the FidelityFX SDK and its architecture
|
||||
/// this means that a <c><i>FfxPipelineDescription</i></c> will map to either a
|
||||
/// monolithic object in an explicit API (such as a
|
||||
/// <c><i>PipelineStateObject</i></c> in DirectX 12). Or a shader and some
|
||||
/// ancillary API objects (in something like DirectX 11).
|
||||
///
|
||||
/// The <c><i>contextFlags</i></c> field contains a copy of the flags passed
|
||||
/// to <c><i>ffxContextCreate</i></c> via the <c><i>flags</i></c> field of
|
||||
/// the <c><i>Ffx<Effect>InitializationParams</i></c> structure. These flags are
|
||||
/// used to determine which permutation of a pipeline for a specific
|
||||
/// <c><i>Ffx<Effect>Pass</i></c> should be used to implement the features required
|
||||
/// by each application, as well as to achieve the best performance on specific
|
||||
/// target hardware configurations.
|
||||
///
|
||||
/// When using one of the provided backends for FidelityFX SDK (such as DirectX 12 or
|
||||
/// Vulkan) the data required to create a pipeline is compiled off line and
|
||||
/// included into the backend library that you are using. For cases where the
|
||||
/// backend interface is overridden by providing custom callback function
|
||||
/// implementations care should be taken to respect the contents of the
|
||||
/// <c><i>contextFlags</i></c> field in order to correctly support the options
|
||||
/// provided by the FidelityFX SDK, and achieve best performance.
|
||||
/// ///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxPipelineDescription {
|
||||
|
||||
uint32_t contextFlags; ///< A collection of <c><i>FfxInitializationFlagBits</i></c> which were passed to the context.
|
||||
const FfxSamplerDescription* samplers; ///< A collection of samplers to use when building the root signature for the pipeline
|
||||
size_t samplerCount; ///< Number of samplers to create for the pipeline
|
||||
const FfxRootConstantDescription* rootConstants; ///< A collection of root constant descriptions to use when building the root signature for the pipeline
|
||||
uint32_t rootConstantBufferCount; ///< Number of root constant buffers to create for the pipeline
|
||||
wchar_t name[64]; ///< Pipeline name with which to name the pipeline object
|
||||
FfxBindStage stage; ///< The stage(s) for which this pipeline is being built
|
||||
uint32_t indirectWorkload; ///< Whether this pipeline has an indirect workload
|
||||
FfxSurfaceFormat backbufferFormat; ///< For raster pipelines this contains the backbuffer format
|
||||
} FfxPipelineDescription;
|
||||
|
||||
/// A structure containing the data required to create a barrier
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxBarrierDescription
|
||||
{
|
||||
FfxResourceInternal resource;
|
||||
FfxBarrierType barrierType;
|
||||
FfxResourceStates currentState;
|
||||
FfxResourceStates newState;
|
||||
uint32_t subResourceID;
|
||||
} FfxBarrierDescription;
|
||||
|
||||
|
||||
/// A structure containing a constant buffer.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxConstantBuffer {
|
||||
|
||||
uint32_t num32BitEntries; ///< The size (expressed in 32-bit chunks) stored in data.
|
||||
uint32_t data[FFX_MAX_CONST_SIZE]; ///< Constant buffer data
|
||||
}FfxConstantBuffer;
|
||||
|
||||
/// A structure describing a clear render job.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxClearFloatJobDescription {
|
||||
|
||||
float color[4]; ///< The clear color of the resource.
|
||||
FfxResourceInternal target; ///< The resource to be cleared.
|
||||
} FfxClearFloatJobDescription;
|
||||
|
||||
/// A structure describing a compute render job.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxComputeJobDescription {
|
||||
|
||||
FfxPipelineState pipeline; ///< Compute pipeline for the render job.
|
||||
uint32_t dimensions[3]; ///< Dispatch dimensions.
|
||||
FfxResourceInternal cmdArgument; ///< Dispatch indirect cmd argument buffer
|
||||
uint32_t cmdArgumentOffset; ///< Dispatch indirect offset within the cmd argument buffer
|
||||
FfxResourceInternal srvTextures[FFX_MAX_NUM_SRVS]; ///< SRV texture resources to be bound in the compute job.
|
||||
wchar_t srvTextureNames[FFX_MAX_NUM_SRVS][64];
|
||||
FfxResourceInternal uavTextures[FFX_MAX_NUM_UAVS]; ///< UAV texture resources to be bound in the compute job.
|
||||
uint32_t uavTextureMips[FFX_MAX_NUM_UAVS]; ///< Mip level of UAV texture resources to be bound in the compute job.
|
||||
wchar_t uavTextureNames[FFX_MAX_NUM_UAVS][64];
|
||||
FfxResourceInternal srvBuffers[FFX_MAX_NUM_SRVS]; ///< SRV buffer resources to be bound in the compute job.
|
||||
wchar_t srvBufferNames[FFX_MAX_NUM_SRVS][64];
|
||||
FfxResourceInternal uavBuffers[FFX_MAX_NUM_UAVS]; ///< UAV buffer resources to be bound in the compute job.
|
||||
wchar_t uavBufferNames[FFX_MAX_NUM_UAVS][64];
|
||||
FfxConstantBuffer cbs[FFX_MAX_NUM_CONST_BUFFERS]; ///< Constant buffers to be bound in the compute job.
|
||||
wchar_t cbNames[FFX_MAX_NUM_CONST_BUFFERS][64];
|
||||
} FfxComputeJobDescription;
|
||||
|
||||
typedef struct FfxRasterJobDescription
|
||||
{
|
||||
FfxPipelineState pipeline; ///< Raster pipeline for the render job.
|
||||
uint32_t numVertices;
|
||||
FfxResourceInternal renderTarget;
|
||||
|
||||
FfxResourceInternal srvTextures[FFX_MAX_NUM_SRVS]; ///< SRV resources to be bound in the compute job.
|
||||
wchar_t srvTextureNames[FFX_MAX_NUM_SRVS][64];
|
||||
FfxResourceInternal uavTextures[FFX_MAX_NUM_UAVS]; ///< UAV resources to be bound in the compute job.
|
||||
uint32_t uavTextureMips[FFX_MAX_NUM_UAVS]; ///< Mip level of UAV resources to be bound in the compute job.
|
||||
wchar_t uavTextureNames[FFX_MAX_NUM_UAVS][64];
|
||||
FfxConstantBuffer cbs[FFX_MAX_NUM_CONST_BUFFERS]; ///< Constant buffers to be bound in the compute job.
|
||||
wchar_t cbNames[FFX_MAX_NUM_CONST_BUFFERS][64];
|
||||
} FfxRasterJobDescription;
|
||||
|
||||
/// A structure describing a copy render job.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxCopyJobDescription
|
||||
{
|
||||
FfxResourceInternal src; ///< Source resource for the copy.
|
||||
FfxResourceInternal dst; ///< Destination resource for the copy.
|
||||
} FfxCopyJobDescription;
|
||||
|
||||
/// A structure describing a single render job.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxGpuJobDescription{
|
||||
|
||||
FfxGpuJobType jobType; ///< Type of the job.
|
||||
|
||||
union {
|
||||
FfxClearFloatJobDescription clearJobDescriptor; ///< Clear job descriptor. Valid when <c><i>jobType</i></c> is <c><i>FFX_RENDER_JOB_CLEAR_FLOAT</i></c>.
|
||||
FfxCopyJobDescription copyJobDescriptor; ///< Copy job descriptor. Valid when <c><i>jobType</i></c> is <c><i>FFX_RENDER_JOB_COPY</i></c>.
|
||||
FfxComputeJobDescription computeJobDescriptor; ///< Compute job descriptor. Valid when <c><i>jobType</i></c> is <c><i>FFX_RENDER_JOB_COMPUTE</i></c>.
|
||||
FfxRasterJobDescription rasterJobDescriptor;
|
||||
FfxBarrierDescription barrierDescriptor;
|
||||
};
|
||||
} FfxGpuJobDescription;
|
||||
|
||||
#if defined(POPULATE_SHADER_BLOB_FFX)
|
||||
#undef POPULATE_SHADER_BLOB_FFX
|
||||
#endif // #if defined(POPULATE_SHADER_BLOB_FFX)
|
||||
|
||||
/// Macro definition to copy header shader blob information into its SDK structural representation
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
#define POPULATE_SHADER_BLOB_FFX(info, index) \
|
||||
{ \
|
||||
info[index].blobData, info[index].blobSize, info[index].numConstantBuffers, info[index].numSRVTextures, info[index].numUAVTextures, \
|
||||
info[index].numSRVBuffers, info[index].numUAVBuffers, info[index].numSamplers, info[index].numRTAccelerationStructures, \
|
||||
info[index].constantBufferNames, \
|
||||
info[index].constantBufferBindings, info[index].constantBufferCounts, info[index].srvTextureNames, info[index].srvTextureBindings, \
|
||||
info[index].srvTextureCounts, info[index].uavTextureNames, info[index].uavTextureBindings, info[index].uavTextureCounts, \
|
||||
info[index].srvBufferNames, info[index].srvBufferBindings, info[index].srvBufferCounts, \
|
||||
info[index].uavBufferNames, info[index].uavBufferBindings, info[index].uavBufferCounts, info[index].samplerNames, \
|
||||
info[index].samplerBindings, info[index].samplerCounts, info[index].rtAccelerationStructureNames, info[index].rtAccelerationStructureBindings, \
|
||||
info[index].rtAccelerationStructureCounts \
|
||||
}
|
||||
|
||||
// A single shader blob and a description of its resources.
|
||||
///
|
||||
/// @ingroup SDKTypes
|
||||
typedef struct FfxShaderBlob {
|
||||
|
||||
const uint8_t* data; // A pointer to the blob
|
||||
const uint32_t size; // Size in bytes.
|
||||
|
||||
const uint32_t cbvCount; // Number of CBs.
|
||||
const uint32_t srvTextureCount; // Number of SRV Textures.
|
||||
const uint32_t uavTextureCount; // Number of UAV Textures.
|
||||
const uint32_t srvBufferCount; // Number of SRV Buffers.
|
||||
const uint32_t uavBufferCount; // Number of UAV Buffers.
|
||||
const uint32_t samplerCount; // Number of Samplers.
|
||||
const uint32_t rtAccelStructCount; // Number of RT Acceleration structures.
|
||||
|
||||
// constant buffers
|
||||
const char** boundConstantBufferNames;
|
||||
const uint32_t* boundConstantBuffers; // Pointer to an array of bound ConstantBuffers.
|
||||
const uint32_t* boundConstantBufferCounts; // Pointer to an array of bound ConstantBuffer resource counts
|
||||
|
||||
// srv textures
|
||||
const char** boundSRVTextureNames;
|
||||
const uint32_t* boundSRVTextures; // Pointer to an array of bound SRV resources.
|
||||
const uint32_t* boundSRVTextureCounts; // Pointer to an array of bound SRV resource counts
|
||||
|
||||
// uav textures
|
||||
const char** boundUAVTextureNames;
|
||||
const uint32_t* boundUAVTextures; // Pointer to an array of bound UAV texture resources.
|
||||
const uint32_t* boundUAVTextureCounts; // Pointer to an array of bound UAV texture resource counts
|
||||
|
||||
// srv buffers
|
||||
const char** boundSRVBufferNames;
|
||||
const uint32_t* boundSRVBuffers; // Pointer to an array of bound SRV buffer resources.
|
||||
const uint32_t* boundSRVBufferCounts; // Pointer to an array of bound SRV buffer resource counts
|
||||
|
||||
// uav buffers
|
||||
const char** boundUAVBufferNames;
|
||||
const uint32_t* boundUAVBuffers; // Pointer to an array of bound UAV buffer resources.
|
||||
const uint32_t* boundUAVBufferCounts; // Pointer to an array of bound UAV buffer resource counts
|
||||
|
||||
// samplers
|
||||
const char** boundSamplerNames;
|
||||
const uint32_t* boundSamplers; // Pointer to an array of bound sampler resources.
|
||||
const uint32_t* boundSamplerCounts; // Pointer to an array of bound sampler resource counts
|
||||
|
||||
// rt acceleration structures
|
||||
const char** boundRTAccelerationStructureNames;
|
||||
const uint32_t* boundRTAccelerationStructures; // Pointer to an array of bound UAV buffer resources.
|
||||
const uint32_t* boundRTAccelerationStructureCounts; // Pointer to an array of bound UAV buffer resource counts
|
||||
|
||||
} FfxShaderBlob;
|
||||
|
||||
typedef struct FfxPresentCallbackDescription
|
||||
{
|
||||
FfxDevice device;
|
||||
FfxCommandList commandList;
|
||||
FfxResource currentBackBuffer;
|
||||
FfxResource currentUI;
|
||||
FfxResource outputSwapChainBuffer;
|
||||
bool isInterpolatedFrame;
|
||||
} FfxPresentCallbackDescription;
|
||||
|
||||
typedef struct FfxFrameGenerationDispatchDescription {
|
||||
FfxCommandList commandList;
|
||||
FfxResource presentColor;
|
||||
FfxResource outputs[4];
|
||||
uint32_t numInterpolatedFrames;
|
||||
bool reset;
|
||||
FfxBackbufferTransferFunction backBufferTransferFunction;
|
||||
float minMaxLuminance[2];
|
||||
} FfxFrameGenerationDispatchDescription;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // #ifdef __cplusplus
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
// This file is part of the FidelityFX SDK.
|
||||
//
|
||||
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <FidelityFX/host/ffx_types.h>
|
||||
|
||||
/// @defgroup Utils Utilities
|
||||
/// Utility Macros used by the FidelityFX SDK
|
||||
///
|
||||
/// @ingroup ffxHost
|
||||
|
||||
/// The value of Pi.
|
||||
///
|
||||
/// @ingroup Utils
|
||||
const float FFX_PI = 3.141592653589793f;
|
||||
|
||||
/// An epsilon value for floating point numbers.
|
||||
///
|
||||
/// @ingroup Utils
|
||||
const float FFX_EPSILON = 1e-06f;
|
||||
|
||||
/// Helper macro to create the version number.
|
||||
///
|
||||
/// @ingroup Utils
|
||||
#define FFX_MAKE_VERSION(major, minor, patch) ((major << 22) | (minor << 12) | patch)
|
||||
|
||||
///< Use this to specify no version.
|
||||
///
|
||||
/// @ingroup Utils
|
||||
#define FFX_UNSPECIFIED_VERSION 0xFFFFAD00
|
||||
|
||||
/// Helper macro to avoid warnings about unused variables.
|
||||
///
|
||||
/// @ingroup Utils
|
||||
#define FFX_UNUSED(x) ((void)(x))
|
||||
|
||||
/// Helper macro to align an integer to the specified power of 2 boundary
|
||||
///
|
||||
/// @ingroup Utils
|
||||
#define FFX_ALIGN_UP(x, y) (((x) + ((y)-1)) & ~((y)-1))
|
||||
|
||||
/// Helper macro to check if a value is aligned.
|
||||
///
|
||||
/// @ingroup Utils
|
||||
#define FFX_IS_ALIGNED(x) (((x) != 0) && ((x) & ((x)-1)))
|
||||
|
||||
/// Helper macro to compute the rounded-up integer division of two unsigned integers
|
||||
///
|
||||
/// @ingroup Utils
|
||||
#define FFX_DIVIDE_ROUNDING_UP(x, y) ((x + y - 1) / y)
|
||||
|
||||
/// Helper macro to stringify a value.
|
||||
///
|
||||
/// @ingroup Utils
|
||||
#define FFX_STR(s) FFX_XSTR(s)
|
||||
#define FFX_XSTR(s) #s
|
||||
|
||||
/// Helper macro to forward declare a structure.
|
||||
///
|
||||
/// @ingroup Utils
|
||||
#define FFX_FORWARD_DECLARE(x) typedef struct x x
|
||||
|
||||
/// Helper macro to return the maximum of two values.
|
||||
///
|
||||
/// @ingroup Utils
|
||||
#define FFX_MAXIMUM(x, y) (((x) > (y)) ? (x) : (y))
|
||||
|
||||
/// Helper macro to return the minimum of two values.
|
||||
///
|
||||
/// @ingroup Utils
|
||||
#define FFX_MINIMUM(x, y) (((x) < (y)) ? (x) : (y))
|
||||
|
||||
/// Helper macro to do safe free on a pointer.
|
||||
///
|
||||
/// @ingroup Utils
|
||||
#define FFX_SAFE_FREE(x) \
|
||||
if (x) \
|
||||
free(x)
|
||||
|
||||
/// Helper macro to return the abs of an integer value.
|
||||
///
|
||||
/// @ingroup Utils
|
||||
#define FFX_ABSOLUTE(x) (((x) < 0) ? (-(x)) : (x))
|
||||
|
||||
/// Helper macro to return sign of a value.
|
||||
///
|
||||
/// @ingroup Utils
|
||||
#define FFX_SIGN(x) (((x) < 0) ? -1 : 1)
|
||||
|
||||
/// Helper macro to work out the number of elements in an array.
|
||||
///
|
||||
/// @ingroup Utils
|
||||
#define FFX_ARRAY_ELEMENTS(x) (int32_t)((sizeof(x) / sizeof(0 [x])) / ((size_t)(!(sizeof(x) % sizeof(0 [x])))))
|
||||
|
||||
/// The maximum length of a path that can be specified to the FidelityFX API.
|
||||
///
|
||||
/// @ingroup Utils
|
||||
#define FFX_MAXIMUM_PATH (260)
|
||||
|
||||
/// Helper macro to check if the specified key is set in a bitfield.
|
||||
///
|
||||
/// @ingroup Utils
|
||||
#define FFX_CONTAINS_FLAG(options, key) ((options & key) == key)
|
||||
@@ -63,7 +63,10 @@ int main() {
|
||||
Field("rtStateObjectsCreated", offsetof(FlWriterState, rtStateObjectsCreated), sizeof(uint32_t));
|
||||
Field("rasterPsoCreated", offsetof(FlWriterState, rasterPsoCreated), sizeof(uint32_t));
|
||||
Field("runtimeCensus", offsetof(FlWriterState, runtimeCensus), sizeof(uint32_t));
|
||||
Field("reserved", offsetof(FlWriterState, reserved), sizeof(uint32_t) * 5, true);
|
||||
Field("slTagCensus", offsetof(FlWriterState, slTagCensus), sizeof(uint32_t));
|
||||
Field("dxgiPresentsUnseen", offsetof(FlWriterState, dxgiPresentsUnseen), sizeof(uint32_t));
|
||||
Field("dxgiPresentSamples", offsetof(FlWriterState, dxgiPresentSamples), sizeof(uint32_t));
|
||||
Field("reserved", offsetof(FlWriterState, reserved), sizeof(uint32_t) * 2, true);
|
||||
std::printf(" ] },\n");
|
||||
|
||||
std::printf(" \"FlControlBlock\": { \"size\": %zu, \"fields\": [\n", sizeof(FlControlBlock));
|
||||
@@ -98,7 +101,8 @@ int main() {
|
||||
Field("fgEvaluations", offsetof(FlFrameRecord, fgEvaluations), sizeof(uint8_t));
|
||||
Field("vramUsedMb", offsetof(FlFrameRecord, vramUsedMb), sizeof(uint32_t));
|
||||
Field("reflexLatencyUs", offsetof(FlFrameRecord, reflexLatencyUs), sizeof(uint32_t));
|
||||
Field("reserved", offsetof(FlFrameRecord, reserved), sizeof(uint32_t));
|
||||
Field("dxgiUnseen", offsetof(FlFrameRecord, dxgiUnseen), sizeof(uint8_t));
|
||||
Field("reserved", offsetof(FlFrameRecord, reserved), sizeof(uint8_t) * 3);
|
||||
Field("seq", offsetof(FlFrameRecord, seq), sizeof(uint32_t));
|
||||
Field("swapchainId", offsetof(FlFrameRecord, swapchainId), sizeof(uint32_t), true);
|
||||
std::printf(" ] }\n");
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
#include <windows.h>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "nvapi.h"
|
||||
|
||||
@@ -46,9 +48,141 @@ void Check(bool condition, const char* what) {
|
||||
}
|
||||
}
|
||||
|
||||
// --- --ngx-state <pid>: what the DRIVER says about a process's DLSS features -------
|
||||
//
|
||||
// WHY THIS MODE EXISTS (2026-09-05, 20_OPEN_QUESTIONS §H5 / §H11). Four real titles
|
||||
// run DLSS through NGX directly and drive DLSS Frame Generation on a path the
|
||||
// Streamline hooks never see (Lies of P, Hell Is Us, Expedition 33, Black Myth:
|
||||
// Wukong), and a fifth (Dying Light: The Beast, Streamline 2.8) presents its
|
||||
// generated frames where the present hook cannot count them. The NGX SDK is
|
||||
// licence-blocked, so nothing in the Overlay may hook nvngx_*.dll. NVAPI is MIT and
|
||||
// vendored, and NvAPI_NGX_GetNGXOverrideState (R570+) is documented as returning,
|
||||
// FOR A GIVEN PROCESS ID, the driver's own feedback bits for Super Resolution, Ray
|
||||
// Reconstruction and Frame Generation -- DLL loaded, feature created, evaluated, FG
|
||||
// mode, multi-frame -- plus the scaling ratio, the performance (quality) mode and the
|
||||
// frame-generation count. Out of process, by PID, from the driver's bookkeeping:
|
||||
// no game memory, no hook, no vendor binary patched.
|
||||
//
|
||||
// WHAT IS NOT KNOWN, and why this is a probe rather than a producer: the API's name
|
||||
// says "override", and whether its feedback bits are populated for a process with
|
||||
// no NVIDIA-app override configured is unmeasured. Whether "frameGenerationCount" is
|
||||
// the title's multiplier or only an override target is unmeasured. This mode prints
|
||||
// the raw words and every decoded bit so the owner's run against a running title
|
||||
// answers both, before any report line is built on it.
|
||||
struct FlagName {
|
||||
NvU64 bit;
|
||||
const char* name;
|
||||
};
|
||||
|
||||
constexpr FlagName kFlags[] = {
|
||||
{NV_NGX_DLSS_OVERRIDE_FLAG_INITIALIZED, "INITIALIZED"},
|
||||
{NV_NGX_DLSS_OVERRIDE_FLAG_ENABLED, "ENABLED"},
|
||||
{NV_NGX_DLSS_OVERRIDE_FLAG_DLL_EXISTS, "DLL_EXISTS"},
|
||||
{NV_NGX_DLSS_OVERRIDE_FLAG_DLL_LOADED, "DLL_LOADED"},
|
||||
{NV_NGX_DLSS_OVERRIDE_FLAG_DLL_SELECTED, "DLL_SELECTED"},
|
||||
{NV_NGX_DLSS_OVERRIDE_FLAG_PRESET, "PRESET"},
|
||||
{NV_NGX_DLSS_OVERRIDE_FLAG_PERF_MODE, "PERF_MODE"},
|
||||
{NV_NGX_DLSS_OVERRIDE_FLAG_SCALING_RATIO, "SCALING_RATIO"},
|
||||
{NV_NGX_DLSS_OVERRIDE_FLAG_OPTIMAL_SETTINGS, "OPTIMAL_SETTINGS"},
|
||||
{NV_NGX_DLSS_OVERRIDE_FLAG_CREATED, "CREATED"},
|
||||
{NV_NGX_DLSS_OVERRIDE_FLAG_EVALUATE, "EVALUATE"},
|
||||
{NV_NGX_DLSS_OVERRIDE_FLAG_FG_MODE, "FG_MODE"},
|
||||
{NV_NGX_DLSS_OVERRIDE_FLAG_SR_DLAA_MODE, "SR_DLAA_MODE"},
|
||||
{NV_NGX_DLSS_OVERRIDE_FLAG_FG_MULTI_FRAME, "FG_MULTI_FRAME"},
|
||||
{NV_NGX_DLSS_OVERRIDE_FLAG_ERR_FAILED, "ERR_FAILED"},
|
||||
{NV_NGX_DLSS_OVERRIDE_FLAG_ERR_DENIED, "ERR_DENIED"},
|
||||
{NV_NGX_DLSS_OVERRIDE_FLAG_ERR_DRS, "ERR_DRS"},
|
||||
{NV_NGX_DLSS_OVERRIDE_FLAG_ERR_NOT_FOUND, "ERR_NOT_FOUND"},
|
||||
{NV_NGX_DLSS_OVERRIDE_FLAG_ERR_DLL_LOAD, "ERR_DLL_LOAD"},
|
||||
};
|
||||
|
||||
void PrintMask(const char* feature, NvU64 mask) {
|
||||
std::printf(" %-4s feedback 0x%016llX :", feature, static_cast<unsigned long long>(mask));
|
||||
bool any = false;
|
||||
for (const FlagName& f : kFlags) {
|
||||
if ((mask & f.bit) != 0u) {
|
||||
std::printf(" %s", f.name);
|
||||
any = true;
|
||||
}
|
||||
}
|
||||
NvU64 known = 0;
|
||||
for (const FlagName& f : kFlags) {
|
||||
known |= f.bit;
|
||||
}
|
||||
if ((mask & ~known) != 0u) {
|
||||
std::printf(" +unknown(0x%llX)", static_cast<unsigned long long>(mask & ~known));
|
||||
any = true;
|
||||
}
|
||||
std::printf("%s\n", any ? "" : " (none)");
|
||||
}
|
||||
|
||||
int NgxState(unsigned long pid) {
|
||||
std::printf("fl-probe-nvapi --ngx-state %lu — the driver's NGX feedback for one process\n\n", pid);
|
||||
const NvAPI_Status init = NvAPI_Initialize();
|
||||
if (init != NVAPI_OK) {
|
||||
NvAPI_ShortString desc = {};
|
||||
NvAPI_GetErrorMessage(init, desc);
|
||||
std::printf(" NvAPI_Initialize -> %d (%s)\n BRANCH: DEGRADED — no usable NVIDIA driver on this machine.\n",
|
||||
static_cast<int>(init), desc);
|
||||
std::printf("NGXSTATE status=DEGRADED nvapi=%d\n", static_cast<int>(init));
|
||||
return 2;
|
||||
}
|
||||
NvU32 driverVersion = 0;
|
||||
NvAPI_ShortString branch = {};
|
||||
if (NvAPI_SYS_GetDriverAndBranchVersion(&driverVersion, branch) == NVAPI_OK) {
|
||||
std::printf(" driver %u.%02u (%s)\n", driverVersion / 100, driverVersion % 100, branch);
|
||||
}
|
||||
|
||||
NV_NGX_DLSS_OVERRIDE_GET_STATE_PARAMS params = {};
|
||||
params.version = NV_NGX_DLSS_OVERRIDE_GET_STATE_PARAMS_VER;
|
||||
params.processIdentifier = static_cast<NvU32>(pid);
|
||||
const NvAPI_Status status = NvAPI_NGX_GetNGXOverrideState(¶ms);
|
||||
if (status != NVAPI_OK) {
|
||||
NvAPI_ShortString desc = {};
|
||||
NvAPI_GetErrorMessage(status, desc);
|
||||
std::printf(" NvAPI_NGX_GetNGXOverrideState -> %d (%s)\n", static_cast<int>(status), desc);
|
||||
std::printf(" BRANCH: UNANSWERED — the driver did not answer for pid %lu (not an NVIDIA-rendered process, a "
|
||||
"driver older than R570, or the API refusing this caller).\n",
|
||||
pid);
|
||||
std::printf("NGXSTATE status=UNANSWERED nvapi=%d\n", static_cast<int>(status));
|
||||
NvAPI_Unload();
|
||||
return 3;
|
||||
}
|
||||
|
||||
std::printf(" NvAPI_NGX_GetNGXOverrideState -> NVAPI_OK\n BRANCH: ANSWERED\n\n");
|
||||
PrintMask("SR", params.feedbackMaskSR);
|
||||
PrintMask("RR", params.feedbackMaskRR);
|
||||
PrintMask("FG", params.feedbackMaskFG);
|
||||
std::printf(" scalingRatio %.4f\n", static_cast<double>(params.scalingRatio));
|
||||
std::printf(" performanceMode %u\n", params.performanceMode);
|
||||
std::printf(" renderPreset %u\n", params.renderPreset);
|
||||
std::printf(" frameGenerationCount %u (\"FG Override Frame Count Target\" per nvapi.h -- whether this is the "
|
||||
"title's multiplier is what this run measures)\n",
|
||||
params.frameGenerationCount);
|
||||
std::printf(" frameGenerationPreset %u\n", params.frameGenerationPreset);
|
||||
std::printf(" frameGenerationMode %u\n", params.frameGenerationMode);
|
||||
std::printf(" reserved %u %u\n", params.reserved[0], params.reserved[1]);
|
||||
// THE MACHINE LINE. FrameLedger.CaptureHost spawns this probe beside each module snapshot
|
||||
// (NgxDriverProbe) and reads exactly this line; everything above is for a human. One line,
|
||||
// key=value, hex masks, so a parser cannot mistake a decoded name for a field.
|
||||
std::printf(
|
||||
"NGXSTATE status=ANSWERED sr=0x%016llX rr=0x%016llX fg=0x%016llX ratio=%.4f mode=%u preset=%u fgcount=%u "
|
||||
"fgpreset=%u fgmode=%u driver=%u\n",
|
||||
static_cast<unsigned long long>(params.feedbackMaskSR), static_cast<unsigned long long>(params.feedbackMaskRR),
|
||||
static_cast<unsigned long long>(params.feedbackMaskFG), static_cast<double>(params.scalingRatio),
|
||||
params.performanceMode, params.renderPreset, params.frameGenerationCount, params.frameGenerationPreset,
|
||||
params.frameGenerationMode, driverVersion);
|
||||
NvAPI_Unload();
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int main() {
|
||||
int main(int argc, char** argv) {
|
||||
if (argc >= 3 && std::strcmp(argv[1], "--ngx-state") == 0) {
|
||||
return NgxState(std::strtoul(argv[2], nullptr, 10));
|
||||
}
|
||||
|
||||
std::printf("fl-probe-nvapi — the vendored NVAPI material, exercised\n\n");
|
||||
|
||||
// 1 + 2 are proven by this translation unit existing: it includes nvapi.h
|
||||
|
||||
@@ -11,7 +11,7 @@ add_executable(hook-harness main.cpp proxy_swapchain.h)
|
||||
# --probe-upscaler-resolve calls the OVERLAY'S resolver, not a copy of it, or it
|
||||
# would prove a fact about GetProcAddress.
|
||||
target_link_libraries(hook-harness PRIVATE FrameLedger.Shm fl_dxgi_vtable fl_native_flags fl_streamline_headers
|
||||
fl_fidelityfx_headers)
|
||||
fl_fidelityfx_headers fl_fsr3_host_headers)
|
||||
target_include_directories(hook-harness PRIVATE "${CMAKE_SOURCE_DIR}/FrameLedger.Overlay/include")
|
||||
target_compile_definitions(hook-harness PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
|
||||
|
||||
@@ -30,6 +30,8 @@ target_compile_definitions(hook-harness PRIVATE
|
||||
FL_STUB_FFX_UPSCALER=L"$<TARGET_FILE:fl_stub_ffx_upscaler>"
|
||||
FL_STUB_FFX_FG=L"$<TARGET_FILE:fl_stub_ffx_fg>"
|
||||
FL_STUB_FFX_LOADER=L"$<TARGET_FILE:fl_stub_ffx_loader>"
|
||||
# The FSR 3.0 host stand-in (ffx_fsr3_x64.dll), same rule.
|
||||
FL_STUB_FFX_FSR3_HOST=L"$<TARGET_FILE:fl_stub_ffx_fsr3_host>"
|
||||
# Shared with fl_guard_test from src/native/CMakeLists.txt, so the fixture and
|
||||
# the assertion cannot hold different numbers.
|
||||
FL_TAGGED_RENDER_W=${FL_TAGGED_RENDER_W}
|
||||
@@ -39,7 +41,7 @@ target_compile_definitions(hook-harness PRIVATE
|
||||
FL_DXR_DISPATCH_D=${FL_DXR_DISPATCH_D}
|
||||
)
|
||||
add_dependencies(hook-harness fl_stub_sl_interposer fl_stub_sl_common fl_stub_sl_interposer_v1
|
||||
fl_stub_ffx_dx12 fl_stub_ffx_upscaler fl_stub_ffx_fg fl_stub_ffx_loader)
|
||||
fl_stub_ffx_dx12 fl_stub_ffx_upscaler fl_stub_ffx_fg fl_stub_ffx_loader fl_stub_ffx_fsr3_host)
|
||||
|
||||
# WARP + CreateSwapChainForComposition means no GPU and no HWND are needed, so
|
||||
# these run on a hosted CI runner — which is what 20_OPEN_QUESTIONS §H4 said
|
||||
|
||||
@@ -52,6 +52,16 @@
|
||||
// production call site at all
|
||||
// --presents-per-eval K
|
||||
// the FG factor --hold-presenting-fg emits. 1 is the control
|
||||
// --sl-tag-for-frame
|
||||
// make --hold-presenting-upscaled tag through slSetTagForFrame
|
||||
// (Streamline 2.8's frame-based API) instead of slSetTag
|
||||
// --sl-tag-whole-resource
|
||||
// make --hold-presenting-upscaled tag with a ZERO extent and the
|
||||
// size on the Resource instead (the whole-resource shape)
|
||||
// --sl-tag-dlssg-inputs
|
||||
// make --hold-presenting-upscaled tag depth, motion vectors, HUD-less
|
||||
// and UI beside the scaling input -- the list a DLSS-G title sends
|
||||
// every frame -- with NO kFeatureDLSS_G evaluation
|
||||
// --probe-ffx-resolve
|
||||
// AMD ffx-api: the Overlay's resolver picks each LEAF's own
|
||||
// ffxDispatch with the loader decoy present, and a dispatch
|
||||
@@ -61,13 +71,16 @@
|
||||
// an FSR title does: one UPSCALE and one PREPARE (issued twice,
|
||||
// same frameID) per application frame, one FRAMEGENERATION per
|
||||
// frame at K > 1, then K presents (--presents-per-eval K)
|
||||
// --ffx-topology 1x|2x|ue
|
||||
// --ffx-topology 1x|2x|ue|fsr3host|fsr3host+mono
|
||||
// which vendor shape --hold-presenting-ffx stands in: 2x (default)
|
||||
// is the SDK 2.x pair of effect DLLs behind the LOADER (the game
|
||||
// calls the loader; the loader forwards NOT through the leaves'
|
||||
// exports -- measured), 1x the SDK 1.1.x monolith sending the
|
||||
// pre-V2 PREPARE, ue the UE5 shape: the two effect DLLs called
|
||||
// directly, no loader
|
||||
// directly, no loader; fsr3host the FSR 3.0 HOST DLL alone
|
||||
// (ffx_fsr3_x64.dll!ffxFsr3ContextDispatchUpscale, no PREPARE,
|
||||
// no frame generation), fsr3host+mono Cyberpunk's shape: the host
|
||||
// upscales while the 1.1.x monolith prepares and generates
|
||||
// --ffx-no-prepare drop the PREPARE dispatch: the frame-generation-OFF shape, where
|
||||
// the Overlay must count UPSCALE dispatches instead
|
||||
//
|
||||
@@ -106,6 +119,12 @@
|
||||
#include <ffx_api.h>
|
||||
#include <ffx_framegeneration.h>
|
||||
#include <ffx_upscale.h>
|
||||
// And the FSR 3.0 HOST API (tag fsr3-v3.0.4), for the descriptor the fsr3host
|
||||
// topologies build and the type of the export they call on the host stub. Inside a
|
||||
// namespace, as the Overlay includes it: both trees define FfxFrameGenerationConfig.
|
||||
namespace fsr3host {
|
||||
#include <FidelityFX/host/ffx_fsr3.h>
|
||||
} // namespace fsr3host
|
||||
|
||||
#pragma comment(lib, "d3d11.lib")
|
||||
#pragma comment(lib, "d3d12.lib")
|
||||
@@ -1725,7 +1744,55 @@ bool ProbeSlInputs() {
|
||||
const sl::BaseStructure* one[] = {&tagWholeResource};
|
||||
const auto r = fl::slinputs::FindScalingInputExtent(one, 1);
|
||||
Check(!r.found && r.renderW == 0 && r.renderH == 0,
|
||||
"a whole-resource tag yields the honest unknown, not a 0x0 resolution");
|
||||
"a whole-resource tag with NO size on the Resource yields the honest unknown, not a 0x0 resolution");
|
||||
}
|
||||
{
|
||||
// THE WHOLE-RESOURCE SHAPE WITH THE SIZE ON THE RESOURCE: extent zero, and
|
||||
// the Resource the tag points at declares width/height. That is the title's
|
||||
// statement of the input buffer's size, read from the argument it passed.
|
||||
sl::Resource sized(sl::ResourceType::eTex2d, nullptr);
|
||||
sized.width = kTaggedRenderW;
|
||||
sized.height = kTaggedRenderH;
|
||||
sl::ResourceTag whole(&sized, sl::kBufferTypeScalingInputColor, sl::ResourceLifecycle::eValidUntilPresent,
|
||||
&zero);
|
||||
const sl::BaseStructure* one[] = {&whole};
|
||||
const auto r = fl::slinputs::FindScalingInputExtent(one, 1);
|
||||
Check(r.found && r.renderW == kTaggedRenderW && r.renderH == kTaggedRenderH,
|
||||
"a whole-resource tag takes the exact size the Resource declares");
|
||||
}
|
||||
{
|
||||
// A non-zero extent WINS over the Resource's size: the extent is the area in
|
||||
// use, the Resource may be the larger dynamic-resolution target.
|
||||
sl::Resource bigger(sl::ResourceType::eTex2d, nullptr);
|
||||
bigger.width = kTaggedRenderW * 2u;
|
||||
bigger.height = kTaggedRenderH * 2u;
|
||||
sl::ResourceTag sub(&bigger, sl::kBufferTypeScalingInputColor, sl::ResourceLifecycle::eValidUntilPresent,
|
||||
&real);
|
||||
const sl::BaseStructure* one[] = {&sub};
|
||||
const auto r = fl::slinputs::FindScalingInputExtent(one, 1);
|
||||
Check(r.found && r.renderW == kTaggedRenderW && r.renderH == kTaggedRenderH,
|
||||
"an extent takes precedence over the Resource's own size");
|
||||
}
|
||||
{
|
||||
// The Resource pointer names something that is NOT a Resource: GUID-checked
|
||||
// and skipped, never read as one.
|
||||
sl::ViewportHandle notAResource{9u};
|
||||
sl::ResourceTag bad(reinterpret_cast<sl::Resource*>(¬AResource), sl::kBufferTypeScalingInputColor,
|
||||
sl::ResourceLifecycle::eValidUntilPresent, &zero);
|
||||
const sl::BaseStructure* one[] = {&bad};
|
||||
Check(!fl::slinputs::FindScalingInputExtent(one, 1).found,
|
||||
"a whole-resource tag whose Resource fails the GUID check yields nothing");
|
||||
}
|
||||
{
|
||||
// TagSize is the SAME reading the global-tag detours use, so the direct
|
||||
// call is asserted too: a Resource with one zero dimension is not a size.
|
||||
sl::Resource half(sl::ResourceType::eTex2d, nullptr);
|
||||
half.width = kTaggedRenderW;
|
||||
sl::ResourceTag whole(&half, sl::kBufferTypeScalingInputColor, sl::ResourceLifecycle::eValidUntilPresent,
|
||||
&zero);
|
||||
uint32_t w = 0;
|
||||
uint32_t h = 0;
|
||||
Check(!fl::slinputs::TagSize(whole, w, h), "a Resource declaring only a width is not a size");
|
||||
}
|
||||
{
|
||||
const sl::BaseStructure* one[] = {&tagOtherBuffer};
|
||||
@@ -2156,6 +2223,51 @@ bool ProbeFfxResolve() {
|
||||
Check(exportsUp() == 0u && exportsFg() == 0u,
|
||||
"neither leaf's EXPORT was entered by the forward - the loader reached the direct entry, as the real "
|
||||
"one was measured to bypass the leaf exports");
|
||||
|
||||
// THE FSR 3.0 HOST, the fifth module: its own export, resolved by ITS name through
|
||||
// the host ABI arm, and the negatives that keep it from being mistaken for a leaf.
|
||||
std::printf("\n[ffx] the FSR 3.0 host facade: resolved by name through its own ABI arm, and not a leaf\n");
|
||||
const HMODULE host = LoadStubExactly(FL_STUB_FFX_FSR3_HOST);
|
||||
Check(host != nullptr, "the ffx_fsr3_x64.dll host stub loaded from its absolute path");
|
||||
if (host == nullptr) {
|
||||
return false;
|
||||
}
|
||||
Check(fl::inventory::SpeaksFsr3Host(host), "the host stub speaks the four FSR 3.0 host names");
|
||||
Check(!fl::inventory::SpeaksFsr3Host(decoy), "the sl.common.dll decoy does not");
|
||||
Check(!fl::inventory::SpeaksFsr3Host(monolith),
|
||||
"and neither does the 1.1.x monolith - the host's names are its own, so a monolith of the wrong NAME cannot "
|
||||
"pass the host arm");
|
||||
Check(!fl::inventory::SpeaksFfxApi(host), "the host does not speak ffx-api: it exports no ffxDispatch");
|
||||
Check(fl::inventory::SpeaksExpectedAbi(fl::inventory::kModuleFfxFsr3Host, host),
|
||||
"the ABI arm approves the host by its own name");
|
||||
Check(!fl::inventory::SpeaksExpectedAbi(fl::inventory::kModuleFfxFsr3Host, monolith),
|
||||
"and refuses a module of the host's name that does not speak the host ABI");
|
||||
Check(fl::inventory::FfxLeafOf(fl::inventory::kModuleFfxFsr3Host) < 0,
|
||||
"the host is NOT a leaf slot - the installer keys it by module name");
|
||||
void* fromHost =
|
||||
fl::inventory::ResolveScoped(fl::inventory::kModuleFfxFsr3Host, fl::inventory::kSymbolFfxFsr3DispatchUpscale);
|
||||
Check(fromHost != nullptr &&
|
||||
fromHost == reinterpret_cast<void*>(GetProcAddress(host, fl::inventory::kSymbolFfxFsr3DispatchUpscale)),
|
||||
"ResolveScoped returned the host's own ffxFsr3ContextDispatchUpscale");
|
||||
Check(fl::inventory::ResolveScoped(fl::inventory::kModuleFfxFsr3Host, "ffxDispatch") == nullptr,
|
||||
"and the host has no ffxDispatch to resolve");
|
||||
// The non-row, stated at runtime as well as at compile time: the export EXISTS on the
|
||||
// module and no inventory row names it (20_OPEN_QUESTIONS §H11's reversal condition).
|
||||
Check(GetProcAddress(host, "ffxFsr3DispatchFrameGeneration") != nullptr,
|
||||
"the host exports ffxFsr3DispatchFrameGeneration");
|
||||
bool fgIsARow = false;
|
||||
bool hostIsARow = false;
|
||||
#define FL_PROBE_HOST_ROW(mod, sym, family) \
|
||||
if (std::strcmp(sym, "ffxFsr3DispatchFrameGeneration") == 0) { \
|
||||
fgIsARow = true; \
|
||||
} \
|
||||
if (_wcsicmp(mod, fl::inventory::kModuleFfxFsr3Host) == 0) { \
|
||||
hostIsARow = true; \
|
||||
}
|
||||
FL_HOOK_INVENTORY(FL_PROBE_HOST_ROW)
|
||||
#undef FL_PROBE_HOST_ROW
|
||||
Check(hostIsARow, "an FL_HOOK_INVENTORY row names ffx_fsr3_x64.dll");
|
||||
Check(!fgIsARow, "and no row names ffxFsr3DispatchFrameGeneration - deliberately (dllmain.cpp)");
|
||||
return g_failures == 0;
|
||||
}
|
||||
|
||||
@@ -2178,13 +2290,19 @@ bool ProbeFfxResolve() {
|
||||
// ---------------------------------------------------------------------------
|
||||
using StubSetTagFn = sl::Result(STDMETHODCALLTYPE*)(const sl::ViewportHandle&, const sl::ResourceTag*, uint32_t,
|
||||
sl::CommandBuffer*);
|
||||
// The token slot is integer-class (a reference is a pointer) and nothing on either
|
||||
// side dereferences it, so the dummy buffer stands in exactly as it does for
|
||||
// slEvaluateFeature's token below.
|
||||
using StubSetTagForFrameFn = sl::Result(STDMETHODCALLTYPE*)(const void*, const sl::ViewportHandle&,
|
||||
const sl::ResourceTag*, uint32_t, sl::CommandBuffer*);
|
||||
|
||||
using StubEvaluateFn = sl::Result(STDMETHODCALLTYPE*)(sl::Feature, const void*, const void*, uint32_t, void*);
|
||||
using StubTokenFn = sl::Result(STDMETHODCALLTYPE*)(sl::FrameToken*&, const uint32_t*);
|
||||
|
||||
alignas(16) unsigned char g_dummyFrameToken[64]{};
|
||||
|
||||
int HoldPresentingUpscaled(Gfx& g, int seconds, bool real, sl::Feature feature) {
|
||||
int HoldPresentingUpscaled(Gfx& g, int seconds, bool real, sl::Feature feature, bool tagForFrame, bool wholeResource,
|
||||
bool dlssgInputs) {
|
||||
const HMODULE stub = LoadStubExactly(FL_STUB_SL_INTERPOSER);
|
||||
if (stub == nullptr) {
|
||||
Check(false, "the sl.interposer.dll stub loaded for the upscaled hold");
|
||||
@@ -2214,16 +2332,50 @@ int HoldPresentingUpscaled(Gfx& g, int seconds, bool real, sl::Feature feature)
|
||||
Check(false, "the stub exports slSetTag");
|
||||
return 1;
|
||||
}
|
||||
// THE 2.8 ROUTE: the same tag list through slSetTagForFrame, and NEVER through
|
||||
// slSetTag in that mode -- so an extent in the record can only have come from the
|
||||
// frame-based row, which is what the injected case for it asserts.
|
||||
auto setTagForFrame =
|
||||
reinterpret_cast<StubSetTagForFrameFn>(reinterpret_cast<void*>(GetProcAddress(stub, "slSetTagForFrame")));
|
||||
if (setTagForFrame == nullptr) {
|
||||
Check(false, "the stub exports slSetTagForFrame");
|
||||
return 1;
|
||||
}
|
||||
// Two shapes of the same statement. The extent shape is Cyberpunk's; the
|
||||
// whole-resource shape (zero extent, size on the Resource) is the one a title
|
||||
// that tags entire buffers produces, and under it an extent in the record can
|
||||
// only have come from the Resource's declared size.
|
||||
sl::Extent extent{};
|
||||
sl::Extent zero{};
|
||||
extent.width = kTaggedRenderW;
|
||||
extent.height = kTaggedRenderH;
|
||||
sl::ResourceTag tag(nullptr, sl::kBufferTypeScalingInputColor, sl::ResourceLifecycle::eValidUntilPresent, &extent);
|
||||
sl::Resource sized(sl::ResourceType::eTex2d, nullptr);
|
||||
sized.width = kTaggedRenderW;
|
||||
sized.height = kTaggedRenderH;
|
||||
sl::ResourceTag tag(wholeResource ? &sized : nullptr, sl::kBufferTypeScalingInputColor,
|
||||
sl::ResourceLifecycle::eValidUntilPresent, wholeResource ? &zero : &extent);
|
||||
sl::ViewportHandle viewport{0u};
|
||||
|
||||
// THE DLSS-G SHAPE: the same list a title running DLSS Frame Generation sends every
|
||||
// frame (DLSS-G programming guide §5.0) -- depth, motion vectors, HUD-less colour and
|
||||
// UI colour+alpha beside the scaling input. No kFeatureDLSS_G is evaluated here, so a
|
||||
// record naming DLSS_G can only have come from the tags' TYPES.
|
||||
sl::ResourceTag depthTag(nullptr, sl::kBufferTypeDepth, sl::ResourceLifecycle::eValidUntilPresent, &extent);
|
||||
sl::ResourceTag mvecTag(nullptr, sl::kBufferTypeMotionVectors, sl::ResourceLifecycle::eValidUntilPresent, &extent);
|
||||
sl::ResourceTag hudlessTag(nullptr, sl::kBufferTypeHUDLessColor, sl::ResourceLifecycle::eValidUntilPresent,
|
||||
&extent);
|
||||
sl::ResourceTag uiTag(nullptr, sl::kBufferTypeUIColorAndAlpha, sl::ResourceLifecycle::eValidUntilPresent, &extent);
|
||||
sl::ResourceTag list[5] = {depthTag, mvecTag, tag, hudlessTag, uiTag};
|
||||
const sl::ResourceTag* tags = dlssgInputs ? list : &tag;
|
||||
const uint32_t numTags = dlssgInputs ? 5u : 1u;
|
||||
|
||||
const UINT flags = real ? 0u : DXGI_PRESENT_TEST;
|
||||
std::printf(" presenting for %d second(s) [%s], evaluating feature %u before each present\n", seconds,
|
||||
real ? "REAL" : "DXGI_PRESENT_TEST", static_cast<unsigned>(feature));
|
||||
std::printf(" tagged kBufferTypeScalingInputColor extent %ux%u\n", kTaggedRenderW, kTaggedRenderH);
|
||||
std::printf(" tagged kBufferTypeScalingInputColor %s %ux%u through %s%s\n",
|
||||
wholeResource ? "whole resource, Resource size" : "extent", kTaggedRenderW, kTaggedRenderH,
|
||||
tagForFrame ? "slSetTagForFrame (Streamline 2.8, frame-based)" : "slSetTag",
|
||||
dlssgInputs ? ", beside depth, motion vectors, HUD-less and UI (the DLSS-G inputs)" : "");
|
||||
std::fflush(stdout);
|
||||
|
||||
const ULONGLONG until = GetTickCount64() + static_cast<ULONGLONG>(seconds) * 1000ULL;
|
||||
@@ -2233,7 +2385,11 @@ int HoldPresentingUpscaled(Gfx& g, int seconds, bool real, sl::Feature feature)
|
||||
// Tag, then evaluate, then present -- the order a Streamline title uses,
|
||||
// and the order that matters: the extent must be in place before the
|
||||
// evaluation the Overlay attributes it to.
|
||||
setTag(viewport, &tag, 1, nullptr);
|
||||
if (tagForFrame) {
|
||||
setTagForFrame(g_dummyFrameToken, viewport, tags, numTags, nullptr);
|
||||
} else {
|
||||
setTag(viewport, tags, numTags, nullptr);
|
||||
}
|
||||
// ONE EVALUATION PER PRESENT, which is what a real upscaled title does
|
||||
// and what makes the drained record's identity checkable frame by frame.
|
||||
eval(feature, g_dummyFrameToken, nullptr, 0, nullptr);
|
||||
@@ -2368,13 +2524,37 @@ int HoldPresentingFg(Gfx& g, int seconds, bool real, int presentsPerEval) {
|
||||
// ---------------------------------------------------------------------------
|
||||
// Which module the fixture calls: 1x = the monolith, 2x = the loader (which forwards to
|
||||
// the two leaves through their DIRECT entry, as measured), ue = the two leaves called
|
||||
// directly with no loader in the process, the UE5 shape.
|
||||
enum class FfxTopology { Monolith, Loader, Ue };
|
||||
// directly with no loader in the process, the UE5 shape, fsr3host = the FSR 3.0 HOST
|
||||
// DLL alone (its named UPSCALE export, no PREPARE, no frame generation -- the K = 1
|
||||
// double-count control for that row), fsr3host+mono = Cyberpunk 2077's measured shape:
|
||||
// the host upscales while the 1.1.x monolith prepares and generates.
|
||||
enum class FfxTopology { Monolith, Loader, Ue, Fsr3Host, Fsr3HostMonolith };
|
||||
|
||||
using PfnFsr3DispatchUpscale = decltype(&fsr3host::ffxFsr3ContextDispatchUpscale);
|
||||
|
||||
int HoldPresentingFfx(Gfx& g, int seconds, bool real, int presentsPerEval, FfxTopology topology, bool prepare) {
|
||||
HMODULE upEntry = nullptr; // where UPSCALE goes
|
||||
HMODULE fgEntry = nullptr; // where PREPARE and FRAMEGENERATION go
|
||||
if (topology == FfxTopology::Monolith) {
|
||||
HMODULE upEntry = nullptr; // where UPSCALE goes (an ffx-api module)
|
||||
HMODULE fgEntry = nullptr; // where PREPARE and FRAMEGENERATION go
|
||||
HMODULE hostEntry = nullptr; // where UPSCALE goes on the FSR 3.0 host topologies
|
||||
if (topology == FfxTopology::Fsr3Host || topology == FfxTopology::Fsr3HostMonolith) {
|
||||
hostEntry = LoadStubExactly(FL_STUB_FFX_FSR3_HOST);
|
||||
if (hostEntry == nullptr) {
|
||||
Check(false, "the ffx_fsr3_x64.dll host stub loaded for the ffx hold");
|
||||
return 1;
|
||||
}
|
||||
if (topology == FfxTopology::Fsr3HostMonolith) {
|
||||
fgEntry = LoadStubExactly(FL_STUB_FFX_DX12);
|
||||
if (fgEntry == nullptr) {
|
||||
Check(false, "the SDK 1.1.x monolith stub loaded beside the host for the ffx hold");
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
// The host alone prepares nothing and generates nothing: FSR 3.0's frame
|
||||
// generation lives in ffx_frameinterpolation_x64.dll, which no row hooks. The
|
||||
// count must come from the host's UPSCALE, so PREPARE is off whatever was asked.
|
||||
prepare = false;
|
||||
}
|
||||
} else if (topology == FfxTopology::Monolith) {
|
||||
upEntry = fgEntry = LoadStubExactly(FL_STUB_FFX_DX12);
|
||||
if (upEntry == nullptr) {
|
||||
Check(false, "the SDK 1.1.x monolith stub loaded for the ffx hold");
|
||||
@@ -2406,16 +2586,30 @@ int HoldPresentingFfx(Gfx& g, int seconds, bool real, int presentsPerEval, FfxTo
|
||||
fgEntry = fg;
|
||||
}
|
||||
}
|
||||
auto dispatchUp = reinterpret_cast<PfnFfxDispatch>(reinterpret_cast<void*>(GetProcAddress(upEntry, "ffxDispatch")));
|
||||
auto dispatchFg = reinterpret_cast<PfnFfxDispatch>(reinterpret_cast<void*>(GetProcAddress(fgEntry, "ffxDispatch")));
|
||||
if (dispatchUp == nullptr || dispatchFg == nullptr) {
|
||||
Check(false, "the entry module(s) export ffxDispatch");
|
||||
auto dispatchUp =
|
||||
upEntry != nullptr
|
||||
? reinterpret_cast<PfnFfxDispatch>(reinterpret_cast<void*>(GetProcAddress(upEntry, "ffxDispatch")))
|
||||
: nullptr;
|
||||
auto dispatchFg =
|
||||
fgEntry != nullptr
|
||||
? reinterpret_cast<PfnFfxDispatch>(reinterpret_cast<void*>(GetProcAddress(fgEntry, "ffxDispatch")))
|
||||
: nullptr;
|
||||
auto dispatchHost = hostEntry != nullptr
|
||||
? reinterpret_cast<PfnFsr3DispatchUpscale>(reinterpret_cast<void*>(
|
||||
GetProcAddress(hostEntry, fl::inventory::kSymbolFfxFsr3DispatchUpscale)))
|
||||
: nullptr;
|
||||
if ((upEntry != nullptr && dispatchUp == nullptr) || (fgEntry != nullptr && dispatchFg == nullptr) ||
|
||||
(hostEntry != nullptr && dispatchHost == nullptr)) {
|
||||
Check(false, "the entry module(s) export their dispatch entry point");
|
||||
return 1;
|
||||
}
|
||||
const bool topology2x = topology != FfxTopology::Monolith;
|
||||
const char* topologyName = topology == FfxTopology::Monolith ? "SDK 1.1.x (monolith)"
|
||||
: topology == FfxTopology::Loader ? "SDK 2.x (two leaves behind the loader)"
|
||||
: "UE5 (two leaves, no loader)";
|
||||
// The pre-V2 PREPARE is the 1.1.x monolith's, on both topologies that use it.
|
||||
const bool topology2x = topology == FfxTopology::Loader || topology == FfxTopology::Ue;
|
||||
const char* topologyName = topology == FfxTopology::Monolith ? "SDK 1.1.x (monolith)"
|
||||
: topology == FfxTopology::Loader ? "SDK 2.x (two leaves behind the loader)"
|
||||
: topology == FfxTopology::Ue ? "UE5 (two leaves, no loader)"
|
||||
: topology == FfxTopology::Fsr3Host ? "FSR 3.0 host DLL alone"
|
||||
: "FSR 3.0 host DLL + SDK 1.1.x monolith";
|
||||
|
||||
const int k = presentsPerEval < 1 ? 1 : presentsPerEval;
|
||||
const UINT flags = real ? 0u : DXGI_PRESENT_TEST;
|
||||
@@ -2447,14 +2641,26 @@ int HoldPresentingFfx(Gfx& g, int seconds, bool real, int presentsPerEval, FfxTo
|
||||
gen.header.type = FFX_API_DISPATCH_DESC_TYPE_FRAMEGENERATION;
|
||||
gen.numGeneratedFrames = static_cast<uint32_t>(k - 1);
|
||||
|
||||
// The FSR 3.0 HOST descriptor, from the vendored fsr3-v3.0.4 struct: the same tagged
|
||||
// extent, in the field the Overlay pins at offset 1256. Nothing else is set, and the
|
||||
// stub reads nothing at all, so a record carrying this size proves the Overlay read it
|
||||
// off the argument.
|
||||
fsr3host::FfxFsr3DispatchUpscaleDescription hostUp{};
|
||||
hostUp.renderSize.width = kTaggedRenderW;
|
||||
hostUp.renderSize.height = kTaggedRenderH;
|
||||
|
||||
const ULONGLONG until = GetTickCount64() + static_cast<ULONGLONG>(seconds) * 1000ULL;
|
||||
long long presented = 0;
|
||||
long long frames = 0;
|
||||
uint64_t frameId = 0;
|
||||
while (GetTickCount64() < until) {
|
||||
++frameId;
|
||||
dispatchUp(nullptr, &up.header);
|
||||
if (prepare) {
|
||||
if (dispatchHost != nullptr) {
|
||||
dispatchHost(nullptr, &hostUp);
|
||||
} else {
|
||||
dispatchUp(nullptr, &up.header);
|
||||
}
|
||||
if (prepare && dispatchFg != nullptr) {
|
||||
// TWICE, SAME frameID: the SDK's own sample re-issues the prepare when its
|
||||
// configuration changes, and the vendor's contract is about the INDEX. A
|
||||
// writer that counted calls reads 2.0 at K = 1 here.
|
||||
@@ -2462,7 +2668,7 @@ int HoldPresentingFfx(Gfx& g, int seconds, bool real, int presentsPerEval, FfxTo
|
||||
dispatchFg(nullptr, &prep.header);
|
||||
dispatchFg(nullptr, &prep.header);
|
||||
}
|
||||
if (k > 1) {
|
||||
if (k > 1 && dispatchFg != nullptr) {
|
||||
gen.frameID = frameId;
|
||||
dispatchFg(nullptr, &gen.header);
|
||||
}
|
||||
@@ -2509,6 +2715,30 @@ bool ProbeFrameIdentity(Gfx& g) {
|
||||
Check(realIsAFrame, "a real present submits exactly one frame");
|
||||
std::printf(" %d real present(s) moved the counter by %u\n", kReal, afterReal - afterTest);
|
||||
|
||||
// The cost of asking. The Overlay reads this counter on every hooked present
|
||||
// (dllmain RecordPresent, the DXGI-counted diagnostic 20_OPEN_QUESTIONS §H5
|
||||
// A1.7), so the price of one call is part of the present hook's overhead
|
||||
// statement. A measurement, not a check: a threshold here fails on a shared
|
||||
// runner for reasons unrelated to the code (see --probe-cost).
|
||||
{
|
||||
constexpr int kCalls = 20000;
|
||||
LARGE_INTEGER f{};
|
||||
LARGE_INTEGER t0{};
|
||||
LARGE_INTEGER t1{};
|
||||
QueryPerformanceFrequency(&f);
|
||||
UINT sink = 0;
|
||||
QueryPerformanceCounter(&t0);
|
||||
for (int i = 0; i < kCalls; ++i) {
|
||||
g.swapChain1->GetLastPresentCount(&sink);
|
||||
}
|
||||
QueryPerformanceCounter(&t1);
|
||||
const double ns =
|
||||
static_cast<double>(t1.QuadPart - t0.QuadPart) * 1e9 / static_cast<double>(f.QuadPart) / kCalls;
|
||||
std::printf(" GetLastPresentCount costs %.1f ns/call (%d calls, WARP; the Overlay pays this once per hooked "
|
||||
"present)\n",
|
||||
ns, kCalls);
|
||||
}
|
||||
|
||||
// The two together are the contract. Separately, each passes against a
|
||||
// wrong writer: a writer that ignores everything satisfies the first, and
|
||||
// one that counts everything satisfies the second.
|
||||
@@ -2562,6 +2792,9 @@ int main(int argc, char** argv) {
|
||||
// hold mode drives every combination and the tests assert one expression.
|
||||
FfxTopology ffxTopology = FfxTopology::Loader;
|
||||
bool ffxPrepare = true;
|
||||
bool slTagForFrame = false;
|
||||
bool slTagWholeResource = false;
|
||||
bool slTagDlssgInputs = false;
|
||||
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
if (std::strcmp(argv[i], "--real") == 0) {
|
||||
@@ -2584,18 +2817,28 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
} else if (std::strcmp(argv[i], "--ffx-topology") == 0 && i + 1 < argc) {
|
||||
const char* t = argv[++i];
|
||||
ffxTopology = std::strcmp(t, "1x") == 0 ? FfxTopology::Monolith
|
||||
: std::strcmp(t, "ue") == 0 ? FfxTopology::Ue
|
||||
: FfxTopology::Loader;
|
||||
ffxTopology = std::strcmp(t, "1x") == 0 ? FfxTopology::Monolith
|
||||
: std::strcmp(t, "ue") == 0 ? FfxTopology::Ue
|
||||
: std::strcmp(t, "fsr3host") == 0 ? FfxTopology::Fsr3Host
|
||||
: std::strcmp(t, "fsr3host+mono") == 0 ? FfxTopology::Fsr3HostMonolith
|
||||
: FfxTopology::Loader;
|
||||
} else if (std::strcmp(argv[i], "--ffx-no-prepare") == 0) {
|
||||
ffxPrepare = false;
|
||||
} else if (std::strcmp(argv[i], "--sl-tag-for-frame") == 0) {
|
||||
slTagForFrame = true;
|
||||
} else if (std::strcmp(argv[i], "--sl-tag-whole-resource") == 0) {
|
||||
slTagWholeResource = true;
|
||||
} else if (std::strcmp(argv[i], "--sl-tag-dlssg-inputs") == 0) {
|
||||
slTagDlssgInputs = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
if (std::strcmp(argv[i], "--real") == 0 || std::strcmp(argv[i], "--plus-ui") == 0 ||
|
||||
std::strcmp(argv[i], "--present-interval-ms") == 0 || std::strcmp(argv[i], "--presents-per-eval") == 0 ||
|
||||
std::strcmp(argv[i], "--ffx-topology") == 0 || std::strcmp(argv[i], "--ffx-no-prepare") == 0) {
|
||||
std::strcmp(argv[i], "--ffx-topology") == 0 || std::strcmp(argv[i], "--ffx-no-prepare") == 0 ||
|
||||
std::strcmp(argv[i], "--sl-tag-for-frame") == 0 || std::strcmp(argv[i], "--sl-tag-whole-resource") == 0 ||
|
||||
std::strcmp(argv[i], "--sl-tag-dlssg-inputs") == 0) {
|
||||
if (std::strcmp(argv[i], "--plus-ui") == 0 || std::strcmp(argv[i], "--present-interval-ms") == 0 ||
|
||||
std::strcmp(argv[i], "--presents-per-eval") == 0 || std::strcmp(argv[i], "--ffx-topology") == 0) {
|
||||
++i;
|
||||
@@ -2611,7 +2854,9 @@ int main(int argc, char** argv) {
|
||||
ok = HoldPresentingFfx(g, std::atoi(argv[++i]), real, presentsPerEval, ffxTopology, ffxPrepare) == 0 && ok;
|
||||
ranSomething = true;
|
||||
} else if (std::strcmp(argv[i], "--hold-presenting-upscaled") == 0 && i + 1 < argc) {
|
||||
ok = HoldPresentingUpscaled(g, std::atoi(argv[++i]), real, sl::kFeatureDLSS) == 0 && ok;
|
||||
ok = HoldPresentingUpscaled(g, std::atoi(argv[++i]), real, sl::kFeatureDLSS, slTagForFrame,
|
||||
slTagWholeResource, slTagDlssgInputs) == 0 &&
|
||||
ok;
|
||||
ranSomething = true;
|
||||
} else if (std::strcmp(argv[i], "--hold-presenting-upscaled-unknown") == 0 && i + 1 < argc) {
|
||||
// The SAME target, evaluating a feature id the Overlay does not
|
||||
@@ -2619,7 +2864,9 @@ int main(int argc, char** argv) {
|
||||
// SET -- "a hook ran and could not identify what it saw" -- and must
|
||||
// never report FL_UPSCALER_NONE, which is the only state that may be
|
||||
// aggregated as a negative. 0xF00D is not a Streamline feature.
|
||||
ok = HoldPresentingUpscaled(g, std::atoi(argv[++i]), real, static_cast<sl::Feature>(0xF00Du)) == 0 && ok;
|
||||
ok = HoldPresentingUpscaled(g, std::atoi(argv[++i]), real, static_cast<sl::Feature>(0xF00Du), slTagForFrame,
|
||||
slTagWholeResource, slTagDlssgInputs) == 0 &&
|
||||
ok;
|
||||
ranSomething = true;
|
||||
} else if (std::strcmp(argv[i], "--probe-upscaler-resolve") == 0) {
|
||||
ok = ProbeUpscalerResolve() && ok;
|
||||
|
||||
@@ -23,7 +23,7 @@ function(fl_add_vendor_stub target output source)
|
||||
# supply the vendor signatures so the stub and the detour cannot disagree about
|
||||
# the ABI. Both are INTERFACE include targets and link nothing.
|
||||
target_link_libraries(${target} PRIVATE FrameLedger.Shm fl_native_flags fl_streamline_headers
|
||||
fl_fidelityfx_headers)
|
||||
fl_fidelityfx_headers fl_fsr3_host_headers)
|
||||
target_include_directories(${target} PRIVATE
|
||||
"${CMAKE_SOURCE_DIR}/FrameLedger.Overlay/include"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
@@ -75,3 +75,12 @@ fl_add_vendor_stub(fl_stub_ffx_dx12 "amd_fidelityfx_dx12" stub_amd_fidelityfx_dx
|
||||
fl_add_vendor_stub(fl_stub_ffx_upscaler "amd_fidelityfx_upscaler_dx12" stub_amd_fidelityfx_upscaler_dx12.cpp)
|
||||
fl_add_vendor_stub(fl_stub_ffx_fg "amd_fidelityfx_framegeneration_dx12" stub_amd_fidelityfx_framegeneration_dx12.cpp)
|
||||
fl_add_vendor_stub(fl_stub_ffx_loader "amd_fidelityfx_loader_dx12" stub_amd_fidelityfx_loader_dx12.cpp)
|
||||
|
||||
# --- AMD FidelityFX, the FSR 3.0 HOST API (Cyberpunk 2077's ffx_fsr3_x64.dll) ---
|
||||
#
|
||||
# NOT A LEAF: named exports, the 3.0 host's own descriptor, one row
|
||||
# (ffxFsr3ContextDispatchUpscale). Exports exactly the four names SpeaksFsr3Host
|
||||
# probes for, through the vendored header's own FFX_API (dllexport, no switch) -- and
|
||||
# is therefore hookinventory-check Pass C's SECOND positive control for the export
|
||||
# parser, beside the ffx-api leaf.
|
||||
fl_add_vendor_stub(fl_stub_ffx_fsr3_host "ffx_fsr3_x64" stub_ffx_fsr3_x64.cpp)
|
||||
@@ -0,0 +1,81 @@
|
||||
// A stub that answers to the name `ffx_fsr3_x64.dll` -- the FSR 3.0 HOST DLL Cyberpunk
|
||||
// 2077 ships beside its 1.1.x monolith -- and exports the four names
|
||||
// fl::inventory::SpeaksFsr3Host probes for, one of which is the row the Overlay hooks.
|
||||
//
|
||||
// NOT A LEAF: it exports no ffxDispatch and shares nothing with stub_ffx_leaf.inl. The
|
||||
// one export the Overlay detours takes the host API's own descriptor, whose renderSize
|
||||
// sits 1256 bytes in; the stub reads none of it, so renderW/H in a record can only have
|
||||
// come from the Overlay reading the argument.
|
||||
//
|
||||
// THE SIGNATURES AND THE EXPORT LINKAGE COME FROM THE VENDORED MIT HEADER (tag
|
||||
// fsr3-v3.0.4). FFX_API there is __declspec(dllexport) with no switch, so defining
|
||||
// the function here exports it under exactly the declaration the Overlay's detour is
|
||||
// typed by -- and the same header, included by FrameLedger.Overlay for types only,
|
||||
// exports nothing there because nothing there defines these names. This DLL is Pass C's
|
||||
// second positive control: its export table MUST show ffxFsr3ContextDispatchUpscale.
|
||||
|
||||
#include <FidelityFX/host/ffx_fsr3.h>
|
||||
|
||||
#include "stub_common.h"
|
||||
|
||||
static_assert(
|
||||
fl::stub::InventoryHasRow(fl::inventory::kModuleFfxFsr3Host, fl::inventory::kSymbolFfxFsr3DispatchUpscale),
|
||||
"fl_hook_inventory.h has no ffxFsr3ContextDispatchUpscale row for ffx_fsr3_x64.dll, so this fixture would "
|
||||
"exercise a name the Overlay does not install");
|
||||
static_assert(
|
||||
!fl::stub::InventoryHas("ffxFsr3DispatchFrameGeneration"),
|
||||
"ffxFsr3DispatchFrameGeneration is deliberately NOT a row (dllmain.cpp, fl_hook_inventory.h): on the one "
|
||||
"title that ships the host DLL frame generation goes through the monolith, and the pre-committed reversal "
|
||||
"condition in 20_OPEN_QUESTIONS §H11 has not fired");
|
||||
static_assert(!fl::stub::InventoryHas("ffxFsr3SkipPresent"), "probe-only, never a row");
|
||||
|
||||
namespace {
|
||||
|
||||
volatile LONG g_upscales = 0;
|
||||
volatile LONG g_contexts = 0;
|
||||
|
||||
} // namespace
|
||||
|
||||
extern "C" {
|
||||
|
||||
FFX_API FfxErrorCode ffxFsr3ContextCreate(FfxFsr3Context* context, FfxFsr3ContextDescription* contextDescription) {
|
||||
if (context == nullptr || contextDescription == nullptr) {
|
||||
return FFX_ERROR_INVALID_POINTER;
|
||||
}
|
||||
InterlockedIncrement(&g_contexts);
|
||||
return FFX_OK;
|
||||
}
|
||||
|
||||
// THE ROW'S TARGET. Counts the call and reads nothing of the descriptor.
|
||||
FFX_API FfxErrorCode ffxFsr3ContextDispatchUpscale(FfxFsr3Context* context,
|
||||
const FfxFsr3DispatchUpscaleDescription* dispatchParams) {
|
||||
(void)context;
|
||||
if (dispatchParams == nullptr) {
|
||||
return FFX_ERROR_INVALID_POINTER;
|
||||
}
|
||||
InterlockedIncrement(&g_upscales);
|
||||
return FFX_OK;
|
||||
}
|
||||
|
||||
FFX_API FfxErrorCode ffxFsr3DispatchFrameGeneration(const FfxFrameGenerationDispatchDescription* desc) {
|
||||
return desc != nullptr ? FFX_OK : FFX_ERROR_INVALID_POINTER;
|
||||
}
|
||||
|
||||
FFX_API FfxErrorCode ffxFsr3SkipPresent(FfxFsr3Context* context) {
|
||||
(void)context;
|
||||
return FFX_OK;
|
||||
}
|
||||
|
||||
// FrameLedger-named observer, so nothing here pretends to be part of a vendor API.
|
||||
__declspec(dllexport) unsigned int FlStubFsr3UpscaleCalls() {
|
||||
return static_cast<unsigned int>(InterlockedCompareExchange(&g_upscales, 0, 0));
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID) {
|
||||
if (reason == DLL_PROCESS_ATTACH) {
|
||||
DisableThreadLibraryCalls(module);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@@ -59,6 +59,9 @@ StubFrameToken g_tokenPool[8];
|
||||
static_assert(fl::stub::InventoryHas("slGetNewFrameToken"),
|
||||
"fl_hook_inventory.h no longer contains \"slGetNewFrameToken\", so the frame-token fixture would "
|
||||
"exercise a row the Overlay does not install.");
|
||||
static_assert(fl::stub::InventoryHas("slSetTagForFrame"),
|
||||
"fl_hook_inventory.h no longer contains \"slSetTagForFrame\", so the frame-based tag fixture would "
|
||||
"exercise a row the Overlay does not install.");
|
||||
static_assert(fl::stub::InventoryHas("slEvaluateFeature"),
|
||||
"fl_hook_inventory.h no longer contains \"slEvaluateFeature\", so this stub would export a name "
|
||||
"the Overlay does not look for -- the fixture would pass while proving nothing "
|
||||
@@ -99,6 +102,22 @@ SL_API sl::Result slSetTag(const sl::ViewportHandle& viewport, const sl::Resourc
|
||||
return sl::Result::eOk;
|
||||
}
|
||||
|
||||
// THE FRAME-BASED TAG ENTRY POINT (Streamline 2.8: Dying Light: The Beast ships
|
||||
// 2.8.0, which exports this beside the deprecated slSetTag). Signature from the
|
||||
// vendored header, as above. The stub records nothing here either; the harness
|
||||
// drives it with a known extent so the injected case can assert the Overlay read
|
||||
// renderW/H off THIS route rather than off slSetTag.
|
||||
SL_API sl::Result slSetTagForFrame(const sl::FrameToken& frame, const sl::ViewportHandle& viewport,
|
||||
const sl::ResourceTag* resources, uint32_t numResources,
|
||||
sl::CommandBuffer* cmdBuffer) {
|
||||
(void)frame;
|
||||
(void)viewport;
|
||||
(void)resources;
|
||||
(void)numResources;
|
||||
(void)cmdBuffer;
|
||||
return sl::Result::eOk;
|
||||
}
|
||||
|
||||
// THE ABI MARKERS. Three SL2-only entry points, exported so this stub actually
|
||||
// looks like the generation it stands in for.
|
||||
//
|
||||
|
||||
@@ -3,6 +3,7 @@ using FrameLedger.Application.AntiCheat;
|
||||
using FrameLedger.Application.Consent;
|
||||
using FrameLedger.CaptureHost.Capture;
|
||||
using FrameLedger.CaptureHost.Consent;
|
||||
using FrameLedger.CaptureHost.Consume;
|
||||
using FrameLedger.Domain.AntiCheat;
|
||||
using FrameLedger.Domain.Consent;
|
||||
using FrameLedger.Infrastructure.Ipc;
|
||||
@@ -217,6 +218,117 @@ public sealed class CaptureLoopTests : IDisposable
|
||||
MaxDuration = TimeSpan.FromMilliseconds(120),
|
||||
});
|
||||
|
||||
[Fact]
|
||||
public async Task TheModuleSnapshotIsTakenBesideEveryGuardScanAndOnceMoreBeforeTheLastDrain()
|
||||
{
|
||||
// The snapshot rides on the scan's cadence, never its own: one directly after each publish,
|
||||
// and one more after the loop exits so a module that loaded after the final scan is still
|
||||
// named. The sink's ordered event list is what makes the "directly after" observable.
|
||||
var guard = new CountingGuard();
|
||||
using var sink = new FakeSink();
|
||||
int snapshots = 0;
|
||||
var loop = new CaptureLoop(
|
||||
await StoreWithAsync(), new HookedCaptureGate(guard), guard, new FixedResolver(_pid, SessionEndReason.Running),
|
||||
_ => new FakeLiveness(),
|
||||
_ => (sink, ShmAttachRefusal.Ok),
|
||||
new CaptureOptions
|
||||
{
|
||||
DrainInterval = TimeSpan.FromMilliseconds(1),
|
||||
ScanInterval = TimeSpan.FromMilliseconds(5),
|
||||
AttachBudget = TimeSpan.FromMilliseconds(50),
|
||||
MaxDuration = TimeSpan.FromMilliseconds(120),
|
||||
},
|
||||
pid =>
|
||||
{
|
||||
pid.Should().Be(_pid);
|
||||
snapshots++;
|
||||
sink.Events.Add("modules");
|
||||
return new RuntimeModuleSet(
|
||||
[new RuntimeModuleInfo("sl.interposer.dll", @"C:\Games\Title\sl.interposer.dll", "2,8,0,0", new Version(2, 8, 0, 0))],
|
||||
Snapshots: 1, Unreadable: 0);
|
||||
});
|
||||
|
||||
CaptureResult r = await loop.RunAsync(_exe, Fingerprint, "payload.dll", TestContext.Current.CancellationToken);
|
||||
|
||||
snapshots.Should().Be(sink.Published.Count + 1, "one per scan, plus the one before the last drain");
|
||||
r.RuntimeModules.Snapshots.Should().Be(snapshots);
|
||||
r.RuntimeModules.Unreadable.Should().Be(0);
|
||||
r.RuntimeModules.VersionOf("sl.interposer.dll").Should().Be(new Version(2, 8, 0, 0));
|
||||
r.RuntimeModules.Modules.Should().ContainSingle("the same module across snapshots is one entry");
|
||||
for (int i = 0; i < sink.Events.Count; i++)
|
||||
{
|
||||
if (string.Equals(sink.Events[i], "publish", StringComparison.Ordinal))
|
||||
{
|
||||
sink.Events[i + 1].Should().Be("modules", "the snapshot follows the publish directly");
|
||||
}
|
||||
}
|
||||
|
||||
sink.Events[^2].Should().Be("modules", "the final snapshot precedes the final drain");
|
||||
sink.Events[^1].Should().Be("drain");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ALoopBuiltWithoutASnapshotSourceReportsAnEmptySet()
|
||||
{
|
||||
var guard = new CountingGuard();
|
||||
using var sink = new FakeSink();
|
||||
CaptureLoop loop = Loop(await StoreWithAsync(), guard, sink);
|
||||
|
||||
CaptureResult r = await loop.RunAsync(_exe, Fingerprint, "payload.dll", TestContext.Current.CancellationToken);
|
||||
|
||||
r.RuntimeModules.Should().BeSameAs(RuntimeModuleSet.Empty);
|
||||
r.NgxDriver.Should().BeSameAs(NgxDriverState.NotRun, "no probe was given to the loop");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TheDriverProbeRidesOnTheSameTouchAsTheModuleSnapshotAndIsMergedOntoTheResult()
|
||||
{
|
||||
// The probe is out of process and answers per pid; it rides the scan's cadence exactly as the
|
||||
// module snapshot does, and a later answer that differs is reported as a CHANGE, not averaged.
|
||||
var guard = new CountingGuard();
|
||||
using var sink = new FakeSink();
|
||||
int probes = 0;
|
||||
var loop = new CaptureLoop(
|
||||
await StoreWithAsync(), new HookedCaptureGate(guard), guard, new FixedResolver(_pid, SessionEndReason.Running),
|
||||
_ => new FakeLiveness(),
|
||||
_ => (sink, ShmAttachRefusal.Ok),
|
||||
new CaptureOptions
|
||||
{
|
||||
DrainInterval = TimeSpan.FromMilliseconds(1),
|
||||
ScanInterval = TimeSpan.FromMilliseconds(5),
|
||||
AttachBudget = TimeSpan.FromMilliseconds(50),
|
||||
MaxDuration = TimeSpan.FromMilliseconds(120),
|
||||
},
|
||||
modules: null,
|
||||
ngx: pid =>
|
||||
{
|
||||
pid.Should().Be(_pid);
|
||||
probes++;
|
||||
sink.Events.Add("ngx");
|
||||
// The first reading has DLSS not yet created; every later one has it created and evaluated.
|
||||
ulong sr = probes == 1 ? NgxOverrideFlags.Initialized | NgxOverrideFlags.DllExists
|
||||
: NgxOverrideFlags.Initialized | NgxOverrideFlags.DllExists | NgxOverrideFlags.CreatedAndEvaluated;
|
||||
return NgxDriverState.Parse($"NGXSTATE status=ANSWERED sr=0x{sr:X16} rr=0x1 fg=0x5 ratio=0.0000 mode=0 preset=0 fgcount=0 fgpreset=0 fgmode=0 driver=61664");
|
||||
});
|
||||
|
||||
CaptureResult r = await loop.RunAsync(_exe, Fingerprint, "payload.dll", TestContext.Current.CancellationToken);
|
||||
|
||||
probes.Should().Be(sink.Published.Count + 1, "one per scan, plus the one before the last drain");
|
||||
r.NgxDriver.Outcome.Should().Be(NgxProbeOutcome.Answered);
|
||||
r.NgxDriver.Readings.Should().Be(probes);
|
||||
r.NgxDriver.Answered.Should().Be(probes);
|
||||
r.NgxDriver.SrCreatedAndEvaluated.Should().BeTrue("the last answered reading is the state");
|
||||
r.NgxDriver.Changed.Should().BeTrue("the first reading differed from the later ones");
|
||||
r.NgxDriver.Driver.Should().Be(61664u);
|
||||
for (int i = 0; i < sink.Events.Count; i++)
|
||||
{
|
||||
if (string.Equals(sink.Events[i], "publish", StringComparison.Ordinal))
|
||||
{
|
||||
sink.Events[i + 1].Should().Be("ngx", "the probe follows the publish directly, on the snapshot's touch");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task NoRecordRefusesConsentAndNothingIsEverInjected()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
using FluentAssertions;
|
||||
using FrameLedger.CaptureHost.Capture;
|
||||
using FrameLedger.CaptureHost.Consume;
|
||||
|
||||
namespace FrameLedger.CaptureHost.Tests.Capture;
|
||||
|
||||
/// <summary>
|
||||
/// The out-of-process probe as the loop calls it: every way it can fail is an outcome on the result, never a throw.
|
||||
/// </summary>
|
||||
public sealed class NgxDriverProbeTests
|
||||
{
|
||||
[Fact]
|
||||
public void AMissingProbeIsAnOutcomeThatNamesThePath()
|
||||
{
|
||||
NgxDriverState s = NgxDriverProbe.Run(Environment.ProcessId, @"C:\nowhere\fl-probe-nvapi.exe");
|
||||
|
||||
s.Outcome.Should().Be(NgxProbeOutcome.ProbeMissing);
|
||||
s.Detail.Should().Contain("fl-probe-nvapi.exe");
|
||||
s.SrCreatedAndEvaluated.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RunAgainstThisTestProcessNeverThrowsAndNeverClaimsAFeature()
|
||||
{
|
||||
// The real binary is staged beside the host by the project file when the native build ran
|
||||
// first (CI does; a fresh clone may not). Whichever it is, this process renders nothing
|
||||
// through NGX, so the only honest outcomes are the ones that say so.
|
||||
NgxDriverState s = NgxDriverProbe.Run(Environment.ProcessId);
|
||||
|
||||
s.Outcome.Should().BeOneOf(NgxProbeOutcome.Unanswered, NgxProbeOutcome.Degraded, NgxProbeOutcome.ProbeMissing,
|
||||
NgxProbeOutcome.ProbeFailed);
|
||||
s.SrCreatedAndEvaluated.Should().BeFalse();
|
||||
s.Readings.Should().Be(1);
|
||||
s.Describe().Should().StartWith(" NVIDIA driver NGX state");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using FluentAssertions;
|
||||
using FrameLedger.CaptureHost.Capture;
|
||||
using FrameLedger.CaptureHost.Consume;
|
||||
|
||||
namespace FrameLedger.CaptureHost.Tests.Capture;
|
||||
|
||||
/// <summary>The out-of-process module snapshot: reads a real version, never throws.</summary>
|
||||
public sealed class RuntimeModuleSnapshotTests
|
||||
{
|
||||
[Fact]
|
||||
public void TakeOnOurOwnProcessReadsKernel32sVersion()
|
||||
{
|
||||
RuntimeModuleSet set = RuntimeModuleSnapshot.Take(Environment.ProcessId, ["kernel32.dll"]);
|
||||
|
||||
set.Snapshots.Should().Be(1);
|
||||
set.Unreadable.Should().Be(0);
|
||||
set.Modules.Should().ContainSingle();
|
||||
RuntimeModuleInfo m = set.Modules[0];
|
||||
m.FileName.Should().BeEquivalentTo("kernel32.dll");
|
||||
m.Path.Should().EndWithEquivalentOf("kernel32.dll");
|
||||
m.Parsed.Should().NotBeNull("a system DLL carries a version resource");
|
||||
m.Parsed!.Major.Should().BeGreaterThanOrEqualTo(6);
|
||||
set.VersionOf("KERNEL32.DLL").Should().Be(m.Parsed);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AModuleNotInTheAskedForSetIsNotReported()
|
||||
{
|
||||
RuntimeModuleSet set = RuntimeModuleSnapshot.Take(Environment.ProcessId, ["sl.interposer.dll"]);
|
||||
|
||||
set.Unreadable.Should().Be(0);
|
||||
set.Modules.Should().BeEmpty("this test host does not load Streamline");
|
||||
set.VersionOf("sl.interposer.dll").Should().BeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TakeOnANonexistentPidIsUnreadableNotAThrow()
|
||||
{
|
||||
RuntimeModuleSet set = RuntimeModuleSnapshot.Take(int.MaxValue, ["kernel32.dll"]);
|
||||
|
||||
set.Snapshots.Should().Be(1);
|
||||
set.Unreadable.Should().Be(1);
|
||||
set.Modules.Should().BeEmpty();
|
||||
}
|
||||
}
|
||||
@@ -61,14 +61,35 @@ public sealed class TargetResolverTests : IDisposable
|
||||
SpinWait.SpinUntil(() =>
|
||||
{
|
||||
Process[] seen = Process.GetProcessesByName(name);
|
||||
int count = seen.Length;
|
||||
int count = 0;
|
||||
foreach (Process p in seen)
|
||||
{
|
||||
p.Dispose();
|
||||
try
|
||||
{
|
||||
// VISIBLE MEANS READABLE, not merely enumerated. A process can be in the
|
||||
// snapshot before its image is mapped, with MainModule null -- measured on
|
||||
// the hosted runner 2026-09-04 (OneInstanceResolves, twice in an hour): the
|
||||
// count below reached 1 and the resolver then saw a candidate with no image.
|
||||
// The resolver now counts that as unreadable rather than absent, so a test
|
||||
// that resolved at that instant would read TargetAmbiguous -- still not the
|
||||
// state under test. Wait for the state the case is about.
|
||||
if (p.MainModule?.FileName is not null)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
catch (Exception ex) when (ex is InvalidOperationException or System.ComponentModel.Win32Exception)
|
||||
{
|
||||
// Not readable yet; keep waiting.
|
||||
}
|
||||
finally
|
||||
{
|
||||
p.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
return count >= _children.Count;
|
||||
}, TimeSpan.FromSeconds(10)).Should().BeTrue("every started instance must be enumerable before resolving");
|
||||
}, TimeSpan.FromSeconds(10)).Should().BeTrue("every started instance must be enumerable AND readable before resolving");
|
||||
}
|
||||
|
||||
private int? ResolveNow(out SessionEndReason reason)
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
using System.Diagnostics;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.CaptureHost.Consume;
|
||||
using FrameLedger.Shared;
|
||||
|
||||
namespace FrameLedger.CaptureHost.Tests.Consume;
|
||||
|
||||
/// <summary>
|
||||
/// The identity half of frame generation from the tags a title sends (<c>fl_shm.h</c> §slTagCensus):
|
||||
/// <c>DlssG</c> on a present that drained a HUD-less or UI tag, combined with the COUNT by one rule —
|
||||
/// the count decides <c>none</c>, identity decides the name.
|
||||
/// </summary>
|
||||
public sealed class DlssgIdentityFromTagsTests
|
||||
{
|
||||
private const FlHookFamily _hooks =
|
||||
FlHookFamily.Present | FlHookFamily.UpscalerIdentity | FlHookFamily.UpscalerParams | FlHookFamily.FgEvaluations;
|
||||
|
||||
/// <summary>k presents per application frame; the token and the DLSS_G mark land on the first of each.</summary>
|
||||
private static List<FlFrameRecord> Stream(int appFrames, int k, bool dlssgMark)
|
||||
{
|
||||
List<FlFrameRecord> stream = [];
|
||||
ulong qpc = 1_000_000;
|
||||
long step = Stopwatch.Frequency / (60 * k);
|
||||
for (int f = 0; f < appFrames; f++)
|
||||
{
|
||||
for (int p = 0; p < k; p++)
|
||||
{
|
||||
stream.Add(new FlFrameRecord
|
||||
{
|
||||
Qpc = qpc,
|
||||
SwapchainId = 1,
|
||||
OutputW = 2560,
|
||||
OutputH = 1440,
|
||||
MeasuredMask = (ushort)(FlMeasured.OutputRes | FlMeasured.PresentArgs | FlMeasured.Upscaler
|
||||
| FlMeasured.Fg | FlMeasured.FgCounts),
|
||||
Upscaler = (byte)(p == 0 ? FlUpscaler.Dlss : FlUpscaler.Unknown),
|
||||
FgEvaluations = (byte)(p == 0 ? 1 : 0),
|
||||
FgMode = (byte)(p == 0 && dlssgMark ? FlFgMode.DlssG : FlFgMode.Unknown),
|
||||
});
|
||||
qpc += (ulong)step;
|
||||
}
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
private static uint Census(FlSlTagType global, FlSlTagType frame = FlSlTagType.None, FlSlTagType local = FlSlTagType.None) =>
|
||||
((uint)global << FlSlTagRoute.Global) | ((uint)frame << FlSlTagRoute.Frame) | ((uint)local << FlSlTagRoute.Local);
|
||||
|
||||
private static (MeasuredFacts Facts, string Text) Render(List<FlFrameRecord> stream, FlRuntimeCensus census,
|
||||
uint tagCensus, RuntimeModuleSet? modules = null)
|
||||
{
|
||||
var writer = new FlWriterState
|
||||
{
|
||||
HooksInstalledMask = (uint)_hooks,
|
||||
RuntimeCensus = (uint)census,
|
||||
SlTagCensus = tagCensus,
|
||||
};
|
||||
MeasuredFacts facts = MeasuredFacts.From(stream, writer, Stopwatch.Frequency, 0, 0,
|
||||
FgWindow.From(stream, Stopwatch.Frequency), modules);
|
||||
return (facts, SessionReport.Render(facts));
|
||||
}
|
||||
|
||||
private const FlSlTagType _dlssgList =
|
||||
FlSlTagType.Depth | FlSlTagType.MotionVectors | FlSlTagType.ScalingInput | FlSlTagType.Hudless | FlSlTagType.UiColorAlpha;
|
||||
|
||||
[Fact]
|
||||
public void AnActiveCountBesideTheDlssgMarkIsNamedDlssG()
|
||||
{
|
||||
// Cyberpunk at MFG x3, Hell Is Us / Expedition 33 / Wukong at x4: the count was right and the
|
||||
// technology unnamed on every one, because kFeatureDLSS_G is never evaluated. With the
|
||||
// HUD-less / UI tags marking the drained present, the trio names it.
|
||||
(MeasuredFacts facts, string text) = Render(Stream(100, 4, dlssgMark: true),
|
||||
FlRuntimeCensus.Ran | FlRuntimeCensus.SlInterposer | FlRuntimeCensus.NvngxDlssG, Census(_dlssgList));
|
||||
|
||||
facts.Fg!.IsActive.Should().BeTrue();
|
||||
facts.DlssgInputsTagged.Should().BeTrue();
|
||||
facts.FgMode.Should().Be("DlssG");
|
||||
text.Should().Contain("Native FPS").And.Contain("x4 FG");
|
||||
text.Should().Contain("frame generation: DlssG");
|
||||
text.Should().NotContain("technology not identified");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ACountedNoneBesideTheDlssgMarkIsStillNoneWithTheInputsNoted()
|
||||
{
|
||||
// A title may tag the DLSS-G inputs with frame generation switched off in its menu — the
|
||||
// mark is "feeding", not "generating". The count decides none; the identity is noted, never
|
||||
// promoted to DlssG, and no factor prints.
|
||||
(MeasuredFacts facts, string text) = Render(Stream(200, 1, dlssgMark: true),
|
||||
FlRuntimeCensus.Ran | FlRuntimeCensus.SlInterposer | FlRuntimeCensus.NvngxDlssG, Census(_dlssgList));
|
||||
|
||||
facts.Fg!.IsNone.Should().BeTrue();
|
||||
facts.FgMode.Should().Be(MeasuredFacts.FgNoneInputsTagged);
|
||||
text.Should().Contain(" FPS: ").And.Contain("frame generation: none");
|
||||
text.Should().Contain("DLSS-G inputs were tagged");
|
||||
text.Should().NotContain("frame generation: DlssG");
|
||||
text.Should().NotContain("Native FPS");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ACountedNoneWithoutTheMarkIsPlainNone()
|
||||
{
|
||||
(MeasuredFacts facts, string text) = Render(Stream(200, 1, dlssgMark: false),
|
||||
FlRuntimeCensus.Ran | FlRuntimeCensus.SlInterposer | FlRuntimeCensus.NvngxDlssG,
|
||||
Census(FlSlTagType.ScalingInput | FlSlTagType.Depth | FlSlTagType.MotionVectors));
|
||||
|
||||
facts.DlssgInputsTagged.Should().BeFalse();
|
||||
facts.FgMode.Should().Be(MeasuredFacts.FgNone);
|
||||
text.Should().Contain("frame generation: None").And.NotContain("DLSS-G inputs were tagged");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheWithheldShapeKeepsItsNAAndSaysTheInputsWereFed()
|
||||
{
|
||||
// Dying Light: The Beast: the count is blind to the generated presents (§H5), so `none` is
|
||||
// withheld; the tags say the title is feeding DLSS-G, which strengthens the qualifier without
|
||||
// becoming a count.
|
||||
var interposer = new RuntimeModuleSet(
|
||||
[new RuntimeModuleInfo("sl.interposer.dll", @"D:\Games\dltb\sl.interposer.dll", "2,8,0,0", new Version(2, 8, 0, 0))],
|
||||
Snapshots: 1, Unreadable: 0);
|
||||
(MeasuredFacts facts, string text) = Render(Stream(200, 1, dlssgMark: true),
|
||||
FlRuntimeCensus.Ran | FlRuntimeCensus.SlInterposer | FlRuntimeCensus.SlDlss | FlRuntimeCensus.SlDlssG
|
||||
| FlRuntimeCensus.NvngxDlssG,
|
||||
Census(FlSlTagType.None, frame: _dlssgList), interposer);
|
||||
|
||||
facts.NoneWithheld.Should().NotBeNull();
|
||||
facts.FgMode.Should().StartWith(MeasuredFacts.FgNoneWithheldPrefix);
|
||||
text.Should().Contain("Presented FPS:").And.Contain("WITHHELD");
|
||||
text.Should().Contain("FEEDING frame generation");
|
||||
text.Should().NotContain("frame generation: DlssG");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FsrFgIdentityKeepsPrecedenceOverTheCount()
|
||||
{
|
||||
// A drained FRAMEGENERATION dispatch is a generated batch — a fact about generation, which
|
||||
// the tag mark is not. The pre-existing precedence is unchanged.
|
||||
List<FlFrameRecord> stream = Stream(100, 2, dlssgMark: false);
|
||||
for (int i = 0; i < stream.Count; i += 2)
|
||||
{
|
||||
FlFrameRecord r = stream[i];
|
||||
r.FgMode = (byte)FlFgMode.FsrFg;
|
||||
stream[i] = r;
|
||||
}
|
||||
|
||||
(MeasuredFacts facts, _) = Render(stream, FlRuntimeCensus.Ran | FlRuntimeCensus.AmdFfxDx12, 0);
|
||||
|
||||
facts.FgMode.Should().Be("FsrFg");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheCensusLineNamesEveryTypeOnEveryRoute()
|
||||
{
|
||||
uint census = Census(FlSlTagType.Hudless | FlSlTagType.UiAlpha, frame: FlSlTagType.ScalingInput,
|
||||
local: FlSlTagType.Depth | FlSlTagType.Other);
|
||||
|
||||
string line = SlTagCensusNames.DescribeRoutes(census);
|
||||
|
||||
line.Should().Be("global=[hudless, ui-alpha] frame=[scaling-in] local=[depth, other]");
|
||||
SlTagCensusNames.DescribeRoutes(0).Should().Be("global=[-] frame=[-] local=[-]");
|
||||
FlSlTagRoute.Any(census).Should().HaveFlag(FlSlTagType.DlssgInputs & FlSlTagType.Hudless);
|
||||
(FlSlTagRoute.Any(Census(FlSlTagType.Depth)) & FlSlTagType.DlssgInputs).Should().Be(FlSlTagType.None);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
using System.Diagnostics;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.CaptureHost.Consume;
|
||||
using FrameLedger.Shared;
|
||||
|
||||
namespace FrameLedger.CaptureHost.Tests.Consume;
|
||||
|
||||
/// <summary>
|
||||
/// The driver's FG word beside the <c>frame generation:</c> line (corrected 2026-09-06: it follows DLSS-G once the
|
||||
/// feature exists), and the qualifier a counted-but-refused session prints.
|
||||
/// </summary>
|
||||
public sealed class DriverReportedFrameGenerationTests
|
||||
{
|
||||
private const FlHookFamily _hooks =
|
||||
FlHookFamily.Present | FlHookFamily.UpscalerIdentity | FlHookFamily.UpscalerParams | FlHookFamily.FgEvaluations;
|
||||
|
||||
private static readonly NgxDriverState _fgCreated = NgxDriverState.Parse(
|
||||
"NGXSTATE status=ANSWERED sr=0x605 rr=0x5 fg=0x605 ratio=0.0000 mode=0 preset=0 fgcount=0 fgpreset=0 fgmode=0 driver=61664");
|
||||
|
||||
private static readonly NgxDriverState _fgNotCreated = NgxDriverState.Parse(
|
||||
"NGXSTATE status=ANSWERED sr=0x605 rr=0x5 fg=0x5 ratio=0.0000 mode=0 preset=0 fgcount=0 fgpreset=0 fgmode=0 driver=61664");
|
||||
|
||||
/// <summary>k hooked presents per application frame; the token on the first; DLSS-G marked on it when tagged.</summary>
|
||||
private static List<FlFrameRecord> Stream(int appFrames, int k, bool tagged, byte unseenFrom = 0, int unseenAfter = int.MaxValue)
|
||||
{
|
||||
List<FlFrameRecord> stream = [];
|
||||
ulong qpc = 1_000_000;
|
||||
ulong step = (ulong)(Stopwatch.Frequency / (60 * k));
|
||||
for (int f = 0; f < appFrames; f++)
|
||||
{
|
||||
for (int p = 0; p < k; p++)
|
||||
{
|
||||
bool first = p == 0;
|
||||
stream.Add(new FlFrameRecord
|
||||
{
|
||||
Qpc = qpc,
|
||||
SwapchainId = 1,
|
||||
OutputW = 2560,
|
||||
OutputH = 1440,
|
||||
MeasuredMask = (ushort)(FlMeasured.OutputRes | FlMeasured.PresentArgs | FlMeasured.Upscaler
|
||||
| FlMeasured.Fg | FlMeasured.FgCounts | FlMeasured.DxgiPresents),
|
||||
Upscaler = (byte)(first ? FlUpscaler.Dlss : FlUpscaler.Unknown),
|
||||
FgEvaluations = (byte)(first ? 1 : 0),
|
||||
FgMode = (byte)(first && tagged ? FlFgMode.DlssG : FlFgMode.Unknown),
|
||||
DxgiUnseen = f >= unseenAfter ? unseenFrom : (byte)0,
|
||||
});
|
||||
qpc += step;
|
||||
}
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
private static (MeasuredFacts Facts, string Text) Render(List<FlFrameRecord> stream, NgxDriverState ngx)
|
||||
{
|
||||
var writer = new FlWriterState
|
||||
{
|
||||
HooksInstalledMask = (uint)_hooks,
|
||||
RuntimeCensus = (uint)(FlRuntimeCensus.Ran | FlRuntimeCensus.SlInterposer | FlRuntimeCensus.NvngxDlssG),
|
||||
DxgiPresentSamples = (uint)stream.Count,
|
||||
};
|
||||
MeasuredFacts facts = MeasuredFacts.From(stream, writer, Stopwatch.Frequency, 0, 0,
|
||||
FgWindow.From(stream, Stopwatch.Frequency), ngx: ngx);
|
||||
return (facts, SessionReport.Render(facts));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ATaggedDlssGBesideTheDriversCreatedWordPrintsAgreement()
|
||||
{
|
||||
(MeasuredFacts facts, string text) = Render(Stream(100, 4, tagged: true), _fgCreated);
|
||||
|
||||
facts.FgMode.Should().Be("DlssG");
|
||||
facts.FgModePrinted.Should().Be("DlssG");
|
||||
text.Should().Contain("frame generation: DlssG — the NVIDIA driver agrees: an NGX frame-generation feature");
|
||||
text.Should().Contain("(x4 FG)");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AnActiveCountWithNoTagAndTheDriversCreatedWordIsDlssGDriverReported()
|
||||
{
|
||||
(MeasuredFacts facts, string text) = Render(Stream(100, 4, tagged: false), _fgCreated);
|
||||
|
||||
facts.FgMode.Should().Be(MeasuredFacts.FgActiveUnidentified, "no tag named the technology");
|
||||
facts.FgModePrinted.Should().Be(MeasuredFacts.FgDlssGDriverReported, "the driver did, as identity only");
|
||||
text.Should().Contain("frame generation: DlssG (driver-reported:");
|
||||
text.Should().Contain("(x4 FG)", "the count is the record and is not changed by the driver");
|
||||
text.Should().NotContain("technology not identified");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ATaggedDlssGBesideTheDriversNegativeIsADisagreementPrintedNotResolved()
|
||||
{
|
||||
(_, string text) = Render(Stream(100, 4, tagged: true), _fgNotCreated);
|
||||
|
||||
text.Should().Contain("frame generation: DlssG — WARNING: the NVIDIA driver reports NO NGX frame-generation feature");
|
||||
text.Should().Contain("printed rather than resolved");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ACountedNoneBesideTheDriversCreatedWordPrintsTheFactAndKeepsTheCount()
|
||||
{
|
||||
(MeasuredFacts facts, string text) = Render(Stream(200, 1, tagged: false), _fgCreated);
|
||||
|
||||
facts.FgMode.Should().Be(MeasuredFacts.FgNone);
|
||||
facts.FgModePrinted.Should().Be(MeasuredFacts.FgNone, "the count decides none; the driver's word is identity only");
|
||||
text.Should().Contain("frame generation: None — the NVIDIA driver reports an NGX frame-generation feature created and evaluated");
|
||||
text.Should().Contain("the count above is the record and is not changed by it");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WithoutAnAnswerTheFgLineIsByteIdenticalToBefore()
|
||||
{
|
||||
(_, string text) = Render(Stream(100, 4, tagged: false), NgxDriverState.NotRun);
|
||||
|
||||
text.Should().Contain("frame generation: " + MeasuredFacts.FgActiveUnidentified);
|
||||
text.Should().NotContain("NVIDIA driver");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ACountedSessionWhoseFactorWasRefusedSaysSoInsteadOfNoEvaluationObserved()
|
||||
{
|
||||
// DL:TB at FSR + DLSS-G, 2026-09-06: tokens counted, DXGI-counted presents, the pacer stopping
|
||||
// in the last eighth. The factor is refused (uniformity), and the qualifier must say that.
|
||||
List<FlFrameRecord> s = Stream(400, 1, tagged: true, unseenFrom: 3, unseenAfter: 200);
|
||||
|
||||
(MeasuredFacts facts, string text) = Render(s, _fgCreated);
|
||||
|
||||
facts.Fg!.Refusal.Should().Contain("changed during the session");
|
||||
text.Should().Contain("Presented FPS:");
|
||||
text.Should().Contain("WARNING: frame generation was counted (400 application-frame token(s), and DXGI counted 600 present(s) this hook never saw, so the Displayed rate is ABOVE this number) and its factor is REFUSED");
|
||||
text.Should().Contain("read it as neither Native nor Displayed");
|
||||
text.Should().NotContain("no evaluation was observed");
|
||||
text.Should().Contain("no FG factor: the frame-generation state changed during the session");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
using System.Diagnostics;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.CaptureHost.Consume;
|
||||
using FrameLedger.Shared;
|
||||
|
||||
namespace FrameLedger.CaptureHost.Tests.Consume;
|
||||
|
||||
/// <summary>
|
||||
/// <c>03_METRICS</c> §Upscaling, the driver-reported rung: the driver's word names DLSS only where no hook did,
|
||||
/// stands beside a hook's name as agreement or a printed disagreement, and never claims more than an identity.
|
||||
/// </summary>
|
||||
public sealed class DriverReportedUpscalerTests
|
||||
{
|
||||
private const FlHookFamily _hooks =
|
||||
FlHookFamily.Present | FlHookFamily.UpscalerIdentity | FlHookFamily.UpscalerParams | FlHookFamily.FgEvaluations;
|
||||
|
||||
private static readonly NgxDriverState _created = NgxDriverState.Parse(
|
||||
"NGXSTATE status=ANSWERED sr=0x605 rr=0x90001 fg=0x90001 ratio=0.0000 mode=0 preset=0 fgcount=0 fgpreset=0 fgmode=0 driver=61664");
|
||||
|
||||
private static readonly NgxDriverState _notCreated = NgxDriverState.Parse(
|
||||
"NGXSTATE status=ANSWERED sr=0x5 rr=0x1 fg=0x1 ratio=0.0000 mode=0 preset=0 fgcount=0 fgpreset=0 fgmode=0 driver=61664");
|
||||
|
||||
/// <summary>Records with, or without, a hooked upscaler identity; the hook family is installed either way.</summary>
|
||||
private static List<FlFrameRecord> Stream(FlUpscaler identity)
|
||||
{
|
||||
List<FlFrameRecord> stream = [];
|
||||
ulong qpc = 1_000_000;
|
||||
ulong step = (ulong)(Stopwatch.Frequency / 60);
|
||||
for (int f = 0; f < 120; f++)
|
||||
{
|
||||
stream.Add(new FlFrameRecord
|
||||
{
|
||||
Qpc = qpc,
|
||||
SwapchainId = 1,
|
||||
OutputW = 2560,
|
||||
OutputH = 1440,
|
||||
MeasuredMask = (ushort)(FlMeasured.OutputRes | FlMeasured.PresentArgs | FlMeasured.Upscaler),
|
||||
Upscaler = (byte)identity,
|
||||
});
|
||||
qpc += step;
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
private static (MeasuredFacts Facts, string Text) Render(FlUpscaler identity, NgxDriverState? ngx)
|
||||
{
|
||||
List<FlFrameRecord> stream = Stream(identity);
|
||||
var writer = new FlWriterState { HooksInstalledMask = (uint)_hooks, RuntimeCensus = (uint)FlRuntimeCensus.Ran };
|
||||
MeasuredFacts facts = MeasuredFacts.From(stream, writer, Stopwatch.Frequency, 0, 0, ngx: ngx);
|
||||
return (facts, SessionReport.Render(facts));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LiesOfPShapeNoHookNamedAnUpscalerAndTheDriverSaysCreatedIsDlssDriverReported()
|
||||
{
|
||||
(MeasuredFacts facts, string text) = Render(FlUpscaler.Unknown, _created);
|
||||
|
||||
facts.Upscaler.Should().BeNull("the hook ran and decoded nothing on an NGX-direct title");
|
||||
facts.UpscalerDriverReported.Should().Be(MeasuredFacts.UpscalerDlssDriverReported);
|
||||
facts.UpscalerDriverNote.Should().BeNull("the identity line already carries the attribution");
|
||||
text.Should().Contain("upscaler: Dlss (driver-reported:");
|
||||
text.Should().Contain("not counted by this hook");
|
||||
text.Should().NotContain("upscaler: N/A");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AHookedDlssBesideTheDriversCreatedWordPrintsAgreement()
|
||||
{
|
||||
(MeasuredFacts facts, string text) = Render(FlUpscaler.Dlss, _created);
|
||||
|
||||
facts.Upscaler.Should().Be("Dlss");
|
||||
facts.UpscalerDriverReported.Should().BeNull("a hook's name always outranks the driver's word");
|
||||
text.Should().Contain("upscaler: Dlss — the NVIDIA driver agrees");
|
||||
text.Should().NotContain("driver-reported:");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AHookedDlssBesideTheDriversNegativeIsADisagreementPrintedNotResolved()
|
||||
{
|
||||
(MeasuredFacts facts, string text) = Render(FlUpscaler.Dlss, _notCreated);
|
||||
|
||||
facts.Upscaler.Should().Be("Dlss");
|
||||
text.Should().Contain("upscaler: Dlss — WARNING: the NVIDIA driver reports NO NGX super-resolution feature created");
|
||||
text.Should().Contain("printed rather than resolved");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NoHookNameAndTheDriversNegativeKeepsNaWithTheNegativeAttributed()
|
||||
{
|
||||
(MeasuredFacts facts, string text) = Render(FlUpscaler.Unknown, _notCreated);
|
||||
|
||||
facts.UpscalerDriverReported.Should().BeNull();
|
||||
text.Should().Contain("upscaler: N/A (an upscaler hook ran");
|
||||
text.Should().Contain("— the NVIDIA driver reports no NGX super-resolution feature created in this process (driver-reported; it says nothing about FSR or XeSS)");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AnFsrIdentityBesideTheDriversCreatedWordIsPrintedAsAlso()
|
||||
{
|
||||
(_, string text) = Render(FlUpscaler.Fsr3, _created);
|
||||
|
||||
text.Should().Contain("upscaler: Fsr3 — the NVIDIA driver also reports an NGX super-resolution feature");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WithoutAProbeOrWithoutAnAnswerTheLineIsByteIdenticalToBefore()
|
||||
{
|
||||
(_, string none) = Render(FlUpscaler.Unknown, null);
|
||||
(_, string unanswered) = Render(FlUpscaler.Unknown, NgxDriverState.Parse("NGXSTATE status=UNANSWERED nvapi=-160"));
|
||||
(_, string missing) = Render(FlUpscaler.Unknown, NgxDriverState.Of(NgxProbeOutcome.ProbeMissing, @"C:\nowhere\fl-probe-nvapi.exe"));
|
||||
|
||||
foreach (string text in new[] { none, unanswered, missing })
|
||||
{
|
||||
text.Should().Contain("upscaler: N/A (an upscaler hook ran");
|
||||
text.Should().NotContain("NVIDIA driver");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
using System.Diagnostics;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.CaptureHost.Consume;
|
||||
using FrameLedger.Shared;
|
||||
|
||||
namespace FrameLedger.CaptureHost.Tests.Consume;
|
||||
|
||||
/// <summary>
|
||||
/// Displayed counted by DXGI (<c>FlFrameRecord.dxgiUnseen</c>, <c>20_OPEN_QUESTIONS</c> §H5 row P1-DXGI): on
|
||||
/// Dying Light: The Beast (Streamline 2.8.0, DLSS FG ×4) the hook timed one present per application frame
|
||||
/// while DXGI's own counter on the same chain moved by ≈ 3.9 — so the window counts
|
||||
/// <c>Displayed = hooked + unseen</c>, says so on its own line, and every other title is byte-identical.
|
||||
/// </summary>
|
||||
public sealed class DxgiCountedWindowTests
|
||||
{
|
||||
private const FlHookFamily _hooks =
|
||||
FlHookFamily.Present | FlHookFamily.UpscalerIdentity | FlHookFamily.UpscalerParams | FlHookFamily.FgEvaluations;
|
||||
|
||||
private const FlRuntimeCensus _dyingLightAtDlss = FlRuntimeCensus.Ran | FlRuntimeCensus.SlInterposer
|
||||
| FlRuntimeCensus.SlDlss | FlRuntimeCensus.SlDlssG
|
||||
| FlRuntimeCensus.NvngxDlssG;
|
||||
|
||||
private static readonly long _step = Stopwatch.Frequency / 70;
|
||||
|
||||
/// <summary>
|
||||
/// The DL:TB shape: one hooked present per application frame (token drained, DLSS-G identity from the
|
||||
/// tags), each carrying <paramref name="unseen"/> DXGI-counted presents under the bit, or under no bit
|
||||
/// when <paramref name="claim"/> is false.
|
||||
/// </summary>
|
||||
private static List<FlFrameRecord> Stream(int appFrames, byte unseen, bool claim = true, int from = 0, int to = int.MaxValue)
|
||||
{
|
||||
List<FlFrameRecord> stream = [];
|
||||
ulong qpc = 1_000_000;
|
||||
for (int f = 0; f < appFrames; f++)
|
||||
{
|
||||
bool inRange = f >= from && f < to;
|
||||
byte u = inRange ? unseen : (byte)0;
|
||||
stream.Add(new FlFrameRecord
|
||||
{
|
||||
Qpc = qpc,
|
||||
SwapchainId = 1,
|
||||
OutputW = 2560,
|
||||
OutputH = 1440,
|
||||
MeasuredMask = (ushort)(FlMeasured.OutputRes | FlMeasured.PresentArgs | FlMeasured.Upscaler
|
||||
| FlMeasured.Fg | FlMeasured.FgCounts
|
||||
| (claim ? FlMeasured.DxgiPresents : FlMeasured.None)),
|
||||
Upscaler = (byte)FlUpscaler.Dlss,
|
||||
FgEvaluations = 1,
|
||||
FgMode = (byte)FlFgMode.DlssG,
|
||||
FeatureFlags = (byte)FlFeatureFlags.RayReconstructionObserved,
|
||||
DxgiUnseen = u,
|
||||
});
|
||||
qpc += (ulong)_step;
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
private static RuntimeModuleSet Interposer(string version) => new(
|
||||
[new RuntimeModuleInfo("sl.interposer.dll", @"D:\Games\title\sl.interposer.dll", version.Replace('.', ','),
|
||||
Version.Parse(version))],
|
||||
Snapshots: 1, Unreadable: 0);
|
||||
|
||||
private static (MeasuredFacts Facts, string Text) Render(List<FlFrameRecord> stream, uint unseenTotal, uint samples)
|
||||
{
|
||||
var writer = new FlWriterState
|
||||
{
|
||||
HooksInstalledMask = (uint)_hooks,
|
||||
RuntimeCensus = (uint)_dyingLightAtDlss,
|
||||
DxgiPresentsUnseen = unseenTotal,
|
||||
DxgiPresentSamples = samples,
|
||||
};
|
||||
MeasuredFacts facts = MeasuredFacts.From(stream, writer, Stopwatch.Frequency, 0, 0,
|
||||
FgWindow.From(stream, Stopwatch.Frequency), Interposer("2.8.0.0"));
|
||||
return (facts, SessionReport.Render(facts));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ThreeUnseenPerHookedPresentMakesAFourTimesTrioLabelledDxgiCounted()
|
||||
{
|
||||
List<FlFrameRecord> s = Stream(200, unseen: 3);
|
||||
|
||||
(MeasuredFacts facts, string text) = Render(s, unseenTotal: 600, samples: 200);
|
||||
FgWindow w = facts.Fg!;
|
||||
|
||||
w.Presents.Should().Be(200);
|
||||
w.DxgiUnseen.Should().Be(600);
|
||||
w.DxgiClaiming.Should().Be(200);
|
||||
w.DisplayedPresents.Should().Be(800);
|
||||
w.DxgiCounted.Should().BeTrue();
|
||||
w.Refusal.Should().BeNull();
|
||||
w.Factor.Should().BeApproximately(4.0, 0.001);
|
||||
w.IsActive.Should().BeTrue();
|
||||
w.PresentsPerBatch.Should().BeApproximately(4.0, 0.001);
|
||||
(w.DisplayedFps / w.NativeFps).Should().BeApproximately(4.0, 0.03, "Native × factor ≈ Displayed over ONE window");
|
||||
|
||||
facts.NoneWithheld.Should().BeNull("the count is no longer 1.0, so there is nothing to withhold");
|
||||
facts.FgMode.Should().Be("DlssG");
|
||||
text.Should().Contain("Native FPS:").And.Contain("-> Displayed FPS:").And.Contain("(x4 FG)");
|
||||
text.Should().Contain("over 800 present(s)");
|
||||
text.Should().Contain("Displayed is DXGI-COUNTED: 600 of those present(s)");
|
||||
text.Should().Contain("a count DXGI made, not this hook");
|
||||
text.Should().Contain("dxgi-unseen=600");
|
||||
text.Should().NotContain("WITHHELD").And.NotContain("Presented FPS:");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ZeroUnseenEverywhereIsByteIdenticalToTheWindowBeforeTheByteExisted()
|
||||
{
|
||||
List<FlFrameRecord> claimed = Stream(200, unseen: 0);
|
||||
List<FlFrameRecord> unclaimed = Stream(200, unseen: 0, claim: false);
|
||||
|
||||
FgWindow a = FgWindow.From(claimed, Stopwatch.Frequency);
|
||||
FgWindow b = FgWindow.From(unclaimed, Stopwatch.Frequency);
|
||||
|
||||
a.DxgiCounted.Should().BeFalse();
|
||||
a.DxgiClaiming.Should().Be(200);
|
||||
b.DxgiClaiming.Should().Be(0);
|
||||
a.DisplayedPresents.Should().Be(200);
|
||||
a.Factor.Should().Be(b.Factor);
|
||||
a.DisplayedFps.Should().Be(b.DisplayedFps);
|
||||
a.BucketFactors.Should().Equal(b.BucketFactors);
|
||||
|
||||
// And the DL:TB shape with the count at 1.0 beside a READ counter is `none` since Leg 0: DXGI itself
|
||||
// counted nothing this hook did not, on the chain where the 2.8.0 pacer's presents would show.
|
||||
(MeasuredFacts facts, string text) = Render(claimed, unseenTotal: 0, samples: 200);
|
||||
facts.NoneWithheld.Should().BeNull();
|
||||
text.Should().Contain("frame generation: none").And.Contain("DXGI's own present counter agrees")
|
||||
.And.NotContain("WITHHELD").And.NotContain("DXGI-COUNTED");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void APacerThatStopsHalfWayFailsUniformityLikeAnyOtherStateChange()
|
||||
{
|
||||
List<FlFrameRecord> s = Stream(400, unseen: 3, from: 0, to: 200);
|
||||
|
||||
FgWindow w = FgWindow.From(s, Stopwatch.Frequency);
|
||||
|
||||
w.DxgiUnseen.Should().Be(600);
|
||||
w.Refusal.Should().Contain("changed during the session");
|
||||
w.Factor.Should().BeNull();
|
||||
w.BatchRefusal.Should().Contain("changed during the session", "presents/batch takes the same numerator");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ASaturatedByteIsASentinelAndTheFactorIsRefused()
|
||||
{
|
||||
List<FlFrameRecord> s = Stream(200, unseen: 3);
|
||||
FlFrameRecord r = s[100];
|
||||
r.DxgiUnseen = byte.MaxValue;
|
||||
s[100] = r;
|
||||
|
||||
FgWindow w = FgWindow.From(s, Stopwatch.Frequency);
|
||||
|
||||
w.DxgiSaturated.Should().Be(1);
|
||||
w.Refusal.Should().Contain("255");
|
||||
w.Factor.Should().BeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AByteUnderAClearBitIsNobodysCountAndAnHonestyViolation()
|
||||
{
|
||||
List<FlFrameRecord> s = Stream(200, unseen: 3, claim: false);
|
||||
|
||||
(MeasuredFacts facts, _) = Render(s, unseenTotal: 0, samples: 0);
|
||||
|
||||
facts.Fg!.DxgiUnseen.Should().Be(0, "an unclaimed byte is not read");
|
||||
facts.Fg.Factor.Should().BeApproximately(1.0, 0.001);
|
||||
facts.HonestyViolations.Should().Be(200);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
using System.Diagnostics;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.CaptureHost.Consume;
|
||||
using FrameLedger.Shared;
|
||||
|
||||
namespace FrameLedger.CaptureHost.Tests.Consume;
|
||||
|
||||
/// <summary>
|
||||
/// DXGI's own present counter in the writer state (<c>FlWriterState.dxgiPresentsUnseen / dxgiPresentSamples</c>,
|
||||
/// <c>20_OPEN_QUESTIONS</c> §H5 A1.7) beside a counted <c>none</c>: since Leg 0 (2026-09-06) a READ counter
|
||||
/// decides the Streamline 2.8.0 shape, and on every shape it is a second witness printed beside the count.
|
||||
/// </summary>
|
||||
public sealed class DxgiPresentCounterTests
|
||||
{
|
||||
private const FlHookFamily _countingHooks =
|
||||
FlHookFamily.Present | FlHookFamily.UpscalerIdentity | FlHookFamily.FgEvaluations;
|
||||
|
||||
private const FlRuntimeCensus _dyingLightAtDlss = FlRuntimeCensus.Ran | FlRuntimeCensus.SlInterposer
|
||||
| FlRuntimeCensus.SlDlss | FlRuntimeCensus.SlDlssG
|
||||
| FlRuntimeCensus.NvngxDlssG;
|
||||
|
||||
private static List<FlFrameRecord> Stream(int appFrames)
|
||||
{
|
||||
List<FlFrameRecord> stream = [];
|
||||
ulong qpc = 1_000_000;
|
||||
ulong step = (ulong)(Stopwatch.Frequency / 60);
|
||||
for (int f = 0; f < appFrames; f++)
|
||||
{
|
||||
stream.Add(new FlFrameRecord
|
||||
{
|
||||
Qpc = qpc,
|
||||
SwapchainId = 1,
|
||||
MeasuredMask = (ushort)(FlMeasured.OutputRes | FlMeasured.PresentArgs | FlMeasured.Fg | FlMeasured.FgCounts),
|
||||
FgEvaluations = 1,
|
||||
FgMode = (byte)FlFgMode.Unknown,
|
||||
});
|
||||
qpc += step;
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
private static RuntimeModuleSet Interposer(string version) => new(
|
||||
[new RuntimeModuleInfo("sl.interposer.dll", @"D:\Games\title\sl.interposer.dll", version.Replace('.', ','),
|
||||
Version.Parse(version))],
|
||||
Snapshots: 1, Unreadable: 0);
|
||||
|
||||
private static (MeasuredFacts Facts, string Text) Render(FlRuntimeCensus census, RuntimeModuleSet? modules,
|
||||
uint unseen, uint samples)
|
||||
{
|
||||
List<FlFrameRecord> stream = Stream(200);
|
||||
var writer = new FlWriterState
|
||||
{
|
||||
HooksInstalledMask = (uint)_countingHooks,
|
||||
RuntimeCensus = (uint)census,
|
||||
DxgiPresentsUnseen = unseen,
|
||||
DxgiPresentSamples = samples,
|
||||
};
|
||||
MeasuredFacts facts = MeasuredFacts.From(stream, writer, Stopwatch.Frequency, 0, 0,
|
||||
FgWindow.From(stream, Stopwatch.Frequency), modules);
|
||||
return (facts, SessionReport.Render(facts));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ZeroUnseenOverAReadCounterOnTheStreamline28ShapeIsNoneWithDxgiAgreeing()
|
||||
{
|
||||
(MeasuredFacts facts, string text) = Render(_dyingLightAtDlss, Interposer("2.8.0.0"), unseen: 0, samples: 200);
|
||||
|
||||
facts.DxgiUnseenPerHookedPresent.Should().Be(0.0);
|
||||
facts.NoneWithheld.Should().BeNull();
|
||||
facts.FgMode.Should().Be(MeasuredFacts.FgNone);
|
||||
text.Should().Contain("frame generation: none");
|
||||
text.Should().Contain("DXGI's own present counter agrees: 0 unseen over 200 hooked present(s)");
|
||||
text.Should().NotContain("WITHHELD");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ACounterNeverReadStillWithholdsAndSaysSo()
|
||||
{
|
||||
(MeasuredFacts facts, string text) = Render(_dyingLightAtDlss, Interposer("2.8.0.0"), unseen: 0, samples: 0);
|
||||
|
||||
facts.DxgiUnseenPerHookedPresent.Should().BeNull("no hooked present read the counter");
|
||||
facts.NoneWithheld.Should().Contain("was not read this session");
|
||||
facts.NoneBesideDxgi.Should().BeNull();
|
||||
text.Should().Contain("`none` is WITHHELD");
|
||||
text.Should().NotContain("DXGI's own present counter");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UnseenPresentsInTheWriterStateButNotInTheRecordsIsAContradictionNotANone()
|
||||
{
|
||||
// The two words come from the same writer, so a total the records do not carry is a defect;
|
||||
// it is refused rather than read as either `none` or a factor.
|
||||
(MeasuredFacts facts, string text) = Render(_dyingLightAtDlss, Interposer("2.8.0.0"), unseen: 600, samples: 200);
|
||||
|
||||
facts.DxgiUnseenPerHookedPresent.Should().BeApproximately(3.0, 0.001);
|
||||
facts.NoneWithheld.Should().Contain("disagree").And.Contain("600");
|
||||
text.Should().Contain("`none` is WITHHELD");
|
||||
text.Should().NotContain("frame generation: none");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AValidatedNoneOnStreamline27PrintsTheCounterAsASecondWitness()
|
||||
{
|
||||
(MeasuredFacts facts, string text) = Render(FlRuntimeCensus.Ran | FlRuntimeCensus.SlInterposer | FlRuntimeCensus.NvngxDlssG,
|
||||
Interposer("2.7.1.0"), unseen: 7, samples: 200);
|
||||
|
||||
facts.NoneWithheld.Should().BeNull();
|
||||
facts.FgMode.Should().Be(MeasuredFacts.FgNone);
|
||||
text.Should().Contain("frame generation: none");
|
||||
text.Should().Contain("DXGI's own present counter read 7 unseen over 200 hooked present(s), inside the `none` ceiling");
|
||||
}
|
||||
}
|
||||
@@ -162,7 +162,35 @@ public sealed class FfxReportTests
|
||||
FfxCensus c = FfxCensus.From(stream);
|
||||
|
||||
c.SawAnything.Should().BeFalse();
|
||||
c.Describe().Should().Contain("no UPSCALE or FRAMEGENERATION dispatch reached an ffx-api leaf");
|
||||
c.Describe().Should().Contain("no UPSCALE or FRAMEGENERATION dispatch reached an ffx-api leaf or the FSR 3.0 host facade");
|
||||
FfxCensus.From([]).Describe().Should().Contain("no record claimed FL_MEASURED_UPSCALER");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CyberpunkAtFsr3PrintsFsr3IdentityFromTheHostRouteBesideTheMonolithsFrameGeneration()
|
||||
{
|
||||
// Cyberpunk 2077's measured shape (2026-09-04, §H11): the FSR 3.0 HOST DLL upscales through its
|
||||
// named export while the 1.1.x monolith generates through ffxDispatch. The writer's records are
|
||||
// the same shape as any FSR route's -- identity FSR3 on the present that drained the host's
|
||||
// UPSCALE, FsrFg on the one that drained the monolith's FRAMEGENERATION -- and the report
|
||||
// prints the trio at ×2 with no WARNING. Before the host row this title printed `upscaler: N/A`.
|
||||
List<FlFrameRecord> stream = FfxStream(frames: 50, k: 2, FlUpscaler.Fsr3, fgDispatch: true);
|
||||
|
||||
(MeasuredFacts facts, string text) = Render(stream, Writer(FlRuntimeCensus.FfxFsr3 | FlRuntimeCensus.FfxFsr3Upscaler
|
||||
| FlRuntimeCensus.FfxFrameInterpolation | FlRuntimeCensus.AmdFfxDx12));
|
||||
|
||||
facts.Upscaler.Should().Be("Fsr3");
|
||||
facts.FgMode.Should().Be("FsrFg");
|
||||
facts.FgFactor.Should().BeApproximately(2.0, 0.05);
|
||||
text.Should().Contain("upscaler: Fsr3");
|
||||
text.Should().Contain("frame generation: FsrFg");
|
||||
text.Should().Contain("x2 FG");
|
||||
text.Should().NotContain("WARNING");
|
||||
text.Should().NotContain("upscaler: N/A");
|
||||
// The extent prints under frame generation: params ride on one present in two here, and the
|
||||
// window is the identity suffix, not the params suffix (measured N/A on 2026-09-05 otherwise).
|
||||
text.Should().Contain("render -> output: 1485x835 -> 2560x1440");
|
||||
text.Should().NotContain("render -> output: N/A");
|
||||
FfxCensus.From(stream).Describe().Should().Contain("presents/frame=2.00");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,263 @@
|
||||
using System.Diagnostics;
|
||||
using System.Text.RegularExpressions;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.CaptureHost.Consume;
|
||||
using FrameLedger.Shared;
|
||||
|
||||
namespace FrameLedger.CaptureHost.Tests.Consume;
|
||||
|
||||
/// <summary>
|
||||
/// <c>20_OPEN_QUESTIONS</c> §H5 case 3: a counted 1.0 on Streamline 2.8 beside a loaded DLSS-G
|
||||
/// plugin is withheld from <c>none</c>, and every validated <c>none</c> stays byte-identical.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The census words here are the ones real titles published: Dying Light: The Beast at DLSS
|
||||
/// (<c>sl.dlss_g.dll</c> set), Cyberpunk 2077 on 2.7.1 (<c>nvngx_dlssg.dll</c> only), the UE5
|
||||
/// shape with the NGX plugin and no Streamline plugin. The gate is keyed so that only the
|
||||
/// first of those changes, and these cases are what pin that.
|
||||
/// </remarks>
|
||||
public sealed partial class H5CaseThreeTests
|
||||
{
|
||||
[GeneratedRegex(@"[x×] ?\d", RegexOptions.None, matchTimeoutMilliseconds: 1000)]
|
||||
private static partial Regex FgFactorShape();
|
||||
|
||||
private const FlHookFamily _countingHooks =
|
||||
FlHookFamily.Present | FlHookFamily.UpscalerIdentity | FlHookFamily.FgEvaluations;
|
||||
|
||||
private const FlRuntimeCensus _dyingLightAtDlss = FlRuntimeCensus.Ran | FlRuntimeCensus.SlInterposer
|
||||
| FlRuntimeCensus.SlDlss | FlRuntimeCensus.SlDlssG
|
||||
| FlRuntimeCensus.NvngxDlssG;
|
||||
|
||||
private const FlRuntimeCensus _cyberpunkOn271 = FlRuntimeCensus.Ran | FlRuntimeCensus.SlInterposer
|
||||
| FlRuntimeCensus.NvngxDlssG;
|
||||
|
||||
private const FlRuntimeCensus _ue5NgxOnly = FlRuntimeCensus.Ran | FlRuntimeCensus.SlInterposer
|
||||
| FlRuntimeCensus.NvngxDlssG | FlRuntimeCensus.AmdFfxFrameGeneration
|
||||
| FlRuntimeCensus.AmdFfxUpscaler;
|
||||
|
||||
/// <summary>k presents per application frame; the token is counted on the first of each.</summary>
|
||||
private static List<FlFrameRecord> Stream(int appFrames, int k)
|
||||
{
|
||||
List<FlFrameRecord> stream = [];
|
||||
ulong qpc = 1_000_000;
|
||||
long step = Stopwatch.Frequency / (60 * k);
|
||||
for (int f = 0; f < appFrames; f++)
|
||||
{
|
||||
for (int p = 0; p < k; p++)
|
||||
{
|
||||
stream.Add(new FlFrameRecord
|
||||
{
|
||||
Qpc = qpc,
|
||||
SwapchainId = 1,
|
||||
MeasuredMask = (ushort)(FlMeasured.OutputRes | FlMeasured.PresentArgs | FlMeasured.Fg | FlMeasured.FgCounts),
|
||||
FgEvaluations = (byte)(p == 0 ? 1 : 0),
|
||||
FgMode = (byte)FlFgMode.Unknown,
|
||||
});
|
||||
qpc += (ulong)step;
|
||||
}
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
private static RuntimeModuleSet Interposer(string version) => new(
|
||||
[new RuntimeModuleInfo("sl.interposer.dll", @"D:\Games\title\sl.interposer.dll", version.Replace('.', ','),
|
||||
Version.Parse(version))],
|
||||
Snapshots: 1, Unreadable: 0);
|
||||
|
||||
private static (MeasuredFacts Facts, string Text) Render(List<FlFrameRecord> stream, FlRuntimeCensus census,
|
||||
RuntimeModuleSet? modules, FlHookFamily hooks = _countingHooks, uint dxgiSamples = 0)
|
||||
{
|
||||
// dxgiSamples 0 is the shape every case below was written against: DXGI's counter not read,
|
||||
// which since Leg 0 (2026-09-06) is the only shape the gate still withholds on.
|
||||
var writer = new FlWriterState
|
||||
{
|
||||
HooksInstalledMask = (uint)hooks,
|
||||
RuntimeCensus = (uint)census,
|
||||
DxgiPresentSamples = dxgiSamples,
|
||||
};
|
||||
MeasuredFacts facts = MeasuredFacts.From(stream, writer, Stopwatch.Frequency, 0, 0,
|
||||
FgWindow.From(stream, Stopwatch.Frequency), modules);
|
||||
return (facts, SessionReport.Render(facts));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DyingLightTheBeastShapeWithholdsNoneAndPrintsThePresentedLineWithTheH5Warning()
|
||||
{
|
||||
(MeasuredFacts facts, string text) = Render(Stream(200, 1), _dyingLightAtDlss, Interposer("2.8.0.0"));
|
||||
|
||||
facts.NoneWithheld.Should().NotBeNull();
|
||||
facts.FgMode.Should().StartWith(MeasuredFacts.FgNoneWithheldPrefix);
|
||||
facts.FgMode.Should().Contain("sl.dlss_g.dll").And.Contain("2.8.0.0");
|
||||
facts.FgFactor.Should().BeApproximately(1.0, 0.01, "the count is still the record");
|
||||
facts.InterposerVersion.Should().Be(new Version(2, 8, 0, 0));
|
||||
|
||||
text.Should().Contain("Presented FPS:");
|
||||
text.Should().Contain("`none` is WITHHELD");
|
||||
text.Should().Contain("§H5 case 3");
|
||||
text.Should().Contain("counts APPLICATION frames");
|
||||
text.Should().Contain("the Displayed rate, are unknown");
|
||||
text.Should().Contain("frame generation: NOT stated");
|
||||
text.Should().Contain("frame generation: N/A (`none` withheld");
|
||||
text.Should().NotContain(" FPS: ");
|
||||
text.Should().NotContain("frame generation: none");
|
||||
text.Should().NotContain("read it as Displayed, not Native");
|
||||
text.Should().NotContain("Native FPS");
|
||||
FgFactorShape().IsMatch(text).Should().BeFalse("a withheld none prints no factor");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LegZeroDlssgOffOnStreamline28IsNoneWhenDxgiCountedNothingUnseen()
|
||||
{
|
||||
// 2026-09-06, 07:45 and 07:55: Dying Light: The Beast with frame generation OFF, census still
|
||||
// 0x25F0F (the plugin is a startup-time load), presents = tokens, `unseen=0 over samples=3659`.
|
||||
// The 2.8.0 pacer's presents are DXGI presents (row P1-DXGI), so DXGI counting none is `none`.
|
||||
(MeasuredFacts facts, string text) = Render(Stream(200, 1), _dyingLightAtDlss, Interposer("2.8.0.0"),
|
||||
dxgiSamples: 3659);
|
||||
|
||||
facts.NoneWithheld.Should().BeNull();
|
||||
facts.FgMode.Should().Be(MeasuredFacts.FgNone);
|
||||
facts.NoneBesideDxgi.Should().Contain("agrees").And.Contain("3659");
|
||||
text.Should().Contain(" FPS: ");
|
||||
text.Should().Contain("frame generation: none");
|
||||
text.Should().Contain("DXGI's own present counter agrees: 0 unseen over 3659 hooked present(s)");
|
||||
text.Should().NotContain("WITHHELD").And.NotContain("Presented FPS:");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheWithheldReasonNamesTheCounterThatWasNotRead()
|
||||
{
|
||||
(MeasuredFacts facts, _) = Render(Stream(200, 1), _dyingLightAtDlss, Interposer("2.8.0.0"));
|
||||
|
||||
facts.NoneWithheld.Should().Contain("was not read this session").And.Contain("P1-DXGI");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CyberpunkOnStreamline271WithNvngxDlssgLoadedKeepsNone()
|
||||
{
|
||||
// The measured census of the title whose off / ×3 / ×4 legs validated the count (§S31 row P1):
|
||||
// nvngx_dlssg.dll loaded, sl.dlss_g.dll NOT — and the interposer is 2.7.1. Both conjuncts
|
||||
// of the gate are clear, so this is the exact output the run landed on.
|
||||
(MeasuredFacts facts, string text) = Render(Stream(200, 1), _cyberpunkOn271, Interposer("2.7.1.0"));
|
||||
|
||||
facts.NoneWithheld.Should().BeNull();
|
||||
facts.FgMode.Should().Be(MeasuredFacts.FgNone);
|
||||
text.Should().Contain(" FPS: ").And.Contain("frame generation: none");
|
||||
text.Should().NotContain("WITHHELD").And.NotContain("Presented FPS");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AStreamline27TitleThatLoadsThePluginKeepsNoneBelowTheVersionGate()
|
||||
{
|
||||
// The plugin alone is not the shape: it is what Cyberpunk would be if it loaded sl.dlss_g.dll,
|
||||
// and Cyberpunk's generated presents demonstrably reach this hook on 2.7.1.
|
||||
(MeasuredFacts facts, string text) = Render(Stream(200, 1), _dyingLightAtDlss, Interposer("2.7.1.0"));
|
||||
|
||||
facts.NoneWithheld.Should().BeNull();
|
||||
facts.FgMode.Should().Be(MeasuredFacts.FgNone);
|
||||
text.Should().Contain("frame generation: none");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheUe5ShapeWithNvngxDlssgButNoStreamlinePluginKeepsNoneWhateverTheInterposerVersion()
|
||||
{
|
||||
// Expedition 33 and Hell Is Us with frame generation off: nvngx_dlssg.dll is loaded through NGX
|
||||
// on every UE5 title, and their ×3 / ×4 legs read 2.97 / 4.00 through this very hook. A gate
|
||||
// keyed on that module would have turned three validated results into warnings.
|
||||
(MeasuredFacts facts, string text) = Render(Stream(200, 1), _ue5NgxOnly, Interposer("2.9.0.0"));
|
||||
|
||||
facts.NoneWithheld.Should().BeNull();
|
||||
facts.FgMode.Should().Be(MeasuredFacts.FgNone);
|
||||
text.Should().Contain("frame generation: none");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AnUnreadableInterposerVersionWithThePluginLoadedWithholdsNoneAndSaysWhy()
|
||||
{
|
||||
// No snapshot at all, and a snapshot that failed, are the same absence: the discriminator is
|
||||
// missing, and an N/A is the honest answer over a none this consumer cannot discriminate.
|
||||
(MeasuredFacts none, string noneText) = Render(Stream(200, 1), _dyingLightAtDlss, modules: null);
|
||||
(MeasuredFacts failed, string failedText) = Render(Stream(200, 1), _dyingLightAtDlss,
|
||||
new RuntimeModuleSet([], Snapshots: 2, Unreadable: 2));
|
||||
|
||||
none.NoneWithheld.Should().Contain("could not be read");
|
||||
failed.NoneWithheld.Should().Contain("could not be read");
|
||||
noneText.Should().Contain("Presented FPS:").And.Contain("WITHHELD");
|
||||
failedText.Should().Contain("Presented FPS:").And.Contain("WITHHELD");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void StreamlineOneFiveSixIsUntouched()
|
||||
{
|
||||
// The Witcher 3's interposer: no hook installs, no count exists, so the gate has nothing to
|
||||
// withhold and the census-refined N/A is what prints — exactly as before this gate existed.
|
||||
var writer = new FlWriterState
|
||||
{
|
||||
HooksInstalledMask = (uint)FlHookFamily.Present,
|
||||
RuntimeCensus = (uint)(FlRuntimeCensus.Ran | FlRuntimeCensus.SlInterposer),
|
||||
};
|
||||
List<FlFrameRecord> stream = [];
|
||||
ulong qpc = 1_000_000;
|
||||
for (uint i = 0; i < 60; i++)
|
||||
{
|
||||
stream.Add(new FlFrameRecord
|
||||
{
|
||||
FrameIndex = i,
|
||||
Qpc = qpc,
|
||||
SwapchainId = 1,
|
||||
MeasuredMask = (ushort)(FlMeasured.OutputRes | FlMeasured.PresentArgs),
|
||||
});
|
||||
qpc += (ulong)(Stopwatch.Frequency / 120);
|
||||
}
|
||||
|
||||
MeasuredFacts facts = MeasuredFacts.From(stream, writer, Stopwatch.Frequency, 0, 0, null, Interposer("1.5.6.0"));
|
||||
string text = SessionReport.Render(facts);
|
||||
|
||||
facts.NoneWithheld.Should().BeNull();
|
||||
facts.InterposerVersion.Should().Be(new Version(1, 5, 6, 0));
|
||||
text.Should().Contain("no upscaler hook ran, though an upscaler runtime is loaded: sl.interposer.dll");
|
||||
text.Should().Contain("cannot include in-process generated frames");
|
||||
text.Should().NotContain("WITHHELD");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheGateNeverFiresOnAnActiveFactor()
|
||||
{
|
||||
// ×4 counted on the very shape the gate keys on: the trio prints, because a factor that clears
|
||||
// the cadence threshold is a measurement of generated presents reaching this hook.
|
||||
(MeasuredFacts facts, string text) = Render(Stream(100, 4), _dyingLightAtDlss, Interposer("2.8.0.0"));
|
||||
|
||||
facts.NoneWithheld.Should().BeNull();
|
||||
facts.Fg!.IsActive.Should().BeTrue();
|
||||
text.Should().Contain("Native FPS").And.Contain("Displayed FPS").And.Contain("x4 FG");
|
||||
text.Should().NotContain("WITHHELD").And.NotContain("WARNING");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheCensusNamesEveryModuleTheSnapshotAsksAbout()
|
||||
{
|
||||
CensusNames.ModuleFileNames.Should().Contain(["sl.interposer.dll", "sl.dlss_g.dll", "nvngx_dlssg.dll", "ffx_fsr3_x64.dll"]);
|
||||
CensusNames.ModuleFileNames.Should().Contain("_nvngx.dll", "the a / b pairs are split into their members");
|
||||
CensusNames.ModuleFileNames.Should().OnlyContain(n => !n.Contains(" / ", StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MergeKeepsTheFirstVersionSeenAndCountsEverySnapshot()
|
||||
{
|
||||
RuntimeModuleSet first = Interposer("2.8.0.0");
|
||||
RuntimeModuleSet later = new(
|
||||
[
|
||||
new RuntimeModuleInfo("sl.interposer.dll", @"D:\other\sl.interposer.dll", "2,7,1,0", new Version(2, 7, 1, 0)),
|
||||
new RuntimeModuleInfo("sl.dlss_g.dll", @"D:\Games\title\sl.dlss_g.dll", "310,6,0,0", new Version(310, 6, 0, 0)),
|
||||
],
|
||||
Snapshots: 1, Unreadable: 1);
|
||||
|
||||
RuntimeModuleSet merged = first.Merge(later);
|
||||
|
||||
merged.VersionOf("SL.INTERPOSER.DLL").Should().Be(new Version(2, 8, 0, 0), "first seen wins, case-insensitively");
|
||||
merged.VersionOf("sl.dlss_g.dll").Should().Be(new Version(310, 6, 0, 0));
|
||||
merged.Snapshots.Should().Be(2);
|
||||
merged.Unreadable.Should().Be(1);
|
||||
RuntimeModuleSet.Empty.VersionOf("sl.interposer.dll").Should().BeNull();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
using FluentAssertions;
|
||||
using FrameLedger.CaptureHost.Consume;
|
||||
|
||||
namespace FrameLedger.CaptureHost.Tests.Consume;
|
||||
|
||||
/// <summary>
|
||||
/// The probe's machine line, parsed and merged: the words the owner measured on 2026-09-06 are the fixtures.
|
||||
/// </summary>
|
||||
public sealed class NgxDriverStateTests
|
||||
{
|
||||
private const string _hellIsUs =
|
||||
"NGXSTATE status=ANSWERED sr=0x0000000000080605 rr=0x0000000000080005 fg=0x0000000000000005 ratio=0.0000 mode=0 preset=0 fgcount=0 fgpreset=0 fgmode=0 driver=61664";
|
||||
|
||||
private const string _expedition33Override =
|
||||
"NGXSTATE status=ANSWERED sr=0x000000000008067F rr=0x0000000000080005 fg=0x000000000000001F ratio=0.0000 mode=2 preset=11 fgcount=0 fgpreset=0 fgmode=0 driver=61664";
|
||||
|
||||
[Fact]
|
||||
public void TheAnsweredLineIsReadWholeAndTheHumanLinesAreIgnored()
|
||||
{
|
||||
string output = "fl-probe-nvapi --ngx-state 12468 — the driver's NGX feedback for one process\r\n\r\n"
|
||||
+ " driver 616.64 (r616_41)\r\n SR feedback 0x0000000000080605 : INITIALIZED DLL_EXISTS CREATED EVALUATE ERR_NOT_FOUND\r\n"
|
||||
+ _hellIsUs + "\r\n";
|
||||
|
||||
NgxDriverState s = NgxDriverState.Parse(output);
|
||||
|
||||
s.Outcome.Should().Be(NgxProbeOutcome.Answered);
|
||||
s.Sr.Should().Be(0x80605UL);
|
||||
s.Rr.Should().Be(0x80005UL);
|
||||
s.Fg.Should().Be(0x5UL);
|
||||
s.Driver.Should().Be(61664u);
|
||||
s.SrCreatedAndEvaluated.Should().BeTrue("CREATED and EVALUATE are both set on Hell Is Us without an override");
|
||||
s.Readings.Should().Be(1);
|
||||
s.Answered.Should().Be(1);
|
||||
NgxOverrideFlags.Describe(s.Sr).Should().Be("INITIALIZED DLL_EXISTS CREATED EVALUATE ERR_NOT_FOUND");
|
||||
NgxOverrideFlags.Describe(s.Fg).Should().Be("INITIALIZED DLL_EXISTS");
|
||||
NgxOverrideFlags.Describe(0).Should().Be("-");
|
||||
NgxOverrideFlags.Describe(1UL << 40).Should().Be("0x10000000000", "an unknown bit is printed, never dropped");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheOverrideFieldsAreCarriedAndNamedAsOverrideFields()
|
||||
{
|
||||
NgxDriverState s = NgxDriverState.Parse(_expedition33Override);
|
||||
|
||||
s.PerformanceMode.Should().Be(2u);
|
||||
s.RenderPreset.Should().Be(11u);
|
||||
s.ScalingRatio.Should().Be(0.0);
|
||||
s.SrCreatedAndEvaluated.Should().BeTrue();
|
||||
s.Describe().Should().Contain("performanceMode=2 renderPreset=11").And.Contain("the OVERRIDE's values")
|
||||
.And.Contain("identity, never a count or a multiplier");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UnansweredDegradedAndGarbageAreOutcomesNotExceptions()
|
||||
{
|
||||
NgxDriverState.Parse("NGXSTATE status=UNANSWERED nvapi=-160").Outcome.Should().Be(NgxProbeOutcome.Unanswered);
|
||||
NgxDriverState.Parse("NGXSTATE status=DEGRADED nvapi=-2").Outcome.Should().Be(NgxProbeOutcome.Degraded);
|
||||
NgxDriverState.Parse("nothing here").Outcome.Should().Be(NgxProbeOutcome.ProbeFailed);
|
||||
NgxDriverState.Parse("NGXSTATE status=ANSWERED sr=zz").Outcome.Should().Be(NgxProbeOutcome.ProbeFailed);
|
||||
NgxDriverState.Parse("NGXSTATE status=WHAT").Outcome.Should().Be(NgxProbeOutcome.ProbeFailed);
|
||||
NgxDriverState.Parse("NGXSTATE status=UNANSWERED nvapi=-160").SrCreatedAndEvaluated.Should().BeFalse();
|
||||
NgxDriverState.Parse("NGXSTATE status=UNANSWERED nvapi=-160").Describe().Should().Contain("did not answer").And.Contain("NvAPI -160");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MergeKeepsTheLastAnswerCountsEveryReadingAndFlagsAChange()
|
||||
{
|
||||
NgxDriverState before = NgxDriverState.Parse(
|
||||
"NGXSTATE status=ANSWERED sr=0x5 rr=0x1 fg=0x5 ratio=0.0000 mode=0 preset=0 fgcount=0 fgpreset=0 fgmode=0 driver=61664");
|
||||
NgxDriverState after = NgxDriverState.Parse(_hellIsUs);
|
||||
NgxDriverState silent = NgxDriverState.Parse("NGXSTATE status=UNANSWERED nvapi=-160");
|
||||
|
||||
NgxDriverState merged = NgxDriverState.NotRun.Merge(before).Merge(after).Merge(silent);
|
||||
|
||||
merged.Outcome.Should().Be(NgxProbeOutcome.Answered, "an earlier answer outranks a later silence");
|
||||
merged.Sr.Should().Be(0x80605UL, "the last ANSWERED reading is the state");
|
||||
merged.Readings.Should().Be(3);
|
||||
merged.Answered.Should().Be(2);
|
||||
merged.Changed.Should().BeTrue("the SR word gained CREATED | EVALUATE between readings");
|
||||
merged.Describe().Should().Contain("answered 2 of 3 probe(s), and the words CHANGED between readings");
|
||||
|
||||
NgxDriverState same = NgxDriverState.NotRun.Merge(after).Merge(after);
|
||||
same.Changed.Should().BeFalse();
|
||||
same.Describe().Should().Contain("answered 2 of 2 probe(s); driver 616.64");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
using System.Diagnostics;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.CaptureHost.Consume;
|
||||
using FrameLedger.Shared;
|
||||
|
||||
namespace FrameLedger.CaptureHost.Tests.Consume;
|
||||
|
||||
/// <summary>
|
||||
/// The stall diagnostic: the longest intervals, placed against the host's own touches on the target.
|
||||
/// </summary>
|
||||
public sealed class StallReportTests
|
||||
{
|
||||
private static readonly long _hz = Stopwatch.Frequency;
|
||||
|
||||
/// <summary>A 120 FPS stream with one gap of <paramref name="gapMs"/> after <paramref name="gapAfter"/> presents.</summary>
|
||||
private static List<FlFrameRecord> StreamWithGap(int presents, int gapAfter, double gapMs, out long gapStartQpc)
|
||||
{
|
||||
List<FlFrameRecord> s = [];
|
||||
long qpc = 5_000_000;
|
||||
long step = _hz / 120;
|
||||
gapStartQpc = 0;
|
||||
for (int i = 0; i < presents; i++)
|
||||
{
|
||||
s.Add(new FlFrameRecord { FrameIndex = (uint)i, Qpc = (ulong)qpc, SwapchainId = 1 });
|
||||
if (i == gapAfter)
|
||||
{
|
||||
gapStartQpc = qpc;
|
||||
qpc += (long)(gapMs / 1000.0 * _hz);
|
||||
}
|
||||
else
|
||||
{
|
||||
qpc += step;
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheLongestIntervalIsFoundAndPlacedInTheSession()
|
||||
{
|
||||
List<FlFrameRecord> s = StreamWithGap(600, 240, 1000.0, out _);
|
||||
|
||||
StallReport r = StallReport.From(s, _hz, []);
|
||||
|
||||
r.Intervals.Should().Be(599);
|
||||
r.OverThreshold.Should().Be(1);
|
||||
r.Longest.Should().HaveCount(3);
|
||||
r.Longest[0].Milliseconds.Should().BeApproximately(1000.0, 1.0);
|
||||
r.Longest[0].AtSeconds.Should().BeApproximately(2.0, 0.01, "240 presents at 120 FPS");
|
||||
r.Longest[0].NearestTouchSeconds.Should().BeNull();
|
||||
r.Describe().Should().Contain("1 interval(s) of 599 at or over 100 ms").And.Contain("longest: 1000 ms at t=2.00 s")
|
||||
.And.Contain("no host touch recorded");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AHostTouchInsideTheStallNamesFrameLedgerAsASuspect()
|
||||
{
|
||||
List<FlFrameRecord> s = StreamWithGap(600, 240, 1000.0, out long gapStart);
|
||||
long touch = gapStart + _hz / 2; // half a second into the gap
|
||||
|
||||
StallReport r = StallReport.From(s, _hz, [touch]);
|
||||
|
||||
r.Longest[0].NearestTouchSeconds.Should().Be(0.0);
|
||||
r.Longest[0].NearATouch.Should().BeTrue();
|
||||
r.Describe().Should().Contain("A HOST TOUCH INSIDE the interval").And.Contain("SUSPECT");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AHostTouchJustBeforeTheStallIsStillASuspectAndAFarOneIsNot()
|
||||
{
|
||||
List<FlFrameRecord> s = StreamWithGap(600, 240, 1000.0, out long gapStart);
|
||||
|
||||
StallReport near = StallReport.From(s, _hz, [gapStart - _hz / 4]); // 0.25 s before
|
||||
StallReport far = StallReport.From(s, _hz, [gapStart + 30 * _hz]); // 30 s after
|
||||
|
||||
near.Longest[0].NearestTouchSeconds.Should().BeApproximately(-0.25, 0.01);
|
||||
near.Longest[0].NearATouch.Should().BeTrue();
|
||||
near.Describe().Should().Contain("0.25 s before it");
|
||||
far.Longest[0].NearATouch.Should().BeFalse();
|
||||
far.Describe().Should().Contain("not ours");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ASmoothStreamHasNoStallAndStillPrintsItsLongest()
|
||||
{
|
||||
List<FlFrameRecord> s = StreamWithGap(300, -1, 0, out _);
|
||||
|
||||
StallReport r = StallReport.From(s, _hz, [(long)s[10].Qpc]);
|
||||
|
||||
r.OverThreshold.Should().Be(0);
|
||||
r.Longest[0].Milliseconds.Should().BeApproximately(1000.0 / 120, 0.05);
|
||||
r.Touches.Should().Be(1);
|
||||
StallReport.From([s[0]], _hz, []).Describe().Should().Contain("fewer than two presents");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
using System.Diagnostics;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.CaptureHost.Consume;
|
||||
using FrameLedger.Shared;
|
||||
|
||||
namespace FrameLedger.CaptureHost.Tests.Consume;
|
||||
|
||||
/// <summary>
|
||||
/// The render → output line: <c>03_METRICS</c>' ratio over two measured sizes, modal, with the
|
||||
/// settings-moved flag — and never a preset name.
|
||||
/// </summary>
|
||||
public sealed class UpscaleExtentTests
|
||||
{
|
||||
private static FlFrameRecord Record(ushort renderW, ushort renderH, ushort outputW, ushort outputH,
|
||||
FlMeasured extra = FlMeasured.UpscalerParams | FlMeasured.Upscaler) => new()
|
||||
{
|
||||
SwapchainId = 1,
|
||||
OutputW = outputW,
|
||||
OutputH = outputH,
|
||||
RenderW = renderW,
|
||||
RenderH = renderH,
|
||||
UpscalerQuality = 0xFF,
|
||||
UpscalerSharpness = 0xFF,
|
||||
Upscaler = (byte)FlUpscaler.Dlss,
|
||||
MeasuredMask = (ushort)(FlMeasured.OutputRes | FlMeasured.PresentArgs | extra),
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void CyberpunkAtBalancedIs172xAnd58Percent()
|
||||
{
|
||||
// The number measured on 2026-08-15 against the title's own menu: 1485x835 at 2560x1440 is
|
||||
// DLSS Balanced's 0.58, and a writer that hardcoded a plausible resolution cannot produce it.
|
||||
var stream = Enumerable.Range(0, 40).Select(_ => Record(1485, 835, 2560, 1440)).ToList();
|
||||
|
||||
UpscaleExtent? e = UpscaleExtent.From(stream);
|
||||
|
||||
e.Should().NotBeNull();
|
||||
e!.Ratio.Should().BeApproximately(1.724, 0.001);
|
||||
e.RenderScalePercent.Should().BeApproximately(58.0, 0.5);
|
||||
e.Records.Should().Be(40);
|
||||
e.Measured.Should().Be(40);
|
||||
e.DistinctGroups.Should().Be(1);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheReportPrintsBothSizesTheRatioAndTheScaleAndNoPresetName()
|
||||
{
|
||||
var stream = Enumerable.Range(0, 40).Select(_ => Record(1485, 835, 2560, 1440)).ToList();
|
||||
var writer = new FlWriterState
|
||||
{
|
||||
HooksInstalledMask = (uint)(FlHookFamily.Present | FlHookFamily.UpscalerIdentity | FlHookFamily.UpscalerParams),
|
||||
RuntimeCensus = (uint)FlRuntimeCensus.Ran,
|
||||
};
|
||||
|
||||
MeasuredFacts facts = MeasuredFacts.From(stream, writer, Stopwatch.Frequency, 0, 0);
|
||||
string text = SessionReport.Render(facts);
|
||||
|
||||
facts.UpscaleRatio.Should().BeApproximately(1.724, 0.001);
|
||||
text.Should().Contain("render -> output: 1485x835 -> 2560x1440 = 1.72x (58% render scale) on 40 of 40 record(s)");
|
||||
text.Should().NotContain("Balanced", "a preset name derived from the ratio is HANDOFF 7a's owner decision, not this line's");
|
||||
text.Should().NotContain("SETTINGS MOVED");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ASettingsChangeMidWindowIsTheDominantTupleWithTheFlag()
|
||||
{
|
||||
// Quality for the first third, Balanced after. Averaging would print a resolution nobody
|
||||
// rendered at; the modal tuple is a resolution somebody did, and the flag says it moved.
|
||||
var stream = Enumerable.Range(0, 30).Select(_ => Record(1707, 960, 2560, 1440))
|
||||
.Concat(Enumerable.Range(0, 60).Select(_ => Record(1485, 835, 2560, 1440))).ToList();
|
||||
|
||||
UpscaleExtent? e = UpscaleExtent.From(stream);
|
||||
string text = SessionReport.Render(MeasuredFacts.From(stream, new FlWriterState
|
||||
{
|
||||
HooksInstalledMask = (uint)(FlHookFamily.Present | FlHookFamily.UpscalerIdentity | FlHookFamily.UpscalerParams),
|
||||
}, Stopwatch.Frequency, 0, 0));
|
||||
|
||||
e.Should().NotBeNull();
|
||||
e!.RenderW.Should().Be(1485);
|
||||
e.Records.Should().Be(60);
|
||||
e.Measured.Should().Be(90);
|
||||
e.DistinctGroups.Should().Be(2);
|
||||
text.Should().Contain("SETTINGS MOVED: 2 distinct extents");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AParamsBitOnOneInNPresentsUnderFrameGenerationStillYieldsTheExtent()
|
||||
{
|
||||
// THE SHAPE EVERY FG-ON CAPTURE HAS: identity on every record once the family is live, params
|
||||
// only on the present that drained the dispatch or tag (1 in N), an honest zero on the rest.
|
||||
// Keyed on the params bit the window was empty — measured on Cyberpunk at FSR 3 + FG and at
|
||||
// DLSS MFG x3, 2026-09-05 — and this is the case that would have caught it.
|
||||
List<FlFrameRecord> stream = [];
|
||||
for (int f = 0; f < 30; f++)
|
||||
{
|
||||
for (int p = 0; p < 3; p++)
|
||||
{
|
||||
stream.Add(p == 0
|
||||
? Record(1506, 847, 2560, 1440)
|
||||
: Record(0, 0, 2560, 1440, extra: FlMeasured.Upscaler));
|
||||
}
|
||||
}
|
||||
|
||||
UpscaleExtent? e = UpscaleExtent.From(stream);
|
||||
|
||||
e.Should().NotBeNull("one present in three carried both sizes, inside a live identity window");
|
||||
e!.Records.Should().Be(30);
|
||||
e.Measured.Should().Be(30);
|
||||
e.DistinctGroups.Should().Be(1);
|
||||
e.RenderScalePercent.Should().BeApproximately(59.0, 0.5);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AnIntermittentIdentityBitIsStillNoWindow()
|
||||
{
|
||||
// The clean-boundary rule survives on the bit the window is now keyed on: an identity bit
|
||||
// that clears and returns is not an install window (hooksInstalledMask is monotonic), and
|
||||
// the extent is refused rather than averaged over records nobody measured.
|
||||
List<FlFrameRecord> stream =
|
||||
[
|
||||
Record(1506, 847, 2560, 1440), // identity + params
|
||||
Record(0, 0, 2560, 1440, extra: FlMeasured.None), // present-only: the identity bit went away
|
||||
Record(1506, 847, 2560, 1440), // identity + params again
|
||||
];
|
||||
|
||||
UpscaleExtent.From(stream).Should().BeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RecordsWithoutBothBitsDoNotCount()
|
||||
{
|
||||
// A value without its bit is the writer's defect; params without an output size cannot make
|
||||
// a ratio; a window with neither is null and the report says so rather than printing 0.
|
||||
List<FlFrameRecord> stream =
|
||||
[
|
||||
Record(1485, 835, 2560, 1440, extra: FlMeasured.Upscaler), // params bit clear
|
||||
Record(1485, 835, 0, 0), // no output size
|
||||
];
|
||||
|
||||
UpscaleExtent.From(stream).Should().BeNull();
|
||||
string text = SessionReport.Render(MeasuredFacts.From(stream,
|
||||
new FlWriterState { HooksInstalledMask = (uint)FlHookFamily.Present }, Stopwatch.Frequency, 0, 0));
|
||||
text.Should().Contain("render -> output: N/A (no record carried both a render size and an output size)");
|
||||
}
|
||||
}
|
||||
@@ -195,12 +195,25 @@ public sealed class ShmDrainIntegrationTests
|
||||
// else. In layout v3 the zero-defaults are honest by construction — FlUpscaler.NotReported and
|
||||
// FlFgMode.NotReported are 0 — and the mask corroborates rather than being the sole defence.
|
||||
//
|
||||
// OutputRes is asserted as "no bit outside these two" rather than as an exact value, because the
|
||||
// overflow fixture legitimately produces records with PresentArgs alone: past 16 swapchains the
|
||||
// writer has no size to report and #57 made the bit conditional on there being one.
|
||||
// OutputRes is asserted as "no bit outside these three" rather than as an exact value, because
|
||||
// the overflow fixture legitimately produces records with PresentArgs alone: past 16 swapchains
|
||||
// the writer has no size to report and #57 made the bit conditional on there being one. The
|
||||
// third bit is DxgiPresents (2026-09-05): the present hook reads GetLastPresentCount on the chain
|
||||
// it saw, and every record after a chain's first claims the delta — a zero here, which the
|
||||
// byte assertion below pins, because this fixture presents only through the patched body.
|
||||
records.Should().OnlyContain(
|
||||
r => (r.MeasuredMask & ~(ushort)(FlMeasured.OutputRes | FlMeasured.PresentArgs)) == 0,
|
||||
r => (r.MeasuredMask & ~(ushort)(FlMeasured.OutputRes | FlMeasured.PresentArgs | FlMeasured.DxgiPresents)) == 0,
|
||||
"the writer must claim exactly what it measured — no more");
|
||||
// ...AND A PAUSE IS NOT AN UNSEEN PRESENT. The paused-session case below lets the harness
|
||||
// present ~85 times while the hook declines them; the first record after the resume claimed
|
||||
// them all as "presents DXGI counted and this hook never saw" until the epoch guard in
|
||||
// RecordPresent made a declined present invalidate the chain's last reading. This assertion
|
||||
// runs on every fixture, so that case is the one that keeps the guard honest.
|
||||
records.Should().OnlyContain(r => r.DxgiUnseen == 0,
|
||||
"DXGI must count nothing this hook did not on a fixture that presents only through the patched body "
|
||||
+ "— including across a pause, which the hook SAW and declined");
|
||||
records.Should().Contain(r => (r.MeasuredMask & (ushort)FlMeasured.DxgiPresents) != 0,
|
||||
"after a chain's first hooked present the counter has a previous value to difference against");
|
||||
records.Should().OnlyContain(r => (r.MeasuredMask & (ushort)FlMeasured.PresentArgs) != 0,
|
||||
"syncInterval and presentFlags are the call's own arguments; a DXGI present hook always has them");
|
||||
records.Should().OnlyContain(r => r.RtFlags == 0,
|
||||
|
||||
@@ -503,6 +503,21 @@ elseif ($violations.Count -eq 0) {
|
||||
$violations.Add("Pass C: the export parser did not see ffxDispatch on the leaf fixture $($leafStub.FullName), so it reads nothing - refusing rather than reporting a clean export table nobody parsed")
|
||||
}
|
||||
}
|
||||
# A SECOND positive control, on the other vendor macro: the FSR 3.0 host fixture
|
||||
# defines ffxFsr3ContextDispatchUpscale through fsr3-v3.0.4's FFX_API
|
||||
# (dllexport, no switch). Two fixtures through two macros, so a parser that
|
||||
# happened to see one linkage shape is not taken as seeing exports in general.
|
||||
$hostStub = Get-ChildItem $BuildDir -Recurse -Filter 'ffx_fsr3_x64.dll' -ErrorAction SilentlyContinue |
|
||||
Select-Object -First 1
|
||||
if (-not $hostStub) {
|
||||
$violations.Add("Pass C: the ffx_fsr3_x64.dll host fixture was not found under $BuildDir, so the export parser's second positive control is missing")
|
||||
}
|
||||
else {
|
||||
$hostExports = Get-ExportName (& $dumpbin /nologo /exports $hostStub.FullName 2>&1 | Out-String)
|
||||
if ($hostExports -notcontains 'ffxFsr3ContextDispatchUpscale') {
|
||||
$violations.Add("Pass C: the export parser did not see ffxFsr3ContextDispatchUpscale on the host fixture $($hostStub.FullName)")
|
||||
}
|
||||
}
|
||||
foreach ($bad in (Get-ForbiddenExport $exports)) {
|
||||
$violations.Add("Pass C: FrameLedger.Overlay.dll EXPORTS '$bad' - the vendored headers declare these names __declspec(dllexport), and a definition in the Overlay announces a vendor API it does not implement, from inside somebody else's game")
|
||||
}
|
||||
|
||||
+49
-2
@@ -89,7 +89,14 @@ $vendored = @(
|
||||
# in the tree (845 of 845 on 2026-09-04). §2d below asserts, per vendored
|
||||
# file, that it is on that list and carries the grant inline; this row only
|
||||
# asserts the licence copy exists.
|
||||
@{ Path = 'src/native/third_party/fidelityfx'; Licence = 'fidelityfx-MIT.txt'; Name = 'AMD FidelityFX SDK headers' }
|
||||
@{ Path = 'src/native/third_party/fidelityfx'; Licence = 'fidelityfx-MIT.txt'; Name = 'AMD FidelityFX SDK headers' },
|
||||
|
||||
# AMD FidelityFX SDK -- the FSR 3.0 HOST API headers, tag fsr3-v3.0.4. A
|
||||
# DIFFERENT licence shape from the row above: a root LICENSE.txt that IS the
|
||||
# MIT grant verbatim, with every header carrying it inline -- which is why
|
||||
# the directory is separate and §2e below (not §2d) walks it. The same MIT
|
||||
# text from the same project, so the same legal/licenses copy is the notice.
|
||||
@{ Path = 'src/native/third_party/fidelityfx-fsr3'; Licence = 'fidelityfx-MIT.txt'; Name = 'AMD FidelityFX SDK 3.0 host headers' }
|
||||
)
|
||||
|
||||
$licenceDir = Join-Path $RepoRoot 'legal/licenses'
|
||||
@@ -262,6 +269,43 @@ if (Test-Path $ffxDir) {
|
||||
}
|
||||
}
|
||||
|
||||
# --- 2e. AMD FidelityFX, the FSR 3.0 HOST API at tag fsr3-v3.0.4: MIT at the root
|
||||
# AND inline, asserted file by file ----------------------------------------------
|
||||
#
|
||||
# A DIFFERENT SHAPE FROM §2d, which is why it is a different directory and a
|
||||
# different section rather than a second walk of the same one: at this tag the
|
||||
# root LICENSE.txt IS the MIT grant (no exception list to look a path up in), and
|
||||
# every header carries the same grant in its own banner. So the per-file question
|
||||
# is "does THIS header carry the grant", and the per-directory question is "is the
|
||||
# root grant present" -- both asserted, because a re-sync from a later tag would
|
||||
# bring the 2.x exception-list shape in under this directory's name and §2d would
|
||||
# never look here.
|
||||
$fsr3Dir = Join-Path $RepoRoot 'src/native/third_party/fidelityfx-fsr3'
|
||||
if (Test-Path $fsr3Dir) {
|
||||
$fsr3Licence = Join-Path $fsr3Dir 'LICENSE.txt'
|
||||
if (-not (Test-Path $fsr3Licence)) {
|
||||
$violations.Add('AMD FidelityFX 3.0 host headers are vendored but src/native/third_party/fidelityfx-fsr3/LICENSE.txt is missing — at tag fsr3-v3.0.4 that file IS the MIT grant, so nothing else can stand in for it')
|
||||
}
|
||||
elseif ((Get-Content $fsr3Licence -Raw) -notmatch 'Permission is hereby granted, free of charge') {
|
||||
$violations.Add('src/native/third_party/fidelityfx-fsr3/LICENSE.txt does not contain the MIT permission grant — if upstream changed its licensing model at this tag, re-run docs/18_GPU_VENDOR_APIS.md §Checklist rather than trusting this gate')
|
||||
}
|
||||
|
||||
$sdk = Join-Path $fsr3Dir 'sdk'
|
||||
$fsr3Files = @(if (Test-Path $sdk) { Get-ChildItem $sdk -Recurse -File -ErrorAction SilentlyContinue })
|
||||
if ($fsr3Files.Count -eq 0) {
|
||||
$violations.Add('src/native/third_party/fidelityfx-fsr3/sdk holds no files — a vendoring directory with a licence copy and nothing under it is a claim about nothing')
|
||||
}
|
||||
foreach ($f in $fsr3Files) {
|
||||
$rel = [IO.Path]::GetRelativePath($fsr3Dir, $f.FullName).Replace('\', '/')
|
||||
if ($f.Extension -ne '.h') {
|
||||
$violations.Add("fidelityfx-fsr3/$rel is a $($f.Extension) — only the host API's header declarations are vendored from this tag; binaries, sources, shaders and helpers are excluded (third_party/fidelityfx-fsr3/README.md)")
|
||||
}
|
||||
elseif (-not (Select-String -Path $f.FullName -Pattern 'Permission is hereby granted, free of charge' -Quiet)) {
|
||||
$violations.Add("fidelityfx-fsr3/$rel does not carry the MIT grant in its own banner — every one of the ten did at fsr3-v3.0.4, so this is a file that was not checked")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# --- 2c. The notices file's BUNDLING claim must match the filesystem ---------
|
||||
#
|
||||
# Every other check here is keyed on the directory a component WOULD occupy, so
|
||||
@@ -292,7 +336,10 @@ else {
|
||||
@{ Marker = 'NVIDIA NVAPI SDK'; Path = 'src/native/third_party/nvapi' },
|
||||
@{ Marker = 'Vulkan headers'; Path = 'src/native/third_party/vulkan-headers' },
|
||||
@{ Marker = 'NVIDIA Streamline'; Path = 'src/native/third_party/streamline' },
|
||||
@{ Marker = 'AMD FidelityFX'; Path = 'src/native/third_party/fidelityfx' }
|
||||
@{ Marker = 'AMD FidelityFX'; Path = 'src/native/third_party/fidelityfx' },
|
||||
# A marker the row above cannot satisfy by accident: the two directories are
|
||||
# two claims, and one row must not stand in for both.
|
||||
@{ Marker = 'FidelityFX SDK 3.0 host headers'; Path = 'src/native/third_party/fidelityfx-fsr3' }
|
||||
)
|
||||
foreach ($c in $claims) {
|
||||
$matched = @($rows | Where-Object { $_ -match [regex]::Escape($c.Marker) })
|
||||
|
||||
@@ -87,15 +87,32 @@ if ($files.Count -eq 0) {
|
||||
|
||||
# One entry per DISTINCT module name. Titles ship the same DLL repeatedly; the
|
||||
# question is what a module of that name exports, not how many copies exist.
|
||||
#
|
||||
# THE UNION ACROSS COPIES, since 2026-09-04, and not the first copy found. Two
|
||||
# generations of the same name coexist on this machine -- sl.interposer.dll 2.7.1
|
||||
# beside 2.8.0, which added slSetTagForFrame -- and "what a module of that name
|
||||
# exports" depends on which copy the walk happened to reach first. A row for a
|
||||
# symbol only the newer generation exports would then pass or fail Pass A on
|
||||
# directory order. Every distinct version is listed, so the oracle says which
|
||||
# generations it saw; `version` keeps the first for the existing readers.
|
||||
$modules = [ordered]@{}
|
||||
$seen = @{}
|
||||
foreach ($f in $files) {
|
||||
if ($seen.ContainsKey($f.Name)) { $seen[$f.Name]++; continue }
|
||||
$seen[$f.Name] = 1
|
||||
$ex = Get-Exports $f.FullName
|
||||
$ver = (Get-Item $f.FullName).VersionInfo.FileVersion
|
||||
if ($seen.ContainsKey($f.Name)) {
|
||||
$seen[$f.Name]++
|
||||
$m = $modules[$f.Name]
|
||||
$m.exports = @(@($m.exports) + $ex | Sort-Object -Unique)
|
||||
$m.exportCount = $m.exports.Count
|
||||
if ($ver -and ($m.versions -notcontains $ver)) { $m.versions = @(@($m.versions) + $ver) }
|
||||
continue
|
||||
}
|
||||
$seen[$f.Name] = 1
|
||||
$modules[$f.Name] = [ordered]@{
|
||||
exportCount = $ex.Count
|
||||
version = (Get-Item $f.FullName).VersionInfo.FileVersion
|
||||
version = $ver
|
||||
versions = @(if ($ver) { $ver })
|
||||
exports = @($ex)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user