feat(advanced): FSR's depth plane at infinity is stored as +infinity and shown as an infinity sign - FLT_MAX or +infinity in cameraNear / cameraFar is a plane for FSR, where for Streamline it is 'not set' (beta.42 PR-4, D119) (#409)
FL_ADV_FLOAT_INFINITE (0x7F800000) in ffxNearBits / ffxFarBits only; fl::adv::FfxDepthPlaneBits on the ffx route only; InGameAdvancedSampler shows the row as the infinity sign. No field moved, the layout version is unchanged. The layout's comments carry the release numbers of D118 and D122. Measured on fl_adv_fields.h with the Overlay's flags, old header beside new: no difference beyond the run-to-run spread (+25.0 to +25.4 ns per UPSCALE dispatch with Advanced on, +25.2 to +25.8 before; off unchanged). Qodana's native report: six false 'never used' on the registry test's stand-in engines switched off for that file with the reason; one vector reserve fixed. Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
72ee9964b0
commit
c74de2cc12
12 files changed
+234
-33
No files matched your search
@@ -263,6 +263,12 @@ resharper_cpp_if_can_be_replaced_by_constexpr_if_highlighting = none
|
||||
[src/native/{FrameLedger.Injector/src/fl_guard_sources.cpp,FrameLedger.ProcessStats/src/fl_process_stats.cpp,tools/fl-probe-guard/main.cpp,tests/vklayer_test.cpp}]
|
||||
resharper_cpp_declarator_never_used_highlighting = none
|
||||
|
||||
# fl::patch::Install takes its hook engine as a template parameter and calls Create / Enable / Disable on it. The
|
||||
# test's two stand-in engines are used that way and no other, which ReSharper's "never used" does not follow through a
|
||||
# dependent call: six reports, one per member (Qodana, 2026-11-12). The members are the test.
|
||||
[src/native/tests/unhook_inline_test.cpp]
|
||||
resharper_cpp_declarator_never_used_highlighting = none
|
||||
|
||||
# The linter's compiler, not the build's: NVAPI's header makes NvU32 `unsigned int` under clang and `unsigned long`
|
||||
# under MSVC, which is the compiler that builds this probe - and `%lu` is right for it.
|
||||
[src/native/tools/fl-probe-nvapi/main.cpp]
|
||||
|
||||
@@ -35,6 +35,13 @@ numeric core and does not move; the heading is the full version — corrected 20
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- **Advanced metrics: FSR's depth plane at infinity is shown as "∞".** Engines with an infinite depth range tell
|
||||
FSR that one of the two camera planes is at infinity, and FrameLedger took that value for "not set" — so a
|
||||
session's depth range showed one plane where the game had given two. The plane at infinity is now stored and
|
||||
shown as such. Only for FSR, and only while Advanced metrics is on; nothing else about what is read changed.
|
||||
|
||||
### Changed
|
||||
|
||||
- **The Overlay's log is whole after a game exits, and says more.** The log FrameLedger's part inside the game
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ What the region is, as a contract between the two sides:
|
||||
inside on every attempt — a watchdog killed with its process leaves `seq` odd for good, and what it published
|
||||
before is still what the game said.
|
||||
- **Zero is "not read", never a value.** A Streamline `Boolean` and a DLSS preset are stored as the vendor's value
|
||||
plus one; a float as its bits, with `FL_ADV_FLOAT_NONE` for "none seen" — the vendors' own sentinels are refused in
|
||||
plus one; a float as its bits, with `FL_ADV_FLOAT_NONE` for "none seen" — and, in `ffxNearBits` / `ffxFarBits` alone, `FL_ADV_FLOAT_INFINITE` (`0x7F800000`, +infinity's own bits) for a plane at infinity *(0.1.0-beta.42, owner decision D119: an engine with an infinite depth hands FSR `FLT_MAX` or +infinity for one plane; for Streamline `FLT_MAX` is "not set" and stays refused)* — the vendors' own sentinels are refused in
|
||||
the detour and never reach the region; a size of 0 is "not given".
|
||||
- **A per-frame value is summarised where it is seen**: a flag is an "ever seen" mask, a jitter the largest magnitude,
|
||||
a field of view its lowest and highest (D114), the reported frame time a count and a sum the watchdog drains.
|
||||
|
||||
+4
-2
@@ -139,9 +139,11 @@ the traps — is [`handoff/history/0.1.0-beta.40.md`](handoff/history/0.1.0-beta
|
||||
[`handoff/history/0.1.0-beta.40.md`](handoff/history/0.1.0-beta.40.md) §NEXT lists (`kMaxPatches = 48`, the window
|
||||
of `sl::Constants` pinned outside the camera members, the per-call overhead, the gate's list for the two new
|
||||
structs):
|
||||
- **`FLT_MAX` in an FSR depth plane.** Lies of P gave `cameraFar = 10` and no `cameraNear`; most likely the
|
||||
- ~~**`FLT_MAX` in an FSR depth plane.** Lies of P gave `cameraFar = 10` and no `cameraNear`; most likely the
|
||||
plane at infinity is `FLT_MAX`, which the Overlay refuses as "nobody set this". Decide whether it is stored as
|
||||
"infinite" — an Overlay change, with its overhead stated.
|
||||
"infinite" — an Overlay change, with its overhead stated.~~ *(Decided, D119, and built in beta.42:
|
||||
`FL_ADV_FLOAT_INFINITE`, shown "∞". Whether Lies of P's missing plane IS `FLT_MAX` is still the hypothesis it
|
||||
was — item 40 reads it.)*
|
||||
- ~~**Valor Mortis.** One exit by access violation 51 seconds after injection under beta.40, none under an earlier
|
||||
build, not attributed. Its crash count is 1; a second such end switches its hooking off. Before adding a hook
|
||||
to that game's process, ask the owner whether it happened again.~~ **Answered by the owner, 2026-11-12: it was
|
||||
|
||||
@@ -193,8 +193,8 @@ public sealed class InGameAdvancedSampler
|
||||
}
|
||||
|
||||
var depth = new List<AdvancedRow>(3);
|
||||
AddNumber(depth, "cameraNear", s.FfxNearBits);
|
||||
AddNumber(depth, "cameraFar", s.FfxFarBits);
|
||||
AddDepthPlane(depth, "cameraNear", s.FfxNearBits);
|
||||
AddDepthPlane(depth, "cameraFar", s.FfxFarBits);
|
||||
// A range, lowest to highest - never a series, which would say when the player aimed (D114).
|
||||
if (Number(s.FfxFovMinBits) is double low && Number(s.FfxFovMaxBits) is double high)
|
||||
{
|
||||
@@ -232,6 +232,19 @@ public sealed class InGameAdvancedSampler
|
||||
}
|
||||
}
|
||||
|
||||
// A depth plane of FSR's: a number, or the plane at infinity (owner decision D119) - which Number, rightly for every
|
||||
// other field, takes for no value at all.
|
||||
private static void AddDepthPlane(List<AdvancedRow> rows, string member, uint bits)
|
||||
{
|
||||
if (bits == FlAdvancedState.FloatInfinite)
|
||||
{
|
||||
rows.Add(new AdvancedRow(member, "∞"));
|
||||
return;
|
||||
}
|
||||
|
||||
AddNumber(rows, member, bits);
|
||||
}
|
||||
|
||||
private static void AddNumber(List<AdvancedRow> rows, string member, uint bits)
|
||||
{
|
||||
if (Number(bits) is double value)
|
||||
|
||||
@@ -755,13 +755,13 @@ public enum FlAdvancedValid : uint
|
||||
/// <summary>The game asked <c>ffxQuery</c> for the upscaler's memory, and it answered.</summary>
|
||||
FfxMemory = 1u << 2,
|
||||
|
||||
/// <summary>0.1.0-beta.41: <c>ffxConfigure</c> with a frame-generation descriptor was seen.</summary>
|
||||
/// <summary>0.1.0-beta.43 (D118, D122): <c>ffxConfigure</c> with a frame-generation descriptor was seen.</summary>
|
||||
FfxFgConfig = 1u << 3,
|
||||
|
||||
/// <summary>0.1.0-beta.41: <c>slSetConstants</c> was seen.</summary>
|
||||
/// <summary>0.1.0-beta.43 (D118, D122): <c>slSetConstants</c> was seen.</summary>
|
||||
SlConstants = 1u << 4,
|
||||
|
||||
/// <summary>0.1.0-beta.42: at least one feature slot is filled.</summary>
|
||||
/// <summary>0.1.0-beta.44 (D118, D122): at least one feature slot is filled.</summary>
|
||||
SlFeatures = 1u << 5,
|
||||
}
|
||||
|
||||
@@ -788,6 +788,14 @@ public unsafe struct FlAdvancedState
|
||||
/// <summary>A float nobody saw: the bits no detour stores.</summary>
|
||||
public const uint FloatNone = 0xFFFFFFFFu;
|
||||
|
||||
/// <summary>
|
||||
/// The plane at infinity (0.1.0-beta.42, owner decision D119): +infinity's own bits, in <see cref="FfxNearBits"/>
|
||||
/// or <see cref="FfxFarBits"/> and in no other field. An engine with an infinite depth hands FSR
|
||||
/// <c>FLT_MAX</c> or +infinity for one plane; the Overlay stores either as this. Never from Streamline, whose
|
||||
/// <c>FLT_MAX</c> is "not set".
|
||||
/// </summary>
|
||||
public const uint FloatInfinite = 0x7F800000u;
|
||||
|
||||
/// <summary>How many feature slots <see cref="Features"/> holds.</summary>
|
||||
public const int FeatureSlots = 12;
|
||||
|
||||
@@ -942,7 +950,7 @@ public unsafe struct FlAdvancedState
|
||||
/// <summary>Must be zero.</summary>
|
||||
public fixed uint ReservedSl[3];
|
||||
|
||||
/// <summary><see cref="FeatureSlots"/> slots of <see cref="FeatureWords"/> words each (0.1.0-beta.42).</summary>
|
||||
/// <summary><see cref="FeatureSlots"/> slots of <see cref="FeatureWords"/> words each (0.1.0-beta.44).</summary>
|
||||
public fixed uint Features[FeatureSlots * FeatureWords];
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,18 @@ inline bool Usable(float v) noexcept {
|
||||
return (std::bit_cast<uint32_t>(v) & 0x7FFFFFFFu) < 0x7F7FFFFFu;
|
||||
}
|
||||
|
||||
// A depth plane as FSR is handed one (owner decision D119): an ordinary value as its bits; FLT_MAX or +infinity --
|
||||
// how an engine with an infinite depth says "this plane is at infinity" -- as FL_ADV_FLOAT_INFINITE; anything else
|
||||
// (a NaN, a negative infinity, -FLT_MAX) as "no value". FOR THE ffx ROUTE ONLY: Streamline's INVALID_FLOAT is
|
||||
// FLT_MAX and means nobody set it, which is why Usable refuses it everywhere else.
|
||||
inline uint32_t FfxDepthPlaneBits(float v) noexcept {
|
||||
const uint32_t bits = std::bit_cast<uint32_t>(v);
|
||||
if (Usable(v)) {
|
||||
return bits;
|
||||
}
|
||||
return bits == 0x7F7FFFFFu || bits == FL_ADV_FLOAT_INFINITE ? FL_ADV_FLOAT_INFINITE : FL_ADV_FLOAT_NONE;
|
||||
}
|
||||
|
||||
inline float Magnitude(float v) noexcept {
|
||||
return std::bit_cast<float>(std::bit_cast<uint32_t>(v) & 0x7FFFFFFFu);
|
||||
}
|
||||
@@ -237,11 +249,12 @@ inline void ObserveFfxUpscale(uint32_t leaf, const ffxDispatchDescUpscale& d, Ac
|
||||
KeepMax(a.ffxPreExposureMaxBits, d.preExposure);
|
||||
}
|
||||
|
||||
if (Usable(d.cameraNear)) {
|
||||
a.ffxNearBits.store(std::bit_cast<uint32_t>(d.cameraNear), std::memory_order_relaxed);
|
||||
// The two depth planes, the last of each; one of them may be at infinity (D119).
|
||||
if (const uint32_t nearBits = FfxDepthPlaneBits(d.cameraNear); nearBits != FL_ADV_FLOAT_NONE) {
|
||||
a.ffxNearBits.store(nearBits, std::memory_order_relaxed);
|
||||
}
|
||||
if (Usable(d.cameraFar)) {
|
||||
a.ffxFarBits.store(std::bit_cast<uint32_t>(d.cameraFar), std::memory_order_relaxed);
|
||||
if (const uint32_t farBits = FfxDepthPlaneBits(d.cameraFar); farBits != FL_ADV_FLOAT_NONE) {
|
||||
a.ffxFarBits.store(farBits, std::memory_order_relaxed);
|
||||
}
|
||||
// The field of view as a range (owner decision D114): the lowest and the highest, never a series.
|
||||
if (Usable(d.cameraFovAngleVertical) && d.cameraFovAngleVertical > 0.0f) {
|
||||
|
||||
@@ -932,18 +932,30 @@ struct alignas(64) FlDisplayState {
|
||||
|
||||
// FlAdvancedState.validMask: which groups below were ever read. Additive: a reader ignores a bit it does not know.
|
||||
enum FlAdvancedValid : uint32_t {
|
||||
FL_ADV_VALID_DLSS_OPTIONS = 1u << 0, // sl::DLSSOptions seen chained into slEvaluateFeature's inputs
|
||||
FL_ADV_VALID_FFX_UPSCALE = 1u << 1, // an ffx upscale dispatch's extra fields were read
|
||||
FL_ADV_VALID_FFX_MEMORY = 1u << 2, // the game asked ffxQuery for the upscaler's memory, and it answered
|
||||
FL_ADV_VALID_FFX_FG_CONFIG = 1u << 3, // (0.1.0-beta.41) ffxConfigure with a frame-generation descriptor seen
|
||||
FL_ADV_VALID_SL_CONSTANTS = 1u << 4, // (0.1.0-beta.41) slSetConstants seen
|
||||
FL_ADV_VALID_SL_FEATURES = 1u << 5, // (0.1.0-beta.42) at least one feature slot filled
|
||||
FL_ADV_VALID_DLSS_OPTIONS = 1u << 0, // sl::DLSSOptions seen chained into slEvaluateFeature's inputs
|
||||
FL_ADV_VALID_FFX_UPSCALE = 1u << 1, // an ffx upscale dispatch's extra fields were read
|
||||
FL_ADV_VALID_FFX_MEMORY = 1u << 2, // the game asked ffxQuery for the upscaler's memory, and it answered
|
||||
// The release numbers on the three groups below moved twice (owner decisions D118 and D122, 2026-11-12): beta.41
|
||||
// was a fix release and the second step became two. They are declared here and written by nothing until then.
|
||||
FL_ADV_VALID_FFX_FG_CONFIG = 1u << 3, // (0.1.0-beta.43) ffxConfigure with a frame-generation descriptor seen
|
||||
FL_ADV_VALID_SL_CONSTANTS = 1u << 4, // (0.1.0-beta.43) slSetConstants seen
|
||||
FL_ADV_VALID_SL_FEATURES = 1u << 5, // (0.1.0-beta.44) at least one feature slot filled
|
||||
};
|
||||
|
||||
// A float nobody saw. An all-ones pattern is a NaN no detour stores: every value is checked finite first.
|
||||
// A float nobody saw. An all-ones pattern is a NaN no detour stores: every value is checked finite first -- with the
|
||||
// one exception below.
|
||||
#define FL_ADV_FLOAT_NONE 0xFFFFFFFFu
|
||||
|
||||
// Feature slots (0.1.0-beta.42): FL_ADV_FEATURE_SLOTS slots of FL_ADV_FEATURE_WORDS uint32 each, in `features`.
|
||||
// THE PLANE AT INFINITY (0.1.0-beta.42, owner decision D119): +infinity's own bits, in ffxNearBits or ffxFarBits and
|
||||
// in no other field. An engine with an inverted, infinite depth hands FSR one finite plane and FLT_MAX -- or
|
||||
// +infinity -- for the other; three of the first four FSR titles read gave `cameraFar` alone (10, 1, 0.1), the other
|
||||
// plane having been refused as "nobody set this". For FSR that reading is wrong: its FLT_MAX is a plane, not a
|
||||
// sentinel. For Streamline it is right -- INVALID_FLOAT is FLT_MAX -- so this is the ffx route's alone. Stored as
|
||||
// the real +infinity rather than as a second all-ones-like pattern, so that a reader which knows nothing of this
|
||||
// constant still decodes a float that means what it says.
|
||||
#define FL_ADV_FLOAT_INFINITE 0x7F800000u
|
||||
|
||||
// Feature slots (0.1.0-beta.44): FL_ADV_FEATURE_SLOTS slots of FL_ADV_FEATURE_WORDS uint32 each, in `features`.
|
||||
// [0] sl::Feature id PLUS ONE; 0 = an empty slot
|
||||
// [1] bit 0: slGetFeatureVersion answered; bit 1: slGetFeatureRequirements answered
|
||||
// [2..4] versionSL major, minor, build [5..7] versionNGX
|
||||
@@ -988,7 +1000,7 @@ struct alignas(64) FlAdvancedState {
|
||||
uint32_t ffxJitterMaxYBits; // @148
|
||||
uint32_t ffxPreExposureMinBits; // @152
|
||||
uint32_t ffxPreExposureMaxBits; // @156
|
||||
uint32_t ffxNearBits; // @160 cameraNear, the last one seen
|
||||
uint32_t ffxNearBits; // @160 cameraNear, the last one seen; FL_ADV_FLOAT_INFINITE = at infinity
|
||||
uint32_t ffxFarBits; // @164
|
||||
uint32_t ffxFovMinBits; // @168 cameraFovAngleVertical, radians: the lowest and the highest (D114)
|
||||
uint32_t ffxFovMaxBits; // @172
|
||||
@@ -1001,15 +1013,15 @@ struct alignas(64) FlAdvancedState {
|
||||
uint64_t ffxMemoryTotalBytes; // @192 FfxApiEffectMemoryUsage, as the last answered query gave it
|
||||
uint64_t ffxMemoryAliasableBytes; // @200
|
||||
uint32_t ffxMemoryQueries; // @208 answered memory queries (wraps)
|
||||
uint32_t ffxFgConfigures; // @212 (beta.41) ffxConfigure calls with a frame-generation descriptor
|
||||
uint32_t ffxFgEnabledSeen; // @216 (beta.41) bit 0: seen off; bit 1: seen on
|
||||
uint32_t ffxFgAsyncSeen; // @220 (beta.41) allowAsyncWorkloads, the same two bits
|
||||
uint32_t ffxFgOnlyGeneratedSeen; // @224 (beta.41) onlyPresentGenerated, the same two bits
|
||||
uint32_t ffxFgFlagsSeen; // @228 (beta.41) every dispatch flag any configure carried
|
||||
int32_t ffxFgRect[4]; // @232..247 (beta.41) generationRect: left, top, width, height - the last
|
||||
uint32_t ffxFgConfigures; // @212 (beta.43) ffxConfigure calls with a frame-generation descriptor
|
||||
uint32_t ffxFgEnabledSeen; // @216 (beta.43) bit 0: seen off; bit 1: seen on
|
||||
uint32_t ffxFgAsyncSeen; // @220 (beta.43) allowAsyncWorkloads, the same two bits
|
||||
uint32_t ffxFgOnlyGeneratedSeen; // @224 (beta.43) onlyPresentGenerated, the same two bits
|
||||
uint32_t ffxFgFlagsSeen; // @228 (beta.43) every dispatch flag any configure carried
|
||||
int32_t ffxFgRect[4]; // @232..247 (beta.43) generationRect: left, top, width, height - the last
|
||||
uint32_t reservedFfx[2]; // @248..255 must be zero
|
||||
|
||||
// ---- line 4: sl::Constants, summarised (beta.41) - never the camera's position, axes or matrices -----------
|
||||
// ---- line 4: sl::Constants, summarised (beta.43) - never the camera's position, axes or matrices -----------
|
||||
uint32_t slConstantsCalls; // @256 slSetConstants calls, every viewport together (wraps)
|
||||
uint32_t slResets; // @260 calls with `reset` true
|
||||
uint32_t slJitterMaxXBits; // @264
|
||||
@@ -1027,7 +1039,7 @@ struct alignas(64) FlAdvancedState {
|
||||
uint32_t slFlagsSeenFalse; // @304
|
||||
uint32_t reservedSl[3]; // @308..319 must be zero
|
||||
|
||||
// ---- lines 5..22: Streamline's features (beta.42) --------------------------------------------------------------
|
||||
// ---- lines 5..22: Streamline's features (beta.44) --------------------------------------------------------------
|
||||
uint32_t features[FL_ADV_FEATURE_SLOTS * FL_ADV_FEATURE_WORDS]; // @320..1471
|
||||
};
|
||||
|
||||
|
||||
@@ -113,6 +113,7 @@ TEST_CASE("threads that meet the same new types at once keep each exactly once",
|
||||
for (int round = 0; round < 200; ++round) {
|
||||
fl::ffxtypes::Seen seen;
|
||||
std::vector<std::thread> threads;
|
||||
threads.reserve(8);
|
||||
for (int t = 0; t < 8; ++t) {
|
||||
threads.emplace_back([&seen, t] {
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
|
||||
@@ -6835,7 +6835,7 @@ uint32_t BitsOf(float v) {
|
||||
return std::bit_cast<uint32_t>(v);
|
||||
}
|
||||
|
||||
// What 0.1.0-beta.41 and beta.42 fill: declared now, written by nothing in this release.
|
||||
// What 0.1.0-beta.43 and beta.44 fill (beta.41 and beta.42 until D118 and D122): declared, written by nothing yet.
|
||||
bool LaterGroupsAreZero(const fl::FlAdvancedState& a) {
|
||||
bool zero = a.ffxFgConfigures == 0u && a.ffxFgEnabledSeen == 0u && a.ffxFgFlagsSeen == 0u &&
|
||||
a.slConstantsCalls == 0u && a.slResets == 0u && a.slFlagsSeenTrue == 0u && a.slFlagsSeenFalse == 0u;
|
||||
@@ -6942,6 +6942,42 @@ TEST_CASE("region 5 stays empty until the Agent asks, then carries what an FSR t
|
||||
CHECK(r.st->status == fl::FL_STATUS_READY);
|
||||
}
|
||||
|
||||
TEST_CASE("FSR's plane at infinity (beta.42, D119): a far plane of FLT_MAX reaches region 5 as +infinity, beside "
|
||||
"the finite near plane",
|
||||
"[guard][inject][shm][advanced]") {
|
||||
// An engine with an infinite depth hands FSR FLT_MAX for one plane. The Overlay took that for Streamline's "not
|
||||
// set" and dropped it, so three real titles showed one plane of two. Through the shipped DLL, on the SDK 1.1.x
|
||||
// monolith: the same target as the case above, with the far plane at infinity.
|
||||
Child child;
|
||||
REQUIRE(StartHarness(child, L"--real --ffx-topology 1x --advanced --ffx-infinite-far --hold-presenting-ffx 30"));
|
||||
|
||||
ResetFake();
|
||||
g.modules = {"kernel32.dll"};
|
||||
g.scanSet = {child.pi.dwProcessId};
|
||||
REQUIRE(GuardedInjectWithSources(child.pi.dwProcessId, FL_OVERLAY_DLL, FakeSources()).Allowed());
|
||||
|
||||
MappedRing r;
|
||||
REQUIRE(OpenRingFor(child.pi.dwProcessId, r));
|
||||
if (r.st == nullptr || r.ctl == nullptr) {
|
||||
return; // not reached after the REQUIRE; said in the form a static analyser follows (cpp:S2259)
|
||||
}
|
||||
REQUIRE(WaitForIdentityHook(r.st));
|
||||
|
||||
SetAdvancedRequest(r, 11u);
|
||||
fl::FlAdvancedState a{};
|
||||
REQUIRE(ReadAdvanced(r, 11u, a, 0u, fl::FL_ADV_VALID_FFX_UPSCALE));
|
||||
INFO("near 0x" << std::hex << a.ffxNearBits << " far 0x" << a.ffxFarBits);
|
||||
CHECK(a.ffxFarBits == FL_ADV_FLOAT_INFINITE);
|
||||
CHECK(std::bit_cast<float>(a.ffxFarBits) > 3.0e38f); // the float it decodes to IS infinity
|
||||
CHECK(a.ffxNearBits == BitsOf(kAdvFfxNear));
|
||||
// And nothing else of the descriptor took the pattern.
|
||||
CHECK(a.ffxPreExposureMaxBits == BitsOf(kAdvFfxPreExposure));
|
||||
CHECK(a.ffxFovMaxBits == BitsOf(kAdvFfxFovHigh));
|
||||
CHECK(a.ffxSharpnessMaxBits == BitsOf(kAdvFfxSharpness));
|
||||
CHECK(r.st->faultCount == 0u);
|
||||
CHECK(r.st->status == fl::FL_STATUS_READY);
|
||||
}
|
||||
|
||||
TEST_CASE("region 5 carries the DLSS options a title chains into its evaluation, and only while asked",
|
||||
"[guard][inject][shm][advanced]") {
|
||||
Child child;
|
||||
|
||||
@@ -116,6 +116,9 @@
|
||||
// sl::DLSSOptions into slEvaluateFeature's inputs, --hold-presenting-ffx fills the rest of the
|
||||
// UPSCALE descriptor (sharpening, jitter, exposure, depth range, field of view, flags, frame time).
|
||||
// The values are the kAdv* constants below; the injected fl_guard cases assert them
|
||||
// --ffx-infinite-far
|
||||
// with --advanced: the UPSCALE descriptor's cameraFar is FLT_MAX, as an engine with an infinite
|
||||
// depth states the plane at infinity (0.1.0-beta.42, D119), instead of kAdvFfxFar
|
||||
// --ffx-memory-query v1|v2
|
||||
// before every UPSCALE, ask the entry module ffxQuery how much memory the upscaler holds, in
|
||||
// the descriptor of ffx-api 1.1.2 (v1) or 2.0 (v2); the stub answers kAdvMemory*
|
||||
@@ -2159,6 +2162,60 @@ bool ProbeAdvFields() {
|
||||
Check(off.ffxFlagsSeen.load() == 0u && off.ffxResets.load() == 0u, "nothing is invented");
|
||||
}
|
||||
|
||||
// --- FSR's plane at infinity (0.1.0-beta.42, owner decision D119)
|
||||
// -------------------------------------------------
|
||||
{
|
||||
const float flatMax = std::bit_cast<float>(0x7F7FFFFFu);
|
||||
const float plusInf = std::bit_cast<float>(0x7F800000u);
|
||||
Check(fl::adv::FfxDepthPlaneBits(0.1f) == bitsOf(0.1f) && fl::adv::FfxDepthPlaneBits(0.0f) == bitsOf(0.0f),
|
||||
"an ordinary plane is its own bits");
|
||||
Check(fl::adv::FfxDepthPlaneBits(flatMax) == FL_ADV_FLOAT_INFINITE &&
|
||||
fl::adv::FfxDepthPlaneBits(plusInf) == FL_ADV_FLOAT_INFINITE,
|
||||
"FLT_MAX and +infinity are the plane at infinity");
|
||||
Check(fl::adv::FfxDepthPlaneBits(std::bit_cast<float>(0x7FC00000u)) == FL_ADV_FLOAT_NONE &&
|
||||
fl::adv::FfxDepthPlaneBits(std::bit_cast<float>(0xFF800000u)) == FL_ADV_FLOAT_NONE &&
|
||||
fl::adv::FfxDepthPlaneBits(std::bit_cast<float>(0xFF7FFFFFu)) == FL_ADV_FLOAT_NONE,
|
||||
"a NaN, a negative infinity and -FLT_MAX are no plane");
|
||||
Check(std::bit_cast<float>(static_cast<uint32_t>(FL_ADV_FLOAT_INFINITE)) > flatMax,
|
||||
"the stored pattern IS +infinity, so a reader that never heard of it still reads a float that means it");
|
||||
|
||||
// Lies of P's shape: an inverted, infinite depth -- the far plane a small number, the near one FLT_MAX.
|
||||
fl::adv::Accumulators a;
|
||||
ffxDispatchDescUpscale d{};
|
||||
d.cameraNear = flatMax;
|
||||
d.cameraFar = 10.0f;
|
||||
fl::adv::ObserveFfxUpscale(0u, d, a);
|
||||
Check(a.ffxNearBits.load() == FL_ADV_FLOAT_INFINITE && a.ffxFarBits.load() == bitsOf(10.0f),
|
||||
"the plane at infinity is kept beside the finite one -- it used to be dropped");
|
||||
// ...and the other way round, as +infinity; then a NaN changes nothing that was kept.
|
||||
d.cameraNear = 0.05f;
|
||||
d.cameraFar = plusInf;
|
||||
fl::adv::ObserveFfxUpscale(0u, d, a);
|
||||
Check(a.ffxNearBits.load() == bitsOf(0.05f) && a.ffxFarBits.load() == FL_ADV_FLOAT_INFINITE,
|
||||
"either plane may be the infinite one, and the last value of each is what is kept");
|
||||
d.cameraNear = std::bit_cast<float>(0x7FC00000u);
|
||||
d.cameraFar = std::bit_cast<float>(0xFF800000u);
|
||||
fl::adv::ObserveFfxUpscale(0u, d, a);
|
||||
Check(a.ffxNearBits.load() == bitsOf(0.05f) && a.ffxFarBits.load() == FL_ADV_FLOAT_INFINITE,
|
||||
"a plane that is no plane leaves the last one in place");
|
||||
|
||||
// THE STREAMLINE ROUTE IS UNCHANGED: there FLT_MAX is INVALID_FLOAT, nobody's value.
|
||||
fl::adv::Accumulators s;
|
||||
sl::DLSSOptions o;
|
||||
o.preExposure = sl::INVALID_FLOAT;
|
||||
o.exposureScale = plusInf;
|
||||
fl::adv::ObserveDlssOptions(o, s);
|
||||
Check(s.dlssPreExposureBits.load() == FL_ADV_FLOAT_NONE && s.dlssExposureScaleBits.load() == FL_ADV_FLOAT_NONE,
|
||||
"for Streamline FLT_MAX stays 'not set' and an infinity stays no value: the rule is the ffx route's");
|
||||
d.preExposure = flatMax;
|
||||
d.cameraFovAngleVertical = plusInf;
|
||||
fl::adv::Accumulators other;
|
||||
fl::adv::ObserveFfxUpscale(0u, d, other);
|
||||
Check(other.ffxPreExposureMaxBits.load() == FL_ADV_FLOAT_NONE &&
|
||||
other.ffxFovMaxBits.load() == FL_ADV_FLOAT_NONE,
|
||||
"an exposure or a field of view of FLT_MAX or infinity is still no value");
|
||||
}
|
||||
|
||||
// --- the ffx upscaler's memory, both query versions
|
||||
// ------------------------------------------------------------------
|
||||
{
|
||||
@@ -3021,6 +3078,9 @@ void AskQuality(PfnFfxQuery query, FfxQuery what) {
|
||||
}
|
||||
}
|
||||
|
||||
// --ffx-infinite-far (with --advanced): cameraFar is FLT_MAX rather than kAdvFfxFar.
|
||||
bool g_ffxInfiniteFar = false;
|
||||
|
||||
int HoldPresentingFfx(Gfx& g, int seconds, bool real, int presentsPerEval, FfxTopology topology, bool prepare,
|
||||
FfxQuery ask, bool advanced, FfxMemoryQuery askMemory) {
|
||||
if (!HaveD3D11(g, "--hold-presenting-ffx")) {
|
||||
@@ -3143,7 +3203,8 @@ int HoldPresentingFfx(Gfx& g, int seconds, bool real, int presentsPerEval, FfxTo
|
||||
up.sharpness = kAdvFfxSharpness;
|
||||
up.preExposure = kAdvFfxPreExposure;
|
||||
up.cameraNear = kAdvFfxNear;
|
||||
up.cameraFar = kAdvFfxFar;
|
||||
// --ffx-infinite-far: the plane at infinity as an engine with an infinite depth states it (D119).
|
||||
up.cameraFar = g_ffxInfiniteFar ? std::bit_cast<float>(0x7F7FFFFFu) : kAdvFfxFar;
|
||||
up.frameTimeDelta = kAdvFfxFrameTimeMs;
|
||||
up.flags = FFX_UPSCALE_FLAG_NON_LINEAR_COLOR_PQ;
|
||||
}
|
||||
@@ -3418,6 +3479,8 @@ int main(int argc, char** argv) {
|
||||
ffxQuery = std::strcmp(q, "sizes") == 0 ? FfxQuery::Sizes
|
||||
: std::strcmp(q, "ratios") == 0 ? FfxQuery::Ratios
|
||||
: FfxQuery::None;
|
||||
} else if (std::strcmp(argv[i], "--ffx-infinite-far") == 0) {
|
||||
g_ffxInfiniteFar = true;
|
||||
} else if (std::strcmp(argv[i], "--advanced") == 0) {
|
||||
advancedInputs = true;
|
||||
} else if (std::strcmp(argv[i], "--ffx-memory-query") == 0 && i + 1 < argc) {
|
||||
@@ -3464,7 +3527,7 @@ int main(int argc, char** argv) {
|
||||
std::strcmp(argv[i], "--ffx-topology") == 0 || std::strcmp(argv[i], "--ffx-no-prepare") == 0 ||
|
||||
std::strcmp(argv[i], "--ffx-query") == 0 || std::strcmp(argv[i], "--sl-tag-for-frame") == 0 ||
|
||||
std::strcmp(argv[i], "--advanced") == 0 || std::strcmp(argv[i], "--ffx-memory-query") == 0 ||
|
||||
std::strcmp(argv[i], "--sl-tag-whole-resource") == 0 ||
|
||||
std::strcmp(argv[i], "--ffx-infinite-far") == 0 || std::strcmp(argv[i], "--sl-tag-whole-resource") == 0 ||
|
||||
std::strcmp(argv[i], "--sl-tag-dlssg-inputs") == 0 || std::strcmp(argv[i], "--load") == 0 ||
|
||||
std::strcmp(argv[i], "--load-after-ms") == 0) {
|
||||
if (std::strcmp(argv[i], "--plus-ui") == 0 || std::strcmp(argv[i], "--present-interval-ms") == 0 ||
|
||||
|
||||
@@ -96,6 +96,46 @@ public sealed class InGameAdvancedSamplerTests
|
||||
sampler.Facts.Should().NotContain(static f => f.Id.StartsWith("sl.", StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AnFsrDepthPlaneAtInfinityIsShownAsInfiniteAndInNoOtherFieldIsInfinityAValue()
|
||||
{
|
||||
// Owner decision D119: an engine with an infinite depth hands FSR FLT_MAX for one plane, and the Overlay
|
||||
// stores that as +infinity's own bits. Lies of P's shape: the far plane a small number, the near one at
|
||||
// infinity.
|
||||
var sampler = new InGameAdvancedSampler();
|
||||
sampler.Take(new InGameAdvanced(InGameStates.Ffx() with
|
||||
{
|
||||
FfxNearBits = FlAdvancedState.FloatInfinite,
|
||||
FfxFarBits = BitConverter.SingleToUInt32Bits(10f),
|
||||
}));
|
||||
|
||||
Rows(Fact(sampler, "ffx.upscale.depth")).Should().StartWith(["cameraNear=∞", "cameraFar=10"]);
|
||||
|
||||
// The other way round, in the same session: the fact follows what the game says now.
|
||||
sampler.Take(new InGameAdvanced(InGameStates.Ffx(2) with
|
||||
{
|
||||
FfxNearBits = BitConverter.SingleToUInt32Bits(0.05f),
|
||||
FfxFarBits = FlAdvancedState.FloatInfinite,
|
||||
}));
|
||||
Rows(Fact(sampler, "ffx.upscale.depth")).Should().StartWith(["cameraNear=0.05", "cameraFar=∞"]);
|
||||
|
||||
// Infinity is a depth plane's value and nobody else's: an exposure or a jitter carrying the pattern is, as
|
||||
// before, no value - the Overlay never stores it there, and a reader does not invent a meaning for it.
|
||||
var other = new InGameAdvancedSampler();
|
||||
other.Take(new InGameAdvanced(InGameStates.Ffx() with
|
||||
{
|
||||
FfxPreExposureMinBits = FlAdvancedState.FloatInfinite,
|
||||
FfxPreExposureMaxBits = FlAdvancedState.FloatInfinite,
|
||||
FfxJitterMaxXBits = FlAdvancedState.FloatInfinite,
|
||||
FfxJitterMaxYBits = FlAdvancedState.FloatInfinite,
|
||||
FfxNearBits = FlAdvancedState.FloatNone,
|
||||
FfxFarBits = 0xFF800000u,
|
||||
}));
|
||||
other.Facts.Should().NotContain(static f => f.Id == "ffx.upscale.exposure" || f.Id == "ffx.upscale.jitter");
|
||||
Rows(Fact(other, "ffx.upscale.depth")).Should().OnlyContain(static row => row.StartsWith("cameraFov", StringComparison.Ordinal),
|
||||
"a plane nobody gave and a negative infinity are not planes");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SharpeningSeenBothWaysARangeAndAFlagNobodyNamedAreSaidAsTheyAre()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user