mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-22 13:05:57 +00:00
Merge pull request #534: DLSS / DLAA on Linux, a DLSS model choice, the real frame time and a character-trail mask (SchulzCode)
Merged on top of #566 and #594, by hand in vk_dlaa.c: - One dlss_preset key: default keeps #594's model per mode (K for DLAA, Quality and Balanced, M for Performance, L for Ultra Performance); k, j or any other letter a..m takes that model in every mode, live, recreating the features as #534 does. The menu texts say so, with pt-BR and zh-Hans added. - The mask pass stays on #594's camera motion (the identity and the CPU-made reprojection in dlaa_mv.comp's two blocks) and adds #534's outputs; it runs before the per-object pass. Where the reactive mask test (TOTK_DLSS_REACTIVE) ran, DLSS gets that mask instead of the characters'. - #566 dropped the scaler_skipped/scaler_missed report, so #534's reset of it goes too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
5024daf40d
9 files changed
+505
-204
No files matched your search
+5
-3
@@ -37,7 +37,7 @@ static const char *const known[] = {
|
||||
"BIND_SKIP", "BIND_STATS", "BIND_UP", "BIND_X", "BIND_Y",
|
||||
"BIND_ZL", "BIND_ZR", "BLOCK_VIEWS_3D", "CLOTH_REALTIME", "COLOR_BRIGHTNESS", "COLOR_CONTRAST", "COLOR_GAMMA",
|
||||
"COLOR_PRESET", "COLOR_SATURATION", "CONTACT_DEBUG", "CONTACT_SHADOWS", "CORE_DIAG", "CRIT", "CRIT_OUT",
|
||||
"DESC_TEMPLATE", "DEVICE_PROFILE", "DLAA", "DLAA_JITTER", "DLAA_MV", "DLAA_MASKDEBUG", "DLAA_MVDEBUG", "DLAA_OBJMV", "DLAA_SURVEY", "DLAA_TIMES", "DLSS", "DLSS_PRESET", "DLSS_REACTIVE", "DUMP", "DUMP_BUF", "DUMP_DIR",
|
||||
"DESC_TEMPLATE", "DEVICE_PROFILE", "DLAA", "DLAA_JITTER", "DLAA_MV", "DLAA_MASKDEBUG", "DLAA_MVDEBUG", "DLAA_OBJMV", "DLAA_SURVEY", "DLAA_TIMES", "DLSS", "DLSS_CHAR_MASK", "DLSS_PRESET", "DLSS_REACTIVE", "DUMP", "DUMP_BUF", "DUMP_DIR",
|
||||
"DUMP_LOG", "EXEFS", "FEEDBACK", "FIX_C0", "FIX_ZERO", "FLIGHT", "FLIGHT_AT", "FLIGHT_DIR", "FLIGHT_FRAMES",
|
||||
"FLIGHT_SPIKE_MS", "FLIGHT_THUMBS", "FOV", "FOV_PATCH", "FPS60", "FPS_LIMIT", "FREEZE_IDLE", "FREE_CORES",
|
||||
"FULLSCREEN", "FXAA", "GPL", "GPL_DRAW_BUILD", "GPU", "GPU_INDEX", "GPU_NAME", "HDR", "HDR_GAME_NITS", "HDR_HUE",
|
||||
@@ -72,7 +72,7 @@ static const struct { const char *key, *section; } sections[] = {
|
||||
{"COLOR_BRIGHTNESS", "display"}, {"COLOR_CONTRAST", "display"}, {"COLOR_SATURATION", "display"},
|
||||
{"COLOR_GAMMA", "display"}, {"HDR", "display"}, {"HDR_PEAK_NITS", "display"}, {"HDR_GAME_NITS", "display"},
|
||||
{"HDR_UI_NITS", "display"}, {"HDR_HUE", "display"}, {"SHADOW_RES", "display"},
|
||||
{"DLAA", "display"}, {"DLSS", "display"}, {"FXAA", "display"},
|
||||
{"DLAA", "display"}, {"DLSS", "display"}, {"DLSS_PRESET", "display"}, {"DLSS_CHAR_MASK", "display"}, {"FXAA", "display"},
|
||||
{"DEVICE_PROFILE", "display"}, {"ASSUME_FOCUS", "display"},
|
||||
{"SHADOW_SCALE", "display"}, {"SHADOW_RANGE", "display"}, {"CONTACT_SHADOWS", "display"},
|
||||
{"PCSS", "display"},
|
||||
@@ -114,7 +114,9 @@ static const CfgMeta metas[] = {
|
||||
{"PERF_OVERLAY", "off", "off|fps|full", LIVE},
|
||||
{"OUTPUT_RES", "1920x1080", NULL, RESTART}, {"RENDER_SCALE", "game", "game|50|67|75|100|125|150|200", RESTART},
|
||||
{"UPSCALER", "fsr", "fsr|bilinear", LIVE}, {"SHARPNESS", "80", "0..100", LIVE},
|
||||
{"DLAA", "0", "0|1", RESTART}, {"DLSS", "dlaa", "dlaa|quality|balanced|performance|ultra_performance", LIVE}, {"FXAA", "1", "0|1", LIVE},
|
||||
{"DLAA", "0", "0|1", RESTART}, {"DLSS", "dlaa", "dlaa|quality|balanced|performance|ultra_performance", LIVE},
|
||||
{"DLSS_PRESET", "default", "default|k|j", LIVE},
|
||||
{"DLSS_CHAR_MASK", "65", "0|35|65|100", LIVE}, {"FXAA", "1", "0|1", LIVE},
|
||||
{"ASPECT", "fit", "fit|stretch", LIVE}, {"FOV", "100", "70..140", LIVE},
|
||||
{"ANISO", "game", "game|2|4|8|16", RESTART}, // vk_texture.c sampler_features
|
||||
// colour adjustment (vk_color.c); the preset is the menu's, the four values are what the present uses
|
||||
|
||||
+156
-113
@@ -1,119 +1,162 @@
|
||||
// Generated by tools/build_shaders.py from runtime/shaders/dlaa_mv.comp; do not edit.
|
||||
// source sha256 bfa9b6d9e0f9d5cfd4382fa5080fa46f007a1a4e2b886b8fecd9adba11767686
|
||||
// source sha256 e96a6d2d0cec26c47a76280363077c5982919bedc984f20ae9f1d185dc6ae674
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
static const uint32_t dlaa_mv_spv[] = {
|
||||
0x07230203, 0x00010600, 0x0008000b, 0x00000131, 0x00000000, 0x00020011, 0x00000001, 0x00020011,
|
||||
0x07230203, 0x00010300, 0x000d000b, 0x0000019a, 0x00000000, 0x00020011, 0x00000001, 0x00020011,
|
||||
0x00000031, 0x0006000b, 0x00000001, 0x4c534c47, 0x6474732e, 0x3035342e, 0x00000000, 0x0003000e,
|
||||
0x00000000, 0x00000001, 0x000b000f, 0x00000005, 0x00000004, 0x6e69616d, 0x00000000, 0x00000036,
|
||||
0x00000043, 0x0000005d, 0x00000089, 0x000000a0, 0x000000e7, 0x00060010, 0x00000004, 0x00000011,
|
||||
0x00000008, 0x00000008, 0x00000001, 0x00030003, 0x00000002, 0x000001c2, 0x00040005, 0x00000004,
|
||||
0x6e69616d, 0x00000000, 0x00080005, 0x00000036, 0x475f6c67, 0x61626f6c, 0x766e496c, 0x7461636f,
|
||||
0x496e6f69, 0x00000044, 0x00030005, 0x00000041, 0x00000050, 0x00050006, 0x00000041, 0x00000000,
|
||||
0x657a6973, 0x00000000, 0x00050006, 0x00000041, 0x00000001, 0x7474696a, 0x00007265, 0x00030005,
|
||||
0x00000043, 0x00006370, 0x00050005, 0x0000005d, 0x74706564, 0x65745f68, 0x00000078, 0x00030005,
|
||||
0x00000087, 0x00727543, 0x00040006, 0x00000087, 0x00000000, 0x00000072, 0x00030005, 0x00000089,
|
||||
0x00727563, 0x00040005, 0x0000009e, 0x76657250, 0x00000000, 0x00040006, 0x0000009e, 0x00000000,
|
||||
0x00000072, 0x00040005, 0x000000a0, 0x76657270, 0x00000000, 0x00040005, 0x000000e7, 0x6f5f766d,
|
||||
0x00007475, 0x00040047, 0x00000036, 0x0000000b, 0x0000001c, 0x00030047, 0x00000041, 0x00000002,
|
||||
0x00050048, 0x00000041, 0x00000000, 0x00000023, 0x00000000, 0x00050048, 0x00000041, 0x00000001,
|
||||
0x00000023, 0x00000008, 0x00040047, 0x0000005d, 0x00000021, 0x00000000, 0x00040047, 0x0000005d,
|
||||
0x00000022, 0x00000000, 0x00040047, 0x00000086, 0x00000006, 0x00000010, 0x00030047, 0x00000087,
|
||||
0x00000002, 0x00050048, 0x00000087, 0x00000000, 0x00000023, 0x00000000, 0x00040047, 0x00000089,
|
||||
0x00000021, 0x00000002, 0x00040047, 0x00000089, 0x00000022, 0x00000000, 0x00040047, 0x0000009d,
|
||||
0x00000006, 0x00000010, 0x00030047, 0x0000009e, 0x00000002, 0x00050048, 0x0000009e, 0x00000000,
|
||||
0x00000023, 0x00000000, 0x00040047, 0x000000a0, 0x00000021, 0x00000003, 0x00040047, 0x000000a0,
|
||||
0x00000022, 0x00000000, 0x00030047, 0x000000e7, 0x00000019, 0x00040047, 0x000000e7, 0x00000021,
|
||||
0x00000001, 0x00040047, 0x000000e7, 0x00000022, 0x00000000, 0x00020013, 0x00000002, 0x00030021,
|
||||
0x00000003, 0x00000002, 0x00030016, 0x00000006, 0x00000020, 0x00040017, 0x00000007, 0x00000006,
|
||||
0x00000004, 0x00040018, 0x00000009, 0x00000007, 0x00000004, 0x0004002b, 0x00000006, 0x00000015,
|
||||
0x3f800000, 0x0004002b, 0x00000006, 0x00000016, 0x00000000, 0x00040015, 0x0000002f, 0x00000020,
|
||||
0x00000001, 0x00040017, 0x00000030, 0x0000002f, 0x00000002, 0x00040015, 0x00000033, 0x00000020,
|
||||
0x00000000, 0x00040017, 0x00000034, 0x00000033, 0x00000003, 0x00040020, 0x00000035, 0x00000001,
|
||||
0x00000034, 0x0004003b, 0x00000035, 0x00000036, 0x00000001, 0x00040017, 0x00000037, 0x00000033,
|
||||
0x00000002, 0x00020014, 0x0000003b, 0x0004002b, 0x00000033, 0x0000003c, 0x00000000, 0x00040017,
|
||||
0x00000040, 0x00000006, 0x00000002, 0x0004001e, 0x00000041, 0x00000040, 0x00000040, 0x00040020,
|
||||
0x00000042, 0x00000009, 0x00000041, 0x0004003b, 0x00000042, 0x00000043, 0x00000009, 0x0004002b,
|
||||
0x0000002f, 0x00000044, 0x00000000, 0x00040020, 0x00000045, 0x00000009, 0x00000006, 0x0004002b,
|
||||
0x00000033, 0x0000004d, 0x00000001, 0x00090019, 0x0000005a, 0x00000006, 0x00000001, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x0003001b, 0x0000005b, 0x0000005a, 0x00040020,
|
||||
0x0000005c, 0x00000000, 0x0000005b, 0x0004003b, 0x0000005c, 0x0000005d, 0x00000000, 0x0004002b,
|
||||
0x00000006, 0x00000067, 0x3f000000, 0x0004002b, 0x0000002f, 0x0000006a, 0x00000001, 0x00040020,
|
||||
0x0000006b, 0x00000009, 0x00000040, 0x0004002b, 0x00000006, 0x00000075, 0x40000000, 0x0004002b,
|
||||
0x00000033, 0x00000085, 0x00000010, 0x0004001c, 0x00000086, 0x00000007, 0x00000085, 0x0003001e,
|
||||
0x00000087, 0x00000086, 0x00040020, 0x00000088, 0x00000002, 0x00000087, 0x0004003b, 0x00000088,
|
||||
0x00000089, 0x00000002, 0x0004002b, 0x0000002f, 0x0000008a, 0x00000003, 0x0004002b, 0x0000002f,
|
||||
0x0000008b, 0x00000004, 0x0004002b, 0x0000002f, 0x0000008c, 0x00000005, 0x0004002b, 0x0000002f,
|
||||
0x0000008d, 0x00000006, 0x00040020, 0x0000008f, 0x00000002, 0x00000007, 0x0004001c, 0x0000009d,
|
||||
0x00000007, 0x00000085, 0x0003001e, 0x0000009e, 0x0000009d, 0x00040020, 0x0000009f, 0x00000002,
|
||||
0x0000009e, 0x0004003b, 0x0000009f, 0x000000a0, 0x00000002, 0x0005002c, 0x00000040, 0x000000b4,
|
||||
0x00000016, 0x00000016, 0x0004002b, 0x00000006, 0x000000b9, 0x2b8cbccc, 0x0004002b, 0x00000006,
|
||||
0x000000c7, 0x358637bd, 0x00090019, 0x000000e5, 0x00000006, 0x00000001, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000002, 0x00000007, 0x00040020, 0x000000e6, 0x00000000, 0x000000e5, 0x0004003b,
|
||||
0x000000e6, 0x000000e7, 0x00000000, 0x0005002c, 0x00000040, 0x00000130, 0x00000067, 0x00000067,
|
||||
0x00050036, 0x00000002, 0x00000004, 0x00000000, 0x00000003, 0x000200f8, 0x00000005, 0x000300f7,
|
||||
0x000000f0, 0x00000000, 0x000300fb, 0x0000003c, 0x000000f1, 0x000200f8, 0x000000f1, 0x0004003d,
|
||||
0x00000034, 0x00000038, 0x00000036, 0x0007004f, 0x00000037, 0x00000039, 0x00000038, 0x00000038,
|
||||
0x00000000, 0x00000001, 0x0004007c, 0x00000030, 0x0000003a, 0x00000039, 0x00050051, 0x0000002f,
|
||||
0x0000003f, 0x0000003a, 0x00000000, 0x00060041, 0x00000045, 0x00000046, 0x00000043, 0x00000044,
|
||||
0x0000003c, 0x0004003d, 0x00000006, 0x00000047, 0x00000046, 0x0004006e, 0x0000002f, 0x00000048,
|
||||
0x00000047, 0x000500af, 0x0000003b, 0x00000049, 0x0000003f, 0x00000048, 0x000400a8, 0x0000003b,
|
||||
0x0000004a, 0x00000049, 0x000300f7, 0x0000004c, 0x00000000, 0x000400fa, 0x0000004a, 0x0000004b,
|
||||
0x0000004c, 0x000200f8, 0x0000004b, 0x00050051, 0x0000002f, 0x0000004f, 0x0000003a, 0x00000001,
|
||||
0x00060041, 0x00000045, 0x00000050, 0x00000043, 0x00000044, 0x0000004d, 0x0004003d, 0x00000006,
|
||||
0x00000051, 0x00000050, 0x0004006e, 0x0000002f, 0x00000052, 0x00000051, 0x000500af, 0x0000003b,
|
||||
0x00000053, 0x0000004f, 0x00000052, 0x000200f9, 0x0000004c, 0x000200f8, 0x0000004c, 0x000700f5,
|
||||
0x0000003b, 0x00000054, 0x00000049, 0x000000f1, 0x00000053, 0x0000004b, 0x000300f7, 0x00000056,
|
||||
0x00000000, 0x000400fa, 0x00000054, 0x00000055, 0x00000056, 0x000200f8, 0x00000055, 0x000200f9,
|
||||
0x000000f0, 0x000200f8, 0x00000056, 0x0004003d, 0x0000005b, 0x0000005e, 0x0000005d, 0x00040064,
|
||||
0x0000005a, 0x00000060, 0x0000005e, 0x0007005f, 0x00000007, 0x00000061, 0x00000060, 0x0000003a,
|
||||
0x00000002, 0x00000044, 0x00050051, 0x00000006, 0x00000062, 0x00000061, 0x00000000, 0x0004006f,
|
||||
0x00000040, 0x00000066, 0x0000003a, 0x00050081, 0x00000040, 0x00000069, 0x00000066, 0x00000130,
|
||||
0x00050041, 0x0000006b, 0x0000006c, 0x00000043, 0x0000006a, 0x0004003d, 0x00000040, 0x0000006d,
|
||||
0x0000006c, 0x00050083, 0x00000040, 0x0000006e, 0x00000069, 0x0000006d, 0x00050051, 0x00000006,
|
||||
0x00000071, 0x0000006e, 0x00000000, 0x00050088, 0x00000006, 0x00000074, 0x00000071, 0x00000047,
|
||||
0x00050085, 0x00000006, 0x00000076, 0x00000074, 0x00000075, 0x00050083, 0x00000006, 0x00000077,
|
||||
0x00000076, 0x00000015, 0x00050051, 0x00000006, 0x00000079, 0x0000006e, 0x00000001, 0x00060041,
|
||||
0x00000045, 0x0000007a, 0x00000043, 0x00000044, 0x0000004d, 0x0004003d, 0x00000006, 0x0000007b,
|
||||
0x0000007a, 0x00050088, 0x00000006, 0x0000007c, 0x00000079, 0x0000007b, 0x00050085, 0x00000006,
|
||||
0x0000007d, 0x0000007c, 0x00000075, 0x00050083, 0x00000006, 0x0000007e, 0x00000015, 0x0000007d,
|
||||
0x00050085, 0x00000006, 0x00000080, 0x00000062, 0x00000075, 0x00050083, 0x00000006, 0x00000081,
|
||||
0x00000080, 0x00000015, 0x00070050, 0x00000007, 0x00000082, 0x00000077, 0x0000007e, 0x00000081,
|
||||
0x00000015, 0x00060041, 0x0000008f, 0x00000090, 0x00000089, 0x00000044, 0x0000008a, 0x0004003d,
|
||||
0x00000007, 0x00000091, 0x00000090, 0x00060041, 0x0000008f, 0x00000093, 0x00000089, 0x00000044,
|
||||
0x0000008b, 0x0004003d, 0x00000007, 0x00000094, 0x00000093, 0x00060041, 0x0000008f, 0x00000096,
|
||||
0x00000089, 0x00000044, 0x0000008c, 0x0004003d, 0x00000007, 0x00000097, 0x00000096, 0x00060041,
|
||||
0x0000008f, 0x00000099, 0x00000089, 0x00000044, 0x0000008d, 0x0004003d, 0x00000007, 0x0000009a,
|
||||
0x00000099, 0x00070050, 0x00000009, 0x00000110, 0x00000091, 0x00000094, 0x00000097, 0x0000009a,
|
||||
0x00040054, 0x00000009, 0x00000111, 0x00000110, 0x00060041, 0x0000008f, 0x000000a2, 0x000000a0,
|
||||
0x00000044, 0x0000008a, 0x0004003d, 0x00000007, 0x000000a3, 0x000000a2, 0x00060041, 0x0000008f,
|
||||
0x000000a5, 0x000000a0, 0x00000044, 0x0000008b, 0x0004003d, 0x00000007, 0x000000a6, 0x000000a5,
|
||||
0x00060041, 0x0000008f, 0x000000a8, 0x000000a0, 0x00000044, 0x0000008c, 0x0004003d, 0x00000007,
|
||||
0x000000a9, 0x000000a8, 0x00060041, 0x0000008f, 0x000000ab, 0x000000a0, 0x00000044, 0x0000008d,
|
||||
0x0004003d, 0x00000007, 0x000000ac, 0x000000ab, 0x00070050, 0x00000009, 0x0000012c, 0x000000a3,
|
||||
0x000000a6, 0x000000a9, 0x000000ac, 0x00040054, 0x00000009, 0x0000012d, 0x0000012c, 0x0006000c,
|
||||
0x00000009, 0x000000b0, 0x00000001, 0x00000022, 0x00000111, 0x00050091, 0x00000007, 0x000000b2,
|
||||
0x000000b0, 0x00000082, 0x00050051, 0x00000006, 0x000000b7, 0x000000b2, 0x00000003, 0x0006000c,
|
||||
0x00000006, 0x000000b8, 0x00000001, 0x00000004, 0x000000b7, 0x000500ba, 0x0000003b, 0x000000ba,
|
||||
0x000000b8, 0x000000b9, 0x000300f7, 0x000000bc, 0x00000000, 0x000400fa, 0x000000ba, 0x000000bb,
|
||||
0x000000bc, 0x000200f8, 0x000000bb, 0x00070050, 0x00000007, 0x000000c2, 0x000000b7, 0x000000b7,
|
||||
0x000000b7, 0x000000b7, 0x00050088, 0x00000007, 0x000000c3, 0x000000b2, 0x000000c2, 0x00050091,
|
||||
0x00000007, 0x000000c4, 0x0000012d, 0x000000c3, 0x00050051, 0x00000006, 0x000000c6, 0x000000c4,
|
||||
0x00000003, 0x000500ba, 0x0000003b, 0x000000c8, 0x000000c6, 0x000000c7, 0x000300f7, 0x000000ca,
|
||||
0x00000000, 0x000400fa, 0x000000c8, 0x000000c9, 0x000000ca, 0x000200f8, 0x000000c9, 0x0007004f,
|
||||
0x00000040, 0x000000cd, 0x000000c4, 0x000000c4, 0x00000000, 0x00000001, 0x00050050, 0x00000040,
|
||||
0x000000d0, 0x000000c6, 0x000000c6, 0x00050088, 0x00000040, 0x000000d1, 0x000000cd, 0x000000d0,
|
||||
0x00050051, 0x00000006, 0x000000d4, 0x000000d1, 0x00000000, 0x00050085, 0x00000006, 0x000000d5,
|
||||
0x000000d4, 0x00000067, 0x00050081, 0x00000006, 0x000000d6, 0x000000d5, 0x00000067, 0x00050085,
|
||||
0x00000006, 0x000000d9, 0x000000d6, 0x00000047, 0x00050051, 0x00000006, 0x000000db, 0x000000d1,
|
||||
0x00000001, 0x00050085, 0x00000006, 0x000000dc, 0x000000db, 0x00000067, 0x00050083, 0x00000006,
|
||||
0x000000dd, 0x00000067, 0x000000dc, 0x00050085, 0x00000006, 0x000000e0, 0x000000dd, 0x0000007b,
|
||||
0x00050050, 0x00000040, 0x000000e1, 0x000000d9, 0x000000e0, 0x00050083, 0x00000040, 0x000000e4,
|
||||
0x000000e1, 0x0000006e, 0x000200f9, 0x000000ca, 0x000200f8, 0x000000ca, 0x000700f5, 0x00000040,
|
||||
0x0000012f, 0x000000b4, 0x000000bb, 0x000000e4, 0x000000c9, 0x000200f9, 0x000000bc, 0x000200f8,
|
||||
0x000000bc, 0x000700f5, 0x00000040, 0x0000012e, 0x000000b4, 0x00000056, 0x0000012f, 0x000000ca,
|
||||
0x0004003d, 0x000000e5, 0x000000e8, 0x000000e7, 0x00050051, 0x00000006, 0x000000eb, 0x0000012e,
|
||||
0x00000000, 0x00050051, 0x00000006, 0x000000ec, 0x0000012e, 0x00000001, 0x00070050, 0x00000007,
|
||||
0x000000ed, 0x000000eb, 0x000000ec, 0x00000016, 0x00000016, 0x00040063, 0x000000e8, 0x0000003a,
|
||||
0x000000ed, 0x000200f9, 0x000000f0, 0x000200f8, 0x000000f0, 0x000100fd, 0x00010038,
|
||||
0x00000000, 0x00000001, 0x0006000f, 0x00000005, 0x00000004, 0x6e69616d, 0x00000000, 0x00000036,
|
||||
0x00060010, 0x00000004, 0x00000011, 0x00000008, 0x00000008, 0x00000001, 0x00040047, 0x00000036,
|
||||
0x0000000b, 0x0000001c, 0x00030047, 0x00000041, 0x00000002, 0x00050048, 0x00000041, 0x00000000,
|
||||
0x00000023, 0x00000000, 0x00050048, 0x00000041, 0x00000001, 0x00000023, 0x00000008, 0x00050048,
|
||||
0x00000041, 0x00000002, 0x00000023, 0x00000010, 0x00050048, 0x00000041, 0x00000003, 0x00000023,
|
||||
0x00000014, 0x00040047, 0x0000005d, 0x00000021, 0x00000000, 0x00040047, 0x0000005d, 0x00000022,
|
||||
0x00000000, 0x00040047, 0x00000086, 0x00000006, 0x00000010, 0x00030047, 0x00000087, 0x00000002,
|
||||
0x00050048, 0x00000087, 0x00000000, 0x00000023, 0x00000000, 0x00040047, 0x00000089, 0x00000021,
|
||||
0x00000002, 0x00040047, 0x00000089, 0x00000022, 0x00000000, 0x00040047, 0x0000009d, 0x00000006,
|
||||
0x00000010, 0x00030047, 0x0000009e, 0x00000002, 0x00050048, 0x0000009e, 0x00000000, 0x00000023,
|
||||
0x00000000, 0x00040047, 0x000000a0, 0x00000021, 0x00000003, 0x00040047, 0x000000a0, 0x00000022,
|
||||
0x00000000, 0x00030047, 0x000000e7, 0x00000019, 0x00040047, 0x000000e7, 0x00000021, 0x00000001,
|
||||
0x00040047, 0x000000e7, 0x00000022, 0x00000000, 0x00040047, 0x000000f6, 0x00000021, 0x00000004,
|
||||
0x00040047, 0x000000f6, 0x00000022, 0x00000000, 0x00030047, 0x00000101, 0x00000019, 0x00040047,
|
||||
0x00000101, 0x00000021, 0x00000007, 0x00040047, 0x00000101, 0x00000022, 0x00000000, 0x00030047,
|
||||
0x0000012a, 0x00000018, 0x00040047, 0x0000012a, 0x00000021, 0x00000006, 0x00040047, 0x0000012a,
|
||||
0x00000022, 0x00000000, 0x00030047, 0x0000013b, 0x00000019, 0x00040047, 0x0000013b, 0x00000021,
|
||||
0x00000005, 0x00040047, 0x0000013b, 0x00000022, 0x00000000, 0x00040047, 0x00000146, 0x0000000b,
|
||||
0x00000019, 0x00020013, 0x00000002, 0x00030021, 0x00000003, 0x00000002, 0x00030016, 0x00000006,
|
||||
0x00000020, 0x00040017, 0x00000007, 0x00000006, 0x00000004, 0x00040018, 0x00000009, 0x00000007,
|
||||
0x00000004, 0x0004002b, 0x00000006, 0x00000015, 0x3f800000, 0x0004002b, 0x00000006, 0x00000016,
|
||||
0x00000000, 0x00040015, 0x0000002f, 0x00000020, 0x00000001, 0x00040017, 0x00000030, 0x0000002f,
|
||||
0x00000002, 0x00040015, 0x00000033, 0x00000020, 0x00000000, 0x00040017, 0x00000034, 0x00000033,
|
||||
0x00000003, 0x00040020, 0x00000035, 0x00000001, 0x00000034, 0x0004003b, 0x00000035, 0x00000036,
|
||||
0x00000001, 0x00040017, 0x00000037, 0x00000033, 0x00000002, 0x00020014, 0x0000003b, 0x0004002b,
|
||||
0x00000033, 0x0000003c, 0x00000000, 0x00040017, 0x00000040, 0x00000006, 0x00000002, 0x0006001e,
|
||||
0x00000041, 0x00000040, 0x00000040, 0x00000006, 0x00000006, 0x00040020, 0x00000042, 0x00000009,
|
||||
0x00000041, 0x0004003b, 0x00000042, 0x00000043, 0x00000009, 0x0004002b, 0x0000002f, 0x00000044,
|
||||
0x00000000, 0x00040020, 0x00000045, 0x00000009, 0x00000006, 0x0004002b, 0x00000033, 0x0000004d,
|
||||
0x00000001, 0x00090019, 0x0000005a, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000001, 0x00000000, 0x0003001b, 0x0000005b, 0x0000005a, 0x00040020, 0x0000005c, 0x00000000,
|
||||
0x0000005b, 0x0004003b, 0x0000005c, 0x0000005d, 0x00000000, 0x0004002b, 0x00000006, 0x00000067,
|
||||
0x3f000000, 0x0004002b, 0x0000002f, 0x0000006a, 0x00000001, 0x00040020, 0x0000006b, 0x00000009,
|
||||
0x00000040, 0x0004002b, 0x00000006, 0x00000075, 0x40000000, 0x0004002b, 0x00000033, 0x00000085,
|
||||
0x00000010, 0x0004001c, 0x00000086, 0x00000007, 0x00000085, 0x0003001e, 0x00000087, 0x00000086,
|
||||
0x00040020, 0x00000088, 0x00000002, 0x00000087, 0x0004003b, 0x00000088, 0x00000089, 0x00000002,
|
||||
0x0004002b, 0x0000002f, 0x0000008a, 0x00000003, 0x0004002b, 0x0000002f, 0x0000008b, 0x00000004,
|
||||
0x0004002b, 0x0000002f, 0x0000008c, 0x00000005, 0x0004002b, 0x0000002f, 0x0000008d, 0x00000006,
|
||||
0x00040020, 0x0000008f, 0x00000002, 0x00000007, 0x0004001c, 0x0000009d, 0x00000007, 0x00000085,
|
||||
0x0003001e, 0x0000009e, 0x0000009d, 0x00040020, 0x0000009f, 0x00000002, 0x0000009e, 0x0004003b,
|
||||
0x0000009f, 0x000000a0, 0x00000002, 0x0005002c, 0x00000040, 0x000000b4, 0x00000016, 0x00000016,
|
||||
0x0004002b, 0x00000006, 0x000000b9, 0x2b8cbccc, 0x0004002b, 0x00000006, 0x000000c7, 0x358637bd,
|
||||
0x00090019, 0x000000e5, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002,
|
||||
0x00000007, 0x00040020, 0x000000e6, 0x00000000, 0x000000e5, 0x0004003b, 0x000000e6, 0x000000e7,
|
||||
0x00000000, 0x0004002b, 0x0000002f, 0x000000ee, 0x00000002, 0x0004003b, 0x0000005c, 0x000000f6,
|
||||
0x00000000, 0x0004002b, 0x00000006, 0x000000fc, 0x3e808081, 0x00090019, 0x000000ff, 0x00000006,
|
||||
0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x0000000f, 0x00040020, 0x00000100,
|
||||
0x00000000, 0x000000ff, 0x0004003b, 0x00000100, 0x00000101, 0x00000000, 0x0004002b, 0x0000002f,
|
||||
0x00000119, 0xffffffff, 0x0004003b, 0x00000100, 0x0000012a, 0x00000000, 0x0005002c, 0x00000030,
|
||||
0x00000131, 0x00000044, 0x00000044, 0x0004003b, 0x00000100, 0x0000013b, 0x00000000, 0x0004002b,
|
||||
0x00000033, 0x00000145, 0x00000008, 0x0006002c, 0x00000034, 0x00000146, 0x00000145, 0x00000145,
|
||||
0x0000004d, 0x0005002c, 0x00000040, 0x00000197, 0x00000067, 0x00000067, 0x0005002c, 0x00000030,
|
||||
0x00000199, 0x0000006a, 0x0000006a, 0x00050036, 0x00000002, 0x00000004, 0x00000000, 0x00000003,
|
||||
0x000200f8, 0x00000005, 0x000300f7, 0x00000147, 0x00000000, 0x000300fb, 0x0000003c, 0x00000148,
|
||||
0x000200f8, 0x00000148, 0x0004003d, 0x00000034, 0x00000038, 0x00000036, 0x0007004f, 0x00000037,
|
||||
0x00000039, 0x00000038, 0x00000038, 0x00000000, 0x00000001, 0x0004007c, 0x00000030, 0x0000003a,
|
||||
0x00000039, 0x00050051, 0x0000002f, 0x0000003f, 0x0000003a, 0x00000000, 0x00060041, 0x00000045,
|
||||
0x00000046, 0x00000043, 0x00000044, 0x0000003c, 0x0004003d, 0x00000006, 0x00000047, 0x00000046,
|
||||
0x0004006e, 0x0000002f, 0x00000048, 0x00000047, 0x000500af, 0x0000003b, 0x00000049, 0x0000003f,
|
||||
0x00000048, 0x000400a8, 0x0000003b, 0x0000004a, 0x00000049, 0x000300f7, 0x0000004c, 0x00000000,
|
||||
0x000400fa, 0x0000004a, 0x0000004b, 0x0000004c, 0x000200f8, 0x0000004b, 0x00050051, 0x0000002f,
|
||||
0x0000004f, 0x0000003a, 0x00000001, 0x00060041, 0x00000045, 0x00000050, 0x00000043, 0x00000044,
|
||||
0x0000004d, 0x0004003d, 0x00000006, 0x00000051, 0x00000050, 0x0004006e, 0x0000002f, 0x00000052,
|
||||
0x00000051, 0x000500af, 0x0000003b, 0x00000053, 0x0000004f, 0x00000052, 0x000200f9, 0x0000004c,
|
||||
0x000200f8, 0x0000004c, 0x000700f5, 0x0000003b, 0x00000054, 0x00000049, 0x00000148, 0x00000053,
|
||||
0x0000004b, 0x000300f7, 0x00000056, 0x00000000, 0x000400fa, 0x00000054, 0x00000055, 0x00000056,
|
||||
0x000200f8, 0x00000055, 0x000200f9, 0x00000147, 0x000200f8, 0x00000056, 0x0004003d, 0x0000005b,
|
||||
0x0000005e, 0x0000005d, 0x00040064, 0x0000005a, 0x00000060, 0x0000005e, 0x0007005f, 0x00000007,
|
||||
0x00000061, 0x00000060, 0x0000003a, 0x00000002, 0x00000044, 0x00050051, 0x00000006, 0x00000062,
|
||||
0x00000061, 0x00000000, 0x0004006f, 0x00000040, 0x00000066, 0x0000003a, 0x00050081, 0x00000040,
|
||||
0x00000069, 0x00000066, 0x00000197, 0x00050041, 0x0000006b, 0x0000006c, 0x00000043, 0x0000006a,
|
||||
0x0004003d, 0x00000040, 0x0000006d, 0x0000006c, 0x00050083, 0x00000040, 0x0000006e, 0x00000069,
|
||||
0x0000006d, 0x00050051, 0x00000006, 0x00000071, 0x0000006e, 0x00000000, 0x00050088, 0x00000006,
|
||||
0x00000074, 0x00000071, 0x00000047, 0x00050085, 0x00000006, 0x00000076, 0x00000074, 0x00000075,
|
||||
0x00050083, 0x00000006, 0x00000077, 0x00000076, 0x00000015, 0x00050051, 0x00000006, 0x00000079,
|
||||
0x0000006e, 0x00000001, 0x00060041, 0x00000045, 0x0000007a, 0x00000043, 0x00000044, 0x0000004d,
|
||||
0x0004003d, 0x00000006, 0x0000007b, 0x0000007a, 0x00050088, 0x00000006, 0x0000007c, 0x00000079,
|
||||
0x0000007b, 0x00050085, 0x00000006, 0x0000007d, 0x0000007c, 0x00000075, 0x00050083, 0x00000006,
|
||||
0x0000007e, 0x00000015, 0x0000007d, 0x00050085, 0x00000006, 0x00000080, 0x00000062, 0x00000075,
|
||||
0x00050083, 0x00000006, 0x00000081, 0x00000080, 0x00000015, 0x00070050, 0x00000007, 0x00000082,
|
||||
0x00000077, 0x0000007e, 0x00000081, 0x00000015, 0x00060041, 0x0000008f, 0x00000090, 0x00000089,
|
||||
0x00000044, 0x0000008a, 0x0004003d, 0x00000007, 0x00000091, 0x00000090, 0x00060041, 0x0000008f,
|
||||
0x00000093, 0x00000089, 0x00000044, 0x0000008b, 0x0004003d, 0x00000007, 0x00000094, 0x00000093,
|
||||
0x00060041, 0x0000008f, 0x00000096, 0x00000089, 0x00000044, 0x0000008c, 0x0004003d, 0x00000007,
|
||||
0x00000097, 0x00000096, 0x00060041, 0x0000008f, 0x00000099, 0x00000089, 0x00000044, 0x0000008d,
|
||||
0x0004003d, 0x00000007, 0x0000009a, 0x00000099, 0x00070050, 0x00000009, 0x00000167, 0x00000091,
|
||||
0x00000094, 0x00000097, 0x0000009a, 0x00040054, 0x00000009, 0x00000168, 0x00000167, 0x00060041,
|
||||
0x0000008f, 0x000000a2, 0x000000a0, 0x00000044, 0x0000008a, 0x0004003d, 0x00000007, 0x000000a3,
|
||||
0x000000a2, 0x00060041, 0x0000008f, 0x000000a5, 0x000000a0, 0x00000044, 0x0000008b, 0x0004003d,
|
||||
0x00000007, 0x000000a6, 0x000000a5, 0x00060041, 0x0000008f, 0x000000a8, 0x000000a0, 0x00000044,
|
||||
0x0000008c, 0x0004003d, 0x00000007, 0x000000a9, 0x000000a8, 0x00060041, 0x0000008f, 0x000000ab,
|
||||
0x000000a0, 0x00000044, 0x0000008d, 0x0004003d, 0x00000007, 0x000000ac, 0x000000ab, 0x00070050,
|
||||
0x00000009, 0x00000183, 0x000000a3, 0x000000a6, 0x000000a9, 0x000000ac, 0x00040054, 0x00000009,
|
||||
0x00000184, 0x00000183, 0x0006000c, 0x00000009, 0x000000b0, 0x00000001, 0x00000022, 0x00000168,
|
||||
0x00050091, 0x00000007, 0x000000b2, 0x000000b0, 0x00000082, 0x00050051, 0x00000006, 0x000000b7,
|
||||
0x000000b2, 0x00000003, 0x0006000c, 0x00000006, 0x000000b8, 0x00000001, 0x00000004, 0x000000b7,
|
||||
0x000500ba, 0x0000003b, 0x000000ba, 0x000000b8, 0x000000b9, 0x000300f7, 0x000000bc, 0x00000000,
|
||||
0x000400fa, 0x000000ba, 0x000000bb, 0x000000bc, 0x000200f8, 0x000000bb, 0x00070050, 0x00000007,
|
||||
0x000000c2, 0x000000b7, 0x000000b7, 0x000000b7, 0x000000b7, 0x00050088, 0x00000007, 0x000000c3,
|
||||
0x000000b2, 0x000000c2, 0x00050091, 0x00000007, 0x000000c4, 0x00000184, 0x000000c3, 0x00050051,
|
||||
0x00000006, 0x000000c6, 0x000000c4, 0x00000003, 0x000500ba, 0x0000003b, 0x000000c8, 0x000000c6,
|
||||
0x000000c7, 0x000300f7, 0x000000ca, 0x00000000, 0x000400fa, 0x000000c8, 0x000000c9, 0x000000ca,
|
||||
0x000200f8, 0x000000c9, 0x0007004f, 0x00000040, 0x000000cd, 0x000000c4, 0x000000c4, 0x00000000,
|
||||
0x00000001, 0x00050050, 0x00000040, 0x000000d0, 0x000000c6, 0x000000c6, 0x00050088, 0x00000040,
|
||||
0x000000d1, 0x000000cd, 0x000000d0, 0x00050051, 0x00000006, 0x000000d4, 0x000000d1, 0x00000000,
|
||||
0x00050085, 0x00000006, 0x000000d5, 0x000000d4, 0x00000067, 0x00050081, 0x00000006, 0x000000d6,
|
||||
0x000000d5, 0x00000067, 0x00050085, 0x00000006, 0x000000d9, 0x000000d6, 0x00000047, 0x00050051,
|
||||
0x00000006, 0x000000db, 0x000000d1, 0x00000001, 0x00050085, 0x00000006, 0x000000dc, 0x000000db,
|
||||
0x00000067, 0x00050083, 0x00000006, 0x000000dd, 0x00000067, 0x000000dc, 0x00050085, 0x00000006,
|
||||
0x000000e0, 0x000000dd, 0x0000007b, 0x00050050, 0x00000040, 0x000000e1, 0x000000d9, 0x000000e0,
|
||||
0x00050083, 0x00000040, 0x000000e4, 0x000000e1, 0x0000006e, 0x000200f9, 0x000000ca, 0x000200f8,
|
||||
0x000000ca, 0x000700f5, 0x00000040, 0x00000190, 0x000000b4, 0x000000bb, 0x000000e4, 0x000000c9,
|
||||
0x000200f9, 0x000000bc, 0x000200f8, 0x000000bc, 0x000700f5, 0x00000040, 0x0000018f, 0x000000b4,
|
||||
0x00000056, 0x00000190, 0x000000ca, 0x0004003d, 0x000000e5, 0x000000e8, 0x000000e7, 0x00050051,
|
||||
0x00000006, 0x000000eb, 0x0000018f, 0x00000000, 0x00050051, 0x00000006, 0x000000ec, 0x0000018f,
|
||||
0x00000001, 0x00070050, 0x00000007, 0x000000ed, 0x000000eb, 0x000000ec, 0x00000016, 0x00000016,
|
||||
0x00040063, 0x000000e8, 0x0000003a, 0x000000ed, 0x00050041, 0x00000045, 0x000000ef, 0x00000043,
|
||||
0x000000ee, 0x0004003d, 0x00000006, 0x000000f0, 0x000000ef, 0x000500bc, 0x0000003b, 0x000000f1,
|
||||
0x000000f0, 0x00000016, 0x000300f7, 0x000000f3, 0x00000000, 0x000400fa, 0x000000f1, 0x000000f2,
|
||||
0x000000f3, 0x000200f8, 0x000000f2, 0x000200f9, 0x00000147, 0x000200f8, 0x000000f3, 0x0004003d,
|
||||
0x0000005b, 0x000000f7, 0x000000f6, 0x00040064, 0x0000005a, 0x000000f9, 0x000000f7, 0x0007005f,
|
||||
0x00000007, 0x000000fa, 0x000000f9, 0x0000003a, 0x00000002, 0x00000044, 0x00050051, 0x00000006,
|
||||
0x000000fb, 0x000000fa, 0x00000001, 0x000500ba, 0x0000003b, 0x000000fd, 0x000000fb, 0x000000fc,
|
||||
0x000600a9, 0x00000006, 0x000000fe, 0x000000fd, 0x00000015, 0x00000016, 0x0004003d, 0x000000ff,
|
||||
0x00000102, 0x00000101, 0x00070050, 0x00000007, 0x00000105, 0x000000fe, 0x000000fe, 0x000000fe,
|
||||
0x000000fe, 0x00040063, 0x00000102, 0x0000003a, 0x00000105, 0x00050041, 0x00000045, 0x00000107,
|
||||
0x00000043, 0x0000008a, 0x0004003d, 0x00000006, 0x00000108, 0x00000107, 0x000500ba, 0x0000003b,
|
||||
0x00000109, 0x00000108, 0x00000067, 0x000300f7, 0x0000010b, 0x00000000, 0x000400fa, 0x00000109,
|
||||
0x0000010a, 0x0000010b, 0x000200f8, 0x0000010a, 0x00050081, 0x00000040, 0x0000010f, 0x0000006e,
|
||||
0x0000018f, 0x0006000c, 0x00000040, 0x00000110, 0x00000001, 0x00000008, 0x0000010f, 0x0004006e,
|
||||
0x00000030, 0x00000111, 0x00000110, 0x00050041, 0x0000006b, 0x00000113, 0x00000043, 0x00000044,
|
||||
0x0004003d, 0x00000040, 0x00000114, 0x00000113, 0x0004006e, 0x00000030, 0x00000115, 0x00000114,
|
||||
0x00050082, 0x00000030, 0x00000117, 0x00000115, 0x00000199, 0x000200f9, 0x0000011a, 0x000200f8,
|
||||
0x0000011a, 0x000700f5, 0x00000006, 0x00000193, 0x00000016, 0x0000010a, 0x00000196, 0x0000011d,
|
||||
0x000700f5, 0x0000002f, 0x00000191, 0x00000119, 0x0000010a, 0x0000013a, 0x0000011d, 0x000500b3,
|
||||
0x0000003b, 0x00000120, 0x00000191, 0x0000006a, 0x000400f6, 0x0000011c, 0x0000011d, 0x00000000,
|
||||
0x000400fa, 0x00000120, 0x0000011b, 0x0000011c, 0x000200f8, 0x0000011b, 0x000200f9, 0x00000122,
|
||||
0x000200f8, 0x00000122, 0x000700f5, 0x00000006, 0x00000196, 0x00000193, 0x0000011b, 0x00000136,
|
||||
0x00000123, 0x000700f5, 0x0000002f, 0x00000194, 0x00000119, 0x0000011b, 0x00000138, 0x00000123,
|
||||
0x000500b3, 0x0000003b, 0x00000128, 0x00000194, 0x0000006a, 0x000400f6, 0x00000124, 0x00000123,
|
||||
0x00000000, 0x000400fa, 0x00000128, 0x00000123, 0x00000124, 0x000200f8, 0x00000123, 0x0004003d,
|
||||
0x000000ff, 0x0000012b, 0x0000012a, 0x00050050, 0x00000030, 0x0000012f, 0x00000194, 0x00000191,
|
||||
0x00050080, 0x00000030, 0x00000130, 0x00000111, 0x0000012f, 0x0008000c, 0x00000030, 0x00000133,
|
||||
0x00000001, 0x0000002d, 0x00000130, 0x00000131, 0x00000117, 0x00050062, 0x00000007, 0x00000134,
|
||||
0x0000012b, 0x00000133, 0x00050051, 0x00000006, 0x00000135, 0x00000134, 0x00000000, 0x0007000c,
|
||||
0x00000006, 0x00000136, 0x00000001, 0x00000028, 0x00000196, 0x00000135, 0x00050080, 0x0000002f,
|
||||
0x00000138, 0x00000194, 0x0000006a, 0x000200f9, 0x00000122, 0x000200f8, 0x00000124, 0x000200f9,
|
||||
0x0000011d, 0x000200f8, 0x0000011d, 0x00050080, 0x0000002f, 0x0000013a, 0x00000191, 0x0000006a,
|
||||
0x000200f9, 0x0000011a, 0x000200f8, 0x0000011c, 0x000200f9, 0x0000010b, 0x000200f8, 0x0000010b,
|
||||
0x000700f5, 0x00000006, 0x00000192, 0x00000016, 0x000000f3, 0x00000193, 0x0000011c, 0x0004003d,
|
||||
0x000000ff, 0x0000013c, 0x0000013b, 0x0007000c, 0x00000006, 0x00000140, 0x00000001, 0x00000028,
|
||||
0x000000fe, 0x00000192, 0x00050085, 0x00000006, 0x00000143, 0x00000140, 0x000000f0, 0x00070050,
|
||||
0x00000007, 0x00000144, 0x00000143, 0x00000143, 0x00000143, 0x00000143, 0x00040063, 0x0000013c,
|
||||
0x0000003a, 0x00000144, 0x000200f9, 0x00000147, 0x000200f8, 0x00000147, 0x000100fd, 0x00010038,
|
||||
};
|
||||
+19
-4
@@ -27,6 +27,9 @@
|
||||
// rewritten table (res_heapdef_build) in place of the original; memory.c adds the amount to the application pool, so
|
||||
// no other heap shrinks. Without the rewritten table (a RomFS that lacks it, a format this code does not know) the
|
||||
// patch sets stay off and the game keeps its own sizes.
|
||||
#ifndef _WIN32
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
@@ -60,8 +63,8 @@ static struct {
|
||||
} R;
|
||||
|
||||
// The scene size is decided before the device exists, so NGX cannot be asked yet. NGX loads DLSS from nvngx_dlss.dll
|
||||
// next to totk.exe (vk_dlaa.c vk_dlaa_init): without that file DLSS never runs, and a DLSS mode would leave the game's
|
||||
// plain scaling at 50..67 % of the output. Off Windows vk_dlaa.c is built as no-op stubs, so there is no DLSS at all.
|
||||
// next to totk.exe on Windows, libnvidia-ngx-dlss.so.<version> next to totk on Linux (vk_dlaa.c vk_dlaa_init):
|
||||
// without that file DLSS never runs, and a DLSS mode would leave the game's plain scaling at 50..67 % of the output.
|
||||
static int dlss_dll(void) {
|
||||
#ifdef _WIN32
|
||||
char exe[1024], path[1024 + 32];
|
||||
@@ -71,7 +74,18 @@ static int dlss_dll(void) {
|
||||
snprintf(path, sizeof path, "%.*s/nvngx_dlss.dll", (int)(last - exe), exe);
|
||||
return plat_file_exists(path);
|
||||
#else
|
||||
return 0;
|
||||
char exe[1024];
|
||||
if (!plat_exe_path(exe, sizeof exe)) return 1;
|
||||
char *last = plat_last_sep(exe);
|
||||
if (!last) return 1;
|
||||
*last = 0;
|
||||
DIR *d = opendir(exe);
|
||||
if (!d) return 1;
|
||||
int found = 0;
|
||||
for (struct dirent *e; !found && (e = readdir(d));)
|
||||
found = !strncmp(e->d_name, "libnvidia-ngx-dlss.so.", 22);
|
||||
closedir(d);
|
||||
return found;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -97,7 +111,8 @@ static double dlss_share(const char *m) {
|
||||
rt_log("resolution: DLSS %s needs nvngx_dlss.dll next to totk.exe, which is missing: the scene follows "
|
||||
"render_scale", m);
|
||||
#else
|
||||
rt_log("resolution: DLSS %s runs on Windows only: the scene follows render_scale", m);
|
||||
rt_log("resolution: DLSS %s needs libnvidia-ngx-dlss.so.<version> next to totk, which is missing: the "
|
||||
"scene follows render_scale", m);
|
||||
#endif
|
||||
}
|
||||
return dll ? dlss[i].k : 0;
|
||||
|
||||
@@ -6,14 +6,26 @@
|
||||
// The camera block is TotK's scene uniform block (bound as c4 in the scene's vertex shaders): vec4 rows 3-6 are the
|
||||
// view-projection, rows of a row-major 4x4 with OpenGL clip depth (-w..w). The replay's viewports have negative
|
||||
// heights, so window y grows downwards from ndc y = +1, and depth is z_ndc * 0.5 + 0.5.
|
||||
// With pc.bias > 0 the pass also writes DLSS's bias mask (vk_dlaa.c, "characters"): G-buffer target 0 carries an object
|
||||
// class in green, above 64/255 for characters, creatures and what they hold (Link 253, others 125, held items 160;
|
||||
// terrain 0, foliage 32). A pixel gets pc.bias when a character covers it now, or covered the place its surface came
|
||||
// from last frame (the previous class mask, read through the motion vector, 3x3): there the history holds a moving
|
||||
// character that the camera-only vector does not follow, which is the trail. chars_out keeps this frame's mask for the
|
||||
// next; chars_prev is last frame's (pc.prev_ok 0: none).
|
||||
layout(local_size_x = 8, local_size_y = 8) in;
|
||||
layout(binding = 0) uniform sampler2D depth_tex;
|
||||
layout(binding = 1, rg16f) uniform writeonly image2D mv_out;
|
||||
layout(binding = 2, std140) uniform Cur { vec4 r[16]; } cur;
|
||||
layout(binding = 3, std140) uniform Prev { vec4 r[16]; } prev;
|
||||
layout(binding = 4) uniform sampler2D ids_tex;
|
||||
layout(binding = 5, r8) uniform writeonly image2D mask_out;
|
||||
layout(binding = 6, r8) uniform readonly image2D chars_prev;
|
||||
layout(binding = 7, r8) uniform writeonly image2D chars_out;
|
||||
layout(push_constant) uniform P {
|
||||
vec2 size; // render size in pixels
|
||||
vec2 jitter; // this frame's jitter, pixels, as the scene was drawn (window x right, y down)
|
||||
float bias; // the mask value for character pixels; 0: no mask (bindings 4-7 unused)
|
||||
float prev_ok; // 1: chars_prev holds last frame's class mask at this size
|
||||
} pc;
|
||||
|
||||
mat4 vp(vec4 a, vec4 b, vec4 c, vec4 d) { return transpose(mat4(a, b, c, d)); }
|
||||
@@ -37,4 +49,15 @@ void main() {
|
||||
}
|
||||
}
|
||||
imageStore(mv_out, p, vec4(mv, 0.0, 0.0));
|
||||
if (pc.bias <= 0.0) return;
|
||||
float ch = texelFetch(ids_tex, p, 0).g > 64.0 / 255.0 ? 1.0 : 0.0;
|
||||
imageStore(chars_out, p, vec4(ch));
|
||||
float was = 0.0;
|
||||
if (pc.prev_ok > 0.5) {
|
||||
ivec2 q = ivec2(floor(win + mv)), hi = ivec2(pc.size) - 1;
|
||||
for (int dy = -1; dy <= 1; dy++)
|
||||
for (int dx = -1; dx <= 1; dx++)
|
||||
was = max(was, imageLoad(chars_prev, clamp(q + ivec2(dx, dy), ivec2(0), hi)).r);
|
||||
}
|
||||
imageStore(mask_out, p, vec4(max(ch, was) * pc.bias));
|
||||
}
|
||||
@@ -682,6 +682,11 @@ static void tab_screen(float scale) {
|
||||
static const UiTextId dlss[] = {UI_MENU_DLSS_DLAA, UI_MENU_DLSS_QUALITY, UI_MENU_DLSS_BALANCED,
|
||||
UI_MENU_DLSS_PERFORMANCE, UI_MENU_DLSS_ULTRA};
|
||||
opt_choice("TOTK_DLSS", UI_MENU_DLSS, dlss, 5, UI_MENU_DLSS_DESC);
|
||||
static const UiTextId preset[] = {UI_MENU_DLSS_PRESET_DEFAULT, UI_MENU_DLSS_PRESET_K, UI_MENU_DLSS_PRESET_J};
|
||||
opt_choice("TOTK_DLSS_PRESET", UI_MENU_DLSS_PRESET, preset, 3, UI_MENU_DLSS_PRESET_DESC);
|
||||
static const UiTextId chars[] = {UI_MENU_DLSS_CHARS_OFF, UI_MENU_DLSS_CHARS_LIGHT, UI_MENU_DLSS_CHARS_MEDIUM,
|
||||
UI_MENU_DLSS_CHARS_FULL};
|
||||
opt_choice("TOTK_DLSS_CHAR_MASK", UI_MENU_DLSS_CHARS, chars, 4, UI_MENU_DLSS_CHARS_DESC);
|
||||
opt_toggle("TOTK_FXAA", UI_MENU_FXAA, UI_MENU_FXAA_DESC);
|
||||
rows_color();
|
||||
opt_group(UI_MENU_HDR_GROUP);
|
||||
|
||||
+64
-6
@@ -25,6 +25,15 @@ typedef struct { const char *lang; const char *const *text; } Row;
|
||||
[UI_SWKBD_TITLE] = title, [UI_SWKBD_PROMPT] = prompt, [UI_SWKBD_DEFAULT_NAME] = name, [UI_SWKBD_OK] = ok, \
|
||||
[UI_SWKBD_CANCEL] = cancel, [UI_SWKBD_PAD_HINT] = hint, LANG_NAMES
|
||||
|
||||
// The DLSS model file and the executable, as the player sees them on this platform.
|
||||
#ifdef _WIN32
|
||||
#define DLSS_FILE "nvngx_dlss.dll"
|
||||
#define EXE_FILE "totk.exe"
|
||||
#else
|
||||
#define DLSS_FILE "libnvidia-ngx-dlss.so"
|
||||
#define EXE_FILE "totk"
|
||||
#endif
|
||||
|
||||
static const char *const text_en[UI_TEXT_COUNT] = {
|
||||
SWKBD("Text entry", "Enter a name", "Horse", "OK", "Cancel", "Controller: A = OK, B = Cancel"),
|
||||
|
||||
@@ -126,9 +135,22 @@ static const char *const text_en[UI_TEXT_COUNT] = {
|
||||
"away. Spreads the shadow map over more ground: raise Shadow resolution with it. "
|
||||
"Takes effect at the next start.",
|
||||
[UI_MENU_DLAA] = "NVIDIA DLSS / DLAA",
|
||||
[UI_MENU_DLAA_DESC] = "NVIDIA DLSS for the 3D scene (NVIDIA RTX GPUs; nvngx_dlss.dll next to totk.exe): smoother edges "
|
||||
"and less shimmer. The HUD is not touched. The mode below sets the resolution it works from. Takes effect "
|
||||
"after a restart.",
|
||||
[UI_MENU_DLAA_DESC] = "NVIDIA DLSS for the 3D scene (NVIDIA RTX GPUs; " DLSS_FILE " next to " EXE_FILE "): smoother "
|
||||
"edges and less shimmer. The HUD is not touched. The mode below sets the resolution it works "
|
||||
"from. Takes effect after a restart.",
|
||||
[UI_MENU_DLSS_PRESET] = "DLSS model",
|
||||
[UI_MENU_DLSS_PRESET_DESC] = "Which DLSS model runs. Automatic follows NVIDIA's advice per mode: K for DLAA, Quality "
|
||||
"and Balanced, M for Performance, L for Ultra Performance. J: slightly less ghosting "
|
||||
"behind moving characters, a little more flicker. K: the sharpest model in every mode. "
|
||||
"Applies at once.",
|
||||
[UI_MENU_DLSS_PRESET_DEFAULT] = "Automatic", [UI_MENU_DLSS_PRESET_K] = "K (sharpest)",
|
||||
[UI_MENU_DLSS_PRESET_J] = "J (less ghosting)",
|
||||
[UI_MENU_DLSS_CHARS] = "DLSS character trails",
|
||||
[UI_MENU_DLSS_CHARS_DESC] = "Reduces the faint trails behind moving characters, animals and what they hold: DLSS takes "
|
||||
"less of the previous frames there. Stronger removes more of the trails and leaves those "
|
||||
"edges a little less smooth. Applies at once.",
|
||||
[UI_MENU_DLSS_CHARS_OFF] = "Off", [UI_MENU_DLSS_CHARS_LIGHT] = "Light", [UI_MENU_DLSS_CHARS_MEDIUM] = "Medium",
|
||||
[UI_MENU_DLSS_CHARS_FULL] = "Full",
|
||||
[UI_MENU_DLSS] = "DLSS mode",
|
||||
[UI_MENU_DLSS_DESC] = "DLAA draws the 3D scene at full resolution. Quality, Balanced, Performance and Ultra "
|
||||
"Performance draw it at 67, 58, 50 and 33 % and let DLSS scale it up, which saves GPU time; "
|
||||
@@ -558,9 +580,22 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
|
||||
"Карта теней растягивается на большую площадь, поэтому вместе с этим поднимайте "
|
||||
"разрешение теней. Действует после перезапуска.",
|
||||
[UI_MENU_DLAA] = "NVIDIA DLSS / DLAA",
|
||||
[UI_MENU_DLAA_DESC] = "NVIDIA DLSS для 3D-сцены (видеокарты NVIDIA RTX; nvngx_dlss.dll рядом с totk.exe): ровнее края и "
|
||||
"меньше мерцания. Интерфейс не затрагивается. Режим ниже задаёт разрешение, с которым он работает. "
|
||||
"Действует после перезапуска.",
|
||||
[UI_MENU_DLAA_DESC] = "NVIDIA DLSS для 3D-сцены (видеокарты NVIDIA RTX; " DLSS_FILE " рядом с " EXE_FILE "): ровнее "
|
||||
"края и меньше мерцания. Интерфейс не затрагивается. Режим ниже задаёт разрешение, с которым он "
|
||||
"работает. Действует после перезапуска.",
|
||||
[UI_MENU_DLSS_PRESET] = "Модель DLSS",
|
||||
[UI_MENU_DLSS_PRESET_DESC] = "Какая модель DLSS работает. «Автоматически» следует совету NVIDIA для каждого режима: K "
|
||||
"для DLAA, «Качества» и «Баланса», M для «Производительности», L для «Макс. "
|
||||
"производительности». J: чуть меньше шлейфов за движущимися персонажами, немного больше "
|
||||
"мерцания. K: самая чёткая модель во всех режимах. Действует сразу.",
|
||||
[UI_MENU_DLSS_PRESET_DEFAULT] = "Автоматически", [UI_MENU_DLSS_PRESET_K] = "K (самая чёткая)",
|
||||
[UI_MENU_DLSS_PRESET_J] = "J (меньше шлейфов)",
|
||||
[UI_MENU_DLSS_CHARS] = "Шлейфы персонажей в DLSS",
|
||||
[UI_MENU_DLSS_CHARS_DESC] = "Убирает слабые шлейфы за движущимися персонажами, животными и тем, что они держат: DLSS "
|
||||
"берёт там меньше от прошлых кадров. Чем сильнее, тем меньше шлейфов и тем чуть менее "
|
||||
"гладкие края. Действует сразу.",
|
||||
[UI_MENU_DLSS_CHARS_OFF] = "Выкл.", [UI_MENU_DLSS_CHARS_LIGHT] = "Слабо", [UI_MENU_DLSS_CHARS_MEDIUM] = "Средне",
|
||||
[UI_MENU_DLSS_CHARS_FULL] = "Полностью",
|
||||
[UI_MENU_DLSS] = "Режим DLSS",
|
||||
[UI_MENU_DLSS_DESC] = "DLAA рисует 3D-сцену в полном разрешении. «Качество», «Баланс», «Производительность» и "
|
||||
"«Макс. производительность» рисуют её в 67, 58, 50 и 33 % и масштабируют через DLSS, что "
|
||||
@@ -1316,6 +1351,19 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_DLSS_QUALITY] = "Qualidade",
|
||||
[UI_MENU_DLSS_BALANCED] = "Equilibrado",
|
||||
[UI_MENU_DLSS_PERFORMANCE] = "Desempenho", [UI_MENU_DLSS_ULTRA] = "Ultra Desempenho",
|
||||
[UI_MENU_DLSS_PRESET] = "Modelo do DLSS",
|
||||
[UI_MENU_DLSS_PRESET_DESC] = "Qual modelo do DLSS roda. Automático segue a recomendação da NVIDIA para cada modo: K "
|
||||
"para DLAA, Qualidade e Equilibrado, M para Desempenho, L para Ultra Desempenho. J: um "
|
||||
"pouco menos de rastro atrás de personagens em movimento, um pouco mais de cintilação. K: "
|
||||
"o modelo mais nítido em todos os modos. Vale na hora.",
|
||||
[UI_MENU_DLSS_PRESET_DEFAULT] = "Automático", [UI_MENU_DLSS_PRESET_K] = "K (mais nítido)",
|
||||
[UI_MENU_DLSS_PRESET_J] = "J (menos rastro)",
|
||||
[UI_MENU_DLSS_CHARS] = "Rastros de personagens no DLSS",
|
||||
[UI_MENU_DLSS_CHARS_DESC] = "Reduz os rastros fracos atrás de personagens, animais e do que eles seguram em movimento: "
|
||||
"ali o DLSS usa menos dos quadros anteriores. Mais forte remove mais rastros e deixa essas "
|
||||
"bordas um pouco menos suaves. Vale na hora.",
|
||||
[UI_MENU_DLSS_CHARS_OFF] = "Desligado", [UI_MENU_DLSS_CHARS_LIGHT] = "Leve", [UI_MENU_DLSS_CHARS_MEDIUM] = "Médio",
|
||||
[UI_MENU_DLSS_CHARS_FULL] = "Total",
|
||||
[UI_MENU_FXAA] = "Antisserrilhado do jogo (FXAA)",
|
||||
[UI_MENU_FXAA_DESC] = "A suavização de bordas FXAA do próprio jogo. Borra um pouco os detalhes finos; com o DLAA "
|
||||
"ligado não é necessária.",
|
||||
@@ -1879,6 +1927,16 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
|
||||
[UI_MENU_DLSS_BALANCED] = "平衡",
|
||||
[UI_MENU_DLSS_PERFORMANCE] = "性能",
|
||||
[UI_MENU_DLSS_ULTRA] = "超级性能",
|
||||
[UI_MENU_DLSS_PRESET] = "DLSS 模型",
|
||||
[UI_MENU_DLSS_PRESET_DESC] = "运行哪个 DLSS 模型。自动按 NVIDIA 对各模式的建议:DLAA、质量和平衡用 K,性能用 M,超级性能用 L。"
|
||||
"J:移动角色身后的拖影略少,闪烁略多。K:所有模式都用最清晰的模型。立即生效。",
|
||||
[UI_MENU_DLSS_PRESET_DEFAULT] = "自动", [UI_MENU_DLSS_PRESET_K] = "K(最清晰)",
|
||||
[UI_MENU_DLSS_PRESET_J] = "J(拖影更少)",
|
||||
[UI_MENU_DLSS_CHARS] = "DLSS 角色拖影",
|
||||
[UI_MENU_DLSS_CHARS_DESC] = "减少移动中的角色、动物及其手持物品身后的淡淡拖影:DLSS 在这些位置少用之前的帧。越强拖影越少,"
|
||||
"这些边缘也略欠平滑。立即生效。",
|
||||
[UI_MENU_DLSS_CHARS_OFF] = "关", [UI_MENU_DLSS_CHARS_LIGHT] = "弱", [UI_MENU_DLSS_CHARS_MEDIUM] = "中",
|
||||
[UI_MENU_DLSS_CHARS_FULL] = "强",
|
||||
[UI_MENU_FXAA] = "游戏抗锯齿(FXAA)",
|
||||
[UI_MENU_FXAA_DESC] = "游戏自身的 FXAA 边缘平滑。会让细节略微模糊;开启 DLAA 时不需要。",
|
||||
[UI_MENU_TAB_CHEATS] = "金手指",
|
||||
|
||||
+3
-1
@@ -54,7 +54,9 @@ typedef enum {
|
||||
UI_MENU_CONTACT_SHADOWS, UI_MENU_CONTACT_SHADOWS_DESC,
|
||||
UI_MENU_PCSS, UI_MENU_PCSS_DESC,
|
||||
UI_MENU_DLAA, UI_MENU_DLAA_DESC, UI_MENU_DLSS, UI_MENU_DLSS_DESC, UI_MENU_DLSS_DLAA, UI_MENU_DLSS_QUALITY,
|
||||
UI_MENU_DLSS_BALANCED, UI_MENU_DLSS_PERFORMANCE, UI_MENU_DLSS_ULTRA, UI_MENU_FXAA, UI_MENU_FXAA_DESC,
|
||||
UI_MENU_DLSS_BALANCED, UI_MENU_DLSS_PERFORMANCE, UI_MENU_DLSS_ULTRA, UI_MENU_DLSS_PRESET, UI_MENU_DLSS_PRESET_DESC,
|
||||
UI_MENU_DLSS_PRESET_DEFAULT, UI_MENU_DLSS_PRESET_K, UI_MENU_DLSS_PRESET_J, UI_MENU_DLSS_CHARS, UI_MENU_DLSS_CHARS_DESC,
|
||||
UI_MENU_DLSS_CHARS_OFF, UI_MENU_DLSS_CHARS_LIGHT, UI_MENU_DLSS_CHARS_MEDIUM, UI_MENU_DLSS_CHARS_FULL, UI_MENU_FXAA, UI_MENU_FXAA_DESC,
|
||||
|
||||
// Game
|
||||
UI_MENU_FPS_LIMIT, UI_MENU_FPS_LIMIT_DESC, UI_MENU_FPS_30, UI_MENU_FPS_40, UI_MENU_FPS_45, UI_MENU_FPS_60, UI_MENU_FPS_90,
|
||||
|
||||
+214
-71
@@ -1,16 +1,19 @@
|
||||
// DLAA: NVIDIA DLSS at the scene's own size (TOTK_DLAA, totk.ini dlaa). NGX is loaded at run time from the driver's
|
||||
// NGX core (_nvngx.dll, found through HKLM\SOFTWARE\NVIDIA Corporation\Global\NGXCore); the DLSS model
|
||||
// (nvngx_dlss.dll) is loaded by NGX from the folder of totk.exe. No NVIDIA SDK code or header is compiled in: the few
|
||||
// NGX types used are declared here from the SDK's documented ABI, the way the Metroid Dread recomp's dlss.c reaches
|
||||
// the core (read for behaviour only).
|
||||
// NGX core: on Windows _nvngx.dll, found through HKLM\SOFTWARE\NVIDIA Corporation\Global\NGXCore; on Linux
|
||||
// libnvidia-ngx.so.1, which the NVIDIA driver installs on the library path. NGX loads the DLSS model from the folder of
|
||||
// the executable: nvngx_dlss.dll on Windows, libnvidia-ngx-dlss.so.<version> on Linux. No NVIDIA SDK code or header is
|
||||
// compiled in: the few NGX types used are declared here from the SDK's documented ABI, the way the Metroid Dread
|
||||
// recomp's dlss.c reaches the core (read for behaviour only).
|
||||
//
|
||||
// The core's parameter object is a C++ class whose virtual functions are called through the MSVC vtable: the Set
|
||||
// overloads in slots 0-7 and the Get overloads in 8-15, each group in reverse declaration order. vtable_ok checks that
|
||||
// The core's parameter object is a C++ class whose virtual functions are called through its vtable: the Set overloads
|
||||
// in slots 0-7 and the Get overloads in 8-15. MSVC (the Windows core) lays out each group of overloads in reverse
|
||||
// declaration order, the Itanium C++ ABI (the Linux core, built with GCC) in declaration order. vtable_ok checks the
|
||||
// layout with a set-then-get round trip before anything relies on it.
|
||||
//
|
||||
// Where DLAA runs in the frame, the jitter and the motion vectors: see the sections below.
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -19,6 +22,7 @@
|
||||
|
||||
#include "cfg.h"
|
||||
#include "host.h"
|
||||
#include "platform/platform.h"
|
||||
#include "vk.h"
|
||||
#include "vk_dlaa.h"
|
||||
#include "vk_exec.h"
|
||||
@@ -57,7 +61,7 @@ typedef NgxResult (*PFN_Evaluate)(VkCommandBuffer, const NgxHandle *, const NgxP
|
||||
typedef NgxResult (*PFN_Release)(NgxHandle *);
|
||||
|
||||
static struct {
|
||||
HMODULE core;
|
||||
void *core; // the NGX core library (an HMODULE on Windows)
|
||||
PFN_Init init;
|
||||
PFN_ReqExt req_ext;
|
||||
PFN_Params caps, alloc_params;
|
||||
@@ -77,7 +81,13 @@ typedef NgxResult (*GetI)(const NgxParam *, const char *, int *);
|
||||
typedef NgxResult (*GetU)(const NgxParam *, const char *, unsigned *);
|
||||
typedef NgxResult (*GetF)(const NgxParam *, const char *, float *);
|
||||
typedef NgxResult (*GetP)(const NgxParam *, const char *, void **);
|
||||
// The SDK declares Set(u64), Set(float), Set(double), Set(u32), Set(int), Set(ID3D11Resource *), Set(ID3D12Resource *),
|
||||
// Set(void *), then the Get overloads in the same order, then Reset.
|
||||
#ifdef _WIN32
|
||||
enum { S_P = 0, S_D12, S_D11, S_I, S_U32, S_D, S_F, S_U64, G_P, G_D12, G_D11, G_I, G_U32, G_D, G_F, G_U64 };
|
||||
#else
|
||||
enum { S_U64 = 0, S_F, S_D, S_U32, S_I, S_D11, S_D12, S_P, G_U64, G_F, G_D, G_U32, G_I, G_D11, G_D12, G_P };
|
||||
#endif
|
||||
static void p_seti(NgxParam *p, const char *n, int v) { ((SetI)p->vt->slot[S_I])(p, n, v); }
|
||||
static void p_setu(NgxParam *p, const char *n, unsigned v) { ((SetU)p->vt->slot[S_U32])(p, n, v); }
|
||||
static void p_setf(NgxParam *p, const char *n, float v) { ((SetF)p->vt->slot[S_F])(p, n, v); }
|
||||
@@ -87,6 +97,12 @@ static int p_getu(const NgxParam *p, const char *n, unsigned *v) { return NGX_OK
|
||||
static int p_getf(const NgxParam *p, const char *n, float *v) { return NGX_OK(((GetF)p->vt->slot[G_F])(p, n, v)); }
|
||||
static int p_getp(const NgxParam *p, const char *n, void **v) { return NGX_OK(((GetP)p->vt->slot[G_P])(p, n, v)); }
|
||||
|
||||
#ifdef _WIN32
|
||||
#define DLSS_MODEL "nvngx_dlss.dll"
|
||||
#else
|
||||
#define DLSS_MODEL "libnvidia-ngx-dlss.so.<version>"
|
||||
#endif
|
||||
|
||||
// NGX is brought up only when dlaa is on at start: its device extensions can only be asked for at device creation, and
|
||||
// loading the driver's NGX core on every NVIDIA machine would cost start time and change the device with DLAA off. So
|
||||
// dlaa applies after a restart; switched off, nothing else of DLAA runs.
|
||||
@@ -99,6 +115,7 @@ int vk_dlaa_wanted(void) {
|
||||
static int core_load(void) {
|
||||
if (N.tried) return N.loaded;
|
||||
N.tried = 1;
|
||||
#ifdef _WIN32
|
||||
char dir[MAX_PATH] = {0}, path[MAX_PATH + 32];
|
||||
DWORD n = sizeof dir;
|
||||
if (RegGetValueA(HKEY_LOCAL_MACHINE, "SOFTWARE\\NVIDIA Corporation\\Global\\NGXCore", "FullPath", RRF_RT_REG_SZ,
|
||||
@@ -112,7 +129,17 @@ static int core_load(void) {
|
||||
rt_log("dlaa: cannot load %s (error %lu): DLAA off", path, GetLastError());
|
||||
return 0;
|
||||
}
|
||||
#define FN(f, name) N.f = (void *)GetProcAddress(N.core, name)
|
||||
#define FN(f, name) N.f = (void *)GetProcAddress((HMODULE)N.core, name)
|
||||
#else
|
||||
// The driver's NGX core; the dynamic loader finds it where the driver put it (/usr/lib, /usr/lib/x86_64-linux-gnu).
|
||||
const char *path = "libnvidia-ngx.so.1";
|
||||
N.core = plat_lib_open(path);
|
||||
if (!N.core) {
|
||||
rt_log("dlaa: cannot load %s (not an NVIDIA driver, or one without NGX): DLAA off", path);
|
||||
return 0;
|
||||
}
|
||||
#define FN(f, name) N.f = plat_lib_sym(N.core, name)
|
||||
#endif
|
||||
FN(init, "NVSDK_NGX_VULKAN_Init_Ext2");
|
||||
FN(req_ext, "NVSDK_NGX_VULKAN_RequiredExtensions");
|
||||
FN(caps, "NVSDK_NGX_VULKAN_GetCapabilityParameters");
|
||||
@@ -176,12 +203,46 @@ static int vtable_ok(void) {
|
||||
return ok;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
// UTF-8 to UTF-32 wchar_t, without the C library's locale (the runtime never sets one, so mbstowcs would stop at the
|
||||
// first non-ASCII byte). Returns 0 on malformed input or when out has no room.
|
||||
static int utf8_to_wide(const char *in, wchar_t *out, size_t cap) {
|
||||
const unsigned char *u = (const unsigned char *)in;
|
||||
size_t n = 0;
|
||||
while (*u) {
|
||||
unsigned c = *u++, more = c < 0x80 ? 0 : c >= 0xF0 ? 3 : c >= 0xE0 ? 2 : c >= 0xC0 ? 1 : 4;
|
||||
if (more == 4) return 0;
|
||||
if (more) c &= 0x3F >> more;
|
||||
for (unsigned k = 0; k < more; k++, u++) {
|
||||
if ((*u & 0xC0) != 0x80) return 0;
|
||||
c = c << 6 | (*u & 0x3F);
|
||||
}
|
||||
if (n + 1 >= cap) return 0;
|
||||
out[n++] = (wchar_t)c;
|
||||
}
|
||||
out[n] = 0;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
void vk_dlaa_init(void) {
|
||||
if (!vk_dlaa_wanted() || !core_load()) return;
|
||||
#ifdef _WIN32
|
||||
wchar_t wdir[MAX_PATH];
|
||||
DWORD len = GetModuleFileNameW(NULL, wdir, MAX_PATH);
|
||||
while (len && wdir[len - 1] != L'\\') len--;
|
||||
wdir[len] = 0;
|
||||
#else
|
||||
// The executable's folder, where NGX looks for libnvidia-ngx-dlss.so and writes its logs, as a wchar_t string:
|
||||
// 32-bit code points here, as the Linux core expects.
|
||||
char dir[PLAT_PATH_MAX];
|
||||
wchar_t wdir[PLAT_PATH_MAX];
|
||||
char *cut = plat_exe_path(dir, sizeof dir) ? plat_last_sep(dir) : NULL;
|
||||
if (!cut || !utf8_to_wide((cut[1] = 0, dir), wdir, PLAT_PATH_MAX)) {
|
||||
rt_log("dlaa: cannot name the executable's folder for NGX: DLAA off");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
// 231313132: the application id NVIDIA's DLSS samples use for builds without an NVIDIA-issued id
|
||||
const VkCtx *c = vk_ctx();
|
||||
NgxResult r = N.init(231313132ull, wdir, c->instance, c->phys, c->device, vkGetInstanceProcAddr,
|
||||
@@ -198,7 +259,7 @@ void vk_dlaa_init(void) {
|
||||
p_geti(caps, "SuperSampling.NeedsUpdatedDriver", &driver);
|
||||
}
|
||||
N.available = avail != 0;
|
||||
rt_log("dlaa: NGX up; DLSS %s%s", avail ? "available" : "NOT available (is nvngx_dlss.dll next to totk.exe?)",
|
||||
rt_log("dlaa: NGX up; DLSS %s%s", avail ? "available" : "NOT available (is " DLSS_MODEL " next to the executable?)",
|
||||
driver ? "; the driver needs an update" : "");
|
||||
}
|
||||
|
||||
@@ -234,6 +295,10 @@ static struct {
|
||||
VkImage out, mv;
|
||||
VmaAllocation out_mem, mv_mem;
|
||||
VkImageView out_view, mv_view;
|
||||
VkImage mask, chars[2]; // the bias mask DLSS reads, the character class mask of this and last frame (R8)
|
||||
VmaAllocation mask_mem, chars_mem[2];
|
||||
VkImageView mask_view, chars_view[2];
|
||||
int chars_cur, chars_ok; // chars[chars_cur] is written next; chars_ok: the other holds last frame's
|
||||
NgxHandle *feat;
|
||||
uint64_t used; // evals count when it last ran
|
||||
} sizes[5], *last; // last: the one the previous DLAA frame ran with
|
||||
@@ -263,10 +328,15 @@ static struct {
|
||||
VkPipeline mv_pipe;
|
||||
VkSampler mv_samp;
|
||||
int mv_ok; // -1 not built, 0 failed, 1 ready
|
||||
uint64_t mv_frames, mv_none;
|
||||
uint64_t mv_frames, mv_none, masked; // masked: frames with the characters' bias mask
|
||||
uint64_t why[3]; // history resets: scene size changed, no camera, scene target changed
|
||||
int on; // the dlaa setting, read at each present (the menu switches it live)
|
||||
} D = {.mv_ok = -1};
|
||||
int preset, preset_dirty; // the DLSS model features are created with (preset_value); a change pending
|
||||
VkExecTarget ids; // this frame's G-buffer target 0 (object classes in green), valid with ids_ok
|
||||
int ids_ok;
|
||||
unsigned cfg_seen; // cfg_version when preset was read
|
||||
uint64_t last_eval_ns; // plat_now_ns of the previous evaluation (FrameTimeDeltaInMsec)
|
||||
} D = {.mv_ok = -1, .cfg_seen = ~0u};
|
||||
|
||||
const VkTexImage *vk_dlaa_swap_img;
|
||||
VkImageView vk_dlaa_swap_view;
|
||||
@@ -300,6 +370,12 @@ static void free_size(struct Size *e) {
|
||||
if (e->mv_view) vkDestroyImageView(c->device, e->mv_view, NULL);
|
||||
if (e->out) vmaDestroyImage(c->vma, e->out, e->out_mem);
|
||||
if (e->mv) vmaDestroyImage(c->vma, e->mv, e->mv_mem);
|
||||
if (e->mask_view) vkDestroyImageView(c->device, e->mask_view, NULL);
|
||||
if (e->mask) vmaDestroyImage(c->vma, e->mask, e->mask_mem);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (e->chars_view[i]) vkDestroyImageView(c->device, e->chars_view[i], NULL);
|
||||
if (e->chars[i]) vmaDestroyImage(c->vma, e->chars[i], e->chars_mem[i]);
|
||||
}
|
||||
if (e->feat) N.release(e->feat);
|
||||
memset(e, 0, sizeof *e);
|
||||
}
|
||||
@@ -321,12 +397,16 @@ static struct Size *size_for(VkCommandBuffer cb, uint32_t w, uint32_t h, uint32_
|
||||
}
|
||||
VkImageUsageFlags u = VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
|
||||
VK_IMAGE_USAGE_TRANSFER_DST_BIT;
|
||||
VkImageUsageFlags u8 = VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||
if (!image2d(ow, oh, VK_FORMAT_R16G16B16A16_SFLOAT, u, &e->out, &e->out_mem, &e->out_view) ||
|
||||
!image2d(w, h, VK_FORMAT_R16G16_SFLOAT, u | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, &e->mv, &e->mv_mem, &e->mv_view))
|
||||
!image2d(w, h, VK_FORMAT_R16G16_SFLOAT, u | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, &e->mv, &e->mv_mem, &e->mv_view) ||
|
||||
!image2d(w, h, VK_FORMAT_R8_UNORM, u8, &e->mask, &e->mask_mem, &e->mask_view) ||
|
||||
!image2d(w, h, VK_FORMAT_R8_UNORM, u8, &e->chars[0], &e->chars_mem[0], &e->chars_view[0]) ||
|
||||
!image2d(w, h, VK_FORMAT_R8_UNORM, u8, &e->chars[1], &e->chars_mem[1], &e->chars_view[1]))
|
||||
return NULL;
|
||||
VkImageMemoryBarrier2 ib[2];
|
||||
VkImage im[2] = {e->out, e->mv};
|
||||
for (int i = 0; i < 2; i++)
|
||||
VkImageMemoryBarrier2 ib[5];
|
||||
VkImage im[5] = {e->out, e->mv, e->mask, e->chars[0], e->chars[1]};
|
||||
for (int i = 0; i < 5; i++)
|
||||
ib[i] = (VkImageMemoryBarrier2){.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2,
|
||||
.srcStageMask = VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
|
||||
.dstStageMask = VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
|
||||
@@ -335,7 +415,7 @@ static struct Size *size_for(VkCommandBuffer cb, uint32_t w, uint32_t h, uint32_
|
||||
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
||||
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .image = im[i],
|
||||
.subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}};
|
||||
VkDependencyInfo di = {.sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO, .imageMemoryBarrierCount = 2,
|
||||
VkDependencyInfo di = {.sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO, .imageMemoryBarrierCount = 5,
|
||||
.pImageMemoryBarriers = ib};
|
||||
vkCmdPipelineBarrier2(cb, &di);
|
||||
e->w = w, e->h = h, e->ow = ow, e->oh = oh;
|
||||
@@ -434,15 +514,19 @@ static int mv_init(void) {
|
||||
if (D.mv_ok >= 0) return D.mv_ok;
|
||||
D.mv_ok = 0;
|
||||
const VkCtx *c = vk_ctx();
|
||||
VkDescriptorSetLayoutBinding b[4] = {
|
||||
VkDescriptorSetLayoutBinding b[8] = {
|
||||
{0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_COMPUTE_BIT, NULL},
|
||||
{1, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, NULL},
|
||||
{2, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, NULL},
|
||||
{3, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, NULL}};
|
||||
{3, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_COMPUTE_BIT, NULL},
|
||||
{4, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_COMPUTE_BIT, NULL},
|
||||
{5, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, NULL},
|
||||
{6, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, NULL},
|
||||
{7, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1, VK_SHADER_STAGE_COMPUTE_BIT, NULL}};
|
||||
VkDescriptorSetLayoutCreateInfo dci = {.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO,
|
||||
.flags = VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR,
|
||||
.bindingCount = 4, .pBindings = b};
|
||||
VkPushConstantRange pr = {VK_SHADER_STAGE_COMPUTE_BIT, 0, 16};
|
||||
.bindingCount = 8, .pBindings = b};
|
||||
VkPushConstantRange pr = {VK_SHADER_STAGE_COMPUTE_BIT, 0, 24};
|
||||
VkSamplerCreateInfo si = {.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO, .magFilter = VK_FILTER_NEAREST,
|
||||
.minFilter = VK_FILTER_NEAREST, .mipmapMode = VK_SAMPLER_MIPMAP_MODE_NEAREST,
|
||||
.addressModeU = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,
|
||||
@@ -513,14 +597,17 @@ static int inv4(const double m[16], double o[16]) {
|
||||
}
|
||||
|
||||
// The pass, recorded through the recorder like the replay's own commands. 0: no camera this frame (the vectors stay
|
||||
// zero and DLSS starts a new history).
|
||||
static int mv_pass(VkExec *ex, const struct Size *e, VkImageView zv, float jx, float jy) {
|
||||
// zero and DLSS starts a new history). bias > 0 with this frame's G-buffer classes (D.ids) also writes e->mask, the
|
||||
// bias mask (dlaa_mv.comp); *masked says whether it did.
|
||||
static int mv_pass(VkExec *ex, struct Size *e, VkImageView zv, float jx, float jy, float bias, int *masked) {
|
||||
*masked = 0;
|
||||
VkCommandBuffer cb = ex->cb;
|
||||
uint32_t w = e->w, h = e->h;
|
||||
VkDescriptorBufferInfo cam;
|
||||
if (!mv_init() || !D.cam_addr || !vk_usnap_find(D.cam_addr, CAM_BLOCK, 4, &cam)) {
|
||||
D.mv_none++;
|
||||
D.cam_prev_ok = 0;
|
||||
e->chars_ok = 0;
|
||||
return 0;
|
||||
}
|
||||
// this frame's view-projection as the snapshot holds it, for the reprojection; kept as last frame's for the next
|
||||
@@ -545,7 +632,10 @@ static int mv_pass(VkExec *ex, const struct Size *e, VkImageView zv, float jx, f
|
||||
full_barrier(cb);
|
||||
D.cam_slot ^= 1, D.cam_prev_ok = cr != NULL;
|
||||
if (cr) memcpy(D.cam_prev, cur_vp, sizeof cur_vp);
|
||||
if (!had_prev || !have_m) return 0; // nothing to reproject into: zero motion, new history
|
||||
if (!had_prev || !have_m) { // nothing to reproject into: zero motion, new history
|
||||
e->chars_ok = 0;
|
||||
return 0;
|
||||
}
|
||||
VkDescriptorImageInfo zi = {D.mv_samp, zv, VK_IMAGE_LAYOUT_GENERAL};
|
||||
VkDescriptorImageInfo oi = {VK_NULL_HANDLE, e->mv_view, VK_IMAGE_LAYOUT_GENERAL};
|
||||
uint32_t ms = D.mvm_slot++ % MVM_SLOTS;
|
||||
@@ -557,7 +647,19 @@ static int mv_pass(VkExec *ex, const struct Size *e, VkImageView zv, float jx, f
|
||||
vmaFlushAllocation(vk_ctx()->vma, D.mvm_mem, (VkDeviceSize)ms * 2 * CAM_BYTES, 2 * CAM_BYTES);
|
||||
VkDescriptorBufferInfo cur = {D.mvm, (VkDeviceSize)ms * 2 * CAM_BYTES, CAM_BYTES};
|
||||
VkDescriptorBufferInfo prev = {D.mvm, (VkDeviceSize)ms * 2 * CAM_BYTES + CAM_BYTES, CAM_BYTES};
|
||||
VkWriteDescriptorSet wr[4] = {
|
||||
// The class mask needs the G-buffer at the scene size; otherwise bindings 4-7 get the mask images as stand-ins
|
||||
// (the shader returns before reading them with bias 0).
|
||||
const VkExecTarget *ids = &D.ids;
|
||||
int use = bias > 0 && D.ids_ok && ids->image && ids->width == w && ids->height == h && !ids->is3d;
|
||||
VkImageView iv = use ? vk_exec_target_view(ids->img, ids->format, VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
ids->level, ids->base_layer, 1, 0)
|
||||
: e->mask_view;
|
||||
int cur_c = e->chars_cur;
|
||||
VkDescriptorImageInfo ii = {D.mv_samp, iv, VK_IMAGE_LAYOUT_GENERAL};
|
||||
VkDescriptorImageInfo mki = {VK_NULL_HANDLE, e->mask_view, VK_IMAGE_LAYOUT_GENERAL};
|
||||
VkDescriptorImageInfo cpi = {VK_NULL_HANDLE, e->chars_view[cur_c ^ 1], VK_IMAGE_LAYOUT_GENERAL};
|
||||
VkDescriptorImageInfo coi = {VK_NULL_HANDLE, e->chars_view[cur_c], VK_IMAGE_LAYOUT_GENERAL};
|
||||
VkWriteDescriptorSet wr[8] = {
|
||||
{.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, .dstBinding = 0, .descriptorCount = 1,
|
||||
.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, .pImageInfo = &zi},
|
||||
{.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, .dstBinding = 1, .descriptorCount = 1,
|
||||
@@ -565,12 +667,20 @@ static int mv_pass(VkExec *ex, const struct Size *e, VkImageView zv, float jx, f
|
||||
{.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, .dstBinding = 2, .descriptorCount = 1,
|
||||
.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, .pBufferInfo = &cur},
|
||||
{.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, .dstBinding = 3, .descriptorCount = 1,
|
||||
.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, .pBufferInfo = &prev}};
|
||||
.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, .pBufferInfo = &prev},
|
||||
{.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, .dstBinding = 4, .descriptorCount = 1,
|
||||
.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, .pImageInfo = &ii},
|
||||
{.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, .dstBinding = 5, .descriptorCount = 1,
|
||||
.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, .pImageInfo = &mki},
|
||||
{.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, .dstBinding = 6, .descriptorCount = 1,
|
||||
.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, .pImageInfo = &cpi},
|
||||
{.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, .dstBinding = 7, .descriptorCount = 1,
|
||||
.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, .pImageInfo = &coi}};
|
||||
times_begin(cb);
|
||||
times_mark(cb, T_MV0);
|
||||
vkCmdBindPipeline(cb, VK_PIPELINE_BIND_POINT_COMPUTE, D.mv_pipe);
|
||||
rec_push(vk_pipeline_push_fn(), cb, VK_PIPELINE_BIND_POINT_COMPUTE, D.mv_layout, 0, 4, wr);
|
||||
float pc[4] = {(float)w, (float)h, jx, jy};
|
||||
rec_push(vk_pipeline_push_fn(), cb, VK_PIPELINE_BIND_POINT_COMPUTE, D.mv_layout, 0, 8, wr);
|
||||
float pc[6] = {(float)w, (float)h, jx, jy, use ? bias : 0.0f, use && e->chars_ok ? 1.0f : 0.0f};
|
||||
vkCmdPushConstants(cb, D.mv_layout, VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof pc, pc);
|
||||
vkCmdDispatch(cb, (w + 7) / 8, (h + 7) / 8, 1);
|
||||
full_barrier(cb);
|
||||
@@ -584,6 +694,9 @@ static int mv_pass(VkExec *ex, const struct Size *e, VkImageView zv, float jx, f
|
||||
if (T.on > 0) T.used[T.slot] = 1; // the DLSS marks follow in evaluate
|
||||
vk_mvcheck_final(cb, ex->fence, e->mv, D.color.image, D.color.format, D.color.level, D.color.base_layer, w, h, jx, jy);
|
||||
D.mv_frames++;
|
||||
if (use) e->chars_cur ^= 1, e->chars_ok = 1, D.masked++;
|
||||
else e->chars_ok = 0;
|
||||
*masked = use;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -825,6 +938,27 @@ static void next_jitter(uint32_t w, uint32_t ow) {
|
||||
D.jit_ok = !D.hold && !nj;
|
||||
}
|
||||
|
||||
// The DLSS model (TOTK_DLSS_PRESET, live): default takes NVIDIA's model per mode (evaluate: K for DLAA, Quality and
|
||||
// Balanced, M for Performance, L for Ultra Performance), 0 here. A letter a..m takes that model in every mode: k pins
|
||||
// K, j is the other transformer model, which NVIDIA describes as slightly less ghosting at the cost of extra flicker, e
|
||||
// the older CNN model, cheaper on slower RTX cards. The value is an NVSDK_NGX_DLSS_Hint_Render_Preset (1 A ... 13 M),
|
||||
// read when a feature is created; a change recreates the features (preset_check).
|
||||
static int preset_value(void) {
|
||||
const char *v = cfg_get("TOTK_DLSS_PRESET");
|
||||
int c = v && v[0] && !v[1] ? v[0] | 0x20 : 0;
|
||||
return c >= 'a' && c <= 'm' ? c - 'a' + 1 : 0;
|
||||
}
|
||||
|
||||
// How strongly DLSS favours the current frame on characters and where they just were (TOTK_DLSS_CHAR_MASK, percent,
|
||||
// live; 0 off). Where a character's vectors are the camera's only (dlaa_objmv = 0, or a draw the per-object pass
|
||||
// skips), one that moves on its own drags a faint copy of itself through DLSS's history; the bias mask makes DLSS take
|
||||
// less of the history there, at the cost of some of its anti-aliasing on those pixels.
|
||||
static float char_bias(void) {
|
||||
const char *v = cfg_get("TOTK_DLSS_CHAR_MASK");
|
||||
long n = v && *v ? strtol(v, NULL, 10) : 65;
|
||||
return n <= 0 ? 0.0f : n >= 100 ? 1.0f : (float)n / 100.0f;
|
||||
}
|
||||
|
||||
// The quality setting DLSS is created with, from the scene's share of the output width.
|
||||
static int perf_quality(uint32_t w, uint32_t ow) {
|
||||
if (w >= ow) return NGX_PERFQ_DLAA;
|
||||
@@ -839,9 +973,14 @@ static void evaluate(VkExec *ex, const VkExecTarget *dst) {
|
||||
uint32_t w = t->width, h = t->height, ow = dst->width, oh = dst->height;
|
||||
VkCommandBuffer cb = ex->cb;
|
||||
vk_exec_barrier(ex); // what drew the scene is done (no pass is open here)
|
||||
if (D.preset_dirty) { // another model: features are created with it, so every size gets a new one
|
||||
for (int i = 0; i < 3; i++)
|
||||
if (D.sizes[i].out) free_size(&D.sizes[i]);
|
||||
D.last = NULL, D.preset_dirty = 0;
|
||||
}
|
||||
struct Size *e = size_for(cb, w, h, ow, oh);
|
||||
if (!e) return dl_fail("work image creation", 0);
|
||||
if (e != D.last) D.reset = 1, D.why[0]++; // another size's history is from another moment
|
||||
if (e != D.last) D.reset = 1, D.why[0]++, e->chars_ok = 0; // another size's history is from another moment
|
||||
if (!D.params && !NGX_OK(N.alloc_params(&D.params))) return dl_fail("parameter allocation", 0);
|
||||
NgxParam *p = D.params;
|
||||
VkImageView zv = vk_exec_target_view(z->img, z->format, VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_ASPECT_DEPTH_BIT, z->level,
|
||||
@@ -849,7 +988,8 @@ static void evaluate(VkExec *ex, const VkExecTarget *dst) {
|
||||
float jx = D.jit_used ? D.ux : 0.0f, jy = D.jit_used ? D.uy : 0.0f;
|
||||
static int no_mv = -1;
|
||||
if (no_mv < 0) no_mv = !rt_knob("DLAA_MV", "1"); // TOTK_DLAA_MV=0: zero motion (test)
|
||||
if (no_mv || !mv_pass(ex, e, zv, jx, jy)) {
|
||||
int masked = 0;
|
||||
if (no_mv || !mv_pass(ex, e, zv, jx, jy, char_bias(), &masked)) {
|
||||
VkClearColorValue zero = {{0, 0, 0, 0}};
|
||||
VkImageSubresourceRange all = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1};
|
||||
vkCmdClearColorImage(cb, e->mv, VK_IMAGE_LAYOUT_GENERAL, &zero, 1, &all);
|
||||
@@ -877,14 +1017,9 @@ static void evaluate(VkExec *ex, const VkExecTarget *dst) {
|
||||
p_seti(p, "DLSS.Enable.Output.Subrects", 0);
|
||||
// The model per mode (NVSDK_NGX_DLSS_Hint_Render_Preset: 1 A ... 11 K, 12 L, 13 M), as NVIDIA recommends for
|
||||
// DLSS 4.5 (310.x): K (transformer) for DLAA, Quality and Balanced, M for Performance, L for Ultra Performance.
|
||||
// M and L cost more on cards without FP8 (RTX 20/30). TOTK_DLSS_PRESET=<letter> takes one for every mode,
|
||||
// default the DLL's own choice.
|
||||
const char *pv = cfg_get("TOTK_DLSS_PRESET");
|
||||
int pk = 11, pm = 13, pl = 12;
|
||||
if (pv && *pv) {
|
||||
int c = pv[0] | 0x20;
|
||||
pk = pm = pl = c >= 'a' && c <= 'm' && !pv[1] ? c - 'a' + 1 : 0; // "default": 0, the DLL's choice
|
||||
}
|
||||
// M and L cost more on cards without FP8 (RTX 20/30). dlss_preset (D.preset, preset_check) takes one model for
|
||||
// every mode instead.
|
||||
int pk = D.preset ? D.preset : 11, pm = D.preset ? D.preset : 13, pl = D.preset ? D.preset : 12;
|
||||
p_setu(p, "DLSS.Hint.Render.Preset.DLAA", (unsigned)pk);
|
||||
p_setu(p, "DLSS.Hint.Render.Preset.UltraQuality", (unsigned)pk);
|
||||
p_setu(p, "DLSS.Hint.Render.Preset.Quality", (unsigned)pk);
|
||||
@@ -896,7 +1031,7 @@ static void evaluate(VkExec *ex, const VkExecTarget *dst) {
|
||||
D.reset = 1;
|
||||
int q = perf_quality(w, ow), pr = q == 0 ? pm : q == 3 ? pl : pk;
|
||||
rt_log("dlaa: DLSS feature created at %ux%u -> %ux%u, quality value %d, preset %c (scene format %d, depth format "
|
||||
"%d)", w, h, ow, oh, q, pr ? 'A' + pr - 1 : '-', (int)t->format, (int)z->format);
|
||||
"%d)", w, h, ow, oh, q, 'A' + pr - 1, (int)t->format, (int)z->format);
|
||||
}
|
||||
if (D.last_color != t->image) D.reset = 1, D.why[2]++, D.last_color = t->image;
|
||||
NgxResourceVK rc = res_image(cv, t->image, t->format, w, h, VK_IMAGE_ASPECT_COLOR_BIT, 0);
|
||||
@@ -907,20 +1042,29 @@ static void evaluate(VkExec *ex, const VkExecTarget *dst) {
|
||||
p_setp(p, "Output", &ro);
|
||||
p_setp(p, "Depth", &rz);
|
||||
p_setp(p, "MotionVectors", &rm);
|
||||
NgxResourceVK rk;
|
||||
if (mk) rk = res_image(mk->mask_view, mk->mask, VK_FORMAT_R8_UNORM, w, h, VK_IMAGE_ASPECT_COLOR_BIT, 0);
|
||||
p_setp(p, "DLSS.Input.Bias.Current.Color.Mask", mk ? &rk : NULL); // the parameters outlive the frame
|
||||
p_setf(p, "Jitter.Offset.X", jx);
|
||||
p_setf(p, "Jitter.Offset.Y", jy);
|
||||
p_setf(p, "Sharpness", 0.0f);
|
||||
p_seti(p, "Reset", D.reset);
|
||||
// One bias mask: the reactive one (TOTK_DLSS_REACTIVE, a test) where it ran, else the characters' (mv_pass), else
|
||||
// none. The parameter object is reused, so it is cleared explicitly.
|
||||
NgxResourceVK rk = mk ? res_image(mk->mask_view, mk->mask, VK_FORMAT_R8_UNORM, w, h, VK_IMAGE_ASPECT_COLOR_BIT, 0)
|
||||
: res_image(e->mask_view, e->mask, VK_FORMAT_R8_UNORM, w, h, VK_IMAGE_ASPECT_COLOR_BIT, 0);
|
||||
p_setp(p, "DLSS.Input.Bias.Current.Color.Mask", mk || masked ? (void *)&rk : NULL);
|
||||
p_setu(p, "DLSS.Input.Bias.Current.Color.Subrect.Base.X", 0);
|
||||
p_setu(p, "DLSS.Input.Bias.Current.Color.Subrect.Base.Y", 0);
|
||||
p_setf(p, "MV.Scale.X", 1.0f);
|
||||
p_setf(p, "MV.Scale.Y", 1.0f);
|
||||
p_setu(p, "DLSS.Render.Subrect.Dimensions.Width", w);
|
||||
p_setu(p, "DLSS.Render.Subrect.Dimensions.Height", h);
|
||||
p_setf(p, "DLSS.Pre.Exposure", 1.0f);
|
||||
p_setf(p, "DLSS.Exposure.Scale", 1.0f);
|
||||
p_setf(p, "FrameTimeDeltaInMsec", 16.67f);
|
||||
// The time since the previous evaluation, which DLSS weighs its history by; 60 fps before the first and after a
|
||||
// gap (a pause, a load), where no history carries over anyway.
|
||||
uint64_t now = plat_now_ns();
|
||||
double dt = D.last_eval_ns ? (now - D.last_eval_ns) / 1e6 : 0;
|
||||
D.last_eval_ns = now;
|
||||
p_setf(p, "FrameTimeDeltaInMsec", dt > 0 && dt < 100 ? (float)dt : 16.67f);
|
||||
c0 = timed ? kern_now_ns() : 0;
|
||||
NgxResult r = N.evaluate(cb, e->feat, p, NULL);
|
||||
if (timed) T.cpu_ngx += kern_now_ns() - c0;
|
||||
@@ -951,14 +1095,14 @@ static void evaluate(VkExec *ex, const VkExecTarget *dst) {
|
||||
vk_exec_draw_new_cb(); // NGX bound pipelines and descriptor sets of its own: the next draw binds everything again
|
||||
D.jdepth = z->image;
|
||||
next_jitter(w, ow);
|
||||
if (++D.evals == 1 || D.evals % 3600 == 0)
|
||||
if (++D.evals == 1 || D.evals == 300 || D.evals % 3600 == 0) // 300: one early line with the frames counted
|
||||
rt_log("dlaa: %llu frames anti-aliased (scene %ux%u, output %ux%u; %llu frames without the DLAA point, %llu with camera "
|
||||
"motion, %llu without a camera, %llu jitter holds; resets: %llu size, %llu camera, %llu target; reactive mask %llu, "
|
||||
"without its copy %llu)",
|
||||
"motion, %llu with the characters' mask, %llu without a camera, %llu jitter holds; resets: %llu size, %llu "
|
||||
"camera, %llu target; reactive mask %llu, without its copy %llu)",
|
||||
(unsigned long long)D.evals, w, h, ow, oh, (unsigned long long)D.frames_missed,
|
||||
(unsigned long long)D.mv_frames, (unsigned long long)D.mv_none, (unsigned long long)D.holds,
|
||||
(unsigned long long)D.why[0], (unsigned long long)D.why[1], (unsigned long long)D.why[2],
|
||||
(unsigned long long)R.made, (unsigned long long)R.missed);
|
||||
(unsigned long long)D.mv_frames, (unsigned long long)D.masked, (unsigned long long)D.mv_none,
|
||||
(unsigned long long)D.holds, (unsigned long long)D.why[0], (unsigned long long)D.why[1],
|
||||
(unsigned long long)D.why[2], (unsigned long long)R.made, (unsigned long long)R.missed);
|
||||
}
|
||||
|
||||
static int scene_color(VkFormat f) {
|
||||
@@ -973,6 +1117,11 @@ void vk_dlaa_pass(VkExec *ex) {
|
||||
// and DLAA then ran at a small pass ahead of the whole scene, which reached the screen jittered.
|
||||
if (ex->pass_ncolor >= 3 && z->image && z->format == VK_FORMAT_D32_SFLOAT && z->width >= DLAA_SCENE_MIN_W) {
|
||||
D.gbuf = 1, D.armed = 0;
|
||||
// target 0 is the object-class buffer (RGBA8, the scene size): the characters' bias mask reads its green. A
|
||||
// smaller pass of the same shape (640x360, seen while loading) does not replace the scene's in the same frame.
|
||||
if (c->image && c->format == VK_FORMAT_R8G8B8A8_UNORM && c->width == z->width && c->height == z->height &&
|
||||
c->samples <= 1 && !c->is3d && (!D.ids_ok || c->width >= D.ids.width))
|
||||
D.ids = *c, D.ids_ok = 1;
|
||||
return;
|
||||
}
|
||||
// the scene depth is D32F; a D16 target of the scene size also serves one composite pass before the transparents.
|
||||
@@ -1022,9 +1171,25 @@ static void dlss_mode(void) {
|
||||
if (b != bias_on) bias_on = b, vk_sampler_dlss_bias(b ? res_dlss_lod_bias() : 0.0f);
|
||||
}
|
||||
|
||||
|
||||
// The preset, read again when a setting changed (the menu); a different one recreates the features at the next DLAA run.
|
||||
static void preset_check(void) {
|
||||
unsigned v = cfg_version();
|
||||
if (v == D.cfg_seen) return;
|
||||
D.cfg_seen = v;
|
||||
int p = preset_value();
|
||||
if (p == D.preset) return;
|
||||
if (D.evals) {
|
||||
if (p) rt_log("dlaa: DLSS preset %c in every mode; the features are created again", 'A' + p - 1);
|
||||
else rt_log("dlaa: DLSS presets per mode; the features are created again");
|
||||
}
|
||||
D.preset = p, D.preset_dirty = 1, D.reset = 1;
|
||||
}
|
||||
|
||||
void vk_dlaa_frame(void) {
|
||||
vk_dlaa_swap_img = NULL, vk_dlaa_swap_view = VK_NULL_HANDLE;
|
||||
dlss_mode();
|
||||
preset_check();
|
||||
int on = N.available && cfg_bool("TOTK_DLAA");
|
||||
if (on != D.on) {
|
||||
rt_log("dlaa: %s", on ? "on" : "off");
|
||||
@@ -1039,7 +1204,7 @@ void vk_dlaa_frame(void) {
|
||||
if (D.jit_used && !D.done) D.hold = 60, D.holds++; // jittered but not resolved: that frame shook
|
||||
else if (D.hold) D.hold--;
|
||||
if (!D.done) D.jit_ok = 0;
|
||||
D.armed = D.done = D.jit_used = D.gbuf = D.ended = D.up = 0;
|
||||
D.armed = D.done = D.jit_used = D.gbuf = D.ended = D.up = D.ids_ok = 0;
|
||||
D.cam_addr = 0;
|
||||
}
|
||||
|
||||
@@ -1104,25 +1269,3 @@ int vk_dlaa_skip_draw(VkExec *ex, const GfxShader *fs) {
|
||||
return !fxaa;
|
||||
}
|
||||
|
||||
#else
|
||||
// NGX is loaded as a Windows DLL; elsewhere DLAA, the DLSS modes' scaling and the FXAA switch do nothing.
|
||||
#include "vk_dlaa.h"
|
||||
#include "vk_exec.h"
|
||||
|
||||
const VkTexImage *vk_dlaa_swap_img;
|
||||
VkImageView vk_dlaa_swap_view;
|
||||
|
||||
int vk_dlaa_wanted(void) { return 0; }
|
||||
void vk_dlaa_instance_exts(const char **ext, uint32_t *n, uint32_t max) { (void)ext, (void)n, (void)max; }
|
||||
void vk_dlaa_device_exts(const VkExtensionProperties *have, uint32_t nhave, const char **ext, uint32_t *n, uint32_t max) {
|
||||
(void)have, (void)nhave, (void)ext, (void)n, (void)max;
|
||||
}
|
||||
void vk_dlaa_init(void) {}
|
||||
int vk_dlaa_available(void) { return 0; }
|
||||
void vk_dlaa_pass(VkExec *ex) { (void)ex; }
|
||||
void vk_dlaa_frame(void) {}
|
||||
void vk_dlaa_draw(VkExec *ex) { (void)ex; }
|
||||
void vk_dlaa_viewport(VkExec *ex, VkViewport *v) { (void)ex, (void)v; }
|
||||
int vk_dlaa_skip_draw(VkExec *ex, const GfxShader *fs) { (void)ex, (void)fs; return 0; }
|
||||
int vk_dlaa_prev_camera(VkDescriptorBufferInfo *out, float jitter[2]) { (void)out, (void)jitter; return 0; }
|
||||
#endif
|
||||
Reference in new issue
Block a user