mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-21 21:05:56 +00:00
DLSS upscaling: quality, balanced and performance modes
TOTK_DLSS (dlaa|quality|balanced|performance, read at start) sets the scene to 67, 58 or 50 % of the output. DLSS then runs at the begin of the game's scaling pass (the FXAA shader drawing the light target into the output-sized target, before the HUD) and its result replaces that draw; the HUD is drawn afterwards and never jittered or passed through DLSS. The jitter now ends where the scene ends (the bloom), separately from where DLSS runs. Scaled modes add a mip bias of log2(scale) to repeating, mipmapped material samplers. With a scene smaller than the output, fxaa = 0 no longer skips the game's scaling draw (it left the 3D picture out). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6d181cf327
commit
2e8b4ff1b1
11 files changed
+141
-56
No files matched your search
+18
-1
@@ -49,6 +49,7 @@ static struct {
|
||||
int scene_set; // the scene differs from the game's 5/6 of the output
|
||||
int heapdef_ok; // romfs.c serves the grown HeapDef
|
||||
int on; // res_init switched the patch sets on
|
||||
double dlss_k; // TOTK_DLSS quality/balanced/performance: the scene's share of the output, else 0
|
||||
} R;
|
||||
|
||||
static void decide(void) {
|
||||
@@ -67,7 +68,16 @@ static void decide(void) {
|
||||
}
|
||||
const char *s = cfg_value("TOTK_RENDER_SCALE");
|
||||
double k = 5.0 / 6.0;
|
||||
if (strcmp(s, "game")) {
|
||||
const char *m = cfg_value("TOTK_DLSS"); // a DLSS mode other than dlaa sets the scene size
|
||||
static const struct { const char *name; double k; } dlss[] = {
|
||||
{"quality", 2.0 / 3.0}, {"balanced", 0.58}, {"performance", 0.5}};
|
||||
for (int i = 0; i < 3; i++)
|
||||
if (!strcmp(m, dlss[i].name)) R.dlss_k = dlss[i].k;
|
||||
if (R.dlss_k) {
|
||||
k = R.dlss_k;
|
||||
R.scene_set = 1;
|
||||
rt_log("resolution: DLSS %s: the scene at %.0f %% of the output (render_scale ignored)", m, k * 100);
|
||||
} else if (strcmp(s, "game")) {
|
||||
char *end;
|
||||
double pct = strtod(s, &end);
|
||||
if (end != s && !*end && pct >= 25 && pct <= 400) {
|
||||
@@ -241,6 +251,13 @@ void res_init(void) {
|
||||
scene_on ? "" : " (the game's own 5/6 of the output)", (unsigned long long)res_heap_extra_kib());
|
||||
}
|
||||
|
||||
// DLSS upscaling: textures are sampled for the output's resolution, not the scene's (NVIDIA's DLSS guide: a mip bias
|
||||
// of log2(render / output)), so their detail survives the scaling. 0 without a DLSS mode.
|
||||
float res_dlss_lod_bias(void) {
|
||||
decide();
|
||||
return R.dlss_k ? (float)log2(R.dlss_k) : 0.0f;
|
||||
}
|
||||
|
||||
// 16:9 within 1% (1366x768 counts): the shape the game's own layouts and camera are made for.
|
||||
int res_is_16x9(unsigned w, unsigned h) {
|
||||
double rel = ((double)w / h) / ((double)BASE_W / BASE_H);
|
||||
|
||||
Reference in new issue
Block a user