Render the game above 1080p and scale it to the window with FSR 1

The output and scene patch sets make the game read its output, swapchain and scene sizes from the patch page
(MacNativeGames' sites for 1.2.1 and 1.4.3); resolution.c picks them from TOTK_OUTPUT_RES and TOTK_RENDER_SCALE and
grows the HeapDef texture heap, its parent and the application pool to match. vk_fsr.c runs AMD FSR 1 EASU and RCAS
on the present when the window is larger than the game's output (TOTK_UPSCALER, TOTK_SHARPNESS).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-10-27 13:40:34 +03:00
1 parent 098f8a52da
commit 7abdbc90ac
24 files changed
+6877 -26

No files matched your search

+18
View File
@@ -7,6 +7,8 @@ set fps60 TOTK_FPS60 1
set realtime TOTK_REALTIME 1
set cloth TOTK_CLOTH_REALTIME 1
set bounce TOTK_HIGHFPS_FIX 1
set output TOTK_PATCH_OUTPUT 0
set scene TOTK_PATCH_SCENE 0
# 60 fps: the adaptive present-interval controller (main+0x8f26c8, 1.0.0 0x8f6bec) gets the minimum interval 1.
site fps60 main 8f273c 6b08015f 7100055f # clamp: cmp w10, #1 (was cmp w10, w8 = minimum)
@@ -45,3 +47,19 @@ site cloth main 8222f0 9401d7cf @page:x8 bd400104 1e240842 1e240863 9401d7cf #
# Trampolines (upstream 27c3b43): the slow-motion check compares time object +0x28 (30 / (ratio * time scale)) with
# 100; compare +0x28 * +0x38 (30 / time scale) instead, the same value at 30 Hz and independent of the frame rate.
site bounce main bda798 bd402900 bd402900 bd403901 1e210800 # ldr s0, [x8, #0x28]; ldr s1, [x8, #0x38]; fmul s0, s0, s1
# Output size (upstream games/totk/runtime/game_patches.c patch_output_res; runtime/resolution.c switches the set on).
# The swapchain size nnMain writes before NvInitializeGraphics comes from page +48 ({w, h} as one 64-bit value), and
# the output size the renderer lays out its canvas, crop and UI in (main+0xcc3f00, read from the graphics parameters
# through main+0xcc4160) from page +32; the renderer itself goes to page +40.
site output main e7aa3c d280f008 @page:x8 # mov x8, #0x780 -> adrp x8, page
site output main e7aa40 f2c08708 f9401908 # movk x8, #0x438, lsl #32 -> ldr x8, [x8, #48]
site output main cc3f50 aa1403e0 @page:x21 # mov x0, x20 -> adrp x21, page
site output main cc3f54 94000083 f90016b3 # bl 0xcc4160 -> str x19, [x21, #40]
site output main cc3f58 f9400015 f94012b5 # ldr x21, [x0] -> ldr x21, [x21, #32]
# Scene render size (upstream patch_render_res): the renderer's +0xcc4 / +0xcc8, which size every scene render target,
# take two floats from page +16 instead of the graphics parameters' docked 1600x900.
site scene main cc3f68 5e21d900 @page:x9 # scvtf s0, s8 -> adrp x9, page
site scene main cc3f70 bd0cc660 2d420520 # str s0, [x19, #0xcc4] -> ldp s0, s1, [x9, #16]
site scene main cc3f74 5e21d921 bd0cc660 # scvtf s1, s9 -> str s0, [x19, #0xcc4]
+16
View File
@@ -8,6 +8,8 @@ set fps60 TOTK_FPS60 1
set realtime TOTK_REALTIME 1
set cloth TOTK_CLOTH_REALTIME 1
set bounce TOTK_HIGHFPS_FIX 1
set output TOTK_PATCH_OUTPUT 0
set scene TOTK_PATCH_SCENE 0
# 60 fps: the adaptive present-interval controller (main+0x2db174, 1.2.1 0x8f26c8) gets the minimum interval 1.
site fps60 main 2db204 6b08015f 7100055f # clamp: cmp w10, #1 (was cmp w10, w8 = minimum)
@@ -44,3 +46,17 @@ site cloth main 28bc98 9400546a @page:x8 bd400104 1e240842 1e240863 9400546a #
# over 100; compare +0x28 * +0x38 (30 / time scale) instead, the same value at 30 Hz and independent of the frame rate.
# s1 is set again by the fmov two instructions on.
site bounce main 562a64 bd402920 bd402920 bd403921 1e210800 # ldr s0, [x9, #0x28]; ldr s1, [x9, #0x38]; fmul s0, s0, s1
# Output size (upstream game_patches_v143.c patch_output_res; runtime/resolution.c switches the set on). The swapchain
# size nnMain writes comes from page +48; the display configuration's canvas (+0x10) and active output (+0x508) from
# page +32, and the configuration goes to page +40. x9 is dead at the publication point.
site output main bdb578 d280f008 @page:x8 # mov x8, #0x780 -> adrp x8, page (x9 is built in between)
site output main bdb584 f2c08708 f9401908 # movk x8, #0x438, lsl #32 -> ldr x8, [x8, #48]
site output main 3dcb28 d360fc64 @page:x9 f9001533 f9401123 f9000a63 d360fc64 # lsr x4, x3, #32: x3 = [page+32] first
# Scene render size (upstream patch_render_res): every path that picks the size meets at main+0x585e48; the renderer's
# +0xcc4 / +0xcc8 take two floats from page +16. x3 is scratch in this function; w9 still holds the output size.
site scene main 585e48 1e220160 @page:x3 # scvtf s0, w11 -> adrp x3, page
site scene main 585e50 bd0cc660 2d420460 # str s0, [x19, #0xcc4] -> ldp s0, s1, [x3, #16]
site scene main 585e54 1e220140 bd0cc660 # scvtf s0, w10 -> str s0, [x19, #0xcc4]
site scene main 585e60 bd0cca60 bd0cca61 # str s0, [x19, #0xcc8] -> str s1, [x19, #0xcc8]
+1
View File
@@ -324,6 +324,7 @@ void rt_boot(void) {
ldr_load(rt_config()->exefs);
rt_patches_init();
frame_step_init();
res_init();
cb_addr[0] = hostfn_register("<rtld loader_ready>", cb_loader_ready);
cb_addr[1] = hostfn_register("<rtld module_inits>", cb_module_inits);
cb_addr[2] = hostfn_register("<rtld module_finis>", cb_module_finis);
+9 -5
View File
@@ -39,13 +39,14 @@ static const char *const known[] = {
"GPU_INDEX", "GPU_NAME", "HIGHFPS_FIX", "INPUT", "INPUT_RECORD", "INPUT_SCRIPT", "LANG", "LIB_PREBUILD",
"LIB_PREBUILD_KEEP", "LIB_PREBUILD_THREADS", "LOCALE", "LOD_GUARD", "MEMORY", "MENU_LANG", "MENU_TEST",
"MENU_TEST_DIR", "MENU_TEST_SET", "MINIMAL_LAYOUT", "MIRROR_GAP", "MOTION", "MOUSE_SENS", "MOVIE_HOST", "MOVIE_PACE",
"OPERATION_MODE", "PERF_OVERLAY", "PERF_SLOW_MS", "PIPELINE_CACHE", "PIPE_MEMO", "PIPE_PREBUILD", "PIPE_SKIP", "PIPE_SYNC", "PIPE_WAIT",
"OPERATION_MODE", "OUTPUT_RES", "PATCH_OUTPUT", "PATCH_SCENE", "PERF_OVERLAY", "PERF_SLOW_MS", "PIPELINE_CACHE", "PIPE_MEMO", "PIPE_PREBUILD", "PIPE_SKIP", "PIPE_SYNC", "PIPE_WAIT",
"PREWARM_XLATE", "PROBE_MOVIE", "PROBE_MOVIE_SHOT", "PROFILE", "PROFILE_CHAINS", "PROFILE_DIR", "PROFILE_FRAMES",
"PROFILE_MAIN", "PROFILE_RENDER", "PUSH_SKIP", "PUSH_STAGE", "RDOC", "RDOC_DIR", "RDOC_DLL", "REALTIME", "REEXEC", "REPLAY_ASYNC",
"PROFILE_MAIN", "PROFILE_RENDER", "PUSH_SKIP", "PUSH_STAGE", "RDOC", "RDOC_DIR", "RDOC_DLL", "REALTIME", "REEXEC",
"RENDER_SCALE", "REPLAY_ASYNC",
"REPLAY_CHECK", "RESOLVE_CHECK", "ROMFS", "ROMFS_INDEX", "ROMFS_MMAP", "ROMFS_MODS", "ROMFS_PATCHES",
"ROMFS_PROOF_DIR", "ROMFS_VERIFY", "RUMBLE", "RUMBLE_CURVE", "RUMBLE_STRENGTH", "RUMBLE_TRIGGERS", "SHADER_CACHE",
"SHADER_MEMO", "SHARED_FONTS", "SHOTS", "SHOTS_DIR", "SHOTS_FULL", "SPEED_PROBE", "SPLIT_DRAWS", "SWKBD_ANSWER",
"SWKBD_TEST", "TEST_PREPARE_SHADERS", "TEX_ALIAS", "TEX_MEMO", "TIMER_1MS", "TRACE", "VK_DYN_VERTEX", "VK_NO_FLOAT64",
"SHADER_MEMO", "SHARED_FONTS", "SHARPNESS", "SHOTS", "SHOTS_DIR", "SHOTS_FULL", "SPEED_PROBE", "SPLIT_DRAWS", "SWKBD_ANSWER",
"SWKBD_TEST", "TEST_PREPARE_SHADERS", "TEX_ALIAS", "TEX_MEMO", "TIMER_1MS", "TRACE", "UPSCALER", "VK_DYN_VERTEX", "VK_NO_FLOAT64",
"VK_PRESENT", "VK_SSBO_ALIGN", "VK_SUBGROUP", "VK_SUBGROUP_PIN", "VK_VALIDATION", "VOLUME", "VS_OUTS",
"WINDOW_SIZE", "XLATE", "XLATE_ID", "XLATE_PROCS",
};
@@ -55,7 +56,8 @@ static const struct { const char *key, *section; } sections[] = {
{"FPS_LIMIT", "frame rate"}, {"FPS60", "frame rate"},
{"REALTIME", "frame rate"}, {"CLOTH_REALTIME", "frame rate"}, {"HIGHFPS_FIX", "frame rate"},
{"FULLSCREEN", "display"}, {"WINDOW_SIZE", "display"}, {"PERF_OVERLAY", "display"}, {"VK_PRESENT", "display"},
{"GPU_INDEX", "display"},
{"GPU_INDEX", "display"}, {"OUTPUT_RES", "display"}, {"RENDER_SCALE", "display"}, {"UPSCALER", "display"},
{"SHARPNESS", "display"},
{"MENU_LANG", "language"}, {"LANG", "language"}, {"OPERATION_MODE", "language"},
{"VOLUME", "audio"},
{"MOTION", "input"}, {"RUMBLE_STRENGTH", "input"}, {"RUMBLE_CURVE", "input"}, {"RUMBLE_TRIGGERS", "input"},
@@ -81,6 +83,8 @@ static const CfgMeta metas[] = {
{"FULLSCREEN", "0", "0|1", LIVE}, {"WINDOW_SIZE", "1920x1080", NULL, LIVE},
{"VK_PRESENT", "mailbox", "mailbox|fifo|immediate", LIVE}, {"GPU_INDEX", "", NULL, RESTART},
{"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},
// Game
{"FPS_LIMIT", "60", "30|60|120|144|display", LIVE}, {"FPS60", "1", "0|1", LIVE},
{"REALTIME", "1", "0|1", RESTART}, {"CLOTH_REALTIME", "1", "0|1", RESTART},
File diff suppressed because it is too large. Load diff
+424
View File
@@ -0,0 +1,424 @@
// Generated by tools/build_shaders.py from runtime/shaders/fsr_rcas.comp; do not edit.
// source sha256 6ea46d4c41d9b70c0fffb44b34b812476b6aa6a840f86f941d106d4f05d48ce0
#pragma once
#include <stdint.h>
static const uint32_t fsr_rcas_spv[] = {
0x07230203, 0x00010300, 0x000d000b, 0x00001186, 0x00000000, 0x00020011, 0x00000001, 0x0006000b,
0x00000001, 0x4c534c47, 0x6474732e, 0x3035342e, 0x00000000, 0x0003000e, 0x00000000, 0x00000001,
0x0007000f, 0x00000005, 0x00000004, 0x6e69616d, 0x00000000, 0x0000030c, 0x00000312, 0x00060010,
0x00000004, 0x00000011, 0x00000040, 0x00000001, 0x00000001, 0x00040047, 0x000000b8, 0x00000021,
0x00000000, 0x00040047, 0x000000b8, 0x00000022, 0x00000000, 0x00030047, 0x000002d3, 0x00000002,
0x00050048, 0x000002d3, 0x00000000, 0x00000023, 0x00000000, 0x00030047, 0x000002f9, 0x00000019,
0x00040047, 0x000002f9, 0x00000021, 0x00000001, 0x00040047, 0x000002f9, 0x00000022, 0x00000000,
0x00040047, 0x0000030c, 0x0000000b, 0x0000001b, 0x00040047, 0x00000312, 0x0000000b, 0x0000001a,
0x00040047, 0x0000033e, 0x0000000b, 0x00000019, 0x00020013, 0x00000002, 0x00030021, 0x00000003,
0x00000002, 0x00030016, 0x00000006, 0x00000020, 0x00040015, 0x0000000c, 0x00000020, 0x00000000,
0x00040017, 0x00000031, 0x0000000c, 0x00000002, 0x00040015, 0x00000036, 0x00000020, 0x00000001,
0x00040017, 0x00000037, 0x00000036, 0x00000002, 0x00040017, 0x00000039, 0x00000006, 0x00000004,
0x0004002b, 0x00000036, 0x00000069, 0x00000000, 0x0004002b, 0x00000006, 0x0000007d, 0x3f800000,
0x0004002b, 0x00000006, 0x00000085, 0x00000000, 0x0004002b, 0x0000000c, 0x0000008e, 0x7ef19fff,
0x0004002b, 0x00000006, 0x0000009a, 0x40000000, 0x0004002b, 0x0000000c, 0x000000a1, 0x00000001,
0x00090019, 0x000000b5, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
0x00000000, 0x0003001b, 0x000000b6, 0x000000b5, 0x00040020, 0x000000b7, 0x00000000, 0x000000b6,
0x0004003b, 0x000000b7, 0x000000b8, 0x00000000, 0x0004002b, 0x0000000c, 0x000000c9, 0x00000000,
0x0004002b, 0x0000000c, 0x000000ce, 0x00000002, 0x0004002b, 0x00000036, 0x000000d8, 0xffffffff,
0x0005002c, 0x00000037, 0x000000d9, 0x00000069, 0x000000d8, 0x0005002c, 0x00000037, 0x000000e0,
0x000000d8, 0x00000069, 0x0004002b, 0x00000036, 0x000000ec, 0x00000001, 0x0005002c, 0x00000037,
0x000000ed, 0x000000ec, 0x00000069, 0x0005002c, 0x00000037, 0x000000f4, 0x00000069, 0x000000ec,
0x0004002b, 0x00000006, 0x00000213, 0xc0800000, 0x0004002b, 0x00000006, 0x00000219, 0x40800000,
0x0004002b, 0x00000006, 0x0000027a, 0xbe400000, 0x00020014, 0x000002d0, 0x0003001e, 0x000002d3,
0x00000039, 0x00040020, 0x000002d4, 0x00000009, 0x000002d3, 0x0004003b, 0x000002d4, 0x000002d5,
0x00000009, 0x00040020, 0x000002d6, 0x00000009, 0x00000006, 0x00090019, 0x000002f7, 0x00000006,
0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000002, 0x00040020, 0x000002f8,
0x00000000, 0x000002f7, 0x0004003b, 0x000002f8, 0x000002f9, 0x00000000, 0x00040017, 0x0000030a,
0x0000000c, 0x00000003, 0x00040020, 0x0000030b, 0x00000001, 0x0000030a, 0x0004003b, 0x0000030b,
0x0000030c, 0x00000001, 0x00040020, 0x0000030e, 0x00000001, 0x0000000c, 0x0004003b, 0x0000030b,
0x00000312, 0x00000001, 0x0004002b, 0x0000000c, 0x00000315, 0x00000004, 0x0004002b, 0x0000000c,
0x00000321, 0x00000008, 0x0004002b, 0x0000000c, 0x0000033d, 0x00000040, 0x0006002c, 0x0000030a,
0x0000033e, 0x0000033d, 0x000000a1, 0x000000a1, 0x0004002b, 0x00000036, 0x0000115c, 0x00000003,
0x0004002b, 0x00000006, 0x0000115d, 0x3e800000, 0x00050036, 0x00000002, 0x00000004, 0x00000000,
0x00000003, 0x000200f8, 0x00000005, 0x00060041, 0x000002d6, 0x00000305, 0x000002d5, 0x00000069,
0x000000ce, 0x0004003d, 0x00000006, 0x00000306, 0x00000305, 0x0004007f, 0x00000006, 0x00000348,
0x00000306, 0x0006000c, 0x00000006, 0x00000349, 0x00000001, 0x0000001d, 0x00000348, 0x00050041,
0x0000030e, 0x0000030f, 0x0000030c, 0x000000c9, 0x0004003d, 0x0000000c, 0x00000310, 0x0000030f,
0x000600cb, 0x0000000c, 0x0000036d, 0x00000310, 0x000000ec, 0x0000115c, 0x000600cb, 0x0000000c,
0x00000375, 0x00000310, 0x0000115c, 0x0000115c, 0x000700c9, 0x0000000c, 0x0000037c, 0x00000375,
0x00000310, 0x00000069, 0x000000ec, 0x00050050, 0x00000031, 0x00000365, 0x0000036d, 0x0000037c,
0x00050041, 0x0000030e, 0x00000313, 0x00000312, 0x000000c9, 0x0004003d, 0x0000000c, 0x00000314,
0x00000313, 0x000500c4, 0x0000000c, 0x00000316, 0x00000314, 0x00000315, 0x00050041, 0x0000030e,
0x00000317, 0x00000312, 0x000000a1, 0x0004003d, 0x0000000c, 0x00000318, 0x00000317, 0x000500c4,
0x0000000c, 0x00000319, 0x00000318, 0x00000315, 0x00050050, 0x00000031, 0x0000031a, 0x00000316,
0x00000319, 0x00050080, 0x00000031, 0x0000031b, 0x00000365, 0x0000031a, 0x000300f7, 0x000003a9,
0x00000000, 0x000300fb, 0x000000c9, 0x00000385, 0x000200f8, 0x00000385, 0x00050051, 0x0000000c,
0x00000387, 0x0000031b, 0x00000000, 0x00060041, 0x000002d6, 0x00000388, 0x000002d5, 0x00000069,
0x000000c9, 0x0004003d, 0x00000006, 0x00000389, 0x00000388, 0x0004006d, 0x0000000c, 0x0000038a,
0x00000389, 0x000500ae, 0x000002d0, 0x0000038b, 0x00000387, 0x0000038a, 0x000400a8, 0x000002d0,
0x0000038c, 0x0000038b, 0x000300f7, 0x00000394, 0x00000000, 0x000400fa, 0x0000038c, 0x0000038d,
0x00000394, 0x000200f8, 0x0000038d, 0x00050051, 0x0000000c, 0x0000038f, 0x0000031b, 0x00000001,
0x00060041, 0x000002d6, 0x00000390, 0x000002d5, 0x00000069, 0x000000a1, 0x0004003d, 0x00000006,
0x00000391, 0x00000390, 0x0004006d, 0x0000000c, 0x00000392, 0x00000391, 0x000500ae, 0x000002d0,
0x00000393, 0x0000038f, 0x00000392, 0x000200f9, 0x00000394, 0x000200f8, 0x00000394, 0x000700f5,
0x000002d0, 0x00000395, 0x0000038b, 0x00000385, 0x00000393, 0x0000038d, 0x000300f7, 0x00000397,
0x00000000, 0x000400fa, 0x00000395, 0x00000396, 0x00000397, 0x000200f8, 0x00000396, 0x000200f9,
0x000003a9, 0x000200f8, 0x00000397, 0x0004007c, 0x00000037, 0x00000431, 0x0000031b, 0x00050080,
0x00000037, 0x00000433, 0x00000431, 0x000000d9, 0x0004003d, 0x000000b6, 0x0000059d, 0x000000b8,
0x00040064, 0x000000b5, 0x0000059f, 0x0000059d, 0x0007005f, 0x00000039, 0x000005a0, 0x0000059f,
0x00000433, 0x00000002, 0x00000069, 0x00050080, 0x00000037, 0x00000437, 0x00000431, 0x000000e0,
0x0004003d, 0x000000b6, 0x000005a3, 0x000000b8, 0x00040064, 0x000000b5, 0x000005a5, 0x000005a3,
0x0007005f, 0x00000039, 0x000005a6, 0x000005a5, 0x00000437, 0x00000002, 0x00000069, 0x0004003d,
0x000000b6, 0x000005a9, 0x000000b8, 0x00040064, 0x000000b5, 0x000005ab, 0x000005a9, 0x0007005f,
0x00000039, 0x000005ac, 0x000005ab, 0x00000431, 0x00000002, 0x00000069, 0x00050080, 0x00000037,
0x0000043e, 0x00000431, 0x000000ed, 0x0004003d, 0x000000b6, 0x000005af, 0x000000b8, 0x00040064,
0x000000b5, 0x000005b1, 0x000005af, 0x0007005f, 0x00000039, 0x000005b2, 0x000005b1, 0x0000043e,
0x00000002, 0x00000069, 0x00050080, 0x00000037, 0x00000442, 0x00000431, 0x000000f4, 0x0004003d,
0x000000b6, 0x000005b5, 0x000000b8, 0x00040064, 0x000000b5, 0x000005b7, 0x000005b5, 0x0007005f,
0x00000039, 0x000005b8, 0x000005b7, 0x00000442, 0x00000002, 0x00000069, 0x00050051, 0x00000006,
0x00000446, 0x000005a0, 0x00000000, 0x00050051, 0x00000006, 0x00000448, 0x000005a0, 0x00000001,
0x00050051, 0x00000006, 0x0000044a, 0x000005a0, 0x00000002, 0x00050051, 0x00000006, 0x0000044c,
0x000005a6, 0x00000000, 0x00050051, 0x00000006, 0x0000044e, 0x000005a6, 0x00000001, 0x00050051,
0x00000006, 0x00000450, 0x000005a6, 0x00000002, 0x00050051, 0x00000006, 0x00000452, 0x000005ac,
0x00000000, 0x00050051, 0x00000006, 0x00000454, 0x000005ac, 0x00000001, 0x00050051, 0x00000006,
0x00000456, 0x000005ac, 0x00000002, 0x00050051, 0x00000006, 0x00000458, 0x000005b2, 0x00000000,
0x00050051, 0x00000006, 0x0000045a, 0x000005b2, 0x00000001, 0x00050051, 0x00000006, 0x0000045c,
0x000005b2, 0x00000002, 0x00050051, 0x00000006, 0x0000045e, 0x000005b8, 0x00000000, 0x00050051,
0x00000006, 0x00000460, 0x000005b8, 0x00000001, 0x00050051, 0x00000006, 0x00000462, 0x000005b8,
0x00000002, 0x0007000c, 0x00000006, 0x00000635, 0x00000001, 0x00000025, 0x0000044c, 0x00000458,
0x0007000c, 0x00000006, 0x00000636, 0x00000001, 0x00000025, 0x00000446, 0x00000635, 0x0007000c,
0x00000006, 0x000004e2, 0x00000001, 0x00000025, 0x00000636, 0x0000045e, 0x0007000c, 0x00000006,
0x0000063c, 0x00000001, 0x00000025, 0x0000044e, 0x0000045a, 0x0007000c, 0x00000006, 0x0000063d,
0x00000001, 0x00000025, 0x00000448, 0x0000063c, 0x0007000c, 0x00000006, 0x000004e8, 0x00000001,
0x00000025, 0x0000063d, 0x00000460, 0x0007000c, 0x00000006, 0x00000643, 0x00000001, 0x00000025,
0x00000450, 0x0000045c, 0x0007000c, 0x00000006, 0x00000644, 0x00000001, 0x00000025, 0x0000044a,
0x00000643, 0x0007000c, 0x00000006, 0x000004ee, 0x00000001, 0x00000025, 0x00000644, 0x00000462,
0x0007000c, 0x00000006, 0x0000064a, 0x00000001, 0x00000028, 0x0000044c, 0x00000458, 0x0007000c,
0x00000006, 0x0000064b, 0x00000001, 0x00000028, 0x00000446, 0x0000064a, 0x0007000c, 0x00000006,
0x000004f4, 0x00000001, 0x00000028, 0x0000064b, 0x0000045e, 0x0007000c, 0x00000006, 0x00000651,
0x00000001, 0x00000028, 0x0000044e, 0x0000045a, 0x0007000c, 0x00000006, 0x00000652, 0x00000001,
0x00000028, 0x00000448, 0x00000651, 0x0007000c, 0x00000006, 0x000004fa, 0x00000001, 0x00000028,
0x00000652, 0x00000460, 0x0007000c, 0x00000006, 0x00000658, 0x00000001, 0x00000028, 0x00000450,
0x0000045c, 0x0007000c, 0x00000006, 0x00000659, 0x00000001, 0x00000028, 0x0000044a, 0x00000658,
0x0007000c, 0x00000006, 0x00000500, 0x00000001, 0x00000028, 0x00000659, 0x00000462, 0x0007000c,
0x00000006, 0x00000503, 0x00000001, 0x00000025, 0x000004e2, 0x00000452, 0x00050088, 0x00000006,
0x00000662, 0x0000115d, 0x000004f4, 0x00050085, 0x00000006, 0x00000508, 0x00000503, 0x00000662,
0x0007000c, 0x00000006, 0x0000050b, 0x00000001, 0x00000025, 0x000004e8, 0x00000454, 0x00050088,
0x00000006, 0x0000066e, 0x0000115d, 0x000004fa, 0x00050085, 0x00000006, 0x00000510, 0x0000050b,
0x0000066e, 0x0007000c, 0x00000006, 0x00000513, 0x00000001, 0x00000025, 0x000004ee, 0x00000456,
0x00050088, 0x00000006, 0x0000067a, 0x0000115d, 0x00000500, 0x00050085, 0x00000006, 0x00000518,
0x00000513, 0x0000067a, 0x0007000c, 0x00000006, 0x0000051d, 0x00000001, 0x00000028, 0x000004f4,
0x00000452, 0x00050083, 0x00000006, 0x0000051e, 0x0000007d, 0x0000051d, 0x00050085, 0x00000006,
0x00000521, 0x00000219, 0x000004e2, 0x00050081, 0x00000006, 0x00000524, 0x00000521, 0x00000213,
0x00050088, 0x00000006, 0x00000686, 0x0000007d, 0x00000524, 0x00050085, 0x00000006, 0x00000526,
0x0000051e, 0x00000686, 0x0007000c, 0x00000006, 0x0000052b, 0x00000001, 0x00000028, 0x000004fa,
0x00000454, 0x00050083, 0x00000006, 0x0000052c, 0x0000007d, 0x0000052b, 0x00050085, 0x00000006,
0x0000052f, 0x00000219, 0x000004e8, 0x00050081, 0x00000006, 0x00000532, 0x0000052f, 0x00000213,
0x00050088, 0x00000006, 0x00000692, 0x0000007d, 0x00000532, 0x00050085, 0x00000006, 0x00000534,
0x0000052c, 0x00000692, 0x0007000c, 0x00000006, 0x00000539, 0x00000001, 0x00000028, 0x00000500,
0x00000456, 0x00050083, 0x00000006, 0x0000053a, 0x0000007d, 0x00000539, 0x00050085, 0x00000006,
0x0000053d, 0x00000219, 0x000004ee, 0x00050081, 0x00000006, 0x00000540, 0x0000053d, 0x00000213,
0x00050088, 0x00000006, 0x0000069e, 0x0000007d, 0x00000540, 0x00050085, 0x00000006, 0x00000542,
0x0000053a, 0x0000069e, 0x0004007f, 0x00000006, 0x00000544, 0x00000508, 0x0007000c, 0x00000006,
0x00000546, 0x00000001, 0x00000028, 0x00000544, 0x00000526, 0x0004007f, 0x00000006, 0x00000548,
0x00000510, 0x0007000c, 0x00000006, 0x0000054a, 0x00000001, 0x00000028, 0x00000548, 0x00000534,
0x0004007f, 0x00000006, 0x0000054c, 0x00000518, 0x0007000c, 0x00000006, 0x0000054e, 0x00000001,
0x00000028, 0x0000054c, 0x00000542, 0x0007000c, 0x00000006, 0x000006aa, 0x00000001, 0x00000028,
0x0000054a, 0x0000054e, 0x0007000c, 0x00000006, 0x000006ab, 0x00000001, 0x00000028, 0x00000546,
0x000006aa, 0x0007000c, 0x00000006, 0x00000555, 0x00000001, 0x00000025, 0x000006ab, 0x00000085,
0x0007000c, 0x00000006, 0x00000556, 0x00000001, 0x00000028, 0x0000027a, 0x00000555, 0x00050085,
0x00000006, 0x0000055a, 0x00000556, 0x00000349, 0x00050085, 0x00000006, 0x0000055d, 0x00000219,
0x0000055a, 0x00050081, 0x00000006, 0x0000055f, 0x0000055d, 0x0000007d, 0x0004007c, 0x0000000c,
0x000006bc, 0x0000055f, 0x00050082, 0x0000000c, 0x000006bd, 0x0000008e, 0x000006bc, 0x0004007c,
0x00000006, 0x000006be, 0x000006bd, 0x0004007f, 0x00000006, 0x000006c1, 0x000006be, 0x00050085,
0x00000006, 0x000006c3, 0x000006c1, 0x0000055f, 0x00050081, 0x00000006, 0x000006c5, 0x000006c3,
0x0000009a, 0x00050085, 0x00000006, 0x000006c6, 0x000006be, 0x000006c5, 0x00050081, 0x00000006,
0x0000115e, 0x00000446, 0x0000044c, 0x00050081, 0x00000006, 0x0000115f, 0x0000115e, 0x0000045e,
0x00050081, 0x00000006, 0x00001160, 0x0000115f, 0x00000458, 0x00050085, 0x00000006, 0x0000056f,
0x0000055a, 0x00001160, 0x00050081, 0x00000006, 0x00000571, 0x0000056f, 0x00000452, 0x00050085,
0x00000006, 0x00000573, 0x00000571, 0x000006c6, 0x00050081, 0x00000006, 0x00001161, 0x00000448,
0x0000044e, 0x00050081, 0x00000006, 0x00001162, 0x00001161, 0x00000460, 0x00050081, 0x00000006,
0x00001163, 0x00001162, 0x0000045a, 0x00050085, 0x00000006, 0x00000582, 0x0000055a, 0x00001163,
0x00050081, 0x00000006, 0x00000584, 0x00000582, 0x00000454, 0x00050085, 0x00000006, 0x00000586,
0x00000584, 0x000006c6, 0x00050081, 0x00000006, 0x00001164, 0x0000044a, 0x00000450, 0x00050081,
0x00000006, 0x00001165, 0x00001164, 0x00000462, 0x00050081, 0x00000006, 0x00001166, 0x00001165,
0x0000045c, 0x00050085, 0x00000006, 0x00000595, 0x0000055a, 0x00001166, 0x00050081, 0x00000006,
0x00000597, 0x00000595, 0x00000456, 0x00050085, 0x00000006, 0x00000599, 0x00000597, 0x000006c6,
0x0004003d, 0x000002f7, 0x000003a1, 0x000002f9, 0x00070050, 0x00000039, 0x000003a8, 0x00000573,
0x00000586, 0x00000599, 0x0000007d, 0x00040063, 0x000003a1, 0x00000431, 0x000003a8, 0x000200f9,
0x000003a9, 0x000200f8, 0x000003a9, 0x00050080, 0x0000000c, 0x00000324, 0x00000387, 0x00000321,
0x00060052, 0x00000031, 0x000010e2, 0x00000324, 0x0000031b, 0x00000000, 0x000300f7, 0x000006f9,
0x00000000, 0x000300fb, 0x000000c9, 0x000006d5, 0x000200f8, 0x000006d5, 0x000500ae, 0x000002d0,
0x000006db, 0x00000324, 0x0000038a, 0x000400a8, 0x000002d0, 0x000006dc, 0x000006db, 0x000300f7,
0x000006e4, 0x00000000, 0x000400fa, 0x000006dc, 0x000006dd, 0x000006e4, 0x000200f8, 0x000006dd,
0x00050051, 0x0000000c, 0x000006df, 0x0000031b, 0x00000001, 0x00060041, 0x000002d6, 0x000006e0,
0x000002d5, 0x00000069, 0x000000a1, 0x0004003d, 0x00000006, 0x000006e1, 0x000006e0, 0x0004006d,
0x0000000c, 0x000006e2, 0x000006e1, 0x000500ae, 0x000002d0, 0x000006e3, 0x000006df, 0x000006e2,
0x000200f9, 0x000006e4, 0x000200f8, 0x000006e4, 0x000700f5, 0x000002d0, 0x000006e5, 0x000006db,
0x000006d5, 0x000006e3, 0x000006dd, 0x000300f7, 0x000006e7, 0x00000000, 0x000400fa, 0x000006e5,
0x000006e6, 0x000006e7, 0x000200f8, 0x000006e6, 0x000200f9, 0x000006f9, 0x000200f8, 0x000006e7,
0x0004007c, 0x00000037, 0x00000781, 0x000010e2, 0x00050080, 0x00000037, 0x00000783, 0x00000781,
0x000000d9, 0x0004003d, 0x000000b6, 0x000008ec, 0x000000b8, 0x00040064, 0x000000b5, 0x000008ee,
0x000008ec, 0x0007005f, 0x00000039, 0x000008ef, 0x000008ee, 0x00000783, 0x00000002, 0x00000069,
0x00050080, 0x00000037, 0x00000787, 0x00000781, 0x000000e0, 0x0004003d, 0x000000b6, 0x000008f2,
0x000000b8, 0x00040064, 0x000000b5, 0x000008f4, 0x000008f2, 0x0007005f, 0x00000039, 0x000008f5,
0x000008f4, 0x00000787, 0x00000002, 0x00000069, 0x0004003d, 0x000000b6, 0x000008f8, 0x000000b8,
0x00040064, 0x000000b5, 0x000008fa, 0x000008f8, 0x0007005f, 0x00000039, 0x000008fb, 0x000008fa,
0x00000781, 0x00000002, 0x00000069, 0x00050080, 0x00000037, 0x0000078e, 0x00000781, 0x000000ed,
0x0004003d, 0x000000b6, 0x000008fe, 0x000000b8, 0x00040064, 0x000000b5, 0x00000900, 0x000008fe,
0x0007005f, 0x00000039, 0x00000901, 0x00000900, 0x0000078e, 0x00000002, 0x00000069, 0x00050080,
0x00000037, 0x00000792, 0x00000781, 0x000000f4, 0x0004003d, 0x000000b6, 0x00000904, 0x000000b8,
0x00040064, 0x000000b5, 0x00000906, 0x00000904, 0x0007005f, 0x00000039, 0x00000907, 0x00000906,
0x00000792, 0x00000002, 0x00000069, 0x00050051, 0x00000006, 0x00000796, 0x000008ef, 0x00000000,
0x00050051, 0x00000006, 0x00000798, 0x000008ef, 0x00000001, 0x00050051, 0x00000006, 0x0000079a,
0x000008ef, 0x00000002, 0x00050051, 0x00000006, 0x0000079c, 0x000008f5, 0x00000000, 0x00050051,
0x00000006, 0x0000079e, 0x000008f5, 0x00000001, 0x00050051, 0x00000006, 0x000007a0, 0x000008f5,
0x00000002, 0x00050051, 0x00000006, 0x000007a2, 0x000008fb, 0x00000000, 0x00050051, 0x00000006,
0x000007a4, 0x000008fb, 0x00000001, 0x00050051, 0x00000006, 0x000007a6, 0x000008fb, 0x00000002,
0x00050051, 0x00000006, 0x000007a8, 0x00000901, 0x00000000, 0x00050051, 0x00000006, 0x000007aa,
0x00000901, 0x00000001, 0x00050051, 0x00000006, 0x000007ac, 0x00000901, 0x00000002, 0x00050051,
0x00000006, 0x000007ae, 0x00000907, 0x00000000, 0x00050051, 0x00000006, 0x000007b0, 0x00000907,
0x00000001, 0x00050051, 0x00000006, 0x000007b2, 0x00000907, 0x00000002, 0x0007000c, 0x00000006,
0x00000984, 0x00000001, 0x00000025, 0x0000079c, 0x000007a8, 0x0007000c, 0x00000006, 0x00000985,
0x00000001, 0x00000025, 0x00000796, 0x00000984, 0x0007000c, 0x00000006, 0x00000832, 0x00000001,
0x00000025, 0x00000985, 0x000007ae, 0x0007000c, 0x00000006, 0x0000098b, 0x00000001, 0x00000025,
0x0000079e, 0x000007aa, 0x0007000c, 0x00000006, 0x0000098c, 0x00000001, 0x00000025, 0x00000798,
0x0000098b, 0x0007000c, 0x00000006, 0x00000838, 0x00000001, 0x00000025, 0x0000098c, 0x000007b0,
0x0007000c, 0x00000006, 0x00000992, 0x00000001, 0x00000025, 0x000007a0, 0x000007ac, 0x0007000c,
0x00000006, 0x00000993, 0x00000001, 0x00000025, 0x0000079a, 0x00000992, 0x0007000c, 0x00000006,
0x0000083e, 0x00000001, 0x00000025, 0x00000993, 0x000007b2, 0x0007000c, 0x00000006, 0x00000999,
0x00000001, 0x00000028, 0x0000079c, 0x000007a8, 0x0007000c, 0x00000006, 0x0000099a, 0x00000001,
0x00000028, 0x00000796, 0x00000999, 0x0007000c, 0x00000006, 0x00000844, 0x00000001, 0x00000028,
0x0000099a, 0x000007ae, 0x0007000c, 0x00000006, 0x000009a0, 0x00000001, 0x00000028, 0x0000079e,
0x000007aa, 0x0007000c, 0x00000006, 0x000009a1, 0x00000001, 0x00000028, 0x00000798, 0x000009a0,
0x0007000c, 0x00000006, 0x0000084a, 0x00000001, 0x00000028, 0x000009a1, 0x000007b0, 0x0007000c,
0x00000006, 0x000009a7, 0x00000001, 0x00000028, 0x000007a0, 0x000007ac, 0x0007000c, 0x00000006,
0x000009a8, 0x00000001, 0x00000028, 0x0000079a, 0x000009a7, 0x0007000c, 0x00000006, 0x00000850,
0x00000001, 0x00000028, 0x000009a8, 0x000007b2, 0x0007000c, 0x00000006, 0x00000853, 0x00000001,
0x00000025, 0x00000832, 0x000007a2, 0x00050088, 0x00000006, 0x000009b1, 0x0000115d, 0x00000844,
0x00050085, 0x00000006, 0x00000858, 0x00000853, 0x000009b1, 0x0007000c, 0x00000006, 0x0000085b,
0x00000001, 0x00000025, 0x00000838, 0x000007a4, 0x00050088, 0x00000006, 0x000009bd, 0x0000115d,
0x0000084a, 0x00050085, 0x00000006, 0x00000860, 0x0000085b, 0x000009bd, 0x0007000c, 0x00000006,
0x00000863, 0x00000001, 0x00000025, 0x0000083e, 0x000007a6, 0x00050088, 0x00000006, 0x000009c9,
0x0000115d, 0x00000850, 0x00050085, 0x00000006, 0x00000868, 0x00000863, 0x000009c9, 0x0007000c,
0x00000006, 0x0000086d, 0x00000001, 0x00000028, 0x00000844, 0x000007a2, 0x00050083, 0x00000006,
0x0000086e, 0x0000007d, 0x0000086d, 0x00050085, 0x00000006, 0x00000871, 0x00000219, 0x00000832,
0x00050081, 0x00000006, 0x00000874, 0x00000871, 0x00000213, 0x00050088, 0x00000006, 0x000009d5,
0x0000007d, 0x00000874, 0x00050085, 0x00000006, 0x00000876, 0x0000086e, 0x000009d5, 0x0007000c,
0x00000006, 0x0000087b, 0x00000001, 0x00000028, 0x0000084a, 0x000007a4, 0x00050083, 0x00000006,
0x0000087c, 0x0000007d, 0x0000087b, 0x00050085, 0x00000006, 0x0000087f, 0x00000219, 0x00000838,
0x00050081, 0x00000006, 0x00000882, 0x0000087f, 0x00000213, 0x00050088, 0x00000006, 0x000009e1,
0x0000007d, 0x00000882, 0x00050085, 0x00000006, 0x00000884, 0x0000087c, 0x000009e1, 0x0007000c,
0x00000006, 0x00000889, 0x00000001, 0x00000028, 0x00000850, 0x000007a6, 0x00050083, 0x00000006,
0x0000088a, 0x0000007d, 0x00000889, 0x00050085, 0x00000006, 0x0000088d, 0x00000219, 0x0000083e,
0x00050081, 0x00000006, 0x00000890, 0x0000088d, 0x00000213, 0x00050088, 0x00000006, 0x000009ed,
0x0000007d, 0x00000890, 0x00050085, 0x00000006, 0x00000892, 0x0000088a, 0x000009ed, 0x0004007f,
0x00000006, 0x00000894, 0x00000858, 0x0007000c, 0x00000006, 0x00000896, 0x00000001, 0x00000028,
0x00000894, 0x00000876, 0x0004007f, 0x00000006, 0x00000898, 0x00000860, 0x0007000c, 0x00000006,
0x0000089a, 0x00000001, 0x00000028, 0x00000898, 0x00000884, 0x0004007f, 0x00000006, 0x0000089c,
0x00000868, 0x0007000c, 0x00000006, 0x0000089e, 0x00000001, 0x00000028, 0x0000089c, 0x00000892,
0x0007000c, 0x00000006, 0x000009f9, 0x00000001, 0x00000028, 0x0000089a, 0x0000089e, 0x0007000c,
0x00000006, 0x000009fa, 0x00000001, 0x00000028, 0x00000896, 0x000009f9, 0x0007000c, 0x00000006,
0x000008a5, 0x00000001, 0x00000025, 0x000009fa, 0x00000085, 0x0007000c, 0x00000006, 0x000008a6,
0x00000001, 0x00000028, 0x0000027a, 0x000008a5, 0x00050085, 0x00000006, 0x000008aa, 0x000008a6,
0x00000349, 0x00050085, 0x00000006, 0x000008ad, 0x00000219, 0x000008aa, 0x00050081, 0x00000006,
0x000008af, 0x000008ad, 0x0000007d, 0x0004007c, 0x0000000c, 0x00000a0b, 0x000008af, 0x00050082,
0x0000000c, 0x00000a0c, 0x0000008e, 0x00000a0b, 0x0004007c, 0x00000006, 0x00000a0d, 0x00000a0c,
0x0004007f, 0x00000006, 0x00000a10, 0x00000a0d, 0x00050085, 0x00000006, 0x00000a12, 0x00000a10,
0x000008af, 0x00050081, 0x00000006, 0x00000a14, 0x00000a12, 0x0000009a, 0x00050085, 0x00000006,
0x00000a15, 0x00000a0d, 0x00000a14, 0x00050081, 0x00000006, 0x00001168, 0x00000796, 0x0000079c,
0x00050081, 0x00000006, 0x00001169, 0x00001168, 0x000007ae, 0x00050081, 0x00000006, 0x0000116a,
0x00001169, 0x000007a8, 0x00050085, 0x00000006, 0x000008bf, 0x000008aa, 0x0000116a, 0x00050081,
0x00000006, 0x000008c1, 0x000008bf, 0x000007a2, 0x00050085, 0x00000006, 0x000008c3, 0x000008c1,
0x00000a15, 0x00050081, 0x00000006, 0x0000116b, 0x00000798, 0x0000079e, 0x00050081, 0x00000006,
0x0000116c, 0x0000116b, 0x000007b0, 0x00050081, 0x00000006, 0x0000116d, 0x0000116c, 0x000007aa,
0x00050085, 0x00000006, 0x000008d2, 0x000008aa, 0x0000116d, 0x00050081, 0x00000006, 0x000008d4,
0x000008d2, 0x000007a4, 0x00050085, 0x00000006, 0x000008d6, 0x000008d4, 0x00000a15, 0x00050081,
0x00000006, 0x0000116e, 0x0000079a, 0x000007a0, 0x00050081, 0x00000006, 0x0000116f, 0x0000116e,
0x000007b2, 0x00050081, 0x00000006, 0x00001170, 0x0000116f, 0x000007ac, 0x00050085, 0x00000006,
0x000008e5, 0x000008aa, 0x00001170, 0x00050081, 0x00000006, 0x000008e7, 0x000008e5, 0x000007a6,
0x00050085, 0x00000006, 0x000008e9, 0x000008e7, 0x00000a15, 0x0004003d, 0x000002f7, 0x000006f1,
0x000002f9, 0x00070050, 0x00000039, 0x000006f8, 0x000008c3, 0x000008d6, 0x000008e9, 0x0000007d,
0x00040063, 0x000006f1, 0x00000781, 0x000006f8, 0x000200f9, 0x000006f9, 0x000200f8, 0x000006f9,
0x00050051, 0x0000000c, 0x0000032c, 0x0000031b, 0x00000001, 0x00050080, 0x0000000c, 0x0000032d,
0x0000032c, 0x00000321, 0x00050050, 0x00000031, 0x00001172, 0x00000324, 0x0000032d, 0x000300f7,
0x00000a48, 0x00000000, 0x000300fb, 0x000000c9, 0x00000a24, 0x000200f8, 0x00000a24, 0x000300f7,
0x00000a33, 0x00000000, 0x000400fa, 0x000006dc, 0x00000a2c, 0x00000a33, 0x000200f8, 0x00000a2c,
0x00060041, 0x000002d6, 0x00000a2f, 0x000002d5, 0x00000069, 0x000000a1, 0x0004003d, 0x00000006,
0x00000a30, 0x00000a2f, 0x0004006d, 0x0000000c, 0x00000a31, 0x00000a30, 0x000500ae, 0x000002d0,
0x00000a32, 0x0000032d, 0x00000a31, 0x000200f9, 0x00000a33, 0x000200f8, 0x00000a33, 0x000700f5,
0x000002d0, 0x00000a34, 0x000006db, 0x00000a24, 0x00000a32, 0x00000a2c, 0x000300f7, 0x00000a36,
0x00000000, 0x000400fa, 0x00000a34, 0x00000a35, 0x00000a36, 0x000200f8, 0x00000a35, 0x000200f9,
0x00000a48, 0x000200f8, 0x00000a36, 0x0004007c, 0x00000037, 0x00000ad0, 0x00001172, 0x00050080,
0x00000037, 0x00000ad2, 0x00000ad0, 0x000000d9, 0x0004003d, 0x000000b6, 0x00000c3b, 0x000000b8,
0x00040064, 0x000000b5, 0x00000c3d, 0x00000c3b, 0x0007005f, 0x00000039, 0x00000c3e, 0x00000c3d,
0x00000ad2, 0x00000002, 0x00000069, 0x00050080, 0x00000037, 0x00000ad6, 0x00000ad0, 0x000000e0,
0x0004003d, 0x000000b6, 0x00000c41, 0x000000b8, 0x00040064, 0x000000b5, 0x00000c43, 0x00000c41,
0x0007005f, 0x00000039, 0x00000c44, 0x00000c43, 0x00000ad6, 0x00000002, 0x00000069, 0x0004003d,
0x000000b6, 0x00000c47, 0x000000b8, 0x00040064, 0x000000b5, 0x00000c49, 0x00000c47, 0x0007005f,
0x00000039, 0x00000c4a, 0x00000c49, 0x00000ad0, 0x00000002, 0x00000069, 0x00050080, 0x00000037,
0x00000add, 0x00000ad0, 0x000000ed, 0x0004003d, 0x000000b6, 0x00000c4d, 0x000000b8, 0x00040064,
0x000000b5, 0x00000c4f, 0x00000c4d, 0x0007005f, 0x00000039, 0x00000c50, 0x00000c4f, 0x00000add,
0x00000002, 0x00000069, 0x00050080, 0x00000037, 0x00000ae1, 0x00000ad0, 0x000000f4, 0x0004003d,
0x000000b6, 0x00000c53, 0x000000b8, 0x00040064, 0x000000b5, 0x00000c55, 0x00000c53, 0x0007005f,
0x00000039, 0x00000c56, 0x00000c55, 0x00000ae1, 0x00000002, 0x00000069, 0x00050051, 0x00000006,
0x00000ae5, 0x00000c3e, 0x00000000, 0x00050051, 0x00000006, 0x00000ae7, 0x00000c3e, 0x00000001,
0x00050051, 0x00000006, 0x00000ae9, 0x00000c3e, 0x00000002, 0x00050051, 0x00000006, 0x00000aeb,
0x00000c44, 0x00000000, 0x00050051, 0x00000006, 0x00000aed, 0x00000c44, 0x00000001, 0x00050051,
0x00000006, 0x00000aef, 0x00000c44, 0x00000002, 0x00050051, 0x00000006, 0x00000af1, 0x00000c4a,
0x00000000, 0x00050051, 0x00000006, 0x00000af3, 0x00000c4a, 0x00000001, 0x00050051, 0x00000006,
0x00000af5, 0x00000c4a, 0x00000002, 0x00050051, 0x00000006, 0x00000af7, 0x00000c50, 0x00000000,
0x00050051, 0x00000006, 0x00000af9, 0x00000c50, 0x00000001, 0x00050051, 0x00000006, 0x00000afb,
0x00000c50, 0x00000002, 0x00050051, 0x00000006, 0x00000afd, 0x00000c56, 0x00000000, 0x00050051,
0x00000006, 0x00000aff, 0x00000c56, 0x00000001, 0x00050051, 0x00000006, 0x00000b01, 0x00000c56,
0x00000002, 0x0007000c, 0x00000006, 0x00000cd3, 0x00000001, 0x00000025, 0x00000aeb, 0x00000af7,
0x0007000c, 0x00000006, 0x00000cd4, 0x00000001, 0x00000025, 0x00000ae5, 0x00000cd3, 0x0007000c,
0x00000006, 0x00000b81, 0x00000001, 0x00000025, 0x00000cd4, 0x00000afd, 0x0007000c, 0x00000006,
0x00000cda, 0x00000001, 0x00000025, 0x00000aed, 0x00000af9, 0x0007000c, 0x00000006, 0x00000cdb,
0x00000001, 0x00000025, 0x00000ae7, 0x00000cda, 0x0007000c, 0x00000006, 0x00000b87, 0x00000001,
0x00000025, 0x00000cdb, 0x00000aff, 0x0007000c, 0x00000006, 0x00000ce1, 0x00000001, 0x00000025,
0x00000aef, 0x00000afb, 0x0007000c, 0x00000006, 0x00000ce2, 0x00000001, 0x00000025, 0x00000ae9,
0x00000ce1, 0x0007000c, 0x00000006, 0x00000b8d, 0x00000001, 0x00000025, 0x00000ce2, 0x00000b01,
0x0007000c, 0x00000006, 0x00000ce8, 0x00000001, 0x00000028, 0x00000aeb, 0x00000af7, 0x0007000c,
0x00000006, 0x00000ce9, 0x00000001, 0x00000028, 0x00000ae5, 0x00000ce8, 0x0007000c, 0x00000006,
0x00000b93, 0x00000001, 0x00000028, 0x00000ce9, 0x00000afd, 0x0007000c, 0x00000006, 0x00000cef,
0x00000001, 0x00000028, 0x00000aed, 0x00000af9, 0x0007000c, 0x00000006, 0x00000cf0, 0x00000001,
0x00000028, 0x00000ae7, 0x00000cef, 0x0007000c, 0x00000006, 0x00000b99, 0x00000001, 0x00000028,
0x00000cf0, 0x00000aff, 0x0007000c, 0x00000006, 0x00000cf6, 0x00000001, 0x00000028, 0x00000aef,
0x00000afb, 0x0007000c, 0x00000006, 0x00000cf7, 0x00000001, 0x00000028, 0x00000ae9, 0x00000cf6,
0x0007000c, 0x00000006, 0x00000b9f, 0x00000001, 0x00000028, 0x00000cf7, 0x00000b01, 0x0007000c,
0x00000006, 0x00000ba2, 0x00000001, 0x00000025, 0x00000b81, 0x00000af1, 0x00050088, 0x00000006,
0x00000d00, 0x0000115d, 0x00000b93, 0x00050085, 0x00000006, 0x00000ba7, 0x00000ba2, 0x00000d00,
0x0007000c, 0x00000006, 0x00000baa, 0x00000001, 0x00000025, 0x00000b87, 0x00000af3, 0x00050088,
0x00000006, 0x00000d0c, 0x0000115d, 0x00000b99, 0x00050085, 0x00000006, 0x00000baf, 0x00000baa,
0x00000d0c, 0x0007000c, 0x00000006, 0x00000bb2, 0x00000001, 0x00000025, 0x00000b8d, 0x00000af5,
0x00050088, 0x00000006, 0x00000d18, 0x0000115d, 0x00000b9f, 0x00050085, 0x00000006, 0x00000bb7,
0x00000bb2, 0x00000d18, 0x0007000c, 0x00000006, 0x00000bbc, 0x00000001, 0x00000028, 0x00000b93,
0x00000af1, 0x00050083, 0x00000006, 0x00000bbd, 0x0000007d, 0x00000bbc, 0x00050085, 0x00000006,
0x00000bc0, 0x00000219, 0x00000b81, 0x00050081, 0x00000006, 0x00000bc3, 0x00000bc0, 0x00000213,
0x00050088, 0x00000006, 0x00000d24, 0x0000007d, 0x00000bc3, 0x00050085, 0x00000006, 0x00000bc5,
0x00000bbd, 0x00000d24, 0x0007000c, 0x00000006, 0x00000bca, 0x00000001, 0x00000028, 0x00000b99,
0x00000af3, 0x00050083, 0x00000006, 0x00000bcb, 0x0000007d, 0x00000bca, 0x00050085, 0x00000006,
0x00000bce, 0x00000219, 0x00000b87, 0x00050081, 0x00000006, 0x00000bd1, 0x00000bce, 0x00000213,
0x00050088, 0x00000006, 0x00000d30, 0x0000007d, 0x00000bd1, 0x00050085, 0x00000006, 0x00000bd3,
0x00000bcb, 0x00000d30, 0x0007000c, 0x00000006, 0x00000bd8, 0x00000001, 0x00000028, 0x00000b9f,
0x00000af5, 0x00050083, 0x00000006, 0x00000bd9, 0x0000007d, 0x00000bd8, 0x00050085, 0x00000006,
0x00000bdc, 0x00000219, 0x00000b8d, 0x00050081, 0x00000006, 0x00000bdf, 0x00000bdc, 0x00000213,
0x00050088, 0x00000006, 0x00000d3c, 0x0000007d, 0x00000bdf, 0x00050085, 0x00000006, 0x00000be1,
0x00000bd9, 0x00000d3c, 0x0004007f, 0x00000006, 0x00000be3, 0x00000ba7, 0x0007000c, 0x00000006,
0x00000be5, 0x00000001, 0x00000028, 0x00000be3, 0x00000bc5, 0x0004007f, 0x00000006, 0x00000be7,
0x00000baf, 0x0007000c, 0x00000006, 0x00000be9, 0x00000001, 0x00000028, 0x00000be7, 0x00000bd3,
0x0004007f, 0x00000006, 0x00000beb, 0x00000bb7, 0x0007000c, 0x00000006, 0x00000bed, 0x00000001,
0x00000028, 0x00000beb, 0x00000be1, 0x0007000c, 0x00000006, 0x00000d48, 0x00000001, 0x00000028,
0x00000be9, 0x00000bed, 0x0007000c, 0x00000006, 0x00000d49, 0x00000001, 0x00000028, 0x00000be5,
0x00000d48, 0x0007000c, 0x00000006, 0x00000bf4, 0x00000001, 0x00000025, 0x00000d49, 0x00000085,
0x0007000c, 0x00000006, 0x00000bf5, 0x00000001, 0x00000028, 0x0000027a, 0x00000bf4, 0x00050085,
0x00000006, 0x00000bf9, 0x00000bf5, 0x00000349, 0x00050085, 0x00000006, 0x00000bfc, 0x00000219,
0x00000bf9, 0x00050081, 0x00000006, 0x00000bfe, 0x00000bfc, 0x0000007d, 0x0004007c, 0x0000000c,
0x00000d5a, 0x00000bfe, 0x00050082, 0x0000000c, 0x00000d5b, 0x0000008e, 0x00000d5a, 0x0004007c,
0x00000006, 0x00000d5c, 0x00000d5b, 0x0004007f, 0x00000006, 0x00000d5f, 0x00000d5c, 0x00050085,
0x00000006, 0x00000d61, 0x00000d5f, 0x00000bfe, 0x00050081, 0x00000006, 0x00000d63, 0x00000d61,
0x0000009a, 0x00050085, 0x00000006, 0x00000d64, 0x00000d5c, 0x00000d63, 0x00050081, 0x00000006,
0x00001173, 0x00000ae5, 0x00000aeb, 0x00050081, 0x00000006, 0x00001174, 0x00001173, 0x00000afd,
0x00050081, 0x00000006, 0x00001175, 0x00001174, 0x00000af7, 0x00050085, 0x00000006, 0x00000c0e,
0x00000bf9, 0x00001175, 0x00050081, 0x00000006, 0x00000c10, 0x00000c0e, 0x00000af1, 0x00050085,
0x00000006, 0x00000c12, 0x00000c10, 0x00000d64, 0x00050081, 0x00000006, 0x00001176, 0x00000ae7,
0x00000aed, 0x00050081, 0x00000006, 0x00001177, 0x00001176, 0x00000aff, 0x00050081, 0x00000006,
0x00001178, 0x00001177, 0x00000af9, 0x00050085, 0x00000006, 0x00000c21, 0x00000bf9, 0x00001178,
0x00050081, 0x00000006, 0x00000c23, 0x00000c21, 0x00000af3, 0x00050085, 0x00000006, 0x00000c25,
0x00000c23, 0x00000d64, 0x00050081, 0x00000006, 0x00001179, 0x00000ae9, 0x00000aef, 0x00050081,
0x00000006, 0x0000117a, 0x00001179, 0x00000b01, 0x00050081, 0x00000006, 0x0000117b, 0x0000117a,
0x00000afb, 0x00050085, 0x00000006, 0x00000c34, 0x00000bf9, 0x0000117b, 0x00050081, 0x00000006,
0x00000c36, 0x00000c34, 0x00000af5, 0x00050085, 0x00000006, 0x00000c38, 0x00000c36, 0x00000d64,
0x0004003d, 0x000002f7, 0x00000a40, 0x000002f9, 0x00070050, 0x00000039, 0x00000a47, 0x00000c12,
0x00000c25, 0x00000c38, 0x0000007d, 0x00040063, 0x00000a40, 0x00000ad0, 0x00000a47, 0x000200f9,
0x00000a48, 0x000200f8, 0x00000a48, 0x00060052, 0x00000031, 0x00001124, 0x00000387, 0x00001172,
0x00000000, 0x000300f7, 0x00000d97, 0x00000000, 0x000300fb, 0x000000c9, 0x00000d73, 0x000200f8,
0x00000d73, 0x000300f7, 0x00000d82, 0x00000000, 0x000400fa, 0x0000038c, 0x00000d7b, 0x00000d82,
0x000200f8, 0x00000d7b, 0x00060041, 0x000002d6, 0x00000d7e, 0x000002d5, 0x00000069, 0x000000a1,
0x0004003d, 0x00000006, 0x00000d7f, 0x00000d7e, 0x0004006d, 0x0000000c, 0x00000d80, 0x00000d7f,
0x000500ae, 0x000002d0, 0x00000d81, 0x0000032d, 0x00000d80, 0x000200f9, 0x00000d82, 0x000200f8,
0x00000d82, 0x000700f5, 0x000002d0, 0x00000d83, 0x0000038b, 0x00000d73, 0x00000d81, 0x00000d7b,
0x000300f7, 0x00000d85, 0x00000000, 0x000400fa, 0x00000d83, 0x00000d84, 0x00000d85, 0x000200f8,
0x00000d84, 0x000200f9, 0x00000d97, 0x000200f8, 0x00000d85, 0x0004007c, 0x00000037, 0x00000e1f,
0x00001124, 0x00050080, 0x00000037, 0x00000e21, 0x00000e1f, 0x000000d9, 0x0004003d, 0x000000b6,
0x00000f8a, 0x000000b8, 0x00040064, 0x000000b5, 0x00000f8c, 0x00000f8a, 0x0007005f, 0x00000039,
0x00000f8d, 0x00000f8c, 0x00000e21, 0x00000002, 0x00000069, 0x00050080, 0x00000037, 0x00000e25,
0x00000e1f, 0x000000e0, 0x0004003d, 0x000000b6, 0x00000f90, 0x000000b8, 0x00040064, 0x000000b5,
0x00000f92, 0x00000f90, 0x0007005f, 0x00000039, 0x00000f93, 0x00000f92, 0x00000e25, 0x00000002,
0x00000069, 0x0004003d, 0x000000b6, 0x00000f96, 0x000000b8, 0x00040064, 0x000000b5, 0x00000f98,
0x00000f96, 0x0007005f, 0x00000039, 0x00000f99, 0x00000f98, 0x00000e1f, 0x00000002, 0x00000069,
0x00050080, 0x00000037, 0x00000e2c, 0x00000e1f, 0x000000ed, 0x0004003d, 0x000000b6, 0x00000f9c,
0x000000b8, 0x00040064, 0x000000b5, 0x00000f9e, 0x00000f9c, 0x0007005f, 0x00000039, 0x00000f9f,
0x00000f9e, 0x00000e2c, 0x00000002, 0x00000069, 0x00050080, 0x00000037, 0x00000e30, 0x00000e1f,
0x000000f4, 0x0004003d, 0x000000b6, 0x00000fa2, 0x000000b8, 0x00040064, 0x000000b5, 0x00000fa4,
0x00000fa2, 0x0007005f, 0x00000039, 0x00000fa5, 0x00000fa4, 0x00000e30, 0x00000002, 0x00000069,
0x00050051, 0x00000006, 0x00000e34, 0x00000f8d, 0x00000000, 0x00050051, 0x00000006, 0x00000e36,
0x00000f8d, 0x00000001, 0x00050051, 0x00000006, 0x00000e38, 0x00000f8d, 0x00000002, 0x00050051,
0x00000006, 0x00000e3a, 0x00000f93, 0x00000000, 0x00050051, 0x00000006, 0x00000e3c, 0x00000f93,
0x00000001, 0x00050051, 0x00000006, 0x00000e3e, 0x00000f93, 0x00000002, 0x00050051, 0x00000006,
0x00000e40, 0x00000f99, 0x00000000, 0x00050051, 0x00000006, 0x00000e42, 0x00000f99, 0x00000001,
0x00050051, 0x00000006, 0x00000e44, 0x00000f99, 0x00000002, 0x00050051, 0x00000006, 0x00000e46,
0x00000f9f, 0x00000000, 0x00050051, 0x00000006, 0x00000e48, 0x00000f9f, 0x00000001, 0x00050051,
0x00000006, 0x00000e4a, 0x00000f9f, 0x00000002, 0x00050051, 0x00000006, 0x00000e4c, 0x00000fa5,
0x00000000, 0x00050051, 0x00000006, 0x00000e4e, 0x00000fa5, 0x00000001, 0x00050051, 0x00000006,
0x00000e50, 0x00000fa5, 0x00000002, 0x0007000c, 0x00000006, 0x00001022, 0x00000001, 0x00000025,
0x00000e3a, 0x00000e46, 0x0007000c, 0x00000006, 0x00001023, 0x00000001, 0x00000025, 0x00000e34,
0x00001022, 0x0007000c, 0x00000006, 0x00000ed0, 0x00000001, 0x00000025, 0x00001023, 0x00000e4c,
0x0007000c, 0x00000006, 0x00001029, 0x00000001, 0x00000025, 0x00000e3c, 0x00000e48, 0x0007000c,
0x00000006, 0x0000102a, 0x00000001, 0x00000025, 0x00000e36, 0x00001029, 0x0007000c, 0x00000006,
0x00000ed6, 0x00000001, 0x00000025, 0x0000102a, 0x00000e4e, 0x0007000c, 0x00000006, 0x00001030,
0x00000001, 0x00000025, 0x00000e3e, 0x00000e4a, 0x0007000c, 0x00000006, 0x00001031, 0x00000001,
0x00000025, 0x00000e38, 0x00001030, 0x0007000c, 0x00000006, 0x00000edc, 0x00000001, 0x00000025,
0x00001031, 0x00000e50, 0x0007000c, 0x00000006, 0x00001037, 0x00000001, 0x00000028, 0x00000e3a,
0x00000e46, 0x0007000c, 0x00000006, 0x00001038, 0x00000001, 0x00000028, 0x00000e34, 0x00001037,
0x0007000c, 0x00000006, 0x00000ee2, 0x00000001, 0x00000028, 0x00001038, 0x00000e4c, 0x0007000c,
0x00000006, 0x0000103e, 0x00000001, 0x00000028, 0x00000e3c, 0x00000e48, 0x0007000c, 0x00000006,
0x0000103f, 0x00000001, 0x00000028, 0x00000e36, 0x0000103e, 0x0007000c, 0x00000006, 0x00000ee8,
0x00000001, 0x00000028, 0x0000103f, 0x00000e4e, 0x0007000c, 0x00000006, 0x00001045, 0x00000001,
0x00000028, 0x00000e3e, 0x00000e4a, 0x0007000c, 0x00000006, 0x00001046, 0x00000001, 0x00000028,
0x00000e38, 0x00001045, 0x0007000c, 0x00000006, 0x00000eee, 0x00000001, 0x00000028, 0x00001046,
0x00000e50, 0x0007000c, 0x00000006, 0x00000ef1, 0x00000001, 0x00000025, 0x00000ed0, 0x00000e40,
0x00050088, 0x00000006, 0x0000104f, 0x0000115d, 0x00000ee2, 0x00050085, 0x00000006, 0x00000ef6,
0x00000ef1, 0x0000104f, 0x0007000c, 0x00000006, 0x00000ef9, 0x00000001, 0x00000025, 0x00000ed6,
0x00000e42, 0x00050088, 0x00000006, 0x0000105b, 0x0000115d, 0x00000ee8, 0x00050085, 0x00000006,
0x00000efe, 0x00000ef9, 0x0000105b, 0x0007000c, 0x00000006, 0x00000f01, 0x00000001, 0x00000025,
0x00000edc, 0x00000e44, 0x00050088, 0x00000006, 0x00001067, 0x0000115d, 0x00000eee, 0x00050085,
0x00000006, 0x00000f06, 0x00000f01, 0x00001067, 0x0007000c, 0x00000006, 0x00000f0b, 0x00000001,
0x00000028, 0x00000ee2, 0x00000e40, 0x00050083, 0x00000006, 0x00000f0c, 0x0000007d, 0x00000f0b,
0x00050085, 0x00000006, 0x00000f0f, 0x00000219, 0x00000ed0, 0x00050081, 0x00000006, 0x00000f12,
0x00000f0f, 0x00000213, 0x00050088, 0x00000006, 0x00001073, 0x0000007d, 0x00000f12, 0x00050085,
0x00000006, 0x00000f14, 0x00000f0c, 0x00001073, 0x0007000c, 0x00000006, 0x00000f19, 0x00000001,
0x00000028, 0x00000ee8, 0x00000e42, 0x00050083, 0x00000006, 0x00000f1a, 0x0000007d, 0x00000f19,
0x00050085, 0x00000006, 0x00000f1d, 0x00000219, 0x00000ed6, 0x00050081, 0x00000006, 0x00000f20,
0x00000f1d, 0x00000213, 0x00050088, 0x00000006, 0x0000107f, 0x0000007d, 0x00000f20, 0x00050085,
0x00000006, 0x00000f22, 0x00000f1a, 0x0000107f, 0x0007000c, 0x00000006, 0x00000f27, 0x00000001,
0x00000028, 0x00000eee, 0x00000e44, 0x00050083, 0x00000006, 0x00000f28, 0x0000007d, 0x00000f27,
0x00050085, 0x00000006, 0x00000f2b, 0x00000219, 0x00000edc, 0x00050081, 0x00000006, 0x00000f2e,
0x00000f2b, 0x00000213, 0x00050088, 0x00000006, 0x0000108b, 0x0000007d, 0x00000f2e, 0x00050085,
0x00000006, 0x00000f30, 0x00000f28, 0x0000108b, 0x0004007f, 0x00000006, 0x00000f32, 0x00000ef6,
0x0007000c, 0x00000006, 0x00000f34, 0x00000001, 0x00000028, 0x00000f32, 0x00000f14, 0x0004007f,
0x00000006, 0x00000f36, 0x00000efe, 0x0007000c, 0x00000006, 0x00000f38, 0x00000001, 0x00000028,
0x00000f36, 0x00000f22, 0x0004007f, 0x00000006, 0x00000f3a, 0x00000f06, 0x0007000c, 0x00000006,
0x00000f3c, 0x00000001, 0x00000028, 0x00000f3a, 0x00000f30, 0x0007000c, 0x00000006, 0x00001097,
0x00000001, 0x00000028, 0x00000f38, 0x00000f3c, 0x0007000c, 0x00000006, 0x00001098, 0x00000001,
0x00000028, 0x00000f34, 0x00001097, 0x0007000c, 0x00000006, 0x00000f43, 0x00000001, 0x00000025,
0x00001098, 0x00000085, 0x0007000c, 0x00000006, 0x00000f44, 0x00000001, 0x00000028, 0x0000027a,
0x00000f43, 0x00050085, 0x00000006, 0x00000f48, 0x00000f44, 0x00000349, 0x00050085, 0x00000006,
0x00000f4b, 0x00000219, 0x00000f48, 0x00050081, 0x00000006, 0x00000f4d, 0x00000f4b, 0x0000007d,
0x0004007c, 0x0000000c, 0x000010a9, 0x00000f4d, 0x00050082, 0x0000000c, 0x000010aa, 0x0000008e,
0x000010a9, 0x0004007c, 0x00000006, 0x000010ab, 0x000010aa, 0x0004007f, 0x00000006, 0x000010ae,
0x000010ab, 0x00050085, 0x00000006, 0x000010b0, 0x000010ae, 0x00000f4d, 0x00050081, 0x00000006,
0x000010b2, 0x000010b0, 0x0000009a, 0x00050085, 0x00000006, 0x000010b3, 0x000010ab, 0x000010b2,
0x00050081, 0x00000006, 0x0000117d, 0x00000e34, 0x00000e3a, 0x00050081, 0x00000006, 0x0000117e,
0x0000117d, 0x00000e4c, 0x00050081, 0x00000006, 0x0000117f, 0x0000117e, 0x00000e46, 0x00050085,
0x00000006, 0x00000f5d, 0x00000f48, 0x0000117f, 0x00050081, 0x00000006, 0x00000f5f, 0x00000f5d,
0x00000e40, 0x00050085, 0x00000006, 0x00000f61, 0x00000f5f, 0x000010b3, 0x00050081, 0x00000006,
0x00001180, 0x00000e36, 0x00000e3c, 0x00050081, 0x00000006, 0x00001181, 0x00001180, 0x00000e4e,
0x00050081, 0x00000006, 0x00001182, 0x00001181, 0x00000e48, 0x00050085, 0x00000006, 0x00000f70,
0x00000f48, 0x00001182, 0x00050081, 0x00000006, 0x00000f72, 0x00000f70, 0x00000e42, 0x00050085,
0x00000006, 0x00000f74, 0x00000f72, 0x000010b3, 0x00050081, 0x00000006, 0x00001183, 0x00000e38,
0x00000e3e, 0x00050081, 0x00000006, 0x00001184, 0x00001183, 0x00000e50, 0x00050081, 0x00000006,
0x00001185, 0x00001184, 0x00000e4a, 0x00050085, 0x00000006, 0x00000f83, 0x00000f48, 0x00001185,
0x00050081, 0x00000006, 0x00000f85, 0x00000f83, 0x00000e44, 0x00050085, 0x00000006, 0x00000f87,
0x00000f85, 0x000010b3, 0x0004003d, 0x000002f7, 0x00000d8f, 0x000002f9, 0x00070050, 0x00000039,
0x00000d96, 0x00000f61, 0x00000f74, 0x00000f87, 0x0000007d, 0x00040063, 0x00000d8f, 0x00000e1f,
0x00000d96, 0x000200f9, 0x00000d97, 0x000200f8, 0x00000d97, 0x000100fd, 0x00010038,
};
+20 -16
View File
@@ -739,7 +739,7 @@ static void save_capture(const char *path) {
rt_log("gfx: menu test shot %s (%dx%d)", path, g_cap_w, g_cap_h);
}
static void present_image(VkImage src, VkImageLayout layout, int w, int h, const int crop[4], int defer) {
static void present_image(VkImage src, VkImageLayout layout, VkFormat fmt, int w, int h, const int crop[4], int defer) {
int general = layout == VK_IMAGE_LAYOUT_GENERAL;
gfx_window_start();
VkCtx *c = vk_ctx();
@@ -794,17 +794,21 @@ static void present_image(VkImage src, VkImageLayout layout, int w, int h, const
VkImage dst = g_sc_img[idx];
sync_barrier(cb, dst, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_PIPELINE_STAGE_2_TRANSFER_BIT, 0,
VK_PIPELINE_STAGE_2_TRANSFER_BIT, VK_ACCESS_2_TRANSFER_WRITE_BIT);
if (general) // a GENERAL source (vk_texture.c images): earlier submissions' writes become visible to the blit here
sync_barrier(cb, src, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL, VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
VK_ACCESS_2_MEMORY_WRITE_BIT, VK_PIPELINE_STAGE_2_TRANSFER_BIT, VK_ACCESS_2_TRANSFER_READ_BIT);
VkImageBlit region = {
.srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, .srcOffsets = {{cx, cy, 0}, {cx + cw, cy + ch, 1}},
.dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, .dstOffsets = {{0, 0, 0}, {(int)g_sc_ext.width, (int)g_sc_ext.height, 1}}};
vkCmdBlitImage(cb, src, general ? VK_IMAGE_LAYOUT_GENERAL : VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, dst,
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &region, VK_FILTER_LINEAR);
if (general) // later submissions that write the source wait for the blit's read
sync_barrier(cb, src, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL, VK_PIPELINE_STAGE_2_TRANSFER_BIT, 0,
VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, 0);
const int rect[4] = {cx, cy, cw, ch};
// FSR (TOTK_UPSCALER) when the swapchain is larger than the crop; else the bilinear blit
if (!general || !vk_fsr_record(cb, slot, src, fmt, w, h, rect, dst, g_sc_ext.width, g_sc_ext.height)) {
if (general) // a GENERAL source (vk_texture.c images): earlier submissions' writes become visible to the blit here
sync_barrier(cb, src, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL, VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
VK_ACCESS_2_MEMORY_WRITE_BIT, VK_PIPELINE_STAGE_2_TRANSFER_BIT, VK_ACCESS_2_TRANSFER_READ_BIT);
VkImageBlit region = {
.srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, .srcOffsets = {{cx, cy, 0}, {cx + cw, cy + ch, 1}},
.dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, .dstOffsets = {{0, 0, 0}, {(int)g_sc_ext.width, (int)g_sc_ext.height, 1}}};
vkCmdBlitImage(cb, src, general ? VK_IMAGE_LAYOUT_GENERAL : VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, dst,
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &region, VK_FILTER_LINEAR);
if (general) // later submissions that write the source wait for the blit's read
sync_barrier(cb, src, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL, VK_PIPELINE_STAGE_2_TRANSFER_BIT, 0,
VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, 0);
}
// last: the image's layout, and the stage and access of its last write, as each step leaves it
VkImageLayout last = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
VkPipelineStageFlags2 last_stage = VK_PIPELINE_STAGE_2_TRANSFER_BIT;
@@ -879,12 +883,11 @@ out:
}
void vk_present_image(VkImage src, VkImageLayout layout, VkFormat fmt, int w, int h, const int crop[4]) {
(void)fmt;
present_image(src, layout, w, h, crop, 0);
present_image(src, layout, fmt, w, h, crop, 0);
}
void vk_present_blit(VkImage src, VkImageLayout layout, int w, int h, const int crop[4]) {
present_image(src, layout, w, h, crop, 1);
void vk_present_blit(VkImage src, VkImageLayout layout, VkFormat fmt, int w, int h, const int crop[4]) {
present_image(src, layout, fmt, w, h, crop, 1);
}
void vk_present_flip(void) {
@@ -913,6 +916,7 @@ void gfx_window_release_vk(void) {
vk_queue_unlock();
g_flip_on = 0; // its blit is done (device idle); the swapchain goes away unpresented
menu_vk_release();
vk_fsr_release();
free_capture();
free_thumbs();
for (int i = 0; i < FRAMES; i++) {
+7
View File
@@ -225,6 +225,13 @@ void account_uid(uint64_t out[2]); // the local user's n
// ---- movies (ov_movie.c)
void movie_tick(Cpu *c); // at every present, on the presenting guest thread: hands
// decoded movie frames over when due, signals their events
// ---- game resolution (resolution.c): TOTK_OUTPUT_RES, TOTK_RENDER_SCALE
uint64_t res_heap_extra_bytes(void); // added to the application pool (mem_init), 2 MiB steps
uint64_t res_heap_extra_kib(void); // added to the HeapDef texture heap and its parent; 0 = none
int res_heapdef_build(const void *in, size_t n, void **out, size_t *out_n); // the HeapDef table (.byml.zs) with
// the grown heaps, malloc'd; 0 = cannot (logged)
void res_heapdef_served(void); // romfs.c serves the grown table
void res_init(void); // after rt_patches_init: the patch page and the sets
// ---- code patches (patches.c) and the frame step (frame_rate.c)
void rt_patches_init(void); // after ldr_load: switches from the environment, the patch
// page committed; logs the sets
+1 -1
View File
@@ -261,7 +261,7 @@ void mem_init(void) {
.alias = {alias, ALIAS_SIZE},
.kernel = {RT_KERNEL_BASE, RT_KERNEL_SIZE},
.hostfn = {RT_HOSTFN_BASE, RT_HOSTFN_SIZE},
.pool = pool ? strtoull(pool, NULL, 0) : DEFAULT_POOL,
.pool = pool ? strtoull(pool, NULL, 0) : DEFAULT_POOL + res_heap_extra_bytes(), // resolution.c
};
if (!L.pool) rt_fatal("memory: TOTK_APP_POOL is 0");
}
+218
View File
@@ -0,0 +1,218 @@
// Game resolution: the size the game composes its frame in (its output: canvas, UI and swapchain) and the size of its
// 3D scene, above the shipped 1920x1080 and 1600x900. The game does the rendering itself, as with the community
// resolution mods (UltraCam, Visual Fixes): the patch sets output and scene (recomp/patches-v121.txt,
// patches-v143.txt; MacNativeGames games/totk/runtime/game_patches.c and game_patches_v143.c, MIT, Copyright (c) 2026
// MacNativeGames contributors) make the game read both sizes from the patch page, and the texture heap that holds the
// output- and scene-sized render targets grows with them.
//
// Settings, read at start: TOTK_OUTPUT_RES = <w>x<h> (default 1920x1080, the game's own), TOTK_RENDER_SCALE = the
// scene's size relative to the output: "game" (default, 5/6, the game's 1600x900 at 1080p) or a percentage; above 100
// the game supersamples its scene, which smooths edges (anti-aliasing) at the cost of GPU time. The game's own final
// pass (FSR 1 EASU) scales the scene to the output; the present scales the output to the window (vk_fsr.c).
//
// Patch page: +16 the scene size {w, h} as floats, +32 the output size and +48 the swapchain size as {w, h} in one
// 64-bit word, +40 the renderer (1.2.1) or display configuration (1.4.3) the patched code stores there.
// Both versions scale the scene they read by output width / 1920 (MacNativeGames measured it on 1.4.3: 2560x1440 asked
// on a 2560x1440 canvas rendered 3408x1920), so the page holds the wanted size divided by that factor.
//
// Heap: agl's DynamicTextureAllocator is one fixed heap, "DynamicTextureAllocatorMem" in
// System/HeapSize/Product.Nin_NX_NVN.HeapDef.byml.zs (113664 KiB, carved from "Graphics", 201728 KiB). At 2560x1440
// the shipped size runs out at the title screen. Both heaps grow by the same amount: the shipped size times the output's
// pixel ratio above 1920x1080 plus the scene's above 1600x900 (MacNativeGames' measurement: a 3440x1440 canvas with a
// 4620x1935 scene crashed at +258 MiB and loaded at +400 MiB; this formula gives +750 MiB there). romfs.c serves the
// 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.
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <zstd.h>
#include "cfg.h"
#include "host.h"
#define BASE_W 1920
#define BASE_H 1080
#define SCENE_W 1600
#define SCENE_H 900
#define DTA_KIB 113664u // DynamicTextureAllocatorMem, shipped
#define SCENE_MAX 4096 // per side, as MacNativeGames' TOTK_RENDER_RES
static struct {
int decided;
unsigned ow, oh, sw, sh; // output and scene
int scene_set; // the scene differs from the game's 5/6 of the output
int heapdef_ok; // romfs.c serves the grown HeapDef
} R;
static void decide(void) {
if (R.decided) return;
R.decided = 1;
R.ow = BASE_W;
R.oh = BASE_H;
const char *o = cfg_value("TOTK_OUTPUT_RES");
unsigned w = 0, h = 0;
char tail;
if (sscanf(o, "%ux%u%c", &w, &h, &tail) == 2 && w >= 1280 && h >= 720 && w <= 7680 && h <= 4320) {
R.ow = w & ~1u;
R.oh = h & ~1u;
} else {
rt_log("resolution: TOTK_OUTPUT_RES=%s is not <width>x<height> in 1280x720..7680x4320; 1920x1080", o);
}
const char *s = cfg_value("TOTK_RENDER_SCALE");
double k = 5.0 / 6.0;
if (strcmp(s, "game")) {
char *end;
double pct = strtod(s, &end);
if (end != s && !*end && pct >= 25 && pct <= 400) {
k = pct / 100.0;
R.scene_set = 1;
} else {
rt_log("resolution: TOTK_RENDER_SCALE=%s is not game or a percentage 25..400; game", s);
}
}
double sw = R.ow * k, sh = R.oh * k;
double fit = fmin(1.0, fmin(SCENE_MAX / sw, SCENE_MAX / sh));
if (fit < 1.0) R.scene_set = 1;
R.sw = (unsigned)(sw * fit + 0.5);
R.sh = (unsigned)(sh * fit + 0.5);
}
static int bigger(void) {
decide();
return R.ow != BASE_W || R.oh != BASE_H || R.scene_set;
}
uint64_t res_heap_extra_kib(void) {
if (!bigger()) return 0;
double grow = fmax(0.0, (double)R.ow * R.oh / (BASE_W * BASE_H) - 1.0) +
fmax(0.0, (double)R.sw * R.sh / (SCENE_W * SCENE_H) - 1.0);
if (grow <= 0) return 0;
return (uint64_t)ceil(DTA_KIB * (1.0 + grow) / 1024.0) * 1024 - DTA_KIB;
}
uint64_t res_heap_extra_bytes(void) { return ((res_heap_extra_kib() << 10) + 0x1fffff) & ~0x1fffffull; }
// ---- the HeapDef table. BYML version 2..7, little endian ("YB"): a hash node is {u8 0xC1, u24 count} and count
// entries {u24 key index, u8 type, u32 value}; an int (type 0xD1) is stored in the entry, so a size changes in place.
typedef struct { uint8_t *p; size_t n; uint32_t keys; } Byml;
static int u32_at(const Byml *b, size_t off, uint32_t *v) {
if (off + 4 > b->n) return 0;
memcpy(v, b->p + off, 4);
return 1;
}
static const char *key_name(const Byml *b, uint32_t k) {
uint32_t head, at;
if (!u32_at(b, b->keys, &head) || (head & 0xff) != 0xc2 || k >= head >> 8 || !u32_at(b, b->keys + 4 + 4 * k, &at) ||
b->keys + at >= b->n || !memchr(b->p + b->keys + at, 0, b->n - b->keys - at))
return NULL;
return (const char *)b->p + b->keys + at;
}
// The offset of the value of hash node `node`'s entry `name`, which must have type `type`; 0 when there is none.
static size_t field(const Byml *b, uint32_t node, const char *name, uint8_t type) {
uint32_t head;
if (!u32_at(b, node, &head) || (head & 0xff) != 0xc1) return 0;
for (uint32_t i = 0; i < head >> 8; i++) {
uint32_t e;
if (!u32_at(b, node + 4 + 8 * (size_t)i, &e)) return 0;
const char *k = key_name(b, e & 0xffffff);
if (k && !strcmp(k, name)) return e >> 24 == type ? node + 8 + 8 * (size_t)i : 0;
}
return 0;
}
static size_t heap_size_field(const Byml *b, uint32_t heaps, const char *heap) {
size_t at = field(b, heaps, heap, 0xc1);
uint32_t node;
return at && u32_at(b, at, &node) ? field(b, node, "Size", 0xd1) : 0;
}
int res_heapdef_build(const void *in, size_t n, void **out, size_t *out_n) {
uint64_t extra = res_heap_extra_kib();
*out = NULL;
if (!extra) return 0;
if (ZSTD_getDictID_fromFrame(in, n)) {
rt_log("resolution: the HeapDef table needs a zstd dictionary; the game keeps its own resolution");
return 0;
}
unsigned long long raw = ZSTD_getFrameContentSize(in, n);
if (raw == ZSTD_CONTENTSIZE_UNKNOWN || raw == ZSTD_CONTENTSIZE_ERROR || raw > (64u << 20)) {
rt_log("resolution: the HeapDef table is not a zstd frame with a size; the game keeps its own resolution");
return 0;
}
Byml b = {malloc((size_t)raw), (size_t)raw, 0};
if (!b.p) return 0;
size_t got = ZSTD_decompress(b.p, b.n, in, n);
uint32_t root, heaps = 0;
uint16_t ver = 0;
if (!ZSTD_isError(got) && got == b.n && b.n >= 16) memcpy(&ver, b.p + 2, 2);
size_t heaps_at = 0, dta_at = 0, gfx_at = 0;
if (ver >= 2 && ver <= 7 && !memcmp(b.p, "YB", 2) && u32_at(&b, 4, &b.keys) && u32_at(&b, 12, &root) &&
(heaps_at = field(&b, root, "Heaps", 0xc1)) && u32_at(&b, heaps_at, &heaps)) {
dta_at = heap_size_field(&b, heaps, "DynamicTextureAllocatorMem");
gfx_at = heap_size_field(&b, heaps, "Graphics");
}
if (!dta_at || !gfx_at) {
rt_log("resolution: the HeapDef table has no DynamicTextureAllocatorMem / Graphics sizes; the game keeps its own "
"resolution");
free(b.p);
return 0;
}
int32_t dta, gfx;
memcpy(&dta, b.p + dta_at, 4);
memcpy(&gfx, b.p + gfx_at, 4);
int32_t dta2 = dta + (int32_t)extra, gfx2 = gfx + (int32_t)extra;
memcpy(b.p + dta_at, &dta2, 4);
memcpy(b.p + gfx_at, &gfx2, 4);
size_t cap = ZSTD_compressBound(b.n);
void *z = malloc(cap);
size_t zn = z ? ZSTD_compress(z, cap, b.p, b.n, 9) : 0;
free(b.p);
if (!z || ZSTD_isError(zn)) {
free(z);
return 0;
}
*out = z;
*out_n = zn;
rt_log("resolution: HeapDef DynamicTextureAllocatorMem %d -> %d KiB, Graphics %d -> %d KiB", dta, dta2, gfx, gfx2);
return 1;
}
void res_heapdef_served(void) { R.heapdef_ok = 1; }
// ---- start: the patch page and the sets
static uint64_t pack(unsigned w, unsigned h) { return (uint64_t)h << 32 | w; }
void res_init(void) {
if (!bigger()) {
rt_log("resolution: the game's own (output 1920x1080, scene 1600x900)");
return;
}
int output = rt_patch_set("output"), scene = rt_patch_set("scene");
if (output < 0 || scene < 0) {
rt_log("resolution: the generated C has no output and scene patch sets; the game keeps its own resolution");
return;
}
fs_init(); // romfs.c serves the grown HeapDef from here on (res_heapdef_served)
if (!R.heapdef_ok) {
rt_log("resolution: no grown HeapDef table; the game keeps its own resolution");
return;
}
uint8_t *page = rt_patch_page();
double k = (double)R.ow / BASE_W; // the game's own scaling of the scene with the output width
float sc[2] = {(float)(R.sw / k), (float)(R.sh / k)};
uint64_t out = pack(R.ow, R.oh), none = 0;
memcpy(page + 16, sc, sizeof sc);
memcpy(page + 32, &out, 8);
memcpy(page + 40, &none, 8);
memcpy(page + 48, &out, 8);
rt_patch_switch(output, R.ow != BASE_W || R.oh != BASE_H);
rt_patch_switch(scene, R.scene_set);
rt_log("resolution: output %ux%u, scene %ux%u%s; texture heap +%llu KiB", R.ow, R.oh, R.sw, R.sh,
R.scene_set ? "" : " (the game's 5/6)", (unsigned long long)res_heap_extra_kib());
}
+65
View File
@@ -343,6 +343,70 @@ static void added_init(void) {
rt_log("RomFS overlay: %zu files added to the RomFS", nadded);
}
// The HeapDef table a bigger game resolution needs (resolution.c): its texture heap and that heap's parent grow. The
// base is an overlay that replaces the table (a mod's heap sizes stay), else the RomFS original; the grown table is
// written to <profile>/resolution/ and served in the base's place.
#define HEAPDEF "System/HeapSize/Product.Nin_NX_NVN.HeapDef.byml.zs"
static void heapdef_overlay(void) {
if (!res_heap_extra_kib()) return;
uint64_t i = lower(HEAPDEF);
if (i >= file_count || strcmp(entry_name(entry(i)), HEAPDEF)) {
rt_log("RomFS: %s missing; the game keeps its own resolution", HEAPDEF);
return;
}
Overlay *base = NULL;
for (size_t k = 0; k < noverlay; k++)
if (overlays[k].index == i) base = &overlays[k];
HANDLE f = base ? open_read(base->path, 1) : image;
uint64_t off = base ? 0 : entry(i).offset, n = base ? base->size : entry(i).size;
void *in = n && n < (16u << 20) && f != INVALID_HANDLE_VALUE ? malloc((size_t)n) : NULL;
int ok = in && read_at(f, in, (uint32_t)n, off) == (int64_t)n;
if (base && f != INVALID_HANDLE_VALUE) CloseHandle(f);
void *out = NULL;
size_t out_n = 0;
ok = ok && res_heapdef_build(in, (size_t)n, &out, &out_n);
free(in);
if (!ok) return;
char dir[2100], file[2200];
need(snprintf(dir, sizeof dir, "%s/resolution", rt_config()->profile) < (int)sizeof dir, "resolution path");
need(snprintf(file, sizeof file, "%s/Product.Nin_NX_NVN.HeapDef.byml.zs", dir) < (int)sizeof file, "resolution path");
wchar_t *wd = fs_wide(dir), *wf = fs_wide(file);
CreateDirectoryW(wd, NULL);
HANDLE w = CreateFileW(wf, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
DWORD put = 0;
ok = w != INVALID_HANDLE_VALUE && WriteFile(w, out, (DWORD)out_n, &put, NULL) && put == out_n;
if (w != INVALID_HANDLE_VALUE) CloseHandle(w);
free(wd);
free(wf);
free(out);
HANDLE r = ok ? open_read(file, 1) : INVALID_HANDLE_VALUE;
if (r == INVALID_HANDLE_VALUE) {
rt_log("RomFS: cannot write %s (error %lu); the game keeps its own resolution", file, GetLastError());
return;
}
Identity id = identity_of(r);
CloseHandle(r);
char *copy = _strdup(file);
need(copy != NULL, "overlay path copy");
if (base) {
free(base->path);
base->path = copy;
base->size = out_n;
base->id = id;
} else {
if (noverlay == overlay_cap) {
overlay_cap = overlay_cap ? overlay_cap * 2 : 16;
overlays = realloc(overlays, overlay_cap * sizeof *overlays);
need(overlays != NULL, "overlay table");
}
char *rel = _strdup(HEAPDEF);
need(rel != NULL, "overlay path copy");
overlays[noverlay++] = (Overlay){i, out_n, copy, rel, id};
}
rt_log("RomFS overlay: %s (%zu bytes, grown heaps) replaces %s", file, out_n, base ? "the mod's table" : "the original");
res_heapdef_served();
}
static void overlay_init(void) {
// TOTK_ROMFS_PATCHES unset: romfs-patches next to romfs-index.bin if it has a manifest (tools/make_romfs_patches.py)
char def[2100];
@@ -355,6 +419,7 @@ static void overlay_init(void) {
const char *dirs[2] = {patches, cfg_get("TOTK_ROMFS_MODS")};
for (int i = 0; i < 2; i++)
if (dirs[i] && *dirs[i] && strcmp(dirs[i], "0")) overlay_load(dirs[i]);
heapdef_overlay();
added_init();
if (noverlay) qsort(overlays, noverlay, sizeof *overlays, overlay_order);
for (size_t k = 1; k < noverlay; k++)
+19
View File
@@ -0,0 +1,19 @@
Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+46
View File
@@ -0,0 +1,46 @@
// AMD FidelityFX Super Resolution 1 edge-adaptive upscale (EASU) of the game's output to the swapchain size
// (runtime/vk_fsr.c). ffx/ffx_a.h and ffx/ffx_fsr1.h are AMD's headers, unmodified (MIT, ffx/LICENSE.txt). Each
// invocation writes four pixels of a 16x16 tile, as AMD's sample does; the constants come from FsrEasuConOffset, so the
// game's crop rectangle can start anywhere in its image.
#version 450
#extension GL_GOOGLE_include_directive : require
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
layout(set = 0, binding = 0) uniform sampler2D src;
layout(set = 0, binding = 1, rgba16f) uniform writeonly image2D dst;
layout(push_constant) uniform Params {
vec4 view; // crop width, crop height, source image width, source image height
vec4 out_; // output width, output height, crop x, crop y
} pc;
#define A_GPU 1
#define A_GLSL 1
#include "ffx/ffx_a.h"
#define FSR_EASU_F 1
AF4 FsrEasuRF(AF2 p) { return textureGather(src, p, 0); }
AF4 FsrEasuGF(AF2 p) { return textureGather(src, p, 1); }
AF4 FsrEasuBF(AF2 p) { return textureGather(src, p, 2); }
#include "ffx/ffx_fsr1.h"
void put(AU2 p, AU4 c0, AU4 c1, AU4 c2, AU4 c3) {
if (p.x >= uint(pc.out_.x) || p.y >= uint(pc.out_.y)) return;
AF3 c;
FsrEasuF(c, p, c0, c1, c2, c3);
imageStore(dst, ivec2(p), vec4(c, 1.0));
}
void main() {
AU4 c0, c1, c2, c3;
FsrEasuConOffset(c0, c1, c2, c3, pc.view.x, pc.view.y, pc.view.z, pc.view.w, pc.out_.x, pc.out_.y, pc.out_.z,
pc.out_.w);
AU2 p = ARmp8x8(gl_LocalInvocationID.x) + AU2(gl_WorkGroupID.x << 4u, gl_WorkGroupID.y << 4u);
put(p, c0, c1, c2, c3);
p.x += 8u;
put(p, c0, c1, c2, c3);
p.y += 8u;
put(p, c0, c1, c2, c3);
p.x -= 8u;
put(p, c0, c1, c2, c3);
}
+41
View File
@@ -0,0 +1,41 @@
// AMD FidelityFX Super Resolution 1 robust contrast-adaptive sharpening (RCAS) of the EASU result
// (runtime/vk_fsr.c). ffx/ffx_a.h and ffx/ffx_fsr1.h are AMD's headers, unmodified (MIT, ffx/LICENSE.txt).
#version 450
#extension GL_GOOGLE_include_directive : require
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
layout(set = 0, binding = 0) uniform sampler2D src;
layout(set = 0, binding = 1, rgba16f) uniform writeonly image2D dst;
layout(push_constant) uniform Params {
vec4 size; // width, height, sharpness in stops (0 = most), unused
} pc;
#define A_GPU 1
#define A_GLSL 1
#include "ffx/ffx_a.h"
#define FSR_RCAS_F 1
AF4 FsrRcasLoadF(ASU2 p) { return texelFetch(src, p, 0); }
void FsrRcasInputF(inout AF1 r, inout AF1 g, inout AF1 b) {}
#include "ffx/ffx_fsr1.h"
void put(AU2 p, AU4 con) {
if (p.x >= uint(pc.size.x) || p.y >= uint(pc.size.y)) return;
AF3 c;
FsrRcasF(c.r, c.g, c.b, p, con);
imageStore(dst, ivec2(p), vec4(c, 1.0));
}
void main() {
AU4 con;
FsrRcasCon(con, pc.size.z);
AU2 p = ARmp8x8(gl_LocalInvocationID.x) + AU2(gl_WorkGroupID.x << 4u, gl_WorkGroupID.y << 4u);
put(p, con);
p.x += 8u;
put(p, con);
p.y += 8u;
put(p, con);
p.x -= 8u;
put(p, con);
}
+35
View File
@@ -402,6 +402,35 @@ static void row_window_size(void) {
opt_choice_list("TOTK_WINDOW_SIZE", UI_MENU_WINDOW_SIZE, pv, pn, n, UI_MENU_WINDOW_SIZE_DESC);
}
// The game resolution (resolution.c): 16:9 sizes from the game's own 1920x1080 up, and the current value when it is
// another size.
static void row_output_res(void) {
static const char *const vals[] = {"1920x1080", "2560x1440", "3200x1800", "3840x2160"};
enum { N = sizeof vals / sizeof *vals };
char shown[N][32];
const char *names[N];
for (int i = 0; i < N; i++) {
int w = 0, h = 0;
sscanf(vals[i], "%dx%d", &w, &h);
snprintf(shown[i], sizeof shown[i], "%d × %d", w, h); // U+00D7, the multiplication sign
names[i] = shown[i];
}
opt_choice_list("TOTK_OUTPUT_RES", UI_MENU_OUTPUT_RES, vals, names, N, UI_MENU_OUTPUT_RES_DESC);
}
static void row_render_scale(void) {
static const char *const vals[] = {"game", "50", "67", "75", "100", "125", "150", "200"};
enum { N = sizeof vals / sizeof *vals };
char shown[N][32];
const char *names[N];
names[0] = menu_text(UI_MENU_RENDER_SCALE_GAME);
for (int i = 1; i < N; i++) {
snprintf(shown[i], sizeof shown[i], "%s %%", vals[i]);
names[i] = shown[i];
}
opt_choice_list("TOTK_RENDER_SCALE", UI_MENU_RENDER_SCALE, vals, names, N, UI_MENU_RENDER_SCALE_DESC);
}
static void row_gpu(void) {
const char *vals[MAX_GPUS + 1], *names[MAX_GPUS + 1];
char idx[MAX_GPUS][4];
@@ -480,6 +509,12 @@ static void tab_screen(float scale) {
row_gpu();
static const UiTextId perf[] = {UI_MENU_PERF_OFF, UI_MENU_PERF_FPS, UI_MENU_PERF_FULL};
opt_choice("TOTK_PERF_OVERLAY", UI_MENU_PERF_OVERLAY, perf, 3, UI_MENU_PERF_OVERLAY_DESC);
opt_group(UI_MENU_GRAPHICS);
row_output_res();
row_render_scale();
static const UiTextId up[] = {UI_MENU_UPSCALER_FSR, UI_MENU_UPSCALER_BILINEAR};
opt_choice("TOTK_UPSCALER", UI_MENU_UPSCALER, up, 2, UI_MENU_UPSCALER_DESC);
opt_slider("TOTK_SHARPNESS", UI_MENU_SHARPNESS, 0, 100, UI_MENU_SHARPNESS_DESC, 5, "%.0f %%");
opt_end();
}
+28
View File
@@ -48,6 +48,20 @@ static const char *const text_en[UI_TEXT_COUNT] = {
[UI_MENU_PERF_OFF] = "Off", [UI_MENU_PERF_FPS] = "FPS", [UI_MENU_PERF_FULL] = "Full",
// printf format of the overlay line in FPS mode: the frame rate
[UI_PERF_LINE_FPS] = "%.0f fps",
[UI_MENU_GRAPHICS] = "Picture",
[UI_MENU_OUTPUT_RES] = "Game resolution",
[UI_MENU_OUTPUT_RES_DESC] = "The size the game draws its picture and interface in. Above 1920 x 1080 the game needs "
"more video memory and GPU time.",
[UI_MENU_RENDER_SCALE] = "3D render scale",
[UI_MENU_RENDER_SCALE_DESC] = "Size of the 3D scene relative to the game resolution; the game's FSR scales it to "
"that size. Above 100 % smooths jagged edges (supersampling) at a high GPU cost.",
[UI_MENU_RENDER_SCALE_GAME] = "Game (83 %)",
[UI_MENU_UPSCALER] = "Scaling to the window",
[UI_MENU_UPSCALER_DESC] = "How the picture is scaled when the window is larger than the game resolution. FSR keeps "
"edges and detail sharper than bilinear.",
[UI_MENU_UPSCALER_FSR] = "AMD FSR 1", [UI_MENU_UPSCALER_BILINEAR] = "Bilinear",
[UI_MENU_SHARPNESS] = "FSR sharpness",
[UI_MENU_SHARPNESS_DESC] = "Sharpening after FSR scaling; 0 turns it off.",
[UI_MENU_FPS_LIMIT] = "Frame rate limit",
[UI_MENU_FPS_LIMIT_DESC] = "The most frames per second the game draws. Above 60 is experimental and needs Game speed "
@@ -195,6 +209,20 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
"режимы.",
[UI_MENU_PERF_OFF] = "Выкл.", [UI_MENU_PERF_FPS] = "FPS", [UI_MENU_PERF_FULL] = "Полный",
[UI_PERF_LINE_FPS] = "%.0f к/с",
[UI_MENU_GRAPHICS] = "Изображение",
[UI_MENU_OUTPUT_RES] = "Разрешение игры",
[UI_MENU_OUTPUT_RES_DESC] = "Размер, в котором игра рисует картинку и интерфейс. Выше 1920 × 1080 игре нужно больше "
"видеопамяти и времени GPU.",
[UI_MENU_RENDER_SCALE] = "Масштаб 3D-отрисовки",
[UI_MENU_RENDER_SCALE_DESC] = "Размер 3D-сцены относительно разрешения игры; FSR игры доводит её до этого размера. "
"Выше 100 % сглаживает лесенки на краях (суперсэмплинг) ценой большой нагрузки на GPU.",
[UI_MENU_RENDER_SCALE_GAME] = "Как в игре (83 %)",
[UI_MENU_UPSCALER] = "Масштабирование под окно",
[UI_MENU_UPSCALER_DESC] = "Как картинка растягивается, когда окно больше разрешения игры. FSR сохраняет края и "
"детали чётче билинейного.",
[UI_MENU_UPSCALER_FSR] = "AMD FSR 1", [UI_MENU_UPSCALER_BILINEAR] = "Билинейное",
[UI_MENU_SHARPNESS] = "Резкость FSR",
[UI_MENU_SHARPNESS_DESC] = "Повышение резкости после масштабирования FSR; 0 выключает его.",
[UI_MENU_FPS_LIMIT] = "Ограничение частоты кадров",
[UI_MENU_FPS_LIMIT_DESC] = "Наибольшее число кадров в секунду. Выше 60 — экспериментальный режим, нужна «Скорость "
+5
View File
@@ -30,6 +30,11 @@ typedef enum {
UI_MENU_GPU, UI_MENU_GPU_DESC, UI_MENU_GPU_AUTO,
UI_MENU_PERF_OVERLAY, UI_MENU_PERF_OVERLAY_DESC, UI_MENU_PERF_OFF, UI_MENU_PERF_FPS, UI_MENU_PERF_FULL,
UI_PERF_LINE_FPS,
UI_MENU_GRAPHICS, // group heading over the resolution rows
UI_MENU_OUTPUT_RES, UI_MENU_OUTPUT_RES_DESC,
UI_MENU_RENDER_SCALE, UI_MENU_RENDER_SCALE_DESC, UI_MENU_RENDER_SCALE_GAME,
UI_MENU_UPSCALER, UI_MENU_UPSCALER_DESC, UI_MENU_UPSCALER_FSR, UI_MENU_UPSCALER_BILINEAR,
UI_MENU_SHARPNESS, UI_MENU_SHARPNESS_DESC,
// Game
UI_MENU_FPS_LIMIT, UI_MENU_FPS_LIMIT_DESC, UI_MENU_FPS_30, UI_MENU_FPS_60, UI_MENU_FPS_120, UI_MENU_FPS_144,
+7 -1
View File
@@ -80,7 +80,13 @@ int vk_selftest(void); // 0 on success
void vk_present_image(VkImage src, VkImageLayout layout, VkFormat fmt, int w, int h, const int crop[4]);
// vk_present_image split in two: vk_present_blit submits the blit and leaves the present waiting, vk_present_flip
// queues it. The next blit or a swapchain rebuild queues a waiting present first.
void vk_present_blit(VkImage src, VkImageLayout layout, int w, int h, const int crop[4]);
void vk_present_blit(VkImage src, VkImageLayout layout, VkFormat fmt, int w, int h, const int crop[4]);
// FSR 1 on the present (vk_fsr.c): records EASU (+ RCAS) of src's crop rectangle {x, y, w, h} into dst, a dw x dh
// swapchain image in TRANSFER_DST; src is in GENERAL and fmt its format. 0 = nothing recorded (the setting says
// bilinear, no upscale is needed, or FSR is not available): the caller blits.
int vk_fsr_record(VkCommandBuffer cb, unsigned slot, VkImage src, VkFormat fmt, int sw, int sh, const int crop[4],
VkImage dst, uint32_t dw, uint32_t dh);
void vk_fsr_release(void); // before the device goes away
void vk_present_flip(void);
// Every submission to ctx->gfx_queue (and xfer_queue when shared) takes this lock; vk_present_image and the swapchain
// rebuild do. Recursive.
+1 -1
View File
@@ -62,7 +62,7 @@ static DWORD WINAPI present_main(void *arg) {
WakeAllConditionVariable(&pcv);
ReleaseSRWLockExclusive(&pl);
if (flight_on) vk_thumbs_frame(j.frame);
vk_present_blit(j.image, VK_IMAGE_LAYOUT_GENERAL, j.w, j.h, j.has_crop ? j.crop : NULL);
vk_present_blit(j.image, VK_IMAGE_LAYOUT_GENERAL, j.format, j.w, j.h, j.has_crop ? j.crop : NULL);
uint64_t f = vk_sync_submit(NULL, 0); // a timeline value after the blit: deferred destruction waits for the blit too
if (j.value && f != j.value)
rt_fatal("vk: the present of frame %llu signalled %llu, queued as %llu", (unsigned long long)j.frame,
+2
View File
@@ -126,6 +126,8 @@ static int test_present(const GfxBackend *b, uint8_t *guest, int *w_out, int *h_
vk_upload_end();
uint64_t frames = gfx_stats().frames;
// the exact colour check needs the bilinear blit: FSR's approximate reciprocals move a flat colour by 1/255
_putenv_s("TOTK_UPSCALER", "bilinear");
vk_present_capture(1);
const int crop[4] = {0, 0, TEX_W, TEX_H};
b->present(&t, crop, 0);
+225
View File
@@ -0,0 +1,225 @@
// AMD FidelityFX Super Resolution 1 on the present path (gfx_window.c present_image): when the window is larger than
// the game's output, EASU scales the game's crop rectangle to the swapchain size and RCAS sharpens it, in place of the
// bilinear vkCmdBlitImage. TOTK_UPSCALER=fsr|bilinear picks it, TOTK_SHARPNESS (0..100, 0 = no RCAS pass) sets RCAS;
// both apply at the next frame.
//
// Per frame: EASU reads the source through a view of its own format (the same colour conversion the blit does) and
// writes an RGBA16F image of the swapchain size; RCAS reads that and writes a second one; a 1:1 blit converts the
// result into the swapchain image, which the caller left in TRANSFER_DST. The shaders (runtime/shaders/fsr_*.comp)
// compute AMD's constants from the push constants. Cost: two compute passes over the swapchain size and one copy per
// present; nothing on the game's draws.
//
// The source view of slot s is destroyed when slot s records again: present_image has waited for that slot's fence.
// The two intermediate images are shared by all slots; each frame's first barrier orders it after the previous
// frame's reads (one queue, so the barrier covers earlier submissions).
#include "vk.h"
#include <string.h>
#include "cfg.h"
#include "fsr_easu_spv.h"
#include "fsr_rcas_spv.h"
#include "host.h"
#define SLOTS 8
static struct {
int tried, ok;
PFN_vkCmdPushDescriptorSetKHR push;
VkDescriptorSetLayout dsl;
VkPipelineLayout layout;
VkPipeline easu, rcas;
VkSampler sampler;
VkImage img[2]; // EASU output, RCAS output
VmaAllocation alloc[2];
VkImageView view[2];
uint32_t w, h; // their size
VkImageView src_view[SLOTS]; // the source view each slot's last frame read
int logged;
} F;
static VkPipeline make_pipeline(VkCtx *c, const uint32_t *code, size_t size) {
VkShaderModuleCreateInfo mi = {.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO, .codeSize = size, .pCode = code};
VkShaderModule m = VK_NULL_HANDLE;
if (vkCreateShaderModule(c->device, &mi, NULL, &m) != VK_SUCCESS) return VK_NULL_HANDLE;
VkComputePipelineCreateInfo ci = {.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,
.stage = {.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
.stage = VK_SHADER_STAGE_COMPUTE_BIT, .module = m, .pName = "main"},
.layout = F.layout};
VkPipeline p = VK_NULL_HANDLE;
if (vkCreateComputePipelines(c->device, VK_NULL_HANDLE, 1, &ci, NULL, &p) != VK_SUCCESS) p = VK_NULL_HANDLE;
vkDestroyShaderModule(c->device, m, NULL);
return p;
}
static int init(VkCtx *c) {
F.tried = 1;
F.push = (PFN_vkCmdPushDescriptorSetKHR)vkGetDeviceProcAddr(c->device, "vkCmdPushDescriptorSetKHR");
if (!F.push) {
rt_log("vk: FSR off: no VK_KHR_push_descriptor; the present scales bilinearly");
return 0;
}
VkDescriptorSetLayoutBinding b[2] = {
{.binding = 0, .descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, .descriptorCount = 1,
.stageFlags = VK_SHADER_STAGE_COMPUTE_BIT},
{.binding = 1, .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, .descriptorCount = 1,
.stageFlags = VK_SHADER_STAGE_COMPUTE_BIT}};
VkDescriptorSetLayoutCreateInfo dci = {.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO,
.flags = VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR,
.bindingCount = 2, .pBindings = b};
VkPushConstantRange pr = {VK_SHADER_STAGE_COMPUTE_BIT, 0, 32};
VkPipelineLayoutCreateInfo li = {.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, .setLayoutCount = 1,
.pSetLayouts = &F.dsl, .pushConstantRangeCount = 1, .pPushConstantRanges = &pr};
VkSamplerCreateInfo si = {.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO, .magFilter = VK_FILTER_LINEAR,
.minFilter = VK_FILTER_LINEAR, .mipmapMode = VK_SAMPLER_MIPMAP_MODE_NEAREST,
.addressModeU = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,
.addressModeV = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,
.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, .maxLod = 0};
if (vkCreateDescriptorSetLayout(c->device, &dci, NULL, &F.dsl) != VK_SUCCESS ||
vkCreatePipelineLayout(c->device, &li, NULL, &F.layout) != VK_SUCCESS ||
vkCreateSampler(c->device, &si, NULL, &F.sampler) != VK_SUCCESS ||
!(F.easu = make_pipeline(c, fsr_easu_spv, sizeof fsr_easu_spv)) ||
!(F.rcas = make_pipeline(c, fsr_rcas_spv, sizeof fsr_rcas_spv))) {
rt_log("vk: FSR off: its pipelines could not be created; the present scales bilinearly");
return 0;
}
rt_log("vk: FSR 1 (EASU + RCAS) ready for the present");
return F.ok = 1;
}
static void free_images(VkCtx *c) {
for (int i = 0; i < 2; i++) {
if (F.view[i]) vkDestroyImageView(c->device, F.view[i], NULL);
if (F.img[i]) vmaDestroyImage(c->vma, F.img[i], F.alloc[i]);
F.view[i] = VK_NULL_HANDLE;
F.img[i] = VK_NULL_HANDLE;
}
F.w = F.h = 0;
}
static int ensure_images(VkCtx *c, uint32_t w, uint32_t h) {
if (F.img[0] && F.w == w && F.h == h) return 1;
vkDeviceWaitIdle(c->device); // a swapchain size change: earlier presents may still read the old images
free_images(c);
for (int i = 0; i < 2; i++) {
VkImageCreateInfo ci = {.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, .imageType = VK_IMAGE_TYPE_2D,
.format = VK_FORMAT_R16G16B16A16_SFLOAT, .extent = {w, h, 1}, .mipLevels = 1,
.arrayLayers = 1, .samples = VK_SAMPLE_COUNT_1_BIT, .tiling = VK_IMAGE_TILING_OPTIMAL,
.usage = VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT |
VK_IMAGE_USAGE_TRANSFER_SRC_BIT};
VmaAllocationCreateInfo ai = {.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE};
if (vmaCreateImage(c->vma, &ci, &ai, &F.img[i], &F.alloc[i], NULL) != VK_SUCCESS) {
F.img[i] = VK_NULL_HANDLE;
free_images(c);
return 0;
}
VkImageViewCreateInfo vi = {.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, .image = F.img[i],
.viewType = VK_IMAGE_VIEW_TYPE_2D, .format = VK_FORMAT_R16G16B16A16_SFLOAT,
.subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}};
if (vkCreateImageView(c->device, &vi, NULL, &F.view[i]) != VK_SUCCESS) {
F.view[i] = VK_NULL_HANDLE;
free_images(c);
return 0;
}
}
F.w = w;
F.h = h;
return 1;
}
static void barrier(VkCommandBuffer cb, VkImage img, VkImageLayout from, VkImageLayout to, VkPipelineStageFlags2 ss,
VkAccessFlags2 sa, VkPipelineStageFlags2 ds, VkAccessFlags2 da) {
VkImageMemoryBarrier2 b = {.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2, .srcStageMask = ss, .srcAccessMask = sa,
.dstStageMask = ds, .dstAccessMask = da, .oldLayout = from, .newLayout = to,
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .image = img,
.subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}};
VkDependencyInfo d = {.sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO, .imageMemoryBarrierCount = 1,
.pImageMemoryBarriers = &b};
vkCmdPipelineBarrier2(cb, &d);
}
static void bind_pass(VkCommandBuffer cb, VkPipeline p, VkImageView in, VkImageView out, const float pc[8]) {
VkDescriptorImageInfo ii = {F.sampler, in, VK_IMAGE_LAYOUT_GENERAL}, oi = {VK_NULL_HANDLE, out, VK_IMAGE_LAYOUT_GENERAL};
VkWriteDescriptorSet w[2] = {
{.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, .dstBinding = 0, .descriptorCount = 1,
.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, .pImageInfo = &ii},
{.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, .dstBinding = 1, .descriptorCount = 1,
.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, .pImageInfo = &oi}};
vkCmdBindPipeline(cb, VK_PIPELINE_BIND_POINT_COMPUTE, p);
F.push(cb, VK_PIPELINE_BIND_POINT_COMPUTE, F.layout, 0, 2, w);
vkCmdPushConstants(cb, F.layout, VK_SHADER_STAGE_COMPUTE_BIT, 0, 32, pc);
}
int vk_fsr_record(VkCommandBuffer cb, unsigned slot, VkImage src, VkFormat fmt, int sw, int sh, const int crop[4],
VkImage dst, uint32_t dw, uint32_t dh) {
int cw = crop[2], ch = crop[3];
if (strcmp(cfg_value("TOTK_UPSCALER"), "fsr") || (dw <= (uint32_t)cw && dh <= (uint32_t)ch) || !fmt) return 0;
VkCtx *c = vk_ctx();
if (!F.tried) init(c);
if (!F.ok || !ensure_images(c, dw, dh)) return 0;
slot %= SLOTS;
if (F.src_view[slot]) vkDestroyImageView(c->device, F.src_view[slot], NULL);
VkImageViewCreateInfo vi = {.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, .image = src,
.viewType = VK_IMAGE_VIEW_TYPE_2D, .format = fmt,
.components = {VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY,
VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_ONE},
.subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}};
if (vkCreateImageView(c->device, &vi, NULL, &F.src_view[slot]) != VK_SUCCESS) {
F.src_view[slot] = VK_NULL_HANDLE;
return 0;
}
int sharp = cfg_int("TOTK_SHARPNESS");
if (sharp < 0) sharp = 0;
if (sharp > 100) sharp = 100;
if (!F.logged) {
F.logged = 1;
rt_log("vk: FSR upscales %dx%d to %ux%u (sharpness %d)", cw, ch, dw, dh, sharp);
}
const VkPipelineStageFlags2 CS = VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, XF = VK_PIPELINE_STAGE_2_TRANSFER_BIT;
// the game's writes to the source become visible to the compute read; the earlier frame's reads of the
// intermediates finish before this frame writes them
barrier(cb, src, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL, VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
VK_ACCESS_2_MEMORY_WRITE_BIT, CS, VK_ACCESS_2_SHADER_SAMPLED_READ_BIT);
for (int i = 0; i < 2; i++)
barrier(cb, F.img[i], VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_GENERAL, CS | XF, 0, CS,
VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT | VK_ACCESS_2_SHADER_SAMPLED_READ_BIT);
uint32_t gx = (dw + 15) / 16, gy = (dh + 15) / 16;
float easu[8] = {(float)cw, (float)ch, (float)sw, (float)sh, (float)dw, (float)dh, (float)crop[0], (float)crop[1]};
bind_pass(cb, F.easu, F.src_view[slot], F.view[0], easu);
vkCmdDispatch(cb, gx, gy, 1);
int last = 0;
if (sharp > 0) {
barrier(cb, F.img[0], VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL, CS, VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT,
CS, VK_ACCESS_2_SHADER_SAMPLED_READ_BIT);
float rcas[8] = {(float)dw, (float)dh, (float)(100 - sharp) / 50.0f, 0, 0, 0, 0, 0};
bind_pass(cb, F.rcas, F.view[0], F.view[1], rcas);
vkCmdDispatch(cb, gx, gy, 1);
last = 1;
}
barrier(cb, F.img[last], VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL, CS, VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT,
XF, VK_ACCESS_2_TRANSFER_READ_BIT);
// later submissions that write the source wait for the compute read
barrier(cb, src, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_GENERAL, CS, 0, VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, 0);
VkImageBlit region = {.srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
.srcOffsets = {{0, 0, 0}, {(int)dw, (int)dh, 1}},
.dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
.dstOffsets = {{0, 0, 0}, {(int)dw, (int)dh, 1}}};
vkCmdBlitImage(cb, F.img[last], VK_IMAGE_LAYOUT_GENERAL, dst, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &region,
VK_FILTER_NEAREST);
return 1;
}
void vk_fsr_release(void) {
VkCtx *c = vk_ctx();
if (!c || !F.tried) return;
free_images(c);
for (int i = 0; i < SLOTS; i++)
if (F.src_view[i]) vkDestroyImageView(c->device, F.src_view[i], NULL);
if (F.easu) vkDestroyPipeline(c->device, F.easu, NULL);
if (F.rcas) vkDestroyPipeline(c->device, F.rcas, NULL);
if (F.sampler) vkDestroySampler(c->device, F.sampler, NULL);
if (F.layout) vkDestroyPipelineLayout(c->device, F.layout, NULL);
if (F.dsl) vkDestroyDescriptorSetLayout(c->device, F.dsl, NULL);
memset(&F, 0, sizeof F);
}
+2 -2
View File
@@ -78,11 +78,11 @@ GEN_FLAGS = ['-O1', '-fno-strict-aliasing', '-Wno-return-type', '-Wno-unused-lab
'-march=x86-64-v3']
RT_FLAGS = ['-O2', '-g', '-Wall', '-fno-strict-aliasing', '-march=x86-64-v3']
LINK_FLAGS = ['-fuse-ld=lld', '-Wl,--stack,16777216', '"-Wl,--Map=$builddir/totk.map"'] # the map feeds tools/prof_report.py
LINK_LIBS = ['-lpsapi', '-lbcrypt', '-lvulkan-1', '-luser32', '-lgdi32', '-ldwmapi', '-lwinmm', '-lSDL3', '-lopus', '-l:libvpx.a', '-l:libstdc++.a', '-l:libwinpthread.a'] # Vulkan back end; libvpx static (movies)
LINK_LIBS = ['-lpsapi', '-lbcrypt', '-lvulkan-1', '-luser32', '-lgdi32', '-ldwmapi', '-lwinmm', '-lSDL3', '-lopus', '-l:libvpx.a', '-l:libzstd.a', '-l:libstdc++.a', '-l:libwinpthread.a'] # Vulkan back end; libvpx static (movies); libzstd static (resolution.c)
VMA_INCLUDE = UCRT.parent / 'include' / 'vma' # vk_mem_alloc.h; MSYS2 package vulkan-memory-allocator
# --toolchain: an llvm-mingw tree. The libraries, headers and DLLs MSYS2 supplies come from the deps directory instead.
LLVM_LINK_LIBS = ['-lpsapi', '-lbcrypt', '-luser32', '-lgdi32', '-ldwmapi', '-lwinmm', '-lvulkan-1', '-lSDL3', '-lopus',
'-l:libvpx.a', '-l:libc++.a', '-l:libc++abi.a', '-l:libunwind.a', '-l:libwinpthread.a']
'-l:libvpx.a', '-l:libzstd.a', '-l:libc++.a', '-l:libc++abi.a', '-l:libunwind.a', '-l:libwinpthread.a']
DEFAULT_DEPS = ROOT / 'toolchain' / 'deps-mingw'
# Runtime sources compiled per install, not in the library: romfs.c includes romfs_config.h, patches.c the patches.h
# of the player's game version (its patch page is the page after that version's main).