Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4df2b823ac |
No files matched your search
@@ -49,6 +49,14 @@ under a `## [x.y.z] - date` heading in the same commit that bumps `VERSION`, the
|
||||
- **A session's summary lists the libraries the game had loaded** — recorded since the first beta and shown nowhere
|
||||
until now — and says when one differs from the copy the game ships ("nvngx_dlss.dll 310.2.1.0 (the game ships
|
||||
3.7.10.0: another copy was loaded, for example by the driver or the NVIDIA App)").
|
||||
- **FrameLedger says when the NVIDIA App overrides a game's DLSS.** Each session now records the NVIDIA driver profile
|
||||
the game ran under — read from the driver's own settings, never from the game — and its summary says what that
|
||||
profile overrides: "NVIDIA profile “…”: DLSS override (preset K, Quality) · Frame Generation override (×4)", Ray
|
||||
Reconstruction, Streamline's override, a forced frame-generation mode, Smooth Motion. It also says what the driver
|
||||
reported applying inside the game ("DLSS DLL chosen by the driver · preset K · Quality"), and the game page's Details
|
||||
card names the overrides from the newest session. These are the driver's settings, not measurements: what FrameLedger
|
||||
measured is shown as before. FrameLedger only reads these settings; it never changes them. Schema 0012 adds one
|
||||
column; the database opens in place.
|
||||
- **A 32-bit game's hooking switch cannot be turned on, and the page says why**: FrameLedger's hook runs in 64-bit
|
||||
games only. Until now the switch turned on and every launch was refused by the guard. A 32-bit game whose hooking
|
||||
was already on has it turned off the first time the capture agent reads it; its sessions are still recorded, with
|
||||
@@ -92,6 +100,9 @@ under a `## [x.y.z] - date` heading in the same commit that bumps `VERSION`, the
|
||||
|
||||
### Fixed
|
||||
|
||||
- **The NVIDIA bridge's native test could not fail on a machine with an NVIDIA GPU.** It was registered to pass on
|
||||
its "which branch" line alone, which makes ctest ignore the exit code; its reference-counting check had been failing
|
||||
on every GPU machine unseen. The check is corrected and a failed assertion now fails the test.
|
||||
- **Turning hooking on for an Unreal game now sees its `EasyAntiCheat` folder.** The scan that runs when hooking is
|
||||
enabled was given the executable's own folder — `<game>\<Project>\Binaries\Win64\` for Unreal titles — and scanned
|
||||
exactly that, while `EasyAntiCheat\` sits at the game's root. The session-time scan always looked at the root, so no
|
||||
|
||||
@@ -477,6 +477,15 @@ carries the three shapes.
|
||||
|
||||
## Upscaling — measured, not guessed (Tier 1)
|
||||
|
||||
> **The NVIDIA driver's overrides are a configuration, not a measurement (beta.8, 2026-09-25).** A session now also
|
||||
> stores the driver profile its executable ran under (`sessions.driver_profile`: the NVIDIA App's DLSS, Ray
|
||||
> Reconstruction and frame-generation overrides, read from the driver's settings store — never from the game's process
|
||||
> or memory, CLAUDE.md rule 4) and the driver's own per-process override report in full (`ngx_driver_words`: preset,
|
||||
> mode, ratio beside the masks). Both are shown as what the driver was set to do and what it says it did — "NVIDIA
|
||||
> profile …: DLSS override (preset K, Quality)" — and neither changes a measured value, a rung of the upscaler ladder or
|
||||
> the frame-generation factor: those stay what the hooks saw. A profile override the hooks contradict is two true
|
||||
> statements about different things, and the page shows both.
|
||||
|
||||
From the upscaler hooks we get, per frame:
|
||||
|
||||
- `upscaler`: the technology **actually executing** (`dlss`, `fsr2`, `fsr3`, `fsr4`, `xess`, `nis`, `none`) — from the API that was called, not from a DLL sitting on disk.
|
||||
|
||||
@@ -494,6 +494,16 @@ Sequential embedded SQL (`Migrations/0001_init.sql`, `0002_*.sql`, …), applied
|
||||
> provenance and no user override. Existing rows read NULL, and a NULL `exe_machine` makes the sweep read the row once
|
||||
> more on its first pass. `LatestVersion` is 11; `LedgerDatabaseTests.ScriptElevenAddsTheExecutableFactsEmptyForExistingRows`.
|
||||
|
||||
> **`0012_driver_profile.sql` (2026-09-25) — `sessions.driver_profile`.** The NVIDIA driver profile the session's
|
||||
> executable ran under, read by the Agent's recorder beside every session (both tiers) through the NVAPI bridge's
|
||||
> read-only DRS entry point (`18_GPU_VENDOR_APIS` §L3, ABI 2): JSON (`Application.Recording.DriverProfileRecord`) —
|
||||
> `Outcome` (`Application` | `Global` | `Degraded`), `Profile`, and one entry per setting of
|
||||
> `Application.Capture.NvidiaDriverSettings` with its `Value` (null = set in no profile), `Location` and `Predefined`.
|
||||
> A driver configuration, never a measurement (`03_METRICS` §Upscaling). NULL for every row before, and where no
|
||||
> NVIDIA bridge was there to ask. The same day `ngx_driver_words` gained `Ratio`, `Mode`, `Preset`, `FgCount`,
|
||||
> `FgPreset`, `FgMode` beside its masks (additive JSON fields; older rows lack them). `LatestVersion` is 12;
|
||||
> `LedgerDatabaseTests.ScriptTwelveAddsTheDriverProfileColumn`.
|
||||
|
||||
> **Every open used to migrate, and one that should not have did — 2026-09-16.** The Agent's `--console sessions`,
|
||||
> a verb that prints, was run against the owner's ledger while the file on disk was at schema 2 and applied 0003 and
|
||||
> 0004 to it. `LedgerDatabase.OpenReadOnlyAsync` exists since that day: an existing file, `PRAGMA query_only`, no
|
||||
|
||||
+11
-1
@@ -234,7 +234,9 @@ All screens are `Page`s registered with the navigation page provider and navigat
|
||||
> cannot run as x64** (x86, 32-bit-preferring .NET, ARM) disables the hooking switch with `Hooking_NotX64_Format` under
|
||||
> it and no re-enable bar — turning it on could only be refused (the Agent refuses `ExecutableNotX64` anyway); a switch
|
||||
> already on can still be turned off. Tests: `GameDetailViewModelTests.TheDetailsCardSaysWhatTheFilesSayAndAnX86SwitchCannotBeTurnedOn`,
|
||||
> `FormatsTests`, and the page renders in `PagesLoadTests`.
|
||||
> `FormatsTests`, and the page renders in `PagesLoadTests`. **The Details card's *NVIDIA App override* row** (same day)
|
||||
> is the newest session that read a driver profile, in the same words; no row where none did. Tests:
|
||||
> `NvidiaOverridesTests`, `GameDetailViewModelTests.TheDetailsCardNamesTheNvidiaAppsOverridesFromTheNewestSessionThatReadThem`.
|
||||
- Tabs (WPF `TabControl`, Fluent-styled):
|
||||
1. **Sessions** — `DataGrid`: date, duration, **tier badge (T1/T2)**, Native, Displayed, FG×, 1% Low, 0.1% Low, resolution + upscaler, max GPU temp, API, chips, ⚠ crash badge, tags. Row → Session summary. Multi-select → "Compare". Tier-2 rows render `—` (not blank, not zero) in Tier-1-only columns, with a tooltip explaining why.
|
||||
2. **Frametime** — ScottPlot timeline of selected session (decimated), stutter markers, sensor overlay toggle (temp on right axis).
|
||||
@@ -289,6 +291,14 @@ Stat cards (Avg uses `FpsReadout`, Median, 1% Low, 0.1% Low, Min/Max, σ, stutte
|
||||
> App) · sl.interposer.dll 2,8,0,0"*. The comparison is with the game's own copy (`games.library_versions`) as the
|
||||
> same four numbers (`Formats.SameVersion`: Streamline's `2,8,0,0` string equals `2.8.0.0`); it names a difference and
|
||||
> never who made it. Older rows show their list the day this ships; a Tier-2 row has none and no line.
|
||||
>
|
||||
> **The NVIDIA driver's side (2026-09-25, beta.8).** Two more lines where they have something to say
|
||||
> (`Services.NvidiaOverrides`): the driver profile the game ran under and what it overrides — *"NVIDIA profile “Clair
|
||||
> Obscur: Expedition 33”: DLSS override (preset K, Quality) · Frame Generation override (×4, latest preset)"*, or "no
|
||||
> DLSS or frame generation override", or the global profile's when none names the game — and what the driver
|
||||
> reported applying in the game's process from its override bits (*"NVIDIA driver, for this game's process: DLSS DLL
|
||||
> chosen by the driver · preset K · Quality"*). Smooth Motion is labelled a setting community tools document, not
|
||||
> NVIDIA. Neither line is a measurement (`03_METRICS` §Upscaling); a machine without an NVIDIA driver shows neither.
|
||||
|
||||
### Compare
|
||||
Session picker (2–5, cross-game allowed) → overlaid percentile curves + stat table with best-value highlighting; FG columns always show Native and Displayed separately. Export PNG.
|
||||
|
||||
@@ -161,6 +161,29 @@ Still resolve **entry points defensively at runtime**: `nvapi64.dll` may be abse
|
||||
> **Not in this build, stated so nobody infers it from the table below:** VRAM (`FlNvSample.vram` is
|
||||
> reserved and its bit is never set — see the Memory row), power, hotspot temperature, per-domain
|
||||
> utilisation beyond the GPU domain, and anything Reflex (§M8: a hook fact, not a poller field).
|
||||
>
|
||||
> **ABI 2 (2026-09-25, beta.8): the driver profile, read-only.** The owner asked whether the NVIDIA App overrides a
|
||||
> game's DLSS (frame generation, ray reconstruction, the model preset). The NVIDIA App writes those overrides into the
|
||||
> driver's own settings store (DRS), so `FlNvDriverProfile(exePath, ids, count, out)` reads them there: a DRS session
|
||||
> is created, the settings loaded, the profile the driver applies to that path found (`NvAPI_DRS_FindApplicationByName`
|
||||
> — a fully qualified path returns the profile the driver will apply on launch; none named → the current global
|
||||
> profile), each id read with `NvAPI_DRS_GetSetting` (value, where it comes from, whether someone set it), and the
|
||||
> session destroyed. **No DRS setter exists in the bridge** — not `SetSetting`, not `SaveSettings`, not
|
||||
> `RestoreProfileDefault`, not `NvAPI_NGX_SetNGXOverrideState`: the overrides are the user's, and this only reports
|
||||
> them. A path longer than NVAPI's string is refused, never truncated (a truncated path names another program).
|
||||
> The ids and their values' meanings are NVIDIA's `NvApiDriverSettings.h` (github.com/NVIDIA/nvapi, MIT), written into
|
||||
> `Application.Capture.NvidiaDriverSettings` as eighteen constants rather than vendored as a header; Smooth Motion
|
||||
> (`0xB0D384C0`) is not in NVIDIA's header and is documented by community profile tools only, which every surface
|
||||
> that shows it says. Managed: `NvapiDriverProfileSource` (`IDriverProfileSource`) — the Agent's recorder reads the
|
||||
> profile beside every session, both tiers, and stores it in `sessions.driver_profile` (schema 0012). Verified by
|
||||
> ctest `fl_nvapi_bridge` (argument refusals, DEGRADED before init, the global profile of the test's own executable on
|
||||
> a GPU machine) and `NvapiBridgeMirrorTests` (`FlNvDriverProfileSize`, ABI 2).
|
||||
>
|
||||
> **The ctest could not fail on a GPU machine until the same day.** `fl_nvapi_bridge` was registered with
|
||||
> `PASS_REGULAR_EXPRESSION` alone, which makes ctest ignore the exit code: the AVAILABLE branch's reference-counting
|
||||
> check (two references, two releases, then a read expected to work) failed on every machine with an NVIDIA GPU while
|
||||
> ctest reported Passed, and CI — no driver — never takes that branch. The check is corrected and the registration now
|
||||
> carries a `FAIL_REGULAR_EXPRESSION` on Catch2's failure lines.
|
||||
|
||||
| Purpose | Function |
|
||||
|---|---|
|
||||
@@ -282,7 +305,7 @@ on the NVIDIA dev box even though nothing in it may be hooked or declared.
|
||||
|
||||
- Poll at 1 Hz on a dedicated Agent thread. Never from the game process, never from the Overlay.
|
||||
- Any layer that throws or hangs twice is disabled for the session and its fields report `N/A`, rather than being retried in a loop.
|
||||
- **Read-only, always.** These libraries can also set clocks, fan curves and power limits. FrameLedger never calls a setter — not in v1, not in the backlog. A measurement tool that can modify hardware state is a different product with a different risk profile.
|
||||
- **Read-only, always.** These libraries can also set clocks, fan curves and power limits. FrameLedger never calls a setter — not in v1, not in the backlog. A measurement tool that can modify hardware state is a different product with a different risk profile. *(Since beta.8 the same holds for the driver's settings store: the bridge reads DRS profiles and has no entry point that writes, saves or restores one — §L3, ABI 2.)*
|
||||
|
||||
## Capability matrix (fill during P0 on real hardware)
|
||||
|
||||
|
||||
@@ -1606,6 +1606,13 @@ only be refused, never the finding (FR-2.2).
|
||||
sweep test re-scan forever. `unknown` is the stored "looked, could not tell".
|
||||
- **`FileVersionInfo` on a System32 file reads its `.mui`.** `version.dll` read in place said 6.2.x, its copy in a temp
|
||||
folder 10.0.x: compare a version against the file that was read, never against its source.
|
||||
- **`PASS_REGULAR_EXPRESSION` alone makes ctest ignore the exit code.** `fl_nvapi_bridge` passed for weeks with a failing
|
||||
assertion on every GPU machine (CI has no driver, so never took the branch). Any test that must print a line AND
|
||||
pass needs a `FAIL_REGULAR_EXPRESSION` beside it; running the test binary directly is the check.
|
||||
- **A C ABI cannot give a function and a struct one name** (`FlNvDriverProfile` the export, `FlNvDriverProfileRead` the
|
||||
struct): C puts typedefs and functions in one namespace, and MSVC's error names neither clearly.
|
||||
- **The driver profile is a configuration.** `sessions.driver_profile` says what the NVIDIA App set; it never feeds
|
||||
the upscaler ladder or the factor. The bridge has no DRS writer, and a PR that adds one is a different product.
|
||||
- **A 32-bit refusal is not a block.** `ExecutableNotX64` writes nothing — no `hook_blocked_reason`, no stamp — so a
|
||||
64-bit build of the same game under *Change executable* can be hooked; the sweep's turn-off uses
|
||||
`hook_autodisabled_reason`, which the page does not offer to undo while the file is still 32-bit.
|
||||
|
||||
@@ -34,6 +34,7 @@ internal sealed class AgentRecording
|
||||
private readonly ISessionObserver _observer;
|
||||
private readonly CapturePause _pause;
|
||||
private readonly IRecorderPolicy _policy;
|
||||
private readonly IDriverProfileSource _profiles;
|
||||
|
||||
public AgentRecording(
|
||||
IGameConsentStore store,
|
||||
@@ -53,8 +54,10 @@ internal sealed class AgentRecording
|
||||
ICrashEventSource crashes,
|
||||
ISessionObserver observer,
|
||||
CapturePause pause,
|
||||
IRecorderPolicy policy)
|
||||
IRecorderPolicy policy,
|
||||
IDriverProfileSource profiles)
|
||||
{
|
||||
_profiles = profiles;
|
||||
_store = store;
|
||||
_gate = gate;
|
||||
_guard = guard;
|
||||
@@ -104,7 +107,8 @@ internal sealed class AgentRecording
|
||||
TimeProvider.System,
|
||||
new RecorderOptions { MinimumSessionLength = minimum, PartialFlushInterval = flush },
|
||||
_observer,
|
||||
_policy);
|
||||
_policy,
|
||||
_profiles);
|
||||
}
|
||||
|
||||
/// <summary>L1 + L2 + L3 under the composite, one poller per session; the poller owns and disposes the layers. The interval is the session's (<c>telemetry.interval_ms</c>, D16).</summary>
|
||||
|
||||
@@ -88,8 +88,7 @@ internal static class AgentServices
|
||||
services.AddSingleton<ITargetLivenessSource, HeldProcessLivenessSource>();
|
||||
services.AddSingleton<IRingAttacher>(static _ => new ShmRingAttacher(NativeAntiCheatGuard.BuildId()));
|
||||
services.AddSingleton<IRuntimeModuleSnapshot>(static _ => new RuntimeModuleSnapshot(CensusNames.ModuleFileNames));
|
||||
services.AddSingleton<NvapiNgxStateProbe>();
|
||||
services.AddSingleton<INgxDriverProbe>(static sp => sp.GetRequiredService<NvapiNgxStateProbe>());
|
||||
AddNvidia(services);
|
||||
|
||||
// The recorder's adapters (PR-D).
|
||||
services.AddSingleton<IPartialSessionStore>(_ => new PartialSessionStore(paths.Tmp));
|
||||
@@ -112,6 +111,19 @@ internal static class AgentServices
|
||||
return services;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// What the NVIDIA driver says about a session, through the bridge (never into a game): the per-process NGX words (P2
|
||||
/// PR-E2), and since beta.8 the driver profile each session's executable runs under — the NVIDIA App's DLSS and
|
||||
/// frame-generation overrides — read from the driver's settings store through the bridge's read-only DRS entry point.
|
||||
/// </summary>
|
||||
private static void AddNvidia(IServiceCollection services)
|
||||
{
|
||||
services.AddSingleton<NvapiNgxStateProbe>();
|
||||
services.AddSingleton<INgxDriverProbe>(static sp => sp.GetRequiredService<NvapiNgxStateProbe>());
|
||||
services.AddSingleton<NvapiDriverProfileSource>();
|
||||
services.AddSingleton<IDriverProfileSource>(static sp => sp.GetRequiredService<NvapiDriverProfileSource>());
|
||||
}
|
||||
|
||||
/// <summary>The static detection sweep (P4 PR-1, <c>05_DETECTION</c> §Caching): hosted under <c>--serve</c> only, composed and inert under <c>--console</c>.</summary>
|
||||
private static void AddDetection(IServiceCollection services, AgentPaths paths)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Text.Json;
|
||||
using FrameLedger.Application.Capture;
|
||||
using FrameLedger.Application.Recording;
|
||||
using S = FrameLedger.Application.Capture.NvidiaDriverSettings;
|
||||
|
||||
namespace FrameLedger.App.Services;
|
||||
|
||||
/// <summary>
|
||||
/// What the NVIDIA driver was told to do with a game, in words (beta.8, owner request 2026-09-25): the NVIDIA App's DLSS and
|
||||
/// frame-generation overrides as the driver profile stores them (<c>sessions.driver_profile</c>), and what the driver itself
|
||||
/// reported applying in the game's process (<c>sessions.ngx_driver_words</c>).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A configuration and a driver's report — never a measurement. What a session MEASURED (the upscaler a hook saw, the frame
|
||||
/// generation it counted) stays the hooks' and is shown as such; these lines say what the driver was set to do and what it
|
||||
/// says it did (<c>03_METRICS</c> §Upscaling). The meanings of the values are NVIDIA's <c>NvApiDriverSettings.h</c>.
|
||||
/// </remarks>
|
||||
[SuppressMessage("Performance", "CA1863:Use 'CompositeFormat'", Justification = "the format strings are resources that follow the UI culture, which changes at runtime")]
|
||||
public static class NvidiaOverrides
|
||||
{
|
||||
/// <summary>
|
||||
/// The session summary's line for the profile: which profile the driver applied and what it overrides. Null when there
|
||||
/// is nothing to say — no profile read (no NVIDIA driver, or a row from before beta.8).
|
||||
/// </summary>
|
||||
public static string? ProfileLine(string? driverProfileJson)
|
||||
{
|
||||
DriverProfileRecord? profile = DriverProfileRecord.Parse(driverProfileJson);
|
||||
if (profile is null || !IsRead(profile))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string overrides = OverridesText(profile);
|
||||
return string.Equals(profile.Outcome, nameof(DriverProfileOutcome.Application), StringComparison.Ordinal)
|
||||
? string.Format(CultureInfo.CurrentCulture, Strings.Nv_Profile_Format, profile.Profile ?? Strings.Common_NotAvailable, overrides)
|
||||
: string.Format(CultureInfo.CurrentCulture, Strings.Nv_Profile_Global_Format, overrides);
|
||||
}
|
||||
|
||||
/// <summary>What the profile overrides, as one phrase list — or "no DLSS or frame generation override".</summary>
|
||||
public static string OverridesText(DriverProfileRecord profile)
|
||||
{
|
||||
IReadOnlyList<string> parts = Of(profile);
|
||||
return parts.Count == 0 ? Strings.Nv_Override_None : string.Join(" · ", parts);
|
||||
}
|
||||
|
||||
/// <summary>Whether the record holds a profile that was read (an application's or the global one).</summary>
|
||||
public static bool IsRead(DriverProfileRecord profile)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(profile);
|
||||
return profile.Outcome is nameof(DriverProfileOutcome.Application) or nameof(DriverProfileOutcome.Global);
|
||||
}
|
||||
|
||||
/// <summary>The overrides a profile sets, one phrase each; empty when it sets none.</summary>
|
||||
public static IReadOnlyList<string> Of(DriverProfileRecord profile)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(profile);
|
||||
List<string> parts = [];
|
||||
if (profile.ValueOf(S.DlssSrOverride) == 1)
|
||||
{
|
||||
parts.Add(Detailed(Strings.Nv_Override_Sr, Preset(profile.ValueOf(S.DlssSrPreset)),
|
||||
Mode(profile.ValueOf(S.DlssSrMode), profile.ValueOf(S.DlssSrScalingRatio)),
|
||||
profile.ValueOf(S.DlaaOverride) == 1 ? Strings.Nv_Mode_Dlaa : null));
|
||||
}
|
||||
|
||||
if (profile.ValueOf(S.DlssRrOverride) == 1)
|
||||
{
|
||||
parts.Add(Detailed(Strings.Nv_Override_Rr, Preset(profile.ValueOf(S.DlssRrPreset)),
|
||||
Mode(profile.ValueOf(S.DlssRrMode), profile.ValueOf(S.DlssRrScalingRatio))));
|
||||
}
|
||||
|
||||
if (profile.ValueOf(S.DlssFgOverride) == 1)
|
||||
{
|
||||
parts.Add(Detailed(Strings.Nv_Override_Fg, Multiplier(profile.ValueOf(S.DlssgMultiFrameCount)), Preset(profile.ValueOf(S.DlssFgPreset)),
|
||||
FrameGenerationMode(profile.ValueOf(S.DlssgMode)), DynamicTarget(profile.ValueOf(S.DlssgDynamicTargetFrameRate))));
|
||||
}
|
||||
else if (FrameGenerationMode(profile.ValueOf(S.DlssgMode)) is { } forced)
|
||||
{
|
||||
parts.Add(forced);
|
||||
}
|
||||
|
||||
if (profile.ValueOf(S.StreamlineDlssOverride) == 1)
|
||||
{
|
||||
parts.Add(Strings.Nv_Override_Sl);
|
||||
}
|
||||
|
||||
if (profile.ValueOf(S.SmoothMotion) == 1)
|
||||
{
|
||||
parts.Add(Strings.Nv_SmoothMotion);
|
||||
}
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The session summary's line for the driver's own report on the game's process (<c>NvAPI_NGX_GetNGXOverrideState</c>):
|
||||
/// what its override bits say it applied. Null when it answered nothing, or reported no override.
|
||||
/// </summary>
|
||||
public static string? DriverLine(string? ngxDriverWordsJson)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(ngxDriverWordsJson))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
NgxDriverWords? words;
|
||||
try
|
||||
{
|
||||
words = JsonSerializer.Deserialize(ngxDriverWordsJson, RecordingJsonContext.Default.NgxDriverWords);
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (words is null || !string.Equals(words.Outcome, nameof(NgxProbeOutcome.Answered), StringComparison.Ordinal))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
ulong sr = Mask(words.Sr);
|
||||
ulong fg = Mask(words.Fg);
|
||||
List<string> parts = [];
|
||||
if ((sr & NgxOverrideFlags.DllSelected) != 0)
|
||||
{
|
||||
parts.Add(Strings.Nv_Driver_DllSelected);
|
||||
}
|
||||
|
||||
if ((sr & NgxOverrideFlags.Preset) != 0 && Preset(words.Preset) is { } preset)
|
||||
{
|
||||
parts.Add(preset);
|
||||
}
|
||||
|
||||
if ((sr & NgxOverrideFlags.PerfMode) != 0 && Mode(words.Mode, ratio: null) is { } mode)
|
||||
{
|
||||
parts.Add(mode);
|
||||
}
|
||||
|
||||
if ((sr & NgxOverrideFlags.ScalingRatio) != 0 && words.Ratio is float ratio && ratio > 0)
|
||||
{
|
||||
parts.Add(string.Format(CultureInfo.CurrentCulture, Strings.Nv_Driver_Ratio_Format, ratio.ToString("0.###", CultureInfo.CurrentCulture)));
|
||||
}
|
||||
|
||||
if ((sr & NgxOverrideFlags.SrDlaaMode) != 0)
|
||||
{
|
||||
parts.Add(Strings.Nv_Mode_Dlaa);
|
||||
}
|
||||
|
||||
if ((fg & NgxOverrideFlags.FgMultiFrame) != 0 && Multiplier(words.FgCount) is { } multiplier)
|
||||
{
|
||||
parts.Add(Detailed(Strings.Nv_Override_Fg, multiplier));
|
||||
}
|
||||
|
||||
return parts.Count == 0 ? null : string.Format(CultureInfo.CurrentCulture, Strings.Nv_Driver_Format, string.Join(" · ", parts));
|
||||
}
|
||||
|
||||
private static ulong Mask(string? hex) =>
|
||||
hex is { Length: > 2 } && ulong.TryParse(hex.AsSpan(2), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out ulong value) ? value : 0;
|
||||
|
||||
private static string Detailed(string head, params string?[] details)
|
||||
{
|
||||
string[] present = [.. details.Where(static d => !string.IsNullOrEmpty(d)).Select(static d => d!)];
|
||||
return present.Length == 0 ? head : string.Format(CultureInfo.CurrentCulture, Strings.Nv_Details_Format, head, string.Join(", ", present));
|
||||
}
|
||||
|
||||
/// <summary>A render preset: 1 = A … 26 = Z, "latest", "default"; 0 (off) and anything else say nothing.</summary>
|
||||
public static string? Preset(uint? value) => value switch
|
||||
{
|
||||
null or 0 => null,
|
||||
S.PresetLatest => Strings.Nv_Preset_Latest,
|
||||
S.PresetDefault => Strings.Nv_Preset_Default,
|
||||
>= 1 and <= 26 => string.Format(CultureInfo.CurrentCulture, Strings.Nv_Preset_Format, (char)('A' + (int)value.Value - 1)),
|
||||
_ => null,
|
||||
};
|
||||
|
||||
/// <summary><c>NGX_DLSS_SR_MODE</c> / <c>_RR_MODE</c>; 3 is "the game's own" — no override — and says nothing.</summary>
|
||||
public static string? Mode(uint? value, uint? ratio) => value switch
|
||||
{
|
||||
0 => Strings.Nv_Mode_Performance,
|
||||
1 => Strings.Nv_Mode_Balanced,
|
||||
2 => Strings.Nv_Mode_Quality,
|
||||
4 => Strings.Nv_Mode_Dlaa,
|
||||
5 => Strings.Nv_Mode_UltraPerformance,
|
||||
6 => ratio is >= 33 and <= 100
|
||||
? string.Format(CultureInfo.CurrentCulture, Strings.Nv_Mode_Custom_Format, ratio.Value)
|
||||
: Strings.Nv_Mode_Custom,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
/// <summary><c>NGX_DLSSG_MULTI_FRAME_COUNT</c>: frames generated per rendered frame, said as the multiplier (1 = ×2 … 3 = ×4).</summary>
|
||||
public static string? Multiplier(uint? generated) =>
|
||||
generated is >= 1 and <= 15 ? string.Format(CultureInfo.CurrentCulture, Strings.Nv_Mfg_Format, generated.Value + 1) : null;
|
||||
|
||||
private static string? FrameGenerationMode(uint? value) => value switch
|
||||
{
|
||||
1 => Strings.Nv_FgMode_Off,
|
||||
2 => Strings.Nv_FgMode_On,
|
||||
3 => Strings.Nv_FgMode_Auto,
|
||||
4 => Strings.Nv_FgMode_Dynamic,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
private static string? DynamicTarget(uint? value) => value switch
|
||||
{
|
||||
null or 0 => null,
|
||||
S.DynamicTargetAuto => Strings.Nv_DynamicTarget_Auto,
|
||||
< S.DynamicTargetAuto => string.Format(CultureInfo.CurrentCulture, Strings.Nv_DynamicTarget_Format, value.Value),
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
Generated
+90
@@ -273,6 +273,7 @@ public static class Strings
|
||||
nameof(GameDetail_Details_LibraryNoVersion_Format),
|
||||
nameof(GameDetail_Details_NoLibraries),
|
||||
nameof(GameDetail_Details_NotRead),
|
||||
nameof(GameDetail_Details_NvidiaOverride),
|
||||
nameof(GameDetail_Details_ProductVersion),
|
||||
nameof(GameDetail_Details_Store),
|
||||
nameof(GameDetail_Details_Version),
|
||||
@@ -426,6 +427,35 @@ public static class Strings
|
||||
nameof(Notice_Refused_Recording),
|
||||
nameof(Notice_Refused_Title_Format),
|
||||
nameof(Notice_Unhooked_Title),
|
||||
nameof(Nv_Details_Format),
|
||||
nameof(Nv_Driver_DllSelected),
|
||||
nameof(Nv_Driver_Format),
|
||||
nameof(Nv_Driver_Ratio_Format),
|
||||
nameof(Nv_DynamicTarget_Auto),
|
||||
nameof(Nv_DynamicTarget_Format),
|
||||
nameof(Nv_FgMode_Auto),
|
||||
nameof(Nv_FgMode_Dynamic),
|
||||
nameof(Nv_FgMode_Off),
|
||||
nameof(Nv_FgMode_On),
|
||||
nameof(Nv_Mfg_Format),
|
||||
nameof(Nv_Mode_Balanced),
|
||||
nameof(Nv_Mode_Custom),
|
||||
nameof(Nv_Mode_Custom_Format),
|
||||
nameof(Nv_Mode_Dlaa),
|
||||
nameof(Nv_Mode_Performance),
|
||||
nameof(Nv_Mode_Quality),
|
||||
nameof(Nv_Mode_UltraPerformance),
|
||||
nameof(Nv_Override_Fg),
|
||||
nameof(Nv_Override_None),
|
||||
nameof(Nv_Override_Rr),
|
||||
nameof(Nv_Override_Sl),
|
||||
nameof(Nv_Override_Sr),
|
||||
nameof(Nv_Preset_Default),
|
||||
nameof(Nv_Preset_Format),
|
||||
nameof(Nv_Preset_Latest),
|
||||
nameof(Nv_Profile_Format),
|
||||
nameof(Nv_Profile_Global_Format),
|
||||
nameof(Nv_SmoothMotion),
|
||||
nameof(Override_Apply),
|
||||
nameof(Override_Body),
|
||||
nameof(Override_Default),
|
||||
@@ -1174,6 +1204,8 @@ public static class Strings
|
||||
|
||||
public static string GameDetail_Details_NotRead => ResourceManager.GetString(nameof(GameDetail_Details_NotRead), Culture) ?? nameof(GameDetail_Details_NotRead);
|
||||
|
||||
public static string GameDetail_Details_NvidiaOverride => ResourceManager.GetString(nameof(GameDetail_Details_NvidiaOverride), Culture) ?? nameof(GameDetail_Details_NvidiaOverride);
|
||||
|
||||
public static string GameDetail_Details_ProductVersion => ResourceManager.GetString(nameof(GameDetail_Details_ProductVersion), Culture) ?? nameof(GameDetail_Details_ProductVersion);
|
||||
|
||||
public static string GameDetail_Details_Store => ResourceManager.GetString(nameof(GameDetail_Details_Store), Culture) ?? nameof(GameDetail_Details_Store);
|
||||
@@ -1480,6 +1512,64 @@ public static class Strings
|
||||
|
||||
public static string Notice_Unhooked_Title => ResourceManager.GetString(nameof(Notice_Unhooked_Title), Culture) ?? nameof(Notice_Unhooked_Title);
|
||||
|
||||
public static string Nv_Details_Format => ResourceManager.GetString(nameof(Nv_Details_Format), Culture) ?? nameof(Nv_Details_Format);
|
||||
|
||||
public static string Nv_Driver_DllSelected => ResourceManager.GetString(nameof(Nv_Driver_DllSelected), Culture) ?? nameof(Nv_Driver_DllSelected);
|
||||
|
||||
public static string Nv_Driver_Format => ResourceManager.GetString(nameof(Nv_Driver_Format), Culture) ?? nameof(Nv_Driver_Format);
|
||||
|
||||
public static string Nv_Driver_Ratio_Format => ResourceManager.GetString(nameof(Nv_Driver_Ratio_Format), Culture) ?? nameof(Nv_Driver_Ratio_Format);
|
||||
|
||||
public static string Nv_DynamicTarget_Auto => ResourceManager.GetString(nameof(Nv_DynamicTarget_Auto), Culture) ?? nameof(Nv_DynamicTarget_Auto);
|
||||
|
||||
public static string Nv_DynamicTarget_Format => ResourceManager.GetString(nameof(Nv_DynamicTarget_Format), Culture) ?? nameof(Nv_DynamicTarget_Format);
|
||||
|
||||
public static string Nv_FgMode_Auto => ResourceManager.GetString(nameof(Nv_FgMode_Auto), Culture) ?? nameof(Nv_FgMode_Auto);
|
||||
|
||||
public static string Nv_FgMode_Dynamic => ResourceManager.GetString(nameof(Nv_FgMode_Dynamic), Culture) ?? nameof(Nv_FgMode_Dynamic);
|
||||
|
||||
public static string Nv_FgMode_Off => ResourceManager.GetString(nameof(Nv_FgMode_Off), Culture) ?? nameof(Nv_FgMode_Off);
|
||||
|
||||
public static string Nv_FgMode_On => ResourceManager.GetString(nameof(Nv_FgMode_On), Culture) ?? nameof(Nv_FgMode_On);
|
||||
|
||||
public static string Nv_Mfg_Format => ResourceManager.GetString(nameof(Nv_Mfg_Format), Culture) ?? nameof(Nv_Mfg_Format);
|
||||
|
||||
public static string Nv_Mode_Balanced => ResourceManager.GetString(nameof(Nv_Mode_Balanced), Culture) ?? nameof(Nv_Mode_Balanced);
|
||||
|
||||
public static string Nv_Mode_Custom => ResourceManager.GetString(nameof(Nv_Mode_Custom), Culture) ?? nameof(Nv_Mode_Custom);
|
||||
|
||||
public static string Nv_Mode_Custom_Format => ResourceManager.GetString(nameof(Nv_Mode_Custom_Format), Culture) ?? nameof(Nv_Mode_Custom_Format);
|
||||
|
||||
public static string Nv_Mode_Dlaa => ResourceManager.GetString(nameof(Nv_Mode_Dlaa), Culture) ?? nameof(Nv_Mode_Dlaa);
|
||||
|
||||
public static string Nv_Mode_Performance => ResourceManager.GetString(nameof(Nv_Mode_Performance), Culture) ?? nameof(Nv_Mode_Performance);
|
||||
|
||||
public static string Nv_Mode_Quality => ResourceManager.GetString(nameof(Nv_Mode_Quality), Culture) ?? nameof(Nv_Mode_Quality);
|
||||
|
||||
public static string Nv_Mode_UltraPerformance => ResourceManager.GetString(nameof(Nv_Mode_UltraPerformance), Culture) ?? nameof(Nv_Mode_UltraPerformance);
|
||||
|
||||
public static string Nv_Override_Fg => ResourceManager.GetString(nameof(Nv_Override_Fg), Culture) ?? nameof(Nv_Override_Fg);
|
||||
|
||||
public static string Nv_Override_None => ResourceManager.GetString(nameof(Nv_Override_None), Culture) ?? nameof(Nv_Override_None);
|
||||
|
||||
public static string Nv_Override_Rr => ResourceManager.GetString(nameof(Nv_Override_Rr), Culture) ?? nameof(Nv_Override_Rr);
|
||||
|
||||
public static string Nv_Override_Sl => ResourceManager.GetString(nameof(Nv_Override_Sl), Culture) ?? nameof(Nv_Override_Sl);
|
||||
|
||||
public static string Nv_Override_Sr => ResourceManager.GetString(nameof(Nv_Override_Sr), Culture) ?? nameof(Nv_Override_Sr);
|
||||
|
||||
public static string Nv_Preset_Default => ResourceManager.GetString(nameof(Nv_Preset_Default), Culture) ?? nameof(Nv_Preset_Default);
|
||||
|
||||
public static string Nv_Preset_Format => ResourceManager.GetString(nameof(Nv_Preset_Format), Culture) ?? nameof(Nv_Preset_Format);
|
||||
|
||||
public static string Nv_Preset_Latest => ResourceManager.GetString(nameof(Nv_Preset_Latest), Culture) ?? nameof(Nv_Preset_Latest);
|
||||
|
||||
public static string Nv_Profile_Format => ResourceManager.GetString(nameof(Nv_Profile_Format), Culture) ?? nameof(Nv_Profile_Format);
|
||||
|
||||
public static string Nv_Profile_Global_Format => ResourceManager.GetString(nameof(Nv_Profile_Global_Format), Culture) ?? nameof(Nv_Profile_Global_Format);
|
||||
|
||||
public static string Nv_SmoothMotion => ResourceManager.GetString(nameof(Nv_SmoothMotion), Culture) ?? nameof(Nv_SmoothMotion);
|
||||
|
||||
public static string Override_Apply => ResourceManager.GetString(nameof(Override_Apply), Culture) ?? nameof(Override_Apply);
|
||||
|
||||
public static string Override_Body => ResourceManager.GetString(nameof(Override_Body), Culture) ?? nameof(Override_Body);
|
||||
|
||||
@@ -2641,4 +2641,124 @@
|
||||
<value>{0} {1}(ゲーム同梱は {2}。ドライバーや NVIDIA App などにより別のコピーが読み込まれました)</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Profile_Format" xml:space="preserve">
|
||||
<value>NVIDIA プロファイル「{0}」: {1}</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Profile_Global_Format" xml:space="preserve">
|
||||
<value>NVIDIA グローバル プロファイル(このゲーム用のプロファイルはありません): {0}</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Override_None" xml:space="preserve">
|
||||
<value>DLSS やフレーム生成の上書きはありません</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Override_Sr" xml:space="preserve">
|
||||
<value>DLSS の上書き</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Override_Rr" xml:space="preserve">
|
||||
<value>レイ再構成の上書き</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Override_Fg" xml:space="preserve">
|
||||
<value>フレーム生成の上書き</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Override_Sl" xml:space="preserve">
|
||||
<value>Streamline 経由の DLSS の上書き</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_FgMode_Off" xml:space="preserve">
|
||||
<value>フレーム生成を強制オフ</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_FgMode_On" xml:space="preserve">
|
||||
<value>フレーム生成を強制オン</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_FgMode_Auto" xml:space="preserve">
|
||||
<value>フレーム生成は自動</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_FgMode_Dynamic" xml:space="preserve">
|
||||
<value>動的フレーム生成</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_SmoothMotion" xml:space="preserve">
|
||||
<value>Smooth Motion(NVIDIA ではなくコミュニティのツールが記載している設定)</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Details_Format" xml:space="preserve">
|
||||
<value>{0}({1})</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Preset_Format" xml:space="preserve">
|
||||
<value>プリセット {0}</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Preset_Latest" xml:space="preserve">
|
||||
<value>最新のプリセット</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Preset_Default" xml:space="preserve">
|
||||
<value>既定のプリセット</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Mode_Performance" xml:space="preserve">
|
||||
<value>パフォーマンス</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Mode_Balanced" xml:space="preserve">
|
||||
<value>バランス</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Mode_Quality" xml:space="preserve">
|
||||
<value>クオリティ</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Mode_Dlaa" xml:space="preserve">
|
||||
<value>DLAA</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Mode_UltraPerformance" xml:space="preserve">
|
||||
<value>ウルトラ パフォーマンス</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Mode_Custom_Format" xml:space="preserve">
|
||||
<value>カスタム {0}%</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Mode_Custom" xml:space="preserve">
|
||||
<value>カスタム比率</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Mfg_Format" xml:space="preserve">
|
||||
<value>×{0}</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_DynamicTarget_Format" xml:space="preserve">
|
||||
<value>動的ターゲット {0} FPS</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_DynamicTarget_Auto" xml:space="preserve">
|
||||
<value>動的ターゲットは自動</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Driver_Format" xml:space="preserve">
|
||||
<value>NVIDIA ドライバー(このゲームのプロセス): {0}</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Driver_DllSelected" xml:space="preserve">
|
||||
<value>ドライバーが選んだ DLSS DLL</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Nv_Driver_Ratio_Format" xml:space="preserve">
|
||||
<value>比率 {0}</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="GameDetail_Details_NvidiaOverride" xml:space="preserve">
|
||||
<value>NVIDIA App の上書き</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1991,4 +1991,94 @@ The documents below are the full terms; this summary does not replace them.</val
|
||||
<data name="Summary_Library_Differs_Format" xml:space="preserve">
|
||||
<value>{0} {1} (the game ships {2}: another copy was loaded, for example by the driver or the NVIDIA App)</value>
|
||||
</data>
|
||||
<data name="Nv_Profile_Format" xml:space="preserve">
|
||||
<value>NVIDIA profile “{0}”: {1}</value>
|
||||
</data>
|
||||
<data name="Nv_Profile_Global_Format" xml:space="preserve">
|
||||
<value>NVIDIA global profile (no profile names this game): {0}</value>
|
||||
</data>
|
||||
<data name="Nv_Override_None" xml:space="preserve">
|
||||
<value>no DLSS or frame generation override</value>
|
||||
</data>
|
||||
<data name="Nv_Override_Sr" xml:space="preserve">
|
||||
<value>DLSS override</value>
|
||||
</data>
|
||||
<data name="Nv_Override_Rr" xml:space="preserve">
|
||||
<value>Ray Reconstruction override</value>
|
||||
</data>
|
||||
<data name="Nv_Override_Fg" xml:space="preserve">
|
||||
<value>Frame Generation override</value>
|
||||
</data>
|
||||
<data name="Nv_Override_Sl" xml:space="preserve">
|
||||
<value>Streamline DLSS override</value>
|
||||
</data>
|
||||
<data name="Nv_FgMode_Off" xml:space="preserve">
|
||||
<value>frame generation forced off</value>
|
||||
</data>
|
||||
<data name="Nv_FgMode_On" xml:space="preserve">
|
||||
<value>frame generation forced on</value>
|
||||
</data>
|
||||
<data name="Nv_FgMode_Auto" xml:space="preserve">
|
||||
<value>frame generation automatic</value>
|
||||
</data>
|
||||
<data name="Nv_FgMode_Dynamic" xml:space="preserve">
|
||||
<value>dynamic frame generation</value>
|
||||
</data>
|
||||
<data name="Nv_SmoothMotion" xml:space="preserve">
|
||||
<value>Smooth Motion (a setting community tools document, not NVIDIA)</value>
|
||||
</data>
|
||||
<data name="Nv_Details_Format" xml:space="preserve">
|
||||
<value>{0} ({1})</value>
|
||||
</data>
|
||||
<data name="Nv_Preset_Format" xml:space="preserve">
|
||||
<value>preset {0}</value>
|
||||
</data>
|
||||
<data name="Nv_Preset_Latest" xml:space="preserve">
|
||||
<value>latest preset</value>
|
||||
</data>
|
||||
<data name="Nv_Preset_Default" xml:space="preserve">
|
||||
<value>default preset</value>
|
||||
</data>
|
||||
<data name="Nv_Mode_Performance" xml:space="preserve">
|
||||
<value>Performance</value>
|
||||
</data>
|
||||
<data name="Nv_Mode_Balanced" xml:space="preserve">
|
||||
<value>Balanced</value>
|
||||
</data>
|
||||
<data name="Nv_Mode_Quality" xml:space="preserve">
|
||||
<value>Quality</value>
|
||||
</data>
|
||||
<data name="Nv_Mode_Dlaa" xml:space="preserve">
|
||||
<value>DLAA</value>
|
||||
</data>
|
||||
<data name="Nv_Mode_UltraPerformance" xml:space="preserve">
|
||||
<value>Ultra Performance</value>
|
||||
</data>
|
||||
<data name="Nv_Mode_Custom_Format" xml:space="preserve">
|
||||
<value>custom {0}%</value>
|
||||
</data>
|
||||
<data name="Nv_Mode_Custom" xml:space="preserve">
|
||||
<value>custom ratio</value>
|
||||
</data>
|
||||
<data name="Nv_Mfg_Format" xml:space="preserve">
|
||||
<value>×{0}</value>
|
||||
</data>
|
||||
<data name="Nv_DynamicTarget_Format" xml:space="preserve">
|
||||
<value>dynamic target {0} FPS</value>
|
||||
</data>
|
||||
<data name="Nv_DynamicTarget_Auto" xml:space="preserve">
|
||||
<value>dynamic target automatic</value>
|
||||
</data>
|
||||
<data name="Nv_Driver_Format" xml:space="preserve">
|
||||
<value>NVIDIA driver, for this game's process: {0}</value>
|
||||
</data>
|
||||
<data name="Nv_Driver_DllSelected" xml:space="preserve">
|
||||
<value>DLSS DLL chosen by the driver</value>
|
||||
</data>
|
||||
<data name="Nv_Driver_Ratio_Format" xml:space="preserve">
|
||||
<value>ratio {0}</value>
|
||||
</data>
|
||||
<data name="GameDetail_Details_NvidiaOverride" xml:space="preserve">
|
||||
<value>NVIDIA App override</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1986,4 +1986,94 @@ Các tài liệu bên dưới là điều khoản đầy đủ; phần tóm tắ
|
||||
<data name="Summary_Library_Differs_Format" xml:space="preserve">
|
||||
<value>{0} {1} (game kèm bản {2}: một bản khác đã được nạp, ví dụ bởi driver hoặc NVIDIA App)</value>
|
||||
</data>
|
||||
<data name="Nv_Profile_Format" xml:space="preserve">
|
||||
<value>Profile NVIDIA “{0}”: {1}</value>
|
||||
</data>
|
||||
<data name="Nv_Profile_Global_Format" xml:space="preserve">
|
||||
<value>Profile toàn cục của NVIDIA (không có profile riêng cho game này): {0}</value>
|
||||
</data>
|
||||
<data name="Nv_Override_None" xml:space="preserve">
|
||||
<value>không ghi đè DLSS hay tạo khung hình</value>
|
||||
</data>
|
||||
<data name="Nv_Override_Sr" xml:space="preserve">
|
||||
<value>Ghi đè DLSS</value>
|
||||
</data>
|
||||
<data name="Nv_Override_Rr" xml:space="preserve">
|
||||
<value>Ghi đè Ray Reconstruction</value>
|
||||
</data>
|
||||
<data name="Nv_Override_Fg" xml:space="preserve">
|
||||
<value>Ghi đè Frame Generation</value>
|
||||
</data>
|
||||
<data name="Nv_Override_Sl" xml:space="preserve">
|
||||
<value>Ghi đè DLSS qua Streamline</value>
|
||||
</data>
|
||||
<data name="Nv_FgMode_Off" xml:space="preserve">
|
||||
<value>tạo khung hình bị ép tắt</value>
|
||||
</data>
|
||||
<data name="Nv_FgMode_On" xml:space="preserve">
|
||||
<value>tạo khung hình bị ép bật</value>
|
||||
</data>
|
||||
<data name="Nv_FgMode_Auto" xml:space="preserve">
|
||||
<value>tạo khung hình tự động</value>
|
||||
</data>
|
||||
<data name="Nv_FgMode_Dynamic" xml:space="preserve">
|
||||
<value>tạo khung hình động</value>
|
||||
</data>
|
||||
<data name="Nv_SmoothMotion" xml:space="preserve">
|
||||
<value>Smooth Motion (setting do công cụ cộng đồng ghi nhận, không phải NVIDIA)</value>
|
||||
</data>
|
||||
<data name="Nv_Details_Format" xml:space="preserve">
|
||||
<value>{0} ({1})</value>
|
||||
</data>
|
||||
<data name="Nv_Preset_Format" xml:space="preserve">
|
||||
<value>preset {0}</value>
|
||||
</data>
|
||||
<data name="Nv_Preset_Latest" xml:space="preserve">
|
||||
<value>preset mới nhất</value>
|
||||
</data>
|
||||
<data name="Nv_Preset_Default" xml:space="preserve">
|
||||
<value>preset mặc định</value>
|
||||
</data>
|
||||
<data name="Nv_Mode_Performance" xml:space="preserve">
|
||||
<value>Performance</value>
|
||||
</data>
|
||||
<data name="Nv_Mode_Balanced" xml:space="preserve">
|
||||
<value>Balanced</value>
|
||||
</data>
|
||||
<data name="Nv_Mode_Quality" xml:space="preserve">
|
||||
<value>Quality</value>
|
||||
</data>
|
||||
<data name="Nv_Mode_Dlaa" xml:space="preserve">
|
||||
<value>DLAA</value>
|
||||
</data>
|
||||
<data name="Nv_Mode_UltraPerformance" xml:space="preserve">
|
||||
<value>Ultra Performance</value>
|
||||
</data>
|
||||
<data name="Nv_Mode_Custom_Format" xml:space="preserve">
|
||||
<value>tùy chỉnh {0}%</value>
|
||||
</data>
|
||||
<data name="Nv_Mode_Custom" xml:space="preserve">
|
||||
<value>tỷ lệ tùy chỉnh</value>
|
||||
</data>
|
||||
<data name="Nv_Mfg_Format" xml:space="preserve">
|
||||
<value>×{0}</value>
|
||||
</data>
|
||||
<data name="Nv_DynamicTarget_Format" xml:space="preserve">
|
||||
<value>mục tiêu động {0} FPS</value>
|
||||
</data>
|
||||
<data name="Nv_DynamicTarget_Auto" xml:space="preserve">
|
||||
<value>mục tiêu động tự động</value>
|
||||
</data>
|
||||
<data name="Nv_Driver_Format" xml:space="preserve">
|
||||
<value>Driver NVIDIA, cho tiến trình của game này: {0}</value>
|
||||
</data>
|
||||
<data name="Nv_Driver_DllSelected" xml:space="preserve">
|
||||
<value>DLL DLSS do driver chọn</value>
|
||||
</data>
|
||||
<data name="Nv_Driver_Ratio_Format" xml:space="preserve">
|
||||
<value>tỷ lệ {0}</value>
|
||||
</data>
|
||||
<data name="GameDetail_Details_NvidiaOverride" xml:space="preserve">
|
||||
<value>Ghi đè của NVIDIA App</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -599,7 +599,7 @@ public sealed partial class GameDetailViewModel : ObservableObject
|
||||
|
||||
PresentChips(detail, lastHooked);
|
||||
PresentSupports(row);
|
||||
PresentDetails(row);
|
||||
PresentDetails(detail);
|
||||
PresentMeasured(last, lastHooked);
|
||||
PresentRecording(row);
|
||||
PresentHooking(row);
|
||||
@@ -635,8 +635,9 @@ public sealed partial class GameDetailViewModel : ObservableObject
|
||||
SupportsEmpty = Supports.Count == 0;
|
||||
}
|
||||
|
||||
private void PresentDetails(GameRow row)
|
||||
private void PresentDetails(GameDetail detail)
|
||||
{
|
||||
GameRow row = detail.Row;
|
||||
Details.Clear();
|
||||
if (row.ExeMachine is null)
|
||||
{
|
||||
@@ -659,6 +660,14 @@ public sealed partial class GameDetailViewModel : ObservableObject
|
||||
? Strings.GameDetail_Details_NoLibraries
|
||||
: string.Join(Environment.NewLine, row.Libraries.Select(LibraryText))));
|
||||
}
|
||||
|
||||
// beta.8: the NVIDIA App's overrides, as the driver profile stood at the newest session that read one (sessions
|
||||
// come newest first). Nothing is shown where no session could ask — a machine without an NVIDIA driver.
|
||||
if (detail.Sessions.Select(static s => Application.Recording.DriverProfileRecord.Parse(s.DriverProfileJson))
|
||||
.FirstOrDefault(static p => p is not null && NvidiaOverrides.IsRead(p)) is { } profile)
|
||||
{
|
||||
Details.Add(new GameDetailRow(Strings.GameDetail_Details_NvidiaOverride, NvidiaOverrides.OverridesText(profile)));
|
||||
}
|
||||
}
|
||||
|
||||
private void AddDetail(string label, string? value)
|
||||
|
||||
@@ -51,6 +51,17 @@ public sealed partial class SessionSummaryViewModel : ObservableObject
|
||||
[ObservableProperty]
|
||||
private string? _librariesLine;
|
||||
|
||||
/// <summary>
|
||||
/// The NVIDIA driver profile the game ran under and what it overrides (<c>sessions.driver_profile</c>, beta.8) — the
|
||||
/// NVIDIA App's DLSS and frame-generation overrides; null where no NVIDIA driver was there to ask.
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string? _driverProfileLine;
|
||||
|
||||
/// <summary>What the driver reported applying in the game's process (<c>sessions.ngx_driver_words</c>); null when it reported no override.</summary>
|
||||
[ObservableProperty]
|
||||
private string? _driverStateLine;
|
||||
|
||||
[ObservableProperty]
|
||||
private FpsReadoutModel _readout = FpsReadoutModel.Unavailable;
|
||||
|
||||
@@ -298,6 +309,8 @@ public sealed partial class SessionSummaryViewModel : ObservableObject
|
||||
? string.Empty
|
||||
: string.Join(" · ", SystemInfoViewModel.Describe(_snapshot).Where(static l => !string.Equals(l.Value, Strings.Common_NotAvailable, StringComparison.Ordinal)).Select(static l => l.Value));
|
||||
LibrariesLine = LoadedLibraries(row.RuntimeModulesJson, Game.Libraries);
|
||||
DriverProfileLine = NvidiaOverrides.ProfileLine(row.DriverProfileJson);
|
||||
DriverStateLine = NvidiaOverrides.DriverLine(row.NgxDriverWordsJson);
|
||||
Tags = _annotation is null ? string.Empty : string.Join(", ", _annotation.Tags);
|
||||
Notes = _annotation?.Notes ?? string.Empty;
|
||||
HasDisplayed = Series?.HasGenerated == true;
|
||||
|
||||
@@ -40,6 +40,10 @@
|
||||
<ui:TextBlock Appearance="Tertiary" TextWrapping="Wrap" Text="{Binding ViewModel.HardwareLine}" />
|
||||
<ui:TextBlock Appearance="Tertiary" TextWrapping="Wrap" Text="{Binding ViewModel.LibrariesLine}"
|
||||
Visibility="{Binding ViewModel.LibrariesLine, Converter={StaticResource NullToCollapsed}}" />
|
||||
<ui:TextBlock Appearance="Tertiary" TextWrapping="Wrap" Text="{Binding ViewModel.DriverProfileLine}"
|
||||
Visibility="{Binding ViewModel.DriverProfileLine, Converter={StaticResource NullToCollapsed}}" />
|
||||
<ui:TextBlock Appearance="Tertiary" TextWrapping="Wrap" Text="{Binding ViewModel.DriverStateLine}"
|
||||
Visibility="{Binding ViewModel.DriverStateLine, Converter={StaticResource NullToCollapsed}}" />
|
||||
<ItemsControl Margin="0,8,0,0" ItemsSource="{Binding ViewModel.Chips}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace FrameLedger.Application.Capture;
|
||||
|
||||
/// <summary>Which branch a driver-profile read took (<c>FL_NV_PROFILE_*</c>).</summary>
|
||||
public enum DriverProfileOutcome
|
||||
{
|
||||
/// <summary>Nothing was asked.</summary>
|
||||
NotRead,
|
||||
|
||||
/// <summary>An application profile names the executable; its values are what the driver gives it.</summary>
|
||||
Application,
|
||||
|
||||
/// <summary>No profile names it: the current global profile's values are what it gets.</summary>
|
||||
Global,
|
||||
|
||||
/// <summary>No usable NVIDIA driver, or its settings store refused.</summary>
|
||||
Degraded,
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace FrameLedger.Application.Capture;
|
||||
|
||||
/// <summary>What <see cref="IDriverProfileSource"/> read for one executable.</summary>
|
||||
public sealed record DriverProfileReading
|
||||
{
|
||||
/// <summary>Nothing was asked: no source composed.</summary>
|
||||
public static readonly DriverProfileReading NotRead = new() { Outcome = DriverProfileOutcome.NotRead };
|
||||
|
||||
public required DriverProfileOutcome Outcome { get; init; }
|
||||
|
||||
/// <summary>The profile the driver applies, as the driver names it; null when none was read.</summary>
|
||||
public string? ProfileName { get; init; }
|
||||
|
||||
/// <summary>The NvAPI status behind a degraded answer (or the lookup's, for the global branch).</summary>
|
||||
public int? NvapiStatus { get; init; }
|
||||
|
||||
/// <summary>One entry per id asked, in that order; empty unless the outcome is <see cref="DriverProfileOutcome.Application"/> or <see cref="DriverProfileOutcome.Global"/>.</summary>
|
||||
public IReadOnlyList<DriverSettingReading> Settings { get; init; } = [];
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace FrameLedger.Application.Capture;
|
||||
|
||||
/// <summary>Where a driver setting's value comes from (<c>NVDRS_SETTING_LOCATION</c>, plus "set nowhere").</summary>
|
||||
public enum DriverSettingLocation
|
||||
{
|
||||
/// <summary>Set in no profile (<c>NVAPI_SETTING_NOT_FOUND</c>): the driver's own behaviour applies.</summary>
|
||||
NotSet,
|
||||
|
||||
/// <summary>The profile the driver applies to this executable.</summary>
|
||||
Profile,
|
||||
|
||||
/// <summary>The global profile.</summary>
|
||||
Global,
|
||||
|
||||
/// <summary>The base profile.</summary>
|
||||
Base,
|
||||
|
||||
/// <summary>The driver's default.</summary>
|
||||
Default,
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace FrameLedger.Application.Capture;
|
||||
|
||||
/// <summary>
|
||||
/// One driver setting as the profile gives it: its value (null when it is set in no profile, so the driver behaves as it
|
||||
/// ships), where that value comes from, and whether it is the driver's shipped value or one someone set.
|
||||
/// </summary>
|
||||
public sealed record DriverSettingReading(uint Id, uint? Value, DriverSettingLocation Location, bool Predefined);
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace FrameLedger.Application.Capture;
|
||||
|
||||
/// <summary>
|
||||
/// The NVIDIA driver profile an executable runs under (beta.8, 2026-09-25): which profile the driver applies to it, and
|
||||
/// the values that profile gives the DLSS and frame-generation override settings the NVIDIA App writes
|
||||
/// (<see cref="NvidiaDriverSettings"/>).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Read from the driver's own settings store, by the executable's path, through the NVAPI bridge's read-only DRS entry
|
||||
/// point — never from the game's process or memory (CLAUDE.md rule 4), and nothing is ever written back. A machine
|
||||
/// without an NVIDIA driver answers <see cref="DriverProfileOutcome.Degraded"/>; the call never throws.
|
||||
/// </remarks>
|
||||
public interface IDriverProfileSource
|
||||
{
|
||||
DriverProfileReading Read(string exePath);
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
namespace FrameLedger.Application.Capture;
|
||||
|
||||
/// <summary>
|
||||
/// The NVIDIA driver (DRS) setting ids behind the NVIDIA App's per-game DLSS and frame-generation overrides, which
|
||||
/// <see cref="IDriverProfileSource"/> reads (beta.8, 2026-09-25). The ids and the meanings of their values are NVIDIA's own
|
||||
/// <c>NvApiDriverSettings.h</c> (github.com/NVIDIA/nvapi, MIT) — except <see cref="SmoothMotion"/>, which NVIDIA has not
|
||||
/// published and which community profile tools (nvidiaProfileInspector) document; every surface that shows it says so.
|
||||
/// </summary>
|
||||
public static class NvidiaDriverSettings
|
||||
{
|
||||
/// <summary><c>NGX_DLSS_SR_OVERRIDE</c>: 0 off, 1 on — the NVIDIA App's DLSS Super Resolution override.</summary>
|
||||
public const uint DlssSrOverride = 0x10E41E01;
|
||||
|
||||
/// <summary><c>NGX_DLSS_RR_OVERRIDE</c>: 0 off, 1 on — its Ray Reconstruction override.</summary>
|
||||
public const uint DlssRrOverride = 0x10E41E02;
|
||||
|
||||
/// <summary><c>NGX_DLSS_FG_OVERRIDE</c>: 0 off, 1 on — its Frame Generation override.</summary>
|
||||
public const uint DlssFgOverride = 0x10E41E03;
|
||||
|
||||
/// <summary><c>SL_DLSS_OVERRIDE</c>: 0 off, 1 on — the override for a title that reaches DLSS through Streamline.</summary>
|
||||
public const uint StreamlineDlssOverride = 0x10E41E06;
|
||||
|
||||
/// <summary><c>NGX_DLSS_SR_OVERRIDE_RENDER_PRESET_SELECTION</c>: 0 off, 1–15 preset A–O, <see cref="PresetLatest"/>.</summary>
|
||||
public const uint DlssSrPreset = 0x10E41DF3;
|
||||
|
||||
/// <summary><c>NGX_DLSS_RR_OVERRIDE_RENDER_PRESET_SELECTION</c>: 0 off, 1–15 preset A–O, <see cref="PresetLatest"/>.</summary>
|
||||
public const uint DlssRrPreset = 0x10E41DF7;
|
||||
|
||||
/// <summary><c>NGX_DLSS_FG_OVERRIDE_RENDER_PRESET_SELECTION</c>: 0 off, 1–26 preset A–Z, <see cref="PresetDefault"/>, <see cref="PresetLatest"/>.</summary>
|
||||
public const uint DlssFgPreset = 0x10E41DF1;
|
||||
|
||||
/// <summary><c>NGX_DLSS_SR_MODE</c>: 0 Performance, 1 Balanced, 2 Quality, 3 the game's own (the default), 4 DLAA, 5 Ultra Performance, 6 custom.</summary>
|
||||
public const uint DlssSrMode = 0x10AFB768;
|
||||
|
||||
/// <summary><c>NGX_DLSS_RR_MODE</c>: as <see cref="DlssSrMode"/>.</summary>
|
||||
public const uint DlssRrMode = 0x10BD9423;
|
||||
|
||||
/// <summary><c>NGX_DLSS_SR_OVERRIDE_SCALING_RATIO</c>: 33–100 (percent, the custom mode's), 0 the default.</summary>
|
||||
public const uint DlssSrScalingRatio = 0x10E41DF5;
|
||||
|
||||
/// <summary><c>NGX_DLSS_RR_OVERRIDE_SCALING_RATIO</c>: as <see cref="DlssSrScalingRatio"/>.</summary>
|
||||
public const uint DlssRrScalingRatio = 0x10C7D4A2;
|
||||
|
||||
/// <summary><c>NGX_DLAA_OVERRIDE</c>: 0 the default, 1 DLAA on.</summary>
|
||||
public const uint DlaaOverride = 0x10E41DF4;
|
||||
|
||||
/// <summary><c>NGX_DLSSG_MULTI_FRAME_COUNT</c>: 0 off, 1–15 frames generated per rendered frame.</summary>
|
||||
public const uint DlssgMultiFrameCount = 0x104D6667;
|
||||
|
||||
/// <summary><c>NGX_DLSSG_MODE</c>: 0 not set (the default), 1 off, 2 on, 3 auto, 4 dynamic.</summary>
|
||||
public const uint DlssgMode = 0x10308298;
|
||||
|
||||
/// <summary><c>NGX_DLSSG_DYNAMIC_MULTI_FRAME_COUNT_MAX</c>: 0 off, else the dynamic mode's ceiling.</summary>
|
||||
public const uint DlssgDynamicMultiFrameCountMax = 0x10562D0F;
|
||||
|
||||
/// <summary><c>NGX_DLSSG_DYNAMIC_TARGET_FRAME_RATE</c>: 0 disabled, 1–0xFFFFFF frames per second, <see cref="DynamicTargetAuto"/>.</summary>
|
||||
public const uint DlssgDynamicTargetFrameRate = 0x10CF4125;
|
||||
|
||||
/// <summary><c>NGX_DLSS_OVERRIDE_OPTIMAL_SETTINGS</c>: 0 none, 1 <c>PERF_TO_9X</c>.</summary>
|
||||
public const uint DlssOptimalSettingsOverride = 0x10AFB76C;
|
||||
|
||||
/// <summary>NVIDIA Smooth Motion, 0 off / 1 on — NOT in NVIDIA's header: documented by community profile tools only.</summary>
|
||||
public const uint SmoothMotion = 0xB0D384C0;
|
||||
|
||||
/// <summary>The presets' "latest" value (<c>RENDER_PRESET_Latest</c>).</summary>
|
||||
public const uint PresetLatest = 0x00FF_FFFF;
|
||||
|
||||
/// <summary>The frame-generation preset's "default" value (<c>RENDER_PRESET_Default</c>).</summary>
|
||||
public const uint PresetDefault = 0x00FF_FFFE;
|
||||
|
||||
/// <summary><c>NGX_DLSSG_DYNAMIC_TARGET_FRAME_RATE_AUTO</c>.</summary>
|
||||
public const uint DynamicTargetAuto = 0x0100_0000;
|
||||
|
||||
/// <summary>What <see cref="IDriverProfileSource"/> asks for, in the order the summary names them.</summary>
|
||||
public static IReadOnlyList<uint> All { get; } =
|
||||
[
|
||||
DlssSrOverride, DlssSrPreset, DlssSrMode, DlssSrScalingRatio, DlaaOverride,
|
||||
DlssRrOverride, DlssRrPreset, DlssRrMode, DlssRrScalingRatio,
|
||||
DlssFgOverride, DlssFgPreset, DlssgMultiFrameCount, DlssgMode, DlssgDynamicMultiFrameCountMax, DlssgDynamicTargetFrameRate,
|
||||
StreamlineDlssOverride, DlssOptimalSettingsOverride, SmoothMotion,
|
||||
];
|
||||
}
|
||||
@@ -147,6 +147,13 @@ public sealed record SessionRow
|
||||
|
||||
public string? RuntimeModulesJson { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// <c>driver_profile</c> (schema 0012, beta.8): the NVIDIA driver profile the executable ran under and the values it gave
|
||||
/// the NVIDIA App's DLSS / frame-generation override settings (<c>DriverProfileRecord</c>), read from the driver's
|
||||
/// settings store at the session's start, both tiers; null when no NVIDIA bridge was there to ask.
|
||||
/// </summary>
|
||||
public string? DriverProfileJson { get; init; }
|
||||
|
||||
public string? ExecutableMarkersJson { get; init; }
|
||||
|
||||
public string? NgxDriverWordsJson { get; init; }
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
using System.Globalization;
|
||||
using System.Text.Json;
|
||||
using FrameLedger.Application.Capture;
|
||||
|
||||
namespace FrameLedger.Application.Recording;
|
||||
|
||||
/// <summary>
|
||||
/// What <c>sessions.driver_profile</c> stores (schema 0012, beta.8): the NVIDIA driver profile the session's executable ran
|
||||
/// under, as <see cref="IDriverProfileSource"/> read it at the session's start — the outcome, the profile's name, and each
|
||||
/// setting asked with its value (null = set in no profile) and where the value comes from. Ids are stored as hex text so the
|
||||
/// column reads as the driver's own names do.
|
||||
/// </summary>
|
||||
public sealed record DriverProfileRecord
|
||||
{
|
||||
public required string Outcome { get; init; }
|
||||
|
||||
public string? Profile { get; init; }
|
||||
|
||||
public int? NvapiStatus { get; init; }
|
||||
|
||||
public IReadOnlyList<DriverSettingRecord> Settings { get; init; } = [];
|
||||
|
||||
/// <summary>The column for a reading; null for one that was never asked.</summary>
|
||||
public static string? Serialize(DriverProfileReading reading)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(reading);
|
||||
if (reading.Outcome == DriverProfileOutcome.NotRead)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var record = new DriverProfileRecord
|
||||
{
|
||||
Outcome = reading.Outcome.ToString(),
|
||||
Profile = reading.ProfileName,
|
||||
NvapiStatus = reading.NvapiStatus,
|
||||
Settings = [.. reading.Settings.Select(static s => new DriverSettingRecord
|
||||
{
|
||||
Id = Hex(s.Id),
|
||||
Value = s.Value,
|
||||
Location = s.Location.ToString(),
|
||||
Predefined = s.Predefined,
|
||||
})],
|
||||
};
|
||||
return JsonSerializer.Serialize(record, RecordingJsonContext.Default.DriverProfileRecord);
|
||||
}
|
||||
|
||||
/// <summary>The column read back; null for NULL and for a value this build cannot read.</summary>
|
||||
public static DriverProfileRecord? Parse(string? json)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(json))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return JsonSerializer.Deserialize(json, RecordingJsonContext.Default.DriverProfileRecord);
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The value the profile gives <paramref name="id"/>, or null when it is set in no profile or was not read.</summary>
|
||||
public uint? ValueOf(uint id) =>
|
||||
Settings.FirstOrDefault(s => string.Equals(s.Id, Hex(id), StringComparison.OrdinalIgnoreCase))?.Value;
|
||||
|
||||
private static string Hex(uint id) => "0x" + id.ToString("X8", CultureInfo.InvariantCulture);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace FrameLedger.Application.Recording;
|
||||
|
||||
/// <summary>One setting of <see cref="DriverProfileRecord"/>, as stored.</summary>
|
||||
public sealed record DriverSettingRecord
|
||||
{
|
||||
/// <summary>The setting id as hex text (<c>0x10E41E01</c>).</summary>
|
||||
public required string Id { get; init; }
|
||||
|
||||
/// <summary>The DWORD value; null when the setting is set in no profile.</summary>
|
||||
public uint? Value { get; init; }
|
||||
|
||||
/// <summary><c>Profile</c>, <c>Global</c>, <c>Base</c>, <c>Default</c> or <c>NotSet</c>.</summary>
|
||||
public required string Location { get; init; }
|
||||
|
||||
/// <summary>True when the value is the driver's shipped one rather than one someone set.</summary>
|
||||
public bool Predefined { get; init; }
|
||||
}
|
||||
@@ -13,6 +13,27 @@ public sealed record NgxDriverWords
|
||||
|
||||
public uint? Driver { get; init; }
|
||||
|
||||
// beta.8 (2026-09-25): the rest of what NvAPI_NGX_GetNGXOverrideState answers, kept since this date so the summary
|
||||
// can say what an override the driver reports actually set. Null on a row written before, and unless answered.
|
||||
|
||||
/// <summary>The scaling ratio the driver reports for super resolution.</summary>
|
||||
public float? Ratio { get; init; }
|
||||
|
||||
/// <summary>The performance mode the driver reports (<c>NGX_DLSS_SR_MODE</c>'s numbering when an override set it).</summary>
|
||||
public uint? Mode { get; init; }
|
||||
|
||||
/// <summary>The render preset for super resolution / ray reconstruction (1 = A … 15 = O).</summary>
|
||||
public uint? Preset { get; init; }
|
||||
|
||||
/// <summary>The frame-generation override's frame count target.</summary>
|
||||
public uint? FgCount { get; init; }
|
||||
|
||||
/// <summary>The frame-generation render preset.</summary>
|
||||
public uint? FgPreset { get; init; }
|
||||
|
||||
/// <summary>The frame-generation mode.</summary>
|
||||
public uint? FgMode { get; init; }
|
||||
|
||||
public int Readings { get; init; }
|
||||
|
||||
public int Answered { get; init; }
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace FrameLedger.Application.Recording;
|
||||
[JsonSerializable(typeof(Dictionary<string, int>))]
|
||||
[JsonSerializable(typeof(NgxDriverWords))]
|
||||
[JsonSerializable(typeof(FgRefusalDetail))]
|
||||
[JsonSerializable(typeof(DriverProfileRecord))]
|
||||
public sealed partial class RecordingJsonContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
@@ -229,6 +229,12 @@ public static class SessionAggregator
|
||||
Rr = ngx.Outcome == NgxProbeOutcome.Answered ? "0x" + ngx.Rr.ToString("X", CultureInfo.InvariantCulture) : null,
|
||||
Fg = ngx.Outcome == NgxProbeOutcome.Answered ? "0x" + ngx.Fg.ToString("X", CultureInfo.InvariantCulture) : null,
|
||||
Driver = ngx.Outcome == NgxProbeOutcome.Answered ? ngx.Driver : null,
|
||||
Ratio = ngx.Outcome == NgxProbeOutcome.Answered ? (float)ngx.ScalingRatio : null,
|
||||
Mode = ngx.Outcome == NgxProbeOutcome.Answered ? ngx.PerformanceMode : null,
|
||||
Preset = ngx.Outcome == NgxProbeOutcome.Answered ? ngx.RenderPreset : null,
|
||||
FgCount = ngx.Outcome == NgxProbeOutcome.Answered ? ngx.FgCount : null,
|
||||
FgPreset = ngx.Outcome == NgxProbeOutcome.Answered ? ngx.FgPreset : null,
|
||||
FgMode = ngx.Outcome == NgxProbeOutcome.Answered ? ngx.FgMode : null,
|
||||
Readings = ngx.Readings,
|
||||
Answered = ngx.Answered,
|
||||
Changed = ngx.Changed,
|
||||
|
||||
@@ -42,12 +42,16 @@ public sealed class SessionRecorder : ISessionRecorder
|
||||
private readonly RecorderOptions _options;
|
||||
private readonly IRecorderPolicy? _policy;
|
||||
private readonly ISessionObserver? _observer;
|
||||
private readonly IDriverProfileSource? _profiles;
|
||||
|
||||
public SessionRecorder(ICaptureSessionFactory sessions, IGameRepository games, IHardwareSnapshotRepository snapshots,
|
||||
IHardwareSnapshotSource hardware, IPartialSessionStore partials, SessionFinalizer finalizer, ICrashEventSource crashes,
|
||||
Func<RecorderOptions, ITelemetryPoller?> pollers, TimeProvider clock, RecorderOptions? options = null, ISessionObserver? observer = null,
|
||||
IRecorderPolicy? policy = null)
|
||||
IRecorderPolicy? policy = null, IDriverProfileSource? profiles = null)
|
||||
{
|
||||
// beta.8: the NVIDIA driver profile the game runs under, read beside each session; null in every recorder that has
|
||||
// no NVIDIA bridge to ask (the tests, the unshipped host).
|
||||
_profiles = profiles;
|
||||
_sessions = sessions ?? throw new ArgumentNullException(nameof(sessions));
|
||||
_games = games ?? throw new ArgumentNullException(nameof(games));
|
||||
_snapshots = snapshots ?? throw new ArgumentNullException(nameof(snapshots));
|
||||
@@ -67,6 +71,9 @@ public sealed class SessionRecorder : ISessionRecorder
|
||||
_policy = policy;
|
||||
}
|
||||
|
||||
/// <summary>How long finalising waits for the driver-profile read before storing none: a stuck driver must not hold a session.</summary>
|
||||
public static TimeSpan DriverProfileBudget { get; } = TimeSpan.FromSeconds(5);
|
||||
|
||||
public async Task<RecordedSession> RecordAsync(RecordRequest request, CancellationToken ct = default)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(request);
|
||||
@@ -97,6 +104,10 @@ public sealed class SessionRecorder : ISessionRecorder
|
||||
long qpcEpoch, long snapshotId, RecorderOptions options, CancellationToken ct)
|
||||
{
|
||||
ITelemetryPoller? poller = _pollers(options);
|
||||
// The driver profile, read BESIDE the session rather than before it (beta.8): a DRS load takes tens of milliseconds
|
||||
// and a launch must not wait on it. The profile the driver applies is fixed when the process starts, so a read that
|
||||
// starts here and is awaited at the end describes the run.
|
||||
Task<DriverProfileReading>? profile = _profiles is null ? null : Task.Run(() => _profiles.Read(request.NormalisedExePath), CancellationToken.None);
|
||||
try
|
||||
{
|
||||
poller?.Start();
|
||||
@@ -122,7 +133,8 @@ public sealed class SessionRecorder : ISessionRecorder
|
||||
run.FinalFlush();
|
||||
writer.Note("ended " + outcome.Reason);
|
||||
|
||||
RecordedSession recorded = await FinalizeAsync(request, game, header, outcome, run, endedAt, writer, options, ct).ConfigureAwait(false);
|
||||
string? driverProfile = await DriverProfileJsonAsync(profile).ConfigureAwait(false);
|
||||
RecordedSession recorded = await FinalizeAsync(request, game, header, outcome, run, endedAt, writer, options, driverProfile, ct).ConfigureAwait(false);
|
||||
_observer?.Ended(recorded);
|
||||
return recorded;
|
||||
}
|
||||
@@ -140,8 +152,31 @@ public sealed class SessionRecorder : ISessionRecorder
|
||||
: await session.RunAsync(request.NormalisedExePath, request.Observed, request.PayloadPath, ct, request.StopToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The driver-profile read's column, or null — never a failed session: a read that faults, or takes longer than
|
||||
/// <see cref="DriverProfileBudget"/>, stores no profile and the session is finalised as it would have been.
|
||||
/// </summary>
|
||||
private static async Task<string?> DriverProfileJsonAsync(Task<DriverProfileReading>? read)
|
||||
{
|
||||
if (read is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return DriverProfileRecord.Serialize(await read.WaitAsync(DriverProfileBudget).ConfigureAwait(false));
|
||||
}
|
||||
catch (Exception ex) when (ex is TimeoutException or InvalidOperationException or ArgumentException
|
||||
or System.Runtime.InteropServices.ExternalException or DllNotFoundException or EntryPointNotFoundException
|
||||
or BadImageFormatException or System.Runtime.InteropServices.MarshalDirectiveException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<RecordedSession> FinalizeAsync(RecordRequest request, GameRow game, PartialHeader header, CaptureOutcome outcome,
|
||||
Run run, DateTimeOffset endedAt, PartialSessionWriter writer, RecorderOptions options, CancellationToken ct)
|
||||
Run run, DateTimeOffset endedAt, PartialSessionWriter writer, RecorderOptions options, string? driverProfile, CancellationToken ct)
|
||||
{
|
||||
bool hooked = outcome.AttachRefusal == ShmAttachRefusal.Ok;
|
||||
// A held Tier-2 session's duration is the game's (2026-09-22), so the Application-log witness applies to it too.
|
||||
@@ -149,7 +184,7 @@ public sealed class SessionRecorder : ISessionRecorder
|
||||
bool crashEvent = hadPid && _crashes.FoundCrash(Path.GetFileName(request.NormalisedExePath), header.StartedAt, endedAt + ExitStatusMapper.CrashWitnessGrace);
|
||||
ExitStatus exit = ExitStatusMapper.Map(outcome.Reason, outcome.ExitCode, crashEvent);
|
||||
|
||||
SessionRow skeleton = Skeleton(header, outcome, endedAt, exit, crashEvent, hooked);
|
||||
SessionRow skeleton = Skeleton(header, outcome, endedAt, exit, crashEvent, hooked) with { DriverProfileJson = driverProfile };
|
||||
var input = new FinalizeInput
|
||||
{
|
||||
Skeleton = skeleton,
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
-- 0012 (2026-09-25): the NVIDIA driver profile a session's executable ran under (beta.8, owner request: "detect whether
|
||||
-- the NVIDIA App overrides DLSS settings — FG, RR, the model preset").
|
||||
--
|
||||
-- The NVIDIA App writes its per-game DLSS / frame-generation overrides into the driver's own settings store (DRS). The
|
||||
-- Agent reads, through the NVAPI bridge's read-only FlNvDriverProfile, which profile the driver applies to the
|
||||
-- executable and the values it gives those settings (Application.Capture.NvidiaDriverSettings), beside each session
|
||||
-- and in both tiers — it needs the executable's path and nothing of the game's process. JSON
|
||||
-- (Application.Recording.DriverProfileRecord): the outcome (Application | Global | Degraded), the profile's name, and one
|
||||
-- entry per setting with its value (null = set in no profile) and where the value comes from.
|
||||
--
|
||||
-- A fact about the driver's configuration, not a measurement: what a session MEASURED stays the hooks' (03_METRICS
|
||||
-- §Upscaling). Written by the Agent (06_DATA_MODEL §Writer ownership); NULL for every row written before, and for a row
|
||||
-- recorded where no NVIDIA bridge was there to ask.
|
||||
|
||||
ALTER TABLE sessions ADD COLUMN driver_profile TEXT;
|
||||
@@ -13,10 +13,10 @@ namespace FrameLedger.Infrastructure.Persistence;
|
||||
internal static class SessionRowColumns
|
||||
{
|
||||
public const string Insert =
|
||||
"INSERT INTO sessions (session_guid, game_id, snapshot_id, started_at, ended_at, duration_s, qpc_epoch, qpc_frequency, capture_tier, capture_mode, capture_notes, late_attach, telemetry_source, overlay_build_id, exit_status, drain_ticks, foreground_ticks, records_before_attach, dxgi_presents_before_hook, gap_count, guard_ticks_published, launch_wait_ms, api, present_mode, swap_effect, hdr_flag, hdr_source, sync_interval_mode, upscaler, upscaler_quality, upscaler_sharpness, upscaler_driver_reported, render_w, render_h, output_w, output_h, upscale_ratio, settings_changed_midsession, fg_mode, fg_source, fg_factor, fg_driver_reported, fg_runtime_census, fg_none_withheld_reason, fg_refusal, fg_refusal_detail, fg_factor_scope, fg_steady_share, presented_fps, presented_qualifier, dxgi_unseen_total, dxgi_present_samples, displayed_counted_by, sl_tag_census, sl_interposer_version, runtime_modules, executable_markers, ngx_driver_words, rt_flag, rt_source, pt_flag, pt_source, pt_confidence, rr_flag, rr_source, rt_frame_pct, rays_per_pixel, rt_pso_count, rt_tier, hooks_installed_mask, raster_pso_count, frame_count, app_frame_count, displayed_frame_count, dropped_frames, native_fps, displayed_fps, median_fps, p1_low_fps, p01_low_fps, displayed_p1_low_fps, min_fps, max_fps, frametime_stddev_ms, stutter_count, stutter_time_pct, pso_stutter_pct, reflex_active, latency_avg_us, latency_p95_us, dropped_records, fault_count, data_quality_warnings, writer_status_at_end, early_stop_family, loader_signals, vram_proc_avg_mb, vram_proc_max_mb, vram_budget_exceeded_pct, vram_adapter_max_mb, avg_cpu_temp, max_cpu_temp, avg_gpu_temp, max_gpu_temp, max_gpu_hotspot, avg_gpu_load, avg_cpu_load, avg_ram_mb, avg_gpu_power_w, throttle_pct) "
|
||||
+ "VALUES (@session_guid, @game_id, @snapshot_id, @started_at, @ended_at, @duration_s, @qpc_epoch, @qpc_frequency, @capture_tier, @capture_mode, @capture_notes, @late_attach, @telemetry_source, @overlay_build_id, @exit_status, @drain_ticks, @foreground_ticks, @records_before_attach, @dxgi_presents_before_hook, @gap_count, @guard_ticks_published, @launch_wait_ms, @api, @present_mode, @swap_effect, @hdr_flag, @hdr_source, @sync_interval_mode, @upscaler, @upscaler_quality, @upscaler_sharpness, @upscaler_driver_reported, @render_w, @render_h, @output_w, @output_h, @upscale_ratio, @settings_changed_midsession, @fg_mode, @fg_source, @fg_factor, @fg_driver_reported, @fg_runtime_census, @fg_none_withheld_reason, @fg_refusal, @fg_refusal_detail, @fg_factor_scope, @fg_steady_share, @presented_fps, @presented_qualifier, @dxgi_unseen_total, @dxgi_present_samples, @displayed_counted_by, @sl_tag_census, @sl_interposer_version, @runtime_modules, @executable_markers, @ngx_driver_words, @rt_flag, @rt_source, @pt_flag, @pt_source, @pt_confidence, @rr_flag, @rr_source, @rt_frame_pct, @rays_per_pixel, @rt_pso_count, @rt_tier, @hooks_installed_mask, @raster_pso_count, @frame_count, @app_frame_count, @displayed_frame_count, @dropped_frames, @native_fps, @displayed_fps, @median_fps, @p1_low_fps, @p01_low_fps, @displayed_p1_low_fps, @min_fps, @max_fps, @frametime_stddev_ms, @stutter_count, @stutter_time_pct, @pso_stutter_pct, @reflex_active, @latency_avg_us, @latency_p95_us, @dropped_records, @fault_count, @data_quality_warnings, @writer_status_at_end, @early_stop_family, @loader_signals, @vram_proc_avg_mb, @vram_proc_max_mb, @vram_budget_exceeded_pct, @vram_adapter_max_mb, @avg_cpu_temp, @max_cpu_temp, @avg_gpu_temp, @max_gpu_temp, @max_gpu_hotspot, @avg_gpu_load, @avg_cpu_load, @avg_ram_mb, @avg_gpu_power_w, @throttle_pct) RETURNING id";
|
||||
"INSERT INTO sessions (session_guid, game_id, snapshot_id, started_at, ended_at, duration_s, qpc_epoch, qpc_frequency, capture_tier, capture_mode, capture_notes, late_attach, telemetry_source, overlay_build_id, exit_status, drain_ticks, foreground_ticks, records_before_attach, dxgi_presents_before_hook, gap_count, guard_ticks_published, launch_wait_ms, api, present_mode, swap_effect, hdr_flag, hdr_source, sync_interval_mode, upscaler, upscaler_quality, upscaler_sharpness, upscaler_driver_reported, render_w, render_h, output_w, output_h, upscale_ratio, settings_changed_midsession, fg_mode, fg_source, fg_factor, fg_driver_reported, fg_runtime_census, fg_none_withheld_reason, fg_refusal, fg_refusal_detail, fg_factor_scope, fg_steady_share, presented_fps, presented_qualifier, dxgi_unseen_total, dxgi_present_samples, displayed_counted_by, sl_tag_census, sl_interposer_version, runtime_modules, driver_profile, executable_markers, ngx_driver_words, rt_flag, rt_source, pt_flag, pt_source, pt_confidence, rr_flag, rr_source, rt_frame_pct, rays_per_pixel, rt_pso_count, rt_tier, hooks_installed_mask, raster_pso_count, frame_count, app_frame_count, displayed_frame_count, dropped_frames, native_fps, displayed_fps, median_fps, p1_low_fps, p01_low_fps, displayed_p1_low_fps, min_fps, max_fps, frametime_stddev_ms, stutter_count, stutter_time_pct, pso_stutter_pct, reflex_active, latency_avg_us, latency_p95_us, dropped_records, fault_count, data_quality_warnings, writer_status_at_end, early_stop_family, loader_signals, vram_proc_avg_mb, vram_proc_max_mb, vram_budget_exceeded_pct, vram_adapter_max_mb, avg_cpu_temp, max_cpu_temp, avg_gpu_temp, max_gpu_temp, max_gpu_hotspot, avg_gpu_load, avg_cpu_load, avg_ram_mb, avg_gpu_power_w, throttle_pct) "
|
||||
+ "VALUES (@session_guid, @game_id, @snapshot_id, @started_at, @ended_at, @duration_s, @qpc_epoch, @qpc_frequency, @capture_tier, @capture_mode, @capture_notes, @late_attach, @telemetry_source, @overlay_build_id, @exit_status, @drain_ticks, @foreground_ticks, @records_before_attach, @dxgi_presents_before_hook, @gap_count, @guard_ticks_published, @launch_wait_ms, @api, @present_mode, @swap_effect, @hdr_flag, @hdr_source, @sync_interval_mode, @upscaler, @upscaler_quality, @upscaler_sharpness, @upscaler_driver_reported, @render_w, @render_h, @output_w, @output_h, @upscale_ratio, @settings_changed_midsession, @fg_mode, @fg_source, @fg_factor, @fg_driver_reported, @fg_runtime_census, @fg_none_withheld_reason, @fg_refusal, @fg_refusal_detail, @fg_factor_scope, @fg_steady_share, @presented_fps, @presented_qualifier, @dxgi_unseen_total, @dxgi_present_samples, @displayed_counted_by, @sl_tag_census, @sl_interposer_version, @runtime_modules, @driver_profile, @executable_markers, @ngx_driver_words, @rt_flag, @rt_source, @pt_flag, @pt_source, @pt_confidence, @rr_flag, @rr_source, @rt_frame_pct, @rays_per_pixel, @rt_pso_count, @rt_tier, @hooks_installed_mask, @raster_pso_count, @frame_count, @app_frame_count, @displayed_frame_count, @dropped_frames, @native_fps, @displayed_fps, @median_fps, @p1_low_fps, @p01_low_fps, @displayed_p1_low_fps, @min_fps, @max_fps, @frametime_stddev_ms, @stutter_count, @stutter_time_pct, @pso_stutter_pct, @reflex_active, @latency_avg_us, @latency_p95_us, @dropped_records, @fault_count, @data_quality_warnings, @writer_status_at_end, @early_stop_family, @loader_signals, @vram_proc_avg_mb, @vram_proc_max_mb, @vram_budget_exceeded_pct, @vram_adapter_max_mb, @avg_cpu_temp, @max_cpu_temp, @avg_gpu_temp, @max_gpu_temp, @max_gpu_hotspot, @avg_gpu_load, @avg_cpu_load, @avg_ram_mb, @avg_gpu_power_w, @throttle_pct) RETURNING id";
|
||||
|
||||
public const string Select = "SELECT id, session_guid, game_id, snapshot_id, started_at, ended_at, duration_s, qpc_epoch, qpc_frequency, capture_tier, capture_mode, capture_notes, late_attach, telemetry_source, overlay_build_id, exit_status, drain_ticks, foreground_ticks, records_before_attach, dxgi_presents_before_hook, gap_count, guard_ticks_published, launch_wait_ms, api, present_mode, swap_effect, hdr_flag, hdr_source, sync_interval_mode, upscaler, upscaler_quality, upscaler_sharpness, upscaler_driver_reported, render_w, render_h, output_w, output_h, upscale_ratio, settings_changed_midsession, fg_mode, fg_source, fg_factor, fg_driver_reported, fg_runtime_census, fg_none_withheld_reason, fg_refusal, fg_refusal_detail, fg_factor_scope, fg_steady_share, presented_fps, presented_qualifier, dxgi_unseen_total, dxgi_present_samples, displayed_counted_by, sl_tag_census, sl_interposer_version, runtime_modules, executable_markers, ngx_driver_words, rt_flag, rt_source, pt_flag, pt_source, pt_confidence, rr_flag, rr_source, rt_frame_pct, rays_per_pixel, rt_pso_count, rt_tier, hooks_installed_mask, raster_pso_count, frame_count, app_frame_count, displayed_frame_count, dropped_frames, native_fps, displayed_fps, median_fps, p1_low_fps, p01_low_fps, displayed_p1_low_fps, min_fps, max_fps, frametime_stddev_ms, stutter_count, stutter_time_pct, pso_stutter_pct, reflex_active, latency_avg_us, latency_p95_us, dropped_records, fault_count, data_quality_warnings, writer_status_at_end, early_stop_family, loader_signals, vram_proc_avg_mb, vram_proc_max_mb, vram_budget_exceeded_pct, vram_adapter_max_mb, avg_cpu_temp, max_cpu_temp, avg_gpu_temp, max_gpu_temp, max_gpu_hotspot, avg_gpu_load, avg_cpu_load, avg_ram_mb, avg_gpu_power_w, throttle_pct FROM sessions";
|
||||
public const string Select = "SELECT id, session_guid, game_id, snapshot_id, started_at, ended_at, duration_s, qpc_epoch, qpc_frequency, capture_tier, capture_mode, capture_notes, late_attach, telemetry_source, overlay_build_id, exit_status, drain_ticks, foreground_ticks, records_before_attach, dxgi_presents_before_hook, gap_count, guard_ticks_published, launch_wait_ms, api, present_mode, swap_effect, hdr_flag, hdr_source, sync_interval_mode, upscaler, upscaler_quality, upscaler_sharpness, upscaler_driver_reported, render_w, render_h, output_w, output_h, upscale_ratio, settings_changed_midsession, fg_mode, fg_source, fg_factor, fg_driver_reported, fg_runtime_census, fg_none_withheld_reason, fg_refusal, fg_refusal_detail, fg_factor_scope, fg_steady_share, presented_fps, presented_qualifier, dxgi_unseen_total, dxgi_present_samples, displayed_counted_by, sl_tag_census, sl_interposer_version, runtime_modules, driver_profile, executable_markers, ngx_driver_words, rt_flag, rt_source, pt_flag, pt_source, pt_confidence, rr_flag, rr_source, rt_frame_pct, rays_per_pixel, rt_pso_count, rt_tier, hooks_installed_mask, raster_pso_count, frame_count, app_frame_count, displayed_frame_count, dropped_frames, native_fps, displayed_fps, median_fps, p1_low_fps, p01_low_fps, displayed_p1_low_fps, min_fps, max_fps, frametime_stddev_ms, stutter_count, stutter_time_pct, pso_stutter_pct, reflex_active, latency_avg_us, latency_p95_us, dropped_records, fault_count, data_quality_warnings, writer_status_at_end, early_stop_family, loader_signals, vram_proc_avg_mb, vram_proc_max_mb, vram_budget_exceeded_pct, vram_adapter_max_mb, avg_cpu_temp, max_cpu_temp, avg_gpu_temp, max_gpu_temp, max_gpu_hotspot, avg_gpu_load, avg_cpu_load, avg_ram_mb, avg_gpu_power_w, throttle_pct FROM sessions";
|
||||
|
||||
public static Dictionary<string, object?> Parameters(SessionRow s)
|
||||
{
|
||||
@@ -93,6 +93,7 @@ internal static class SessionRowColumns
|
||||
d["sl_tag_census"] = s.SlTagCensus;
|
||||
d["sl_interposer_version"] = s.SlInterposerVersion;
|
||||
d["runtime_modules"] = s.RuntimeModulesJson;
|
||||
d["driver_profile"] = s.DriverProfileJson;
|
||||
d["executable_markers"] = s.ExecutableMarkersJson;
|
||||
d["ngx_driver_words"] = s.NgxDriverWordsJson;
|
||||
}
|
||||
@@ -220,6 +221,7 @@ internal static class SessionRowColumns
|
||||
SlTagCensus = L(r, "sl_tag_census"),
|
||||
SlInterposerVersion = S(r, "sl_interposer_version"),
|
||||
RuntimeModulesJson = S(r, "runtime_modules"),
|
||||
DriverProfileJson = S(r, "driver_profile"),
|
||||
ExecutableMarkersJson = S(r, "executable_markers"),
|
||||
NgxDriverWordsJson = S(r, "ngx_driver_words"),
|
||||
};
|
||||
|
||||
@@ -19,6 +19,13 @@ public interface INvapiBridge : IDisposable
|
||||
/// <summary><c>FlNvDriverVersion</c>: 0 with the version (e.g. 61664) and branch, or a status.</summary>
|
||||
int DriverVersion(out uint version, out string branch);
|
||||
|
||||
/// <summary>
|
||||
/// <c>FlNvDriverProfile</c> (ABI 2, beta.8): the DRS profile the driver applies to <paramref name="exePath"/> and the
|
||||
/// values it gives <paramref name="ids"/> — 0 with the profile filled (its <c>Status</c> says which branch), or a
|
||||
/// status. Read-only: the bridge never calls a DRS setter.
|
||||
/// </summary>
|
||||
int DriverProfile(string exePath, IReadOnlyList<uint> ids, out NvapiDriverProfile profile);
|
||||
|
||||
/// <summary><c>FlNvShutdown</c>.</summary>
|
||||
void Shutdown();
|
||||
}
|
||||
@@ -87,6 +87,20 @@ public sealed class NativeNvapiBridge : INvapiBridge
|
||||
return FlNvNgxState(pid, ref words);
|
||||
}
|
||||
|
||||
public int DriverProfile(string exePath, IReadOnlyList<uint> ids, out NvapiDriverProfile profile)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(exePath);
|
||||
ArgumentNullException.ThrowIfNull(ids);
|
||||
profile = new NvapiDriverProfile
|
||||
{
|
||||
Size = (uint)Marshal.SizeOf<NvapiDriverProfile>(),
|
||||
ProfileName = string.Empty,
|
||||
Settings = new NvapiProfileSetting[NvapiDriverProfile.MaxSettings],
|
||||
};
|
||||
uint[] asked = [.. ids];
|
||||
return FlNvDriverProfile(exePath, asked, (uint)asked.Length, ref profile);
|
||||
}
|
||||
|
||||
public int DriverVersion(out uint version, out string branch)
|
||||
{
|
||||
var buffer = new byte[64];
|
||||
@@ -121,6 +135,8 @@ public sealed class NativeNvapiBridge : INvapiBridge
|
||||
|
||||
public static uint NgxStateSize() => FlNvNgxStateSize();
|
||||
|
||||
public static uint DriverProfileSize() => FlNvDriverProfileSize();
|
||||
|
||||
public static uint AbiVersion() => FlNvAbiVersion();
|
||||
|
||||
public void Dispose()
|
||||
@@ -157,6 +173,14 @@ public sealed class NativeNvapiBridge : INvapiBridge
|
||||
[DllImport(_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern int FlNvDriverVersion(out uint version, [Out] byte[] branch, uint capacity);
|
||||
|
||||
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||
[DllImport(_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern int FlNvDriverProfile([MarshalAs(UnmanagedType.LPWStr)] string exePath, uint[] ids, uint count, ref NvapiDriverProfile profile);
|
||||
|
||||
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||
[DllImport(_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern uint FlNvDriverProfileSize();
|
||||
|
||||
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||
[DllImport(_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern uint FlNvAbiVersion();
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace FrameLedger.Infrastructure.Telemetry;
|
||||
|
||||
/// <summary>
|
||||
/// Mirror of <c>FlNvDriverProfileRead</c> (<c>fl_nvapi_bridge.h</c>, ABI 2, beta.8): the profile the NVIDIA driver applies to
|
||||
/// one executable and the values it gives the settings asked for — read through DRS, never written.
|
||||
/// <c>NvapiBridgeMirrorTests</c> holds its size to the bridge's own <c>FlNvDriverProfileSize</c>.
|
||||
/// </summary>
|
||||
// CA1815: a window onto a native struct, never compared — the same call NvapiNgxWords and FrameLedger.Shared's ring mirrors make.
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "P/Invoke mirror of a native struct; never compared.")]
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||
public struct NvapiDriverProfile
|
||||
{
|
||||
/// <summary><c>FL_NV_PROFILE_APPLICATION</c>: an application profile names this executable.</summary>
|
||||
public const int Application = 0;
|
||||
|
||||
/// <summary><c>FL_NV_PROFILE_GLOBAL</c>: none does; the values are the current global profile's.</summary>
|
||||
public const int Global = 1;
|
||||
|
||||
/// <summary><c>FL_NV_PROFILE_DEGRADED</c>: no usable driver, or DRS refused (<see cref="NvapiStatus"/> says which).</summary>
|
||||
public const int Degraded = 2;
|
||||
|
||||
/// <summary><c>FL_NV_PROFILE_MAX_SETTINGS</c>.</summary>
|
||||
public const int MaxSettings = 24;
|
||||
|
||||
public uint Size;
|
||||
|
||||
public int Status;
|
||||
|
||||
public int NvapiStatus;
|
||||
|
||||
public uint Count;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
|
||||
public string ProfileName;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = MaxSettings)]
|
||||
public NvapiProfileSetting[] Settings;
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
using FrameLedger.Application.Capture;
|
||||
|
||||
namespace FrameLedger.Infrastructure.Telemetry;
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="IDriverProfileSource"/> over the bridge's read-only <c>FlNvDriverProfile</c> (ABI 2, beta.8): the DRS profile the
|
||||
/// NVIDIA driver applies to an executable, and the values it gives <see cref="NvidiaDriverSettings.All"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// From the driver's own settings store, by path: no game process is opened and nothing is loaded into one (CLAUDE.md rule 4),
|
||||
/// and the bridge calls no DRS setter. Owns one bridge reference for its lifetime; a machine without an NVIDIA driver, or a
|
||||
/// build without the bridge beside it, answers <see cref="DriverProfileOutcome.Degraded"/> and never throws.
|
||||
/// </remarks>
|
||||
public sealed class NvapiDriverProfileSource : IDriverProfileSource, IDisposable
|
||||
{
|
||||
private readonly INvapiBridge _bridge;
|
||||
private readonly Lock _lock = new();
|
||||
private bool _started;
|
||||
private bool _usable;
|
||||
private int _refusal;
|
||||
private bool _disposed;
|
||||
|
||||
public NvapiDriverProfileSource(INvapiBridge bridge)
|
||||
{
|
||||
_bridge = bridge ?? throw new ArgumentNullException(nameof(bridge));
|
||||
}
|
||||
|
||||
/// <summary>Over the real DLL: the bridge is born owned here.</summary>
|
||||
public NvapiDriverProfileSource()
|
||||
{
|
||||
_bridge = new NativeNvapiBridge();
|
||||
}
|
||||
|
||||
public DriverProfileReading Read(string exePath)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(exePath);
|
||||
ObjectDisposedException.ThrowIf(_disposed, this);
|
||||
lock (_lock)
|
||||
{
|
||||
if (!_started)
|
||||
{
|
||||
_started = true;
|
||||
_refusal = _bridge.Init();
|
||||
// DRS is per driver, not per GPU handle: a driver that enumerated no GPU still has its settings store.
|
||||
_usable = _refusal is 0 or NativeNvapiBridge.NoGpu;
|
||||
}
|
||||
|
||||
if (!_usable)
|
||||
{
|
||||
return new DriverProfileReading { Outcome = DriverProfileOutcome.Degraded, NvapiStatus = _refusal };
|
||||
}
|
||||
|
||||
int status = _bridge.DriverProfile(exePath, NvidiaDriverSettings.All, out NvapiDriverProfile profile);
|
||||
if (status != 0)
|
||||
{
|
||||
return new DriverProfileReading { Outcome = DriverProfileOutcome.Degraded, NvapiStatus = status };
|
||||
}
|
||||
|
||||
return Map(profile);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The bridge's answer as the Application sees it: a value only where the driver gave one, and where it came from.</summary>
|
||||
public static DriverProfileReading Map(NvapiDriverProfile profile)
|
||||
{
|
||||
DriverProfileOutcome outcome = profile.Status switch
|
||||
{
|
||||
NvapiDriverProfile.Application => DriverProfileOutcome.Application,
|
||||
NvapiDriverProfile.Global => DriverProfileOutcome.Global,
|
||||
_ => DriverProfileOutcome.Degraded,
|
||||
};
|
||||
if (outcome == DriverProfileOutcome.Degraded)
|
||||
{
|
||||
return new DriverProfileReading { Outcome = outcome, NvapiStatus = profile.NvapiStatus };
|
||||
}
|
||||
|
||||
int count = (int)Math.Min(profile.Count, (uint)(profile.Settings?.Length ?? 0));
|
||||
List<DriverSettingReading> settings = new(count);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
NvapiProfileSetting s = profile.Settings![i];
|
||||
bool read = s.Status == 0;
|
||||
settings.Add(new DriverSettingReading(
|
||||
s.Id,
|
||||
read && s.Dword != 0 ? s.Value : null,
|
||||
!read ? DriverSettingLocation.NotSet : s.Location switch
|
||||
{
|
||||
0 => DriverSettingLocation.Profile,
|
||||
1 => DriverSettingLocation.Global,
|
||||
2 => DriverSettingLocation.Base,
|
||||
_ => DriverSettingLocation.Default,
|
||||
},
|
||||
read && s.Predefined != 0));
|
||||
}
|
||||
|
||||
return new DriverProfileReading
|
||||
{
|
||||
Outcome = outcome,
|
||||
ProfileName = string.IsNullOrWhiteSpace(profile.ProfileName) ? null : profile.ProfileName,
|
||||
NvapiStatus = profile.NvapiStatus,
|
||||
Settings = settings,
|
||||
};
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_disposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_disposed = true;
|
||||
lock (_lock)
|
||||
{
|
||||
if (_usable)
|
||||
{
|
||||
_bridge.Shutdown();
|
||||
_usable = false;
|
||||
}
|
||||
}
|
||||
|
||||
_bridge.Dispose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace FrameLedger.Infrastructure.Telemetry;
|
||||
|
||||
/// <summary>Mirror of <c>FlNvProfileSetting</c> (<c>fl_nvapi_bridge.h</c>, ABI 2): one DRS setting as the driver answered it.</summary>
|
||||
// CA1815: a window onto a native struct, never compared — the same call NvapiNgxWords and FrameLedger.Shared's ring mirrors make.
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "P/Invoke mirror of a native struct; never compared.")]
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct NvapiProfileSetting
|
||||
{
|
||||
/// <summary><c>NVAPI_SETTING_NOT_FOUND</c>: the setting is set in no profile, so the driver applies its own behaviour.</summary>
|
||||
public const int SettingNotFound = -160;
|
||||
|
||||
public uint Id;
|
||||
|
||||
/// <summary><c>NvAPI_DRS_GetSetting</c>'s status, verbatim.</summary>
|
||||
public int Status;
|
||||
|
||||
public uint Value;
|
||||
|
||||
/// <summary><c>NVDRS_SETTING_LOCATION</c>: 0 the profile itself, 1 the global profile, 2 base, 3 the driver default.</summary>
|
||||
public uint Location;
|
||||
|
||||
/// <summary>Nonzero when the value is the driver's shipped one; 0 when someone (the NVIDIA App, the user) set it.</summary>
|
||||
public uint Predefined;
|
||||
|
||||
/// <summary>1 when the setting is a DWORD and <see cref="Value"/> holds it.</summary>
|
||||
public uint Dword;
|
||||
}
|
||||
@@ -28,7 +28,9 @@ extern "C" {
|
||||
#define FL_NV_API __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#define FL_NV_ABI_VERSION 1u
|
||||
// 2 since 2026-09-25 (beta.8): FlNvDriverProfile and FlNvDriverProfileSize. Additive — the version exists so the
|
||||
// managed side refuses a DLL that predates the entry point rather than failing on a missing export at the first read.
|
||||
#define FL_NV_ABI_VERSION 2u
|
||||
|
||||
// Status codes. Zero is success; negatives are ours; an NvAPI_Status is passed through where the
|
||||
// caller can act on it (it is negative too, and never one of ours).
|
||||
@@ -89,6 +91,34 @@ typedef struct FlNvNgxWords {
|
||||
uint32_t reserved[2];
|
||||
} FlNvNgxWords;
|
||||
|
||||
// NvAPI_DRS: the driver profile the NVIDIA driver applies to an executable, and the values it gives the settings the
|
||||
// caller names (beta.8, 2026-09-25) — which is where the NVIDIA App writes its per-game DLSS / frame-generation
|
||||
// overrides. READ-ONLY like everything here: a DRS session is created, the settings database loaded, the profile
|
||||
// found, its values read, and the session destroyed. Nothing is set, saved, restored or deleted — NvAPI_DRS_SetSetting,
|
||||
// NvAPI_DRS_SaveSettings and every other DRS writer are never called (18_GPU_VENDOR_APIS §Runtime policy).
|
||||
#define FL_NV_PROFILE_MAX_SETTINGS 24u
|
||||
#define FL_NV_PROFILE_APPLICATION 0 // an application profile names this executable; the values are what it gives it
|
||||
#define FL_NV_PROFILE_GLOBAL 1 // no application profile names it: the values the current global profile gives
|
||||
#define FL_NV_PROFILE_DEGRADED 2 // no usable NVIDIA driver, or DRS refused — nvapiStatus says which
|
||||
|
||||
typedef struct FlNvProfileSetting {
|
||||
uint32_t id; // the setting id asked for
|
||||
int32_t status; // NvAPI_DRS_GetSetting's NvAPI_Status, verbatim (NVAPI_SETTING_NOT_FOUND: set nowhere)
|
||||
uint32_t value; // u32CurrentValue, when status is NVAPI_OK and the setting is a DWORD
|
||||
uint32_t location; // NVDRS_SETTING_LOCATION: 0 this profile, 1 the global profile, 2 base, 3 the default
|
||||
uint32_t predefined; // isCurrentPredefined: nonzero = the driver's shipped value, 0 = a value someone set
|
||||
uint32_t dword; // 1 when the setting is a DWORD (NVDRS_DWORD_TYPE); value is 0 otherwise
|
||||
} FlNvProfileSetting;
|
||||
|
||||
typedef struct FlNvDriverProfileRead {
|
||||
uint32_t size; // sizeof(FlNvDriverProfileRead), set by the caller
|
||||
int32_t status; // FL_NV_PROFILE_*
|
||||
int32_t nvapiStatus; // the NvAPI_Status behind status (FindApplicationByName's for GLOBAL)
|
||||
uint32_t count; // settings[] filled: the count asked for, 0 when DEGRADED
|
||||
uint16_t profileName[128]; // UTF-16, NUL-terminated, truncated
|
||||
FlNvProfileSetting settings[FL_NV_PROFILE_MAX_SETTINGS];
|
||||
} FlNvDriverProfileRead;
|
||||
|
||||
// Reference-counted: every FlNvInit is matched by an FlNvShutdown, and NvAPI_Unload runs at zero.
|
||||
// Returns FL_NV_OK, or the NvAPI_Status NvAPI_Initialize answered (a normal condition on a machine
|
||||
// with no NVIDIA driver — L3 disables cleanly, never throws). A machine whose driver initialises
|
||||
@@ -104,6 +134,13 @@ FL_NV_API int32_t FlNvReadSample(FlNvSample* out);
|
||||
// which branch was taken, and `nvapiStatus` says why.
|
||||
FL_NV_API int32_t FlNvNgxState(uint32_t pid, FlNvNgxWords* out);
|
||||
|
||||
// The profile the driver applies to `exePath` (a fully qualified path — the one the driver will match on launch) and
|
||||
// the values it gives the `count` settings in `ids`. Never fails for a reason the caller cannot read: `status` says
|
||||
// which branch was taken. FL_NV_BAD_ARGUMENT for a null pointer, more than FL_NV_PROFILE_MAX_SETTINGS ids, or a
|
||||
// path too long for NVAPI's string — refused, never truncated, since a truncated path matches another program.
|
||||
FL_NV_API int32_t FlNvDriverProfile(const uint16_t* exePath, const uint32_t* ids, uint32_t count,
|
||||
FlNvDriverProfileRead* out);
|
||||
|
||||
// Driver version (e.g. 61664) and branch string; FL_NV_NOT_INITIALISED before FlNvInit.
|
||||
FL_NV_API int32_t FlNvDriverVersion(uint32_t* version, char* branch, uint32_t branchCapacity);
|
||||
|
||||
@@ -111,6 +148,7 @@ FL_NV_API int32_t FlNvDriverVersion(uint32_t* version, char* branch, uint32_t br
|
||||
FL_NV_API uint32_t FlNvAbiVersion(void);
|
||||
FL_NV_API uint32_t FlNvSampleSize(void);
|
||||
FL_NV_API uint32_t FlNvNgxStateSize(void);
|
||||
FL_NV_API uint32_t FlNvDriverProfileSize(void);
|
||||
FL_NV_API const char* FlNvBuildId(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -223,6 +223,90 @@ FL_NV_API int32_t FlNvNgxState(uint32_t pid, FlNvNgxWords* out) {
|
||||
return FL_NV_OK;
|
||||
}
|
||||
|
||||
FL_NV_API int32_t FlNvDriverProfile(const uint16_t* exePath, const uint32_t* ids, uint32_t count,
|
||||
FlNvDriverProfileRead* out) {
|
||||
if (out == nullptr || exePath == nullptr || (ids == nullptr && count != 0u) || count > FL_NV_PROFILE_MAX_SETTINGS) {
|
||||
return FL_NV_BAD_ARGUMENT;
|
||||
}
|
||||
if (out->size != sizeof(FlNvDriverProfileRead)) {
|
||||
return FL_NV_BAD_SIZE;
|
||||
}
|
||||
// NVAPI's fixed Unicode string: a path that does not fit is refused, never truncated — a truncated path would
|
||||
// find the profile of whatever program it now names.
|
||||
NvAPI_UnicodeString app{};
|
||||
size_t length = 0;
|
||||
while (exePath[length] != 0u) {
|
||||
if (++length >= NVAPI_UNICODE_STRING_MAX) {
|
||||
return FL_NV_BAD_ARGUMENT;
|
||||
}
|
||||
}
|
||||
std::memcpy(app, exePath, length * sizeof(NvU16));
|
||||
|
||||
FlNvDriverProfileRead r{};
|
||||
r.size = sizeof(FlNvDriverProfileRead);
|
||||
r.status = FL_NV_PROFILE_DEGRADED;
|
||||
if (!g_ready.load(std::memory_order_acquire)) {
|
||||
r.nvapiStatus = FL_NV_NOT_INITIALISED;
|
||||
*out = r;
|
||||
return FL_NV_OK;
|
||||
}
|
||||
Locked lock;
|
||||
NvDRSSessionHandle session = nullptr;
|
||||
NvAPI_Status status = NvAPI_DRS_CreateSession(&session);
|
||||
if (status != NVAPI_OK) {
|
||||
r.nvapiStatus = static_cast<int32_t>(status);
|
||||
*out = r;
|
||||
return FL_NV_OK;
|
||||
}
|
||||
status = NvAPI_DRS_LoadSettings(session);
|
||||
NvDRSProfileHandle profile = nullptr;
|
||||
if (status == NVAPI_OK) {
|
||||
NVDRS_APPLICATION application{};
|
||||
application.version = NVDRS_APPLICATION_VER;
|
||||
status = NvAPI_DRS_FindApplicationByName(session, app, &profile, &application);
|
||||
if (status == NVAPI_OK) {
|
||||
r.status = FL_NV_PROFILE_APPLICATION;
|
||||
} else if (status == NVAPI_EXECUTABLE_NOT_FOUND) {
|
||||
// No profile names this executable: the global profile is what the driver gives it.
|
||||
const NvAPI_Status global = NvAPI_DRS_GetCurrentGlobalProfile(session, &profile);
|
||||
r.status = global == NVAPI_OK ? FL_NV_PROFILE_GLOBAL : FL_NV_PROFILE_DEGRADED;
|
||||
if (global != NVAPI_OK) {
|
||||
status = global;
|
||||
}
|
||||
}
|
||||
}
|
||||
r.nvapiStatus = static_cast<int32_t>(status);
|
||||
if (r.status != FL_NV_PROFILE_DEGRADED) {
|
||||
NVDRS_PROFILE info{};
|
||||
info.version = NVDRS_PROFILE_VER;
|
||||
if (NvAPI_DRS_GetProfileInfo(session, profile, &info) == NVAPI_OK) {
|
||||
constexpr size_t kName = sizeof(r.profileName) / sizeof(r.profileName[0]);
|
||||
for (size_t i = 0; i + 1u < kName && info.profileName[i] != 0u; ++i) {
|
||||
r.profileName[i] = info.profileName[i];
|
||||
}
|
||||
}
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
// NVDRS_SETTING carries two unions sized for a binary value: ~8 KB, on the Agent's stack, never a game's.
|
||||
NVDRS_SETTING setting{};
|
||||
setting.version = NVDRS_SETTING_VER;
|
||||
const NvAPI_Status read = NvAPI_DRS_GetSetting(session, profile, ids[i], &setting);
|
||||
FlNvProfileSetting& s = r.settings[i];
|
||||
s.id = ids[i];
|
||||
s.status = static_cast<int32_t>(read);
|
||||
if (read == NVAPI_OK) {
|
||||
s.dword = setting.settingType == NVDRS_DWORD_TYPE ? 1u : 0u;
|
||||
s.value = s.dword != 0u ? setting.u32CurrentValue : 0u;
|
||||
s.location = static_cast<uint32_t>(setting.settingLocation);
|
||||
s.predefined = setting.isCurrentPredefined != 0u ? 1u : 0u;
|
||||
}
|
||||
}
|
||||
r.count = count;
|
||||
}
|
||||
NvAPI_DRS_DestroySession(session);
|
||||
*out = r;
|
||||
return FL_NV_OK;
|
||||
}
|
||||
|
||||
FL_NV_API int32_t FlNvDriverVersion(uint32_t* version, char* branch, uint32_t branchCapacity) {
|
||||
if (version == nullptr) {
|
||||
return FL_NV_BAD_ARGUMENT;
|
||||
@@ -259,6 +343,10 @@ FL_NV_API uint32_t FlNvNgxStateSize(void) {
|
||||
return sizeof(FlNvNgxWords);
|
||||
}
|
||||
|
||||
FL_NV_API uint32_t FlNvDriverProfileSize(void) {
|
||||
return sizeof(FlNvDriverProfileRead);
|
||||
}
|
||||
|
||||
FL_NV_API const char* FlNvBuildId(void) {
|
||||
return FL_BUILD_ID;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,12 @@ add_custom_command(TARGET fl_nvapi_bridge_test POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
$<TARGET_FILE:FrameLedger.NvapiBridge> $<TARGET_FILE_DIR:fl_nvapi_bridge_test>)
|
||||
add_test(NAME fl_nvapi_bridge COMMAND fl_nvapi_bridge_test)
|
||||
set_tests_properties(fl_nvapi_bridge PROPERTIES PASS_REGULAR_EXPRESSION "BRANCH: (AVAILABLE|DEGRADED)")
|
||||
# The branch line is required AND a failed assertion fails the test (2026-09-25). PASS_REGULAR_EXPRESSION alone makes
|
||||
# ctest ignore the exit code, and for as long as it stood alone the AVAILABLE branch's reference-counting check failed
|
||||
# on every machine with an NVIDIA GPU while ctest reported Passed; CI, which has no driver, never takes that branch.
|
||||
set_tests_properties(fl_nvapi_bridge PROPERTIES
|
||||
PASS_REGULAR_EXPRESSION "BRANCH: (AVAILABLE|DEGRADED)"
|
||||
FAIL_REGULAR_EXPRESSION "FAILED:;[0-9]+ failed")
|
||||
|
||||
# The safety-guard matrix. 20_OPEN_QUESTIONS §S13(a) put the guard in C++, which
|
||||
# made Catch2 a PREREQUISITE of the guard rather than a later nicety: 14_TESTING
|
||||
|
||||
@@ -16,6 +16,8 @@ TEST_CASE("the bridge's sizes and version are what the managed mirror will compa
|
||||
CHECK(FlNvAbiVersion() == FL_NV_ABI_VERSION);
|
||||
CHECK(FlNvSampleSize() == sizeof(FlNvSample));
|
||||
CHECK(FlNvNgxStateSize() == sizeof(FlNvNgxWords));
|
||||
CHECK(FlNvDriverProfileSize() == sizeof(FlNvDriverProfileRead));
|
||||
CHECK(sizeof(FlNvDriverProfileRead) == 16u + 256u + FL_NV_PROFILE_MAX_SETTINGS * 24u);
|
||||
CHECK(std::strlen(FlNvBuildId()) > 0u);
|
||||
CHECK(std::strlen(FlNvBuildId()) < 32u);
|
||||
}
|
||||
@@ -28,6 +30,27 @@ TEST_CASE("a wrong struct size is refused before anything is read", "[nvapi][abi
|
||||
FlNvNgxWords n{};
|
||||
n.size = 1u;
|
||||
CHECK(FlNvNgxState(0u, &n) == FL_NV_BAD_SIZE);
|
||||
const uint32_t ids[1] = {0x10E41E01u};
|
||||
const uint16_t path[] = {u'a', u'.', u'e', u'x', u'e', 0u};
|
||||
FlNvDriverProfileRead p{};
|
||||
p.size = 1u;
|
||||
CHECK(FlNvDriverProfile(path, ids, 1u, &p) == FL_NV_BAD_SIZE);
|
||||
p.size = sizeof(FlNvDriverProfileRead);
|
||||
CHECK(FlNvDriverProfile(nullptr, ids, 1u, &p) == FL_NV_BAD_ARGUMENT);
|
||||
CHECK(FlNvDriverProfile(path, nullptr, 1u, &p) == FL_NV_BAD_ARGUMENT);
|
||||
CHECK(FlNvDriverProfile(path, ids, FL_NV_PROFILE_MAX_SETTINGS + 1u, &p) == FL_NV_BAD_ARGUMENT);
|
||||
CHECK(FlNvDriverProfile(path, ids, 1u, nullptr) == FL_NV_BAD_ARGUMENT);
|
||||
}
|
||||
|
||||
TEST_CASE("a path longer than NVAPI's string is refused, never truncated into another program's", "[nvapi][abi]") {
|
||||
static uint16_t long_path[4096];
|
||||
for (size_t i = 0; i + 1u < sizeof(long_path) / sizeof(long_path[0]); ++i) {
|
||||
long_path[i] = u'a';
|
||||
}
|
||||
long_path[sizeof(long_path) / sizeof(long_path[0]) - 1u] = 0u;
|
||||
FlNvDriverProfileRead p{};
|
||||
p.size = sizeof(FlNvDriverProfileRead);
|
||||
CHECK(FlNvDriverProfile(long_path, nullptr, 0u, &p) == FL_NV_BAD_ARGUMENT);
|
||||
}
|
||||
|
||||
TEST_CASE("before FlNvInit every read says so, and the NGX query answers DEGRADED rather than failing",
|
||||
@@ -41,6 +64,13 @@ TEST_CASE("before FlNvInit every read says so, and the NGX query answers DEGRADE
|
||||
n.size = sizeof(FlNvNgxWords);
|
||||
REQUIRE(FlNvNgxState(GetCurrentProcessId(), &n) == FL_NV_OK);
|
||||
CHECK(n.status == FL_NV_NGX_DEGRADED);
|
||||
const uint32_t ids[1] = {0x10E41E01u};
|
||||
const uint16_t path[] = {u'C', u':', u'\\', u'a', u'.', u'e', u'x', u'e', 0u};
|
||||
FlNvDriverProfileRead p{};
|
||||
p.size = sizeof(FlNvDriverProfileRead);
|
||||
REQUIRE(FlNvDriverProfile(path, ids, 1u, &p) == FL_NV_OK);
|
||||
CHECK(p.status == FL_NV_PROFILE_DEGRADED);
|
||||
CHECK(p.count == 0u);
|
||||
}
|
||||
|
||||
TEST_CASE("FlNvInit takes one of two branches and says which; a sample never claims a field it did not read",
|
||||
@@ -84,16 +114,39 @@ TEST_CASE("FlNvInit takes one of two branches and says which; a sample never cla
|
||||
CHECK(version > 0u);
|
||||
std::printf(" driver %u.%02u (%s)\n", version / 100u, version % 100u, branch);
|
||||
}
|
||||
// The driver profile of an executable no profile names: the global one, read and never written. Every id answers
|
||||
// for itself — a value, or "set nowhere" — and the ids come back in the order asked.
|
||||
{
|
||||
wchar_t path[MAX_PATH]{};
|
||||
REQUIRE(GetModuleFileNameW(nullptr, path, MAX_PATH) > 0u);
|
||||
const uint32_t ids[3] = {0x10E41E01u, 0x10E41DF3u, 0x104D6667u};
|
||||
FlNvDriverProfileRead p{};
|
||||
p.size = sizeof(FlNvDriverProfileRead);
|
||||
REQUIRE(FlNvDriverProfile(reinterpret_cast<const uint16_t*>(path), ids, 3u, &p) == FL_NV_OK);
|
||||
if (p.status == FL_NV_PROFILE_DEGRADED) {
|
||||
std::printf(" profile: DEGRADED (NvAPI %d)\n", p.nvapiStatus);
|
||||
CHECK(p.count == 0u);
|
||||
} else {
|
||||
CHECK(p.count == 3u);
|
||||
for (uint32_t i = 0; i < 3u; ++i) {
|
||||
CHECK(p.settings[i].id == ids[i]);
|
||||
}
|
||||
std::printf(" profile: %s, SR override status %d value %u location %u\n",
|
||||
p.status == FL_NV_PROFILE_APPLICATION ? "APPLICATION" : "GLOBAL", p.settings[0].status,
|
||||
p.settings[0].value, p.settings[0].location);
|
||||
}
|
||||
}
|
||||
// This process renders nothing through NGX, so the only honest NGX answers are the two that say so.
|
||||
FlNvNgxWords n{};
|
||||
n.size = sizeof(FlNvNgxWords);
|
||||
REQUIRE(FlNvNgxState(GetCurrentProcessId(), &n) == FL_NV_OK);
|
||||
CHECK((n.status == FL_NV_NGX_UNANSWERED || n.status == FL_NV_NGX_DEGRADED));
|
||||
// Reference counting: a second init is a second reference, and the reads survive the first shutdown.
|
||||
// Reference counting: a second init is a second reference, and the reads survive the first shutdown. (Until
|
||||
// 2026-09-25 this shut down twice before the read — two references, two releases, nothing left to read with — and
|
||||
// the failure was invisible: ctest passed on the branch line alone. See CMakeLists.txt.)
|
||||
const int32_t again = FlNvInit();
|
||||
CHECK((again == FL_NV_OK || again == FL_NV_NO_GPU));
|
||||
FlNvShutdown();
|
||||
FlNvShutdown();
|
||||
const int32_t afterOne = FlNvReadSample(&s);
|
||||
CHECK((afterOne == FL_NV_OK || afterOne == FL_NV_NO_GPU));
|
||||
FlNvShutdown();
|
||||
|
||||
@@ -451,6 +451,47 @@ public sealed class GameDetailViewModelTests
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// beta.8: the Details card names the NVIDIA App's overrides as the driver profile stood at the newest session that read
|
||||
/// one; a game no session read a profile for has no such row.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task TheDetailsCardNamesTheNvidiaAppsOverridesFromTheNewestSessionThatReadThem()
|
||||
{
|
||||
CultureInfo? previous = Strings.Culture;
|
||||
Strings.Culture = CultureInfo.GetCultureInfo("en");
|
||||
try
|
||||
{
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
GameRow game = await s.GameAsync("Alpha");
|
||||
long older = await s.SessionAsync(game.Id, DateTimeOffset.UtcNow.AddHours(-3));
|
||||
_ = await s.SessionAsync(game.Id, DateTimeOffset.UtcNow.AddHours(-1));
|
||||
string profile = Application.Recording.DriverProfileRecord.Serialize(new Application.Capture.DriverProfileReading
|
||||
{
|
||||
Outcome = Application.Capture.DriverProfileOutcome.Application,
|
||||
ProfileName = "Alpha",
|
||||
Settings =
|
||||
[
|
||||
new(Application.Capture.NvidiaDriverSettings.DlssSrOverride, 1, Application.Capture.DriverSettingLocation.Profile, false),
|
||||
new(Application.Capture.NvidiaDriverSettings.DlssSrPreset, 11, Application.Capture.DriverSettingLocation.Profile, false),
|
||||
],
|
||||
})!;
|
||||
(GameDetailViewModel before, _, _, _, _) = await BuildAsync(s, game.Id);
|
||||
before.Details.Should().NotContain(static r => r.Label == "NVIDIA App override", "no session read a profile");
|
||||
|
||||
await s.Db.WriteAsync((c, tx, ct) => Dapper.SqlMapper.ExecuteAsync(c, new Dapper.CommandDefinition(
|
||||
"UPDATE sessions SET driver_profile = @p WHERE id = @id", new { p = profile, id = older }, tx, cancellationToken: ct)), Ct);
|
||||
(GameDetailViewModel vm, _, _, _, _) = await BuildAsync(s, game.Id);
|
||||
|
||||
vm.Details.Should().ContainSingle(static r => r.Label == "NVIDIA App override")
|
||||
.Which.Value.Should().Be("DLSS override (preset K)", "the newest session that read one; the newest read none");
|
||||
}
|
||||
finally
|
||||
{
|
||||
Strings.Culture = previous;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The Agent's refusal for such an executable (beta.8, <c>ExecutableNotX64</c>) is said in words, with the architecture.</summary>
|
||||
[Fact]
|
||||
public void ANotX64RefusalNamesTheArchitecture()
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
using System.Globalization;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.App.Services;
|
||||
using FrameLedger.Application.Capture;
|
||||
using FrameLedger.Application.Recording;
|
||||
using S = FrameLedger.Application.Capture.NvidiaDriverSettings;
|
||||
|
||||
namespace FrameLedger.App.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// The NVIDIA driver's side of a session in words (beta.8): the NVIDIA App's overrides as the driver profile stores them —
|
||||
/// DLSS with its preset and mode, frame generation as its multiplier, Smooth Motion labelled as community-documented — and
|
||||
/// what the driver reported applying in the game's process. Nothing is said where nothing was read.
|
||||
/// </summary>
|
||||
[Collection(StringsCultureCollection.Name)]
|
||||
public sealed class NvidiaOverridesTests
|
||||
{
|
||||
private static T InEnglish<T>(Func<T> f)
|
||||
{
|
||||
CultureInfo? previous = Strings.Culture;
|
||||
CultureInfo previousCulture = CultureInfo.CurrentCulture;
|
||||
try
|
||||
{
|
||||
Strings.Culture = CultureInfo.GetCultureInfo("en");
|
||||
CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("en");
|
||||
return f();
|
||||
}
|
||||
finally
|
||||
{
|
||||
Strings.Culture = previous;
|
||||
CultureInfo.CurrentCulture = previousCulture;
|
||||
}
|
||||
}
|
||||
|
||||
private static string Profile(DriverProfileOutcome outcome, params (uint Id, uint? Value)[] settings) => DriverProfileRecord.Serialize(new DriverProfileReading
|
||||
{
|
||||
Outcome = outcome,
|
||||
ProfileName = "Clair Obscur: Expedition 33",
|
||||
Settings = [.. settings.Select(static s => new DriverSettingReading(s.Id, s.Value, s.Value is null ? DriverSettingLocation.NotSet : DriverSettingLocation.Profile, false))],
|
||||
})!;
|
||||
|
||||
[Fact]
|
||||
public void TheNvidiaAppsOverridesAreSaidWithTheirPresetModeAndMultiplier() => InEnglish(() =>
|
||||
{
|
||||
string json = Profile(DriverProfileOutcome.Application,
|
||||
(S.DlssSrOverride, 1), (S.DlssSrPreset, 11), (S.DlssSrMode, 2),
|
||||
(S.DlssFgOverride, 1), (S.DlssgMultiFrameCount, 3), (S.DlssFgPreset, S.PresetLatest),
|
||||
(S.SmoothMotion, 1), (S.DlssRrOverride, 0));
|
||||
|
||||
NvidiaOverrides.ProfileLine(json).Should().Be(
|
||||
"NVIDIA profile “Clair Obscur: Expedition 33”: DLSS override (preset K, Quality) · Frame Generation override (×4, latest preset) · "
|
||||
+ "Smooth Motion (a setting community tools document, not NVIDIA)");
|
||||
return 0;
|
||||
});
|
||||
|
||||
[Fact]
|
||||
public void ACustomRatioDlaaAndAForcedFrameGenerationModeAreNamed() => InEnglish(() =>
|
||||
{
|
||||
DriverProfileRecord profile = DriverProfileRecord.Parse(Profile(DriverProfileOutcome.Application,
|
||||
(S.DlssSrOverride, 1), (S.DlssSrMode, 6), (S.DlssSrScalingRatio, 77), (S.DlaaOverride, 1), (S.DlssgMode, 2)))!;
|
||||
|
||||
NvidiaOverrides.Of(profile).Should().Equal("DLSS override (custom 77%, DLAA)", "frame generation forced on");
|
||||
return 0;
|
||||
});
|
||||
|
||||
[Fact]
|
||||
public void AProfileThatOverridesNothingSaysSoAndNoProfileSaysNothing() => InEnglish(() =>
|
||||
{
|
||||
NvidiaOverrides.ProfileLine(Profile(DriverProfileOutcome.Global, (S.DlssSrOverride, null), (S.DlssSrMode, 3)))
|
||||
.Should().Be("NVIDIA global profile (no profile names this game): no DLSS or frame generation override", "mode 3 is the game's own");
|
||||
NvidiaOverrides.ProfileLine(Profile(DriverProfileOutcome.Degraded)).Should().BeNull("no NVIDIA driver answered");
|
||||
NvidiaOverrides.ProfileLine(null).Should().BeNull("a row from before beta.8");
|
||||
return 0;
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// The driver's own report, measured on the owner's machine 2026-09-06 under an NVIDIA App override (Clair Obscur:
|
||||
/// Expedition 33): SR mask 0x8067F — DLL selected, preset, performance mode — with preset 11 and mode 2.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void TheDriversReportSaysWhatItsOverrideBitsSet() => InEnglish(() =>
|
||||
{
|
||||
const string expedition = "{\"Outcome\":\"Answered\",\"Sr\":\"0x8067F\",\"Rr\":\"0x0\",\"Fg\":\"0x0\",\"Driver\":61664,\"Mode\":2,\"Preset\":11,\"Readings\":3,\"Answered\":3}";
|
||||
NvidiaOverrides.DriverLine(expedition).Should().Be("NVIDIA driver, for this game's process: DLSS DLL chosen by the driver · preset K · Quality");
|
||||
|
||||
const string plain = "{\"Outcome\":\"Answered\",\"Sr\":\"0x60F\",\"Rr\":\"0x0\",\"Fg\":\"0x0\",\"Readings\":1,\"Answered\":1}";
|
||||
NvidiaOverrides.DriverLine(plain).Should().BeNull("created and evaluated, no override bit: the game's own DLSS");
|
||||
NvidiaOverrides.DriverLine("{\"Outcome\":\"Unanswered\",\"Readings\":1,\"Answered\":0}").Should().BeNull();
|
||||
NvidiaOverrides.DriverLine("not json").Should().BeNull();
|
||||
return 0;
|
||||
});
|
||||
|
||||
[Theory]
|
||||
[InlineData(1u, "preset A")]
|
||||
[InlineData(15u, "preset O")]
|
||||
[InlineData(26u, "preset Z")]
|
||||
[InlineData(S.PresetLatest, "latest preset")]
|
||||
[InlineData(S.PresetDefault, "default preset")]
|
||||
public void PresetsAreLetters(uint value, string expected) => InEnglish(() => NvidiaOverrides.Preset(value)).Should().Be(expected);
|
||||
|
||||
[Theory]
|
||||
[InlineData(0u)]
|
||||
[InlineData(27u)]
|
||||
public void AnOffOrUnknownPresetSaysNothing(uint value) => NvidiaOverrides.Preset(value).Should().BeNull();
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using FluentAssertions;
|
||||
using FrameLedger.Application.Capture;
|
||||
using FrameLedger.Application.Recording;
|
||||
|
||||
namespace FrameLedger.Application.Tests.Recording;
|
||||
|
||||
/// <summary>
|
||||
/// <c>sessions.driver_profile</c> (schema 0012): a reading round-trips with its ids as hex text; a reading never asked
|
||||
/// stores nothing; a column this build cannot read is null, never an exception.
|
||||
/// </summary>
|
||||
public sealed class DriverProfileRecordTests
|
||||
{
|
||||
[Fact]
|
||||
public void AReadingRoundTripsWithItsIdsAsHex()
|
||||
{
|
||||
var reading = new DriverProfileReading
|
||||
{
|
||||
Outcome = DriverProfileOutcome.Application,
|
||||
ProfileName = "Clair Obscur: Expedition 33",
|
||||
NvapiStatus = 0,
|
||||
Settings =
|
||||
[
|
||||
new DriverSettingReading(NvidiaDriverSettings.DlssSrOverride, 1, DriverSettingLocation.Profile, Predefined: false),
|
||||
new DriverSettingReading(NvidiaDriverSettings.SmoothMotion, null, DriverSettingLocation.NotSet, Predefined: false),
|
||||
],
|
||||
};
|
||||
|
||||
string? json = DriverProfileRecord.Serialize(reading);
|
||||
|
||||
json.Should().Contain("\"Id\":\"0x10E41E01\"").And.Contain("\"Outcome\":\"Application\"");
|
||||
DriverProfileRecord back = DriverProfileRecord.Parse(json)!;
|
||||
back.Profile.Should().Be("Clair Obscur: Expedition 33");
|
||||
back.ValueOf(NvidiaDriverSettings.DlssSrOverride).Should().Be(1);
|
||||
back.ValueOf(NvidiaDriverSettings.SmoothMotion).Should().BeNull("set in no profile");
|
||||
back.ValueOf(NvidiaDriverSettings.DlssFgOverride).Should().BeNull("not asked");
|
||||
back.Settings[0].Location.Should().Be("Profile");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData("")]
|
||||
[InlineData("not json")]
|
||||
public void AColumnThisBuildCannotReadIsNull(string? json) => DriverProfileRecord.Parse(json).Should().BeNull();
|
||||
|
||||
[Fact]
|
||||
public void AReadingNeverAskedStoresNothing() => DriverProfileRecord.Serialize(DriverProfileReading.NotRead).Should().BeNull();
|
||||
}
|
||||
@@ -230,8 +230,20 @@ public sealed class SessionRecorderTests : IAsyncDisposable
|
||||
public required SteppingClock Clock { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>What the driver-profile source answers (beta.8); a throwing one proves a failed read costs the column, not the session.</summary>
|
||||
private sealed class ScriptedProfiles(Func<string, DriverProfileReading> answer) : IDriverProfileSource
|
||||
{
|
||||
public List<string> Read { get; } = [];
|
||||
|
||||
DriverProfileReading IDriverProfileSource.Read(string exePath)
|
||||
{
|
||||
Read.Add(exePath);
|
||||
return answer(exePath);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<Harness> MakeAsync(bool consented = true, AntiCheatVerdict? verdict = null, int records = 3_000, FakeLiveness? liveness = null, bool poller = true,
|
||||
bool clockStepsOnDrain = false)
|
||||
bool clockStepsOnDrain = false, IDriverProfileSource? profiles = null)
|
||||
{
|
||||
_db ??= await LedgerDatabase.OpenAsync(Path.Combine(_dir, LedgerPaths.DatabaseFileName), ct: TestContext.Current.CancellationToken).ConfigureAwait(false);
|
||||
var store = new SqliteGameConsentStore(_db);
|
||||
@@ -255,7 +267,7 @@ public sealed class SessionRecorderTests : IAsyncDisposable
|
||||
games, new FakeSnapshots(), new FixedHardware(), partials,
|
||||
new SessionFinalizer(sessions, new RawSeriesCodec()), new NoCrashEvents(),
|
||||
_ => poller ? new FakePoller(clockStepsOnDrain ? clock : null) : null, clock,
|
||||
new RecorderOptions { PartialFlushInterval = TimeSpan.FromSeconds(10) });
|
||||
new RecorderOptions { PartialFlushInterval = TimeSpan.FromSeconds(10) }, profiles: profiles);
|
||||
return new Harness { Recorder = recorder, Games = games, Sessions = sessions, Partials = partials, Clock = clock };
|
||||
}
|
||||
|
||||
@@ -298,6 +310,33 @@ public sealed class SessionRecorderTests : IAsyncDisposable
|
||||
r.Row.FrameCount.Should().Be(3_000, "the row comes back to the caller as finalized");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// beta.8: the NVIDIA driver profile the executable runs under is read beside the session and stored on its row; a
|
||||
/// source that throws costs the column and nothing else.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task TheDriverProfileIsStoredOnTheRowAndAFailedReadCostsOnlyTheColumn()
|
||||
{
|
||||
var profiles = new ScriptedProfiles(static _ => new DriverProfileReading
|
||||
{
|
||||
Outcome = DriverProfileOutcome.Global,
|
||||
ProfileName = "Base Profile",
|
||||
Settings = [new DriverSettingReading(NvidiaDriverSettings.DlssSrOverride, null, DriverSettingLocation.NotSet, false)],
|
||||
});
|
||||
Harness h = await MakeAsync(profiles: profiles);
|
||||
|
||||
await h.Recorder.RecordAsync(Request(), TestContext.Current.CancellationToken);
|
||||
|
||||
profiles.Read.Should().Equal(_exe);
|
||||
DriverProfileRecord stored = DriverProfileRecord.Parse(h.Sessions.Stored.Single().Row.DriverProfileJson)!;
|
||||
(stored.Outcome, stored.Profile).Should().Be(("Global", "Base Profile"));
|
||||
|
||||
Harness failing = await MakeAsync(profiles: new ScriptedProfiles(static _ => throw new InvalidOperationException("the driver refused")));
|
||||
RecordedSession r = await failing.Recorder.RecordAsync(Request(), TestContext.Current.CancellationToken);
|
||||
r.Row.DriverProfileJson.Should().BeNull();
|
||||
r.Finalize.Status.Should().Be(FinalizeStatus.Saved, "the session is recorded as it would have been");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ThePartialCarriesTheBreadcrumbsAndIsFlushedOnTheClock()
|
||||
{
|
||||
|
||||
@@ -133,6 +133,31 @@ public sealed class LedgerDatabaseTests
|
||||
cancellationToken: Ct)).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>Schema 0012 (2026-09-25): <c>sessions.driver_profile</c>, NULL for every row written before.</summary>
|
||||
[Fact]
|
||||
public async Task ScriptTwelveAddsTheDriverProfileColumn()
|
||||
{
|
||||
await using LedgerFixture f = await LedgerFixture.OpenAsync();
|
||||
MigrationRunner.LatestVersion.Should().BeGreaterThanOrEqualTo(12);
|
||||
string path = f.Path;
|
||||
await f.Db.DisposeAsync().ConfigureAwait(true);
|
||||
var c11 = new SqliteConnection(new SqliteConnectionStringBuilder { DataSource = path, Pooling = false }.ToString());
|
||||
await using (c11.ConfigureAwait(true))
|
||||
{
|
||||
await c11.OpenAsync(Ct).ConfigureAwait(true);
|
||||
await RewindToAsync(c11, 11).ConfigureAwait(true);
|
||||
}
|
||||
|
||||
LedgerDatabase migrated = await LedgerDatabase.OpenAsync(path, ct: Ct).ConfigureAwait(true);
|
||||
await using (migrated.ConfigureAwait(true))
|
||||
{
|
||||
migrated.SchemaVersion.Should().Be(MigrationRunner.LatestVersion);
|
||||
long columns = await migrated.ReadAsync((c, ct) => c.ExecuteScalarAsync<long>(new CommandDefinition(
|
||||
"SELECT COUNT(*) FROM pragma_table_info('sessions') WHERE name = 'driver_profile'", cancellationToken: ct)), Ct).ConfigureAwait(true);
|
||||
columns.Should().Be(1);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Schema 0011 (2026-09-25): what a game's files say about themselves — what the executable runs as, its two PE versions,
|
||||
/// the capability files it ships. Applied from schema 10 to a ledger holding a row: the four columns exist and read NULL,
|
||||
|
||||
@@ -13,6 +13,11 @@ internal sealed class FakeNvapiBridge : INvapiBridge
|
||||
|
||||
public uint Driver { get; set; } = 61664;
|
||||
|
||||
/// <summary>What <see cref="DriverProfile"/> answers for a path and the ids asked; null answers DEGRADED.</summary>
|
||||
public Func<string, IReadOnlyList<uint>, NvapiDriverProfile>? Profile { get; set; }
|
||||
|
||||
public List<string> ProfilesRead { get; } = [];
|
||||
|
||||
public int Inits { get; private set; }
|
||||
|
||||
public int Shutdowns { get; private set; }
|
||||
@@ -40,6 +45,15 @@ internal sealed class FakeNvapiBridge : INvapiBridge
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int DriverProfile(string exePath, IReadOnlyList<uint> ids, out NvapiDriverProfile profile)
|
||||
{
|
||||
ProfilesRead.Add(exePath);
|
||||
profile = Profile is null
|
||||
? new NvapiDriverProfile { Status = NvapiDriverProfile.Degraded, NvapiStatus = -1000, ProfileName = string.Empty, Settings = [] }
|
||||
: Profile(exePath, ids);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int DriverVersion(out uint version, out string branch)
|
||||
{
|
||||
version = Driver;
|
||||
|
||||
@@ -16,9 +16,11 @@ public sealed class NvapiBridgeMirrorTests
|
||||
{
|
||||
NativeNvapiBridge.IsPresent.Should().BeTrue("FrameLedger.NvapiBridge.dll must be staged beside the test binary (FrameLedger.NvapiBridge.targets)");
|
||||
|
||||
NativeNvapiBridge.AbiVersion().Should().Be(1u);
|
||||
NativeNvapiBridge.AbiVersion().Should().Be(2u, "ABI 2 added FlNvDriverProfile (beta.8)");
|
||||
((uint)Marshal.SizeOf<NvapiSample>()).Should().Be(NativeNvapiBridge.SampleSize());
|
||||
((uint)Marshal.SizeOf<NvapiNgxWords>()).Should().Be(NativeNvapiBridge.NgxStateSize());
|
||||
((uint)Marshal.SizeOf<NvapiDriverProfile>()).Should().Be(NativeNvapiBridge.DriverProfileSize());
|
||||
Marshal.SizeOf<NvapiProfileSetting>().Should().Be(24);
|
||||
NativeNvapiBridge.BuildId().Should().NotBeNullOrEmpty();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
using FluentAssertions;
|
||||
using FrameLedger.Application.Capture;
|
||||
using FrameLedger.Infrastructure.Telemetry;
|
||||
|
||||
namespace FrameLedger.Infrastructure.Tests.Telemetry;
|
||||
|
||||
/// <summary>
|
||||
/// The driver-profile source (beta.8) over a scripted bridge and the real one: a machine without a usable driver is
|
||||
/// Degraded and never throws; an answered profile keeps each setting's value only where the driver gave one, where it came
|
||||
/// from, and whether someone set it; the ids asked are <see cref="NvidiaDriverSettings.All"/>; the bridge reference taken
|
||||
/// is released.
|
||||
/// </summary>
|
||||
public sealed class NvapiDriverProfileSourceTests
|
||||
{
|
||||
private const string _exe = @"C:\Games\Title\game.exe";
|
||||
|
||||
[Fact]
|
||||
public void ADriverThatDoesNotInitialiseIsDegradedAndNothingIsAsked()
|
||||
{
|
||||
using var bridge = new FakeNvapiBridge { InitResult = -101 };
|
||||
using var source = new NvapiDriverProfileSource(bridge);
|
||||
|
||||
DriverProfileReading r = source.Read(_exe);
|
||||
|
||||
r.Outcome.Should().Be(DriverProfileOutcome.Degraded);
|
||||
r.NvapiStatus.Should().Be(-101);
|
||||
bridge.ProfilesRead.Should().BeEmpty();
|
||||
source.Read(_exe).Outcome.Should().Be(DriverProfileOutcome.Degraded, "the answer is remembered, not asked again");
|
||||
bridge.Inits.Should().Be(1);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AnApplicationProfileKeepsEachValueWhereTheDriverGaveOneAndSaysWhereItCameFrom()
|
||||
{
|
||||
IReadOnlyList<uint>? asked = null;
|
||||
using var bridge = new FakeNvapiBridge
|
||||
{
|
||||
Profile = (path, ids) =>
|
||||
{
|
||||
asked = ids;
|
||||
return new NvapiDriverProfile
|
||||
{
|
||||
Status = NvapiDriverProfile.Application,
|
||||
NvapiStatus = 0,
|
||||
Count = 3,
|
||||
ProfileName = "Clair Obscur: Expedition 33",
|
||||
Settings =
|
||||
[
|
||||
new NvapiProfileSetting { Id = NvidiaDriverSettings.DlssSrOverride, Status = 0, Value = 1, Location = 0, Predefined = 0, Dword = 1 },
|
||||
new NvapiProfileSetting { Id = NvidiaDriverSettings.DlssSrPreset, Status = 0, Value = 11, Location = 1, Predefined = 1, Dword = 1 },
|
||||
new NvapiProfileSetting { Id = NvidiaDriverSettings.SmoothMotion, Status = NvapiProfileSetting.SettingNotFound },
|
||||
],
|
||||
};
|
||||
},
|
||||
};
|
||||
using (var source = new NvapiDriverProfileSource(bridge))
|
||||
{
|
||||
DriverProfileReading r = source.Read(_exe);
|
||||
|
||||
r.Outcome.Should().Be(DriverProfileOutcome.Application);
|
||||
r.ProfileName.Should().Be("Clair Obscur: Expedition 33");
|
||||
r.Settings.Should().Equal(
|
||||
new DriverSettingReading(NvidiaDriverSettings.DlssSrOverride, 1, DriverSettingLocation.Profile, Predefined: false),
|
||||
new DriverSettingReading(NvidiaDriverSettings.DlssSrPreset, 11, DriverSettingLocation.Global, Predefined: true),
|
||||
new DriverSettingReading(NvidiaDriverSettings.SmoothMotion, null, DriverSettingLocation.NotSet, Predefined: false));
|
||||
asked.Should().Equal(NvidiaDriverSettings.All);
|
||||
bridge.ProfilesRead.Should().Equal(_exe);
|
||||
}
|
||||
|
||||
bridge.Shutdowns.Should().Be(1, "the one reference taken is released");
|
||||
bridge.Disposed.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AGlobalAnswerAndADegradedOneAreSaidAsSuch()
|
||||
{
|
||||
var global = NvapiDriverProfileSource.Map(new NvapiDriverProfile { Status = NvapiDriverProfile.Global, NvapiStatus = -166, Count = 0, ProfileName = "Base Profile", Settings = [] });
|
||||
global.Outcome.Should().Be(DriverProfileOutcome.Global);
|
||||
global.NvapiStatus.Should().Be(-166, "the lookup's status: no profile names the executable");
|
||||
|
||||
var degraded = NvapiDriverProfileSource.Map(new NvapiDriverProfile { Status = NvapiDriverProfile.Degraded, NvapiStatus = -1000 });
|
||||
degraded.Outcome.Should().Be(DriverProfileOutcome.Degraded);
|
||||
degraded.Settings.Should().BeEmpty();
|
||||
|
||||
var truncated = NvapiDriverProfileSource.Map(new NvapiDriverProfile { Status = NvapiDriverProfile.Global, Count = 5, Settings = [new NvapiProfileSetting { Id = 1, Status = 0, Value = 7, Dword = 1 }] });
|
||||
truncated.Settings.Should().ContainSingle("a count past the array is never read past it");
|
||||
}
|
||||
|
||||
/// <summary>The real bridge, read-only, on this machine: an NVIDIA driver answers the global profile for this test's own executable; none answers Degraded.</summary>
|
||||
[Fact]
|
||||
public void TheRealBridgeAnswersForThisProcessOrSaysWhy()
|
||||
{
|
||||
NativeNvapiBridge.IsPresent.Should().BeTrue("FrameLedger.NvapiBridge.dll must be staged beside the test binary");
|
||||
using var source = new NvapiDriverProfileSource();
|
||||
|
||||
DriverProfileReading r = source.Read(Environment.ProcessPath!);
|
||||
|
||||
if (r.Outcome == DriverProfileOutcome.Degraded)
|
||||
{
|
||||
r.Settings.Should().BeEmpty();
|
||||
return;
|
||||
}
|
||||
|
||||
r.Outcome.Should().BeOneOf(DriverProfileOutcome.Global, DriverProfileOutcome.Application);
|
||||
r.Settings.Select(static s => s.Id).Should().Equal(NvidiaDriverSettings.All, "one answer per id, in the order asked");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user