mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-22 17:19:58 -04:00
Triforce v0.7.0 "Sage Of Courage"
The 0.6 crashes after warps and area changes fixed (no write-back into memory the capture leaves out), invisible objects fixed (occlusion gate), DLSS frame generation flicker fixed, achievements, the renderer built with a play profile, faster translated game code, helper threads judged on settled scenes, memory, shader preparation, audio effects, launcher, controls and Linux fixes.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
@@ -16,6 +17,50 @@ inline bool scene_size_fits(uint32_t w, uint32_t h, uint32_t ow, uint32_t oh) {
|
||||
return w && h && ow && oh && w <= ow && h <= oh && (uint64_t)w * 3 >= ow && (uint64_t)h * 3 >= oh;
|
||||
}
|
||||
|
||||
/// ((Triforce, 11-22, the performance audit's PRESENT-38, after Source A's) One quality mode's range of render sizes for
|
||||
/// an output, as NGX answers it (ok: it answered one).
|
||||
struct ModeRange {
|
||||
uint32_t min_w = 0, min_h = 0, max_w = 0, max_h = 0;
|
||||
bool ok = false;
|
||||
};
|
||||
/// How far outside a range a render size may be and still be that mode's: a 64th of the range's largest size on that
|
||||
/// axis, 2 pixels at least. The Render resolution row's shares are twelfths of the output rounded up, NGX's own sizes
|
||||
/// are rounded down: 854x480 against NGX's 853x480 for Ultra Performance at 2560x1440.
|
||||
constexpr uint32_t mode_slack(uint32_t largest) { return largest / 64 > 2 ? largest / 64 : 2; }
|
||||
/// The mode (an index into ranges) that takes a render size of w x h for an output of ow x oh, or -1. The first range
|
||||
/// that holds the size; else, with slack on, the first it is outside of by no more than mode_slack on each axis, and
|
||||
/// only for a size DLSS scales at all (scene_size_fits: the output 1 to 3 times it). *widened: taken by the slack.
|
||||
inline int mode_for(const ModeRange* ranges, size_t n, uint32_t w, uint32_t h, uint32_t ow, uint32_t oh, bool slack, bool* widened) {
|
||||
*widened = false;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
const ModeRange& r = ranges[i];
|
||||
if (r.ok && w >= r.min_w && h >= r.min_h && w <= r.max_w && h <= r.max_h) return (int)i;
|
||||
}
|
||||
if (!slack || !scene_size_fits(w, h, ow, oh)) return -1;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
const ModeRange& r = ranges[i];
|
||||
if (!r.ok) continue;
|
||||
const uint32_t sw = mode_slack(r.max_w), sh = mode_slack(r.max_h);
|
||||
if (w + sw >= r.min_w && h + sh >= r.min_h && w <= r.max_w + sw && h <= r.max_h + sh) return *widened = true, (int)i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// ((Triforce, 11-22, the performance audit's PRESENT-32, after Source A's) Whether a feature is made in a one-size mode
|
||||
/// (NGX's DLAA mode: vk_dlss.cpp prepare's `same` list): its render size is the output's. Before, whenever the two sizes
|
||||
/// were equal. NVIDIA DLSS with the Render resolution row at Auto starts at the output's size, so it got a one-size
|
||||
/// feature, and the game's dynamic resolution left that size some frames later: a second feature made in play (Source
|
||||
/// A's save load-in: 119 ms, then 29.5 ms 17 frames on). With the rule (rule: RX_VK_DLSS_PREWARM=1), one-size only where
|
||||
/// NVIDIA DLAA is the Upscaler's choice (dlaa); DLSS at the output's size takes the scaled mode whose range holds it
|
||||
/// (mode_for: Quality's reaches the output's size), and Auto's smaller sizes then draw with that same feature. Off by
|
||||
/// default: DLSS at full size then draws with the scaled mode's network, not DLAA's, a picture nobody has compared yet
|
||||
inline bool dlaa_feature(bool rule, bool dlaa, uint32_t rw, uint32_t rh, uint32_t ow, uint32_t oh) {
|
||||
const bool full = rw == ow && rh == oh;
|
||||
return rule ? full && dlaa : full;
|
||||
}
|
||||
/// RX_VK_DLSS_PREWARM (value, null when unset): the rule above is on only when it is 1
|
||||
inline bool prewarm_rule(const char* text) { return text && *text && std::atoi(text) == 1; }
|
||||
|
||||
/// Whether s is all ASCII: NGX's Linux library takes only such paths (vk_dlss.cpp wide())
|
||||
inline bool ascii(std::string_view s) {
|
||||
for (const char c : s)
|
||||
@@ -84,4 +129,28 @@ inline std::wstring utf8_to_wide(std::string_view s, bool* bad = nullptr) {
|
||||
return out;
|
||||
}
|
||||
|
||||
/// ((Triforce, 11-21, the performance audit's PRESENT-37, after Source A's) The preset DLSS draws with while the DLSS model
|
||||
/// row is stepped through (vk_dlss.cpp prepare). The row goes K, M, L, NVIDIA's default and applies live, so K to L passes
|
||||
/// M: a feature was made for each preset passed, tens of ms of CPU each, and NGX keeps a released feature's video memory for
|
||||
/// some seconds: Source A's 16 GB card at 3440x1440 held 1419 MB of DLSS's for K, M and L at once against 813 MB for L
|
||||
/// alone, and where memory was short NGX refused the next feature. A new preset is taken once the row has held it for
|
||||
/// `frames`; until then the feature already made draws on with its own. With no feature (the first, or one let go) the
|
||||
/// row's preset is taken at once
|
||||
struct PresetSettle {
|
||||
unsigned wanted = ~0u; // (the row's preset, as last seen)
|
||||
uint64_t since = 0; // (the frame it was first seen in)
|
||||
/// The preset for frame `now`: want, the row's; have, the feature's; has: there is a feature
|
||||
unsigned pick(unsigned want, unsigned have, bool has, uint64_t now, uint64_t frames) {
|
||||
if (want != wanted) wanted = want, since = now;
|
||||
if (!has || want == have) return want;
|
||||
return now - since >= frames ? want : have;
|
||||
}
|
||||
};
|
||||
/// RX_VK_DLSS_MODEL_SETTLE's frames: 30 when not set; 0 (and what is no number, or less): at once, as before
|
||||
inline uint64_t settle_frames(const char* text) {
|
||||
if (!text || !*text) return 30;
|
||||
const long v = std::atol(text);
|
||||
return v > 0 ? (uint64_t)v : 0;
|
||||
}
|
||||
|
||||
} // namespace mkwvk::dlss_checks
|
||||
|
||||
Reference in New Issue
Block a user