From 2df08c751e74e4a4cdbe044350e6faca7967cb88 Mon Sep 17 00:00:00 2001 From: ruckus7382sfgsgdf <355121112+ruckus7382sfgsgdf@users.noreply.github.com> Date: Thu, 26 Nov 2026 20:04:11 -0600 Subject: [PATCH] Triforce v0.8.4 Smoother frames and less memory: a compact pipeline cache on NVIDIA, the renderer and game-code profiles, native float in the hot game code, late GPU work left as before. A PC whose NVIDIA shader cache drops the game's gets a driver cache folder of its own. Fixes from the 0.8.3 reports: RenoDX's encoder and tone mapping matched on NVIDIA again; the out-of-memory notice at the next start; no microphone open without a recording device; Evil HD undergrowth kept to 80/120 m; the FG HUD layer keeps what it learned; a stick past 92% is a full push; the DualSense jack read only when used; Linux Save Select, Quit and Restart, and the Linux launcher's sound; the update check uses the program's own version. --- gpu/vk/shaders/evil_ao.comp | 18 +- gpu/vk/shaders/evil_ao_comp_spv.h | 684 +++++++++++++------------ gpu/vk/shaders/fg_hud_layer.comp | 10 +- gpu/vk/shaders/fg_hud_layer_comp_spv.h | 358 ++++++------- gpu/vk/vk_aa.cpp | 9 + gpu/vk/vk_draw.cpp | 169 +++++- gpu/vk/vk_fsr3.cpp | 6 + gpu/vk/vk_internal.h | 7 + gpu/vk/vk_main.cpp | 59 ++- gpu/vk/vk_memory.cpp | 364 ++++++++++++- gpu/vk/vk_menu.cpp | 6 +- gpu/vk/vk_mods.cpp | 48 +- gpu/vk/vk_renodx.cpp | 13 +- gpu/vk/vk_replay.cpp | 113 +++- gpu/vk/vk_vma.cpp | 18 + host/evil_hd.h | 11 +- host/hos.h | 5 + host/hos_main.c | 30 ++ host/hos_sdl.c | 11 +- host/hos_sdl.h | 1 + host/hos_thread.c | 40 ++ host/hos_update.c | 12 + host/mkw_glue.c | 76 ++- host/nn_audio_in.c | 12 +- host/nn_os_sync.c | 68 ++- host/nvn_native.c | 11 + host/oot_menu.c | 9 +- host/pad_sdl.c | 14 + host/pad_speaker.c | 8 + host/posix/display_sdl.c | 9 + host/save_files.c | 4 +- launcher/App/Host/LinuxHost.cs | 10 +- launcher/ui/app.js | 52 +- nx2/lift.py | 4 + nx2/nativefp.py | 485 ++++++++++++++++++ scripts/prof.py | 13 + scripts/renodx_shaders.py | 11 +- tests/nativefp_cpu.c | 23 + tests/nativefp_test.c | 346 +++++++++++++ tests/pad_speaker_test.c | 1 + tests/test_evil_hd_foliage.py | 7 +- tests/test_fsr3fi_hud_layer.py | 19 + tests/test_native_fp.py | 210 ++++++++ tests/test_oot_menu_linux_half.py | 7 +- tests/test_oot_menu_mouse.py | 4 +- 45 files changed, 2828 insertions(+), 567 deletions(-) create mode 100644 nx2/nativefp.py create mode 100644 tests/nativefp_cpu.c create mode 100644 tests/nativefp_test.c create mode 100644 tests/test_native_fp.py diff --git a/gpu/vk/shaders/evil_ao.comp b/gpu/vk/shaders/evil_ao.comp index 749c6df..bef7155 100644 --- a/gpu/vk/shaders/evil_ao.comp +++ b/gpu/vk/shaders/evil_ao.comp @@ -68,11 +68,20 @@ void main() { const float r2 = radius * radius; float occluded = 0.0; vec3 bounce = vec3(0.0); + // ((Triforce, 11-25, a player's report "Ambient Occlusion in fog") how much the picture itself varies around the pixel: its + // brightness here and at the samples' points, lowest and highest. The game's fog is already in the picture this takes, and + // fog (or a room the game keeps dark) makes it nearly flat: the creases the occlusion finds there are ones the fog hides, and + // drawn over it they showed the rock through a foggy cave. Where the picture is that flat the occlusion fades out + const vec3 luma_w = vec3(0.2126, 0.7152, 0.0722); + float lo = dot(texelFetch(src, c, 0).rgb, luma_w), hi = lo; for (int i = 0; i < kSamples; i++) { const float t = (float(i) + 0.5) / float(kSamples); const float angle = 6.2831853 * (t * kTurns + noise); const vec2 offset = vec2(cos(angle), sin(angle)) * (px * t); const ivec2 q = c + ivec2(round(offset)); + const vec3 seen = texelFetch(src, clamp(q, ivec2(0), pc.size - 1), 0).rgb; + const float y = dot(seen, luma_w); + lo = min(lo, y), hi = max(hi, y); const vec3 v = view_at(q) - p; const float vv = dot(v, v); if (vv < 1e-8) continue; @@ -84,13 +93,16 @@ void main() { const float near_share = smoothstep(0.15 * radius, 0.4 * radius, sqrt(vv)); const float w = clamp((cosine - 0.25) / 0.75, 0.0, 1.0) * clamp(1.0 - vv / r2, 0.0, 1.0) * near_share; occluded += w; - bounce += w * texelFetch(src, clamp(q, ivec2(0), pc.size - 1), 0).rgb; + bounce += w * seen; } + // (the spread as a share of the brightest, and 0.05 more: a dark place's small differences count as flat too) + const float contrast = (hi - lo) / (hi + 0.05); + const float not_flat = smoothstep(0.04, 0.16, contrast); // (never darker than kFloor: a corner keeps some light, and what goes wrong (a fringe, a clump) cannot turn black) const float kFloor = 0.5; float ao = clamp(1.0 - pc.k.y * occluded / float(kSamples), kFloor, 1.0); ao = mix(ao, 1.0, smoothstep(0.6 * far, far, p.z)); - ao = mix(1.0, ao, smooth_here); - const float keep = smooth_here * (1.0 - smoothstep(0.6 * far, far, p.z)); + ao = mix(1.0, ao, smooth_here * not_flat); + const float keep = smooth_here * not_flat * (1.0 - smoothstep(0.6 * far, far, p.z)); imageStore(ao_out, c, vec4(bounce / float(kSamples) * keep, ao)); } diff --git a/gpu/vk/shaders/evil_ao_comp_spv.h b/gpu/vk/shaders/evil_ao_comp_spv.h index fb2cfc1..155449d 100644 --- a/gpu/vk/shaders/evil_ao_comp_spv.h +++ b/gpu/vk/shaders/evil_ao_comp_spv.h @@ -1,11 +1,11 @@ -// evil_ao.comp + aa_common.glsl sha256 91f33bb2561ba68662ec3e6293ac2fb4e86045037ec9a4ae9089c0c986f26253 (tests/test_evil_hd.py --write: glslangValidator -V --target-env vulkan1.2 --vn EVIL_AO_COMP_SPV) +// evil_ao.comp + aa_common.glsl sha256 a9a6c6e961fdaa6cddf8d5afad4afdcb43258aaa37964e2a708e785effea88d6 (tests/test_evil_hd.py --write: glslangValidator -V --target-env vulkan1.2 --vn EVIL_AO_COMP_SPV) // 1116.6.0 #pragma once const uint32_t EVIL_AO_COMP_SPV[] = { - 0x07230203,0x00010500,0x0008000b,0x000001f5,0x00000000,0x00020011,0x00000001,0x0006000b, + 0x07230203,0x00010500,0x0008000b,0x0000021e,0x00000000,0x00020011,0x00000001,0x0006000b, 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 0x000a000f,0x00000005,0x00000004,0x6e69616d,0x00000000,0x00000018,0x00000044,0x00000071, - 0x000000b3,0x000001b9,0x00060010,0x00000004,0x00000011,0x00000008,0x00000008,0x00000001, + 0x000000b3,0x0000015f,0x00060010,0x00000004,0x00000011,0x00000008,0x00000008,0x00000001, 0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004,0x6e69616d,0x00000000,0x00060005, 0x0000000a,0x74736964,0x65636e61,0x2874615f,0x003b3166,0x00030005,0x00000009,0x00000064, 0x00060005,0x00000012,0x77656976,0x2874615f,0x3b326976,0x00000000,0x00030005,0x00000011, @@ -26,328 +26,358 @@ const uint32_t EVIL_AO_COMP_SPV[] = { 0x6f6f6d73,0x685f6874,0x00657265,0x00030005,0x00000134,0x00007870,0x00040005,0x00000147, 0x73696f6e,0x00000065,0x00030005,0x00000157,0x00003272,0x00050005,0x0000015b,0x6c63636f, 0x64656475,0x00000000,0x00040005,0x0000015c,0x6e756f62,0x00006563,0x00030005,0x0000015e, - 0x00000069,0x00030005,0x00000167,0x00000074,0x00040005,0x0000016d,0x6c676e61,0x00000065, - 0x00040005,0x00000175,0x7366666f,0x00007465,0x00030005,0x0000017f,0x00000071,0x00030005, - 0x00000185,0x00000076,0x00040005,0x00000186,0x61726170,0x0000006d,0x00030005,0x0000018b, - 0x00007676,0x00040005,0x00000195,0x69736f63,0x0000656e,0x00050005,0x0000019c,0x7261656e, - 0x6168735f,0x00006572,0x00030005,0x000001a6,0x00000077,0x00030005,0x000001b9,0x00637273, - 0x00030005,0x000001c9,0x00006f61,0x00040005,0x000001dd,0x7065656b,0x00000000,0x00030047, - 0x00000016,0x00000002,0x00050048,0x00000016,0x00000000,0x00000023,0x00000000,0x00050048, - 0x00000016,0x00000001,0x00000023,0x00000008,0x00050048,0x00000016,0x00000002,0x00000023, - 0x00000010,0x00050048,0x00000016,0x00000003,0x00000023,0x00000020,0x00040047,0x00000044, - 0x00000021,0x00000000,0x00040047,0x00000044,0x00000022,0x00000000,0x00040047,0x00000071, - 0x0000000b,0x0000001c,0x00030047,0x000000b3,0x00000019,0x00040047,0x000000b3,0x00000021, - 0x00000002,0x00040047,0x000000b3,0x00000022,0x00000000,0x00040047,0x000001b9,0x00000021, - 0x00000001,0x00040047,0x000001b9,0x00000022,0x00000000,0x00040047,0x000001f4,0x0000000b, - 0x00000019,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006, - 0x00000020,0x00040020,0x00000007,0x00000007,0x00000006,0x00040021,0x00000008,0x00000006, - 0x00000007,0x00040015,0x0000000c,0x00000020,0x00000001,0x00040017,0x0000000d,0x0000000c, - 0x00000002,0x00040020,0x0000000e,0x00000007,0x0000000d,0x00040017,0x0000000f,0x00000006, - 0x00000003,0x00040021,0x00000010,0x0000000f,0x0000000e,0x00040017,0x00000014,0x00000006, - 0x00000002,0x00040017,0x00000015,0x00000006,0x00000004,0x0006001e,0x00000016,0x00000014, - 0x0000000d,0x00000015,0x00000015,0x00040020,0x00000017,0x00000009,0x00000016,0x0004003b, - 0x00000017,0x00000018,0x00000009,0x0004002b,0x0000000c,0x00000019,0x00000003,0x00040015, - 0x0000001a,0x00000020,0x00000000,0x0004002b,0x0000001a,0x0000001b,0x00000003,0x00040020, - 0x0000001c,0x00000009,0x00000006,0x0004002b,0x0000000c,0x00000020,0x00000001,0x0004002b, - 0x0000000c,0x00000022,0x00000000,0x00020014,0x00000023,0x0004002b,0x00000006,0x00000027, - 0x3f800000,0x0004002b,0x0000000c,0x0000002a,0x00000002,0x0004002b,0x0000001a,0x0000002b, - 0x00000001,0x0004002b,0x0000001a,0x0000002f,0x00000000,0x0004002b,0x00000006,0x00000033, - 0x33d6bf95,0x0005002c,0x0000000d,0x00000039,0x00000022,0x00000022,0x00040020,0x0000003a, - 0x00000009,0x0000000d,0x00090019,0x00000041,0x00000006,0x00000001,0x00000000,0x00000000, - 0x00000000,0x00000001,0x00000000,0x0003001b,0x00000042,0x00000041,0x00040020,0x00000043, - 0x00000000,0x00000042,0x0004003b,0x00000043,0x00000044,0x00000000,0x00040020,0x0000004c, - 0x00000007,0x00000014,0x0004002b,0x00000006,0x00000050,0x3f000000,0x00040020,0x00000053, - 0x00000009,0x00000014,0x0004002b,0x00000006,0x00000057,0x40000000,0x0004002b,0x0000001a, - 0x0000005d,0x00000002,0x00040017,0x0000006f,0x0000001a,0x00000003,0x00040020,0x00000070, - 0x00000001,0x0000006f,0x0004003b,0x00000070,0x00000071,0x00000001,0x00040017,0x00000072, - 0x0000001a,0x00000002,0x00040020,0x00000076,0x00000007,0x0000000c,0x00040020,0x00000079, - 0x00000009,0x0000000c,0x00040020,0x0000008f,0x00000007,0x0000000f,0x0004002b,0x00000006, - 0x00000096,0x00000000,0x00090019,0x000000b1,0x00000006,0x00000001,0x00000000,0x00000000, - 0x00000000,0x00000002,0x00000002,0x00040020,0x000000b2,0x00000000,0x000000b1,0x0004003b, - 0x000000b2,0x000000b3,0x00000000,0x0007002c,0x00000015,0x000000b6,0x00000096,0x00000096, - 0x00000096,0x00000027,0x0005002c,0x0000000d,0x000000ba,0x00000020,0x00000022,0x0005002c, - 0x0000000d,0x000000c5,0x00000022,0x00000020,0x0004002b,0x00000006,0x00000128,0x3b83126f, - 0x0004002b,0x00000006,0x00000129,0x3ca3d70a,0x0004002b,0x00000006,0x00000141,0x3dcccccd, - 0x0004002b,0x00000006,0x00000148,0x4253ee82,0x0004002b,0x00000006,0x00000149,0x3d897143, - 0x0004002b,0x00000006,0x0000014e,0x3bbf4590,0x0006002c,0x0000000f,0x0000015d,0x00000096, - 0x00000096,0x00000096,0x0004002b,0x0000000c,0x00000165,0x0000000c,0x0004002b,0x00000006, - 0x0000016b,0x41400000,0x0004002b,0x00000006,0x0000016e,0x40c90fdb,0x0004002b,0x00000006, - 0x00000170,0x40e00000,0x0004002b,0x00000006,0x00000190,0x322bcc77,0x0004002b,0x00000006, - 0x0000019d,0x3e19999a,0x0004002b,0x00000006,0x000001a0,0x3ecccccd,0x0004002b,0x00000006, - 0x000001a8,0x3e800000,0x0004002b,0x00000006,0x000001aa,0x3f400000,0x0004003b,0x00000043, - 0x000001b9,0x00000000,0x0004002b,0x00000006,0x000001d2,0x3f19999a,0x0004002b,0x0000001a, - 0x000001f3,0x00000008,0x0006002c,0x0000006f,0x000001f4,0x000001f3,0x000001f3,0x0000002b, - 0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b, - 0x0000000e,0x0000006e,0x00000007,0x0004003b,0x00000007,0x00000089,0x00000007,0x0004003b, - 0x00000007,0x0000008c,0x00000007,0x0004003b,0x0000008f,0x00000090,0x00000007,0x0004003b, - 0x0000000e,0x00000091,0x00000007,0x0004003b,0x0000008f,0x000000b8,0x00000007,0x0004003b, - 0x0000000e,0x000000bc,0x00000007,0x0004003b,0x0000008f,0x000000be,0x00000007,0x0004003b, - 0x0000000e,0x000000c1,0x00000007,0x0004003b,0x0000008f,0x000000c3,0x00000007,0x0004003b, - 0x0000000e,0x000000c7,0x00000007,0x0004003b,0x0000008f,0x000000c9,0x00000007,0x0004003b, - 0x0000000e,0x000000cc,0x00000007,0x0004003b,0x0000008f,0x000000ce,0x00000007,0x0004003b, - 0x0000008f,0x000000dc,0x00000007,0x0004003b,0x0000008f,0x000000e7,0x00000007,0x0004003b, - 0x0000008f,0x000000f5,0x00000007,0x0004003b,0x0000008f,0x00000100,0x00000007,0x0004003b, - 0x00000007,0x0000010e,0x00000007,0x0004003b,0x00000007,0x00000127,0x00000007,0x0004003b, - 0x00000007,0x00000134,0x00000007,0x0004003b,0x00000007,0x00000147,0x00000007,0x0004003b, - 0x00000007,0x00000157,0x00000007,0x0004003b,0x00000007,0x0000015b,0x00000007,0x0004003b, - 0x0000008f,0x0000015c,0x00000007,0x0004003b,0x00000076,0x0000015e,0x00000007,0x0004003b, - 0x00000007,0x00000167,0x00000007,0x0004003b,0x00000007,0x0000016d,0x00000007,0x0004003b, - 0x0000004c,0x00000175,0x00000007,0x0004003b,0x0000000e,0x0000017f,0x00000007,0x0004003b, - 0x0000008f,0x00000185,0x00000007,0x0004003b,0x0000000e,0x00000186,0x00000007,0x0004003b, - 0x00000007,0x0000018b,0x00000007,0x0004003b,0x00000007,0x00000195,0x00000007,0x0004003b, - 0x00000007,0x0000019c,0x00000007,0x0004003b,0x00000007,0x000001a6,0x00000007,0x0004003b, - 0x00000007,0x000001c9,0x00000007,0x0004003b,0x00000007,0x000001dd,0x00000007,0x0004003d, - 0x0000006f,0x00000073,0x00000071,0x0007004f,0x00000072,0x00000074,0x00000073,0x00000073, - 0x00000000,0x00000001,0x0004007c,0x0000000d,0x00000075,0x00000074,0x0003003e,0x0000006e, - 0x00000075,0x00050041,0x00000076,0x00000077,0x0000006e,0x0000002f,0x0004003d,0x0000000c, - 0x00000078,0x00000077,0x00060041,0x00000079,0x0000007a,0x00000018,0x00000020,0x0000002f, - 0x0004003d,0x0000000c,0x0000007b,0x0000007a,0x000500af,0x00000023,0x0000007c,0x00000078, - 0x0000007b,0x000400a8,0x00000023,0x0000007d,0x0000007c,0x000300f7,0x0000007f,0x00000000, - 0x000400fa,0x0000007d,0x0000007e,0x0000007f,0x000200f8,0x0000007e,0x00050041,0x00000076, - 0x00000080,0x0000006e,0x0000002b,0x0004003d,0x0000000c,0x00000081,0x00000080,0x00060041, - 0x00000079,0x00000082,0x00000018,0x00000020,0x0000002b,0x0004003d,0x0000000c,0x00000083, - 0x00000082,0x000500af,0x00000023,0x00000084,0x00000081,0x00000083,0x000200f9,0x0000007f, - 0x000200f8,0x0000007f,0x000700f5,0x00000023,0x00000085,0x0000007c,0x00000005,0x00000084, - 0x0000007e,0x000300f7,0x00000087,0x00000000,0x000400fa,0x00000085,0x00000086,0x00000087, - 0x000200f8,0x00000086,0x000100fd,0x000200f8,0x00000087,0x00060041,0x0000001c,0x0000008a, - 0x00000018,0x00000019,0x0000002f,0x0004003d,0x00000006,0x0000008b,0x0000008a,0x0003003e, - 0x00000089,0x0000008b,0x00060041,0x0000001c,0x0000008d,0x00000018,0x00000019,0x0000005d, - 0x0004003d,0x00000006,0x0000008e,0x0000008d,0x0003003e,0x0000008c,0x0000008e,0x0004003d, - 0x0000000d,0x00000092,0x0000006e,0x0003003e,0x00000091,0x00000092,0x00050039,0x0000000f, - 0x00000093,0x00000012,0x00000091,0x0003003e,0x00000090,0x00000093,0x00050041,0x00000007, - 0x00000094,0x00000090,0x0000005d,0x0004003d,0x00000006,0x00000095,0x00000094,0x000500ba, - 0x00000023,0x00000097,0x00000095,0x00000096,0x000400a8,0x00000023,0x00000098,0x00000097, - 0x000400a8,0x00000023,0x00000099,0x00000098,0x000300f7,0x0000009b,0x00000000,0x000400fa, - 0x00000099,0x0000009a,0x0000009b,0x000200f8,0x0000009a,0x00050041,0x00000007,0x0000009c, - 0x00000090,0x0000005d,0x0004003d,0x00000006,0x0000009d,0x0000009c,0x0004003d,0x00000006, - 0x0000009e,0x0000008c,0x000500be,0x00000023,0x0000009f,0x0000009d,0x0000009e,0x000200f9, - 0x0000009b,0x000200f8,0x0000009b,0x000700f5,0x00000023,0x000000a0,0x00000098,0x00000087, - 0x0000009f,0x0000009a,0x000400a8,0x00000023,0x000000a1,0x000000a0,0x000300f7,0x000000a3, - 0x00000000,0x000400fa,0x000000a1,0x000000a2,0x000000a3,0x000200f8,0x000000a2,0x00050041, - 0x00000007,0x000000a4,0x00000090,0x0000005d,0x0004003d,0x00000006,0x000000a5,0x000000a4, - 0x0004009d,0x00000023,0x000000a6,0x000000a5,0x000200f9,0x000000a3,0x000200f8,0x000000a3, - 0x000700f5,0x00000023,0x000000a7,0x000000a0,0x0000009b,0x000000a6,0x000000a2,0x000400a8, - 0x00000023,0x000000a8,0x000000a7,0x000300f7,0x000000aa,0x00000000,0x000400fa,0x000000a8, - 0x000000a9,0x000000aa,0x000200f8,0x000000a9,0x00050041,0x00000007,0x000000ab,0x00000090, - 0x0000005d,0x0004003d,0x00000006,0x000000ac,0x000000ab,0x0004009c,0x00000023,0x000000ad, - 0x000000ac,0x000200f9,0x000000aa,0x000200f8,0x000000aa,0x000700f5,0x00000023,0x000000ae, - 0x000000a7,0x000000a3,0x000000ad,0x000000a9,0x000300f7,0x000000b0,0x00000000,0x000400fa, - 0x000000ae,0x000000af,0x000000b0,0x000200f8,0x000000af,0x0004003d,0x000000b1,0x000000b4, - 0x000000b3,0x0004003d,0x0000000d,0x000000b5,0x0000006e,0x00040063,0x000000b4,0x000000b5, - 0x000000b6,0x000100fd,0x000200f8,0x000000b0,0x0004003d,0x0000000d,0x000000b9,0x0000006e, - 0x00050082,0x0000000d,0x000000bb,0x000000b9,0x000000ba,0x0003003e,0x000000bc,0x000000bb, - 0x00050039,0x0000000f,0x000000bd,0x00000012,0x000000bc,0x0003003e,0x000000b8,0x000000bd, - 0x0004003d,0x0000000d,0x000000bf,0x0000006e,0x00050080,0x0000000d,0x000000c0,0x000000bf, - 0x000000ba,0x0003003e,0x000000c1,0x000000c0,0x00050039,0x0000000f,0x000000c2,0x00000012, - 0x000000c1,0x0003003e,0x000000be,0x000000c2,0x0004003d,0x0000000d,0x000000c4,0x0000006e, - 0x00050082,0x0000000d,0x000000c6,0x000000c4,0x000000c5,0x0003003e,0x000000c7,0x000000c6, - 0x00050039,0x0000000f,0x000000c8,0x00000012,0x000000c7,0x0003003e,0x000000c3,0x000000c8, - 0x0004003d,0x0000000d,0x000000ca,0x0000006e,0x00050080,0x0000000d,0x000000cb,0x000000ca, - 0x000000c5,0x0003003e,0x000000cc,0x000000cb,0x00050039,0x0000000f,0x000000cd,0x00000012, - 0x000000cc,0x0003003e,0x000000c9,0x000000cd,0x00050041,0x00000007,0x000000cf,0x000000be, - 0x0000005d,0x0004003d,0x00000006,0x000000d0,0x000000cf,0x00050041,0x00000007,0x000000d1, - 0x00000090,0x0000005d,0x0004003d,0x00000006,0x000000d2,0x000000d1,0x00050083,0x00000006, - 0x000000d3,0x000000d0,0x000000d2,0x0006000c,0x00000006,0x000000d4,0x00000001,0x00000004, - 0x000000d3,0x00050041,0x00000007,0x000000d5,0x00000090,0x0000005d,0x0004003d,0x00000006, - 0x000000d6,0x000000d5,0x00050041,0x00000007,0x000000d7,0x000000b8,0x0000005d,0x0004003d, - 0x00000006,0x000000d8,0x000000d7,0x00050083,0x00000006,0x000000d9,0x000000d6,0x000000d8, - 0x0006000c,0x00000006,0x000000da,0x00000001,0x00000004,0x000000d9,0x000500b8,0x00000023, - 0x000000db,0x000000d4,0x000000da,0x000300f7,0x000000de,0x00000000,0x000400fa,0x000000db, - 0x000000dd,0x000000e2,0x000200f8,0x000000dd,0x0004003d,0x0000000f,0x000000df,0x000000be, - 0x0004003d,0x0000000f,0x000000e0,0x00000090,0x00050083,0x0000000f,0x000000e1,0x000000df, - 0x000000e0,0x0003003e,0x000000dc,0x000000e1,0x000200f9,0x000000de,0x000200f8,0x000000e2, - 0x0004003d,0x0000000f,0x000000e3,0x00000090,0x0004003d,0x0000000f,0x000000e4,0x000000b8, - 0x00050083,0x0000000f,0x000000e5,0x000000e3,0x000000e4,0x0003003e,0x000000dc,0x000000e5, - 0x000200f9,0x000000de,0x000200f8,0x000000de,0x0004003d,0x0000000f,0x000000e6,0x000000dc, - 0x0003003e,0x000000ce,0x000000e6,0x00050041,0x00000007,0x000000e8,0x000000c9,0x0000005d, - 0x0004003d,0x00000006,0x000000e9,0x000000e8,0x00050041,0x00000007,0x000000ea,0x00000090, - 0x0000005d,0x0004003d,0x00000006,0x000000eb,0x000000ea,0x00050083,0x00000006,0x000000ec, - 0x000000e9,0x000000eb,0x0006000c,0x00000006,0x000000ed,0x00000001,0x00000004,0x000000ec, - 0x00050041,0x00000007,0x000000ee,0x00000090,0x0000005d,0x0004003d,0x00000006,0x000000ef, - 0x000000ee,0x00050041,0x00000007,0x000000f0,0x000000c3,0x0000005d,0x0004003d,0x00000006, - 0x000000f1,0x000000f0,0x00050083,0x00000006,0x000000f2,0x000000ef,0x000000f1,0x0006000c, - 0x00000006,0x000000f3,0x00000001,0x00000004,0x000000f2,0x000500b8,0x00000023,0x000000f4, - 0x000000ed,0x000000f3,0x000300f7,0x000000f7,0x00000000,0x000400fa,0x000000f4,0x000000f6, - 0x000000fb,0x000200f8,0x000000f6,0x0004003d,0x0000000f,0x000000f8,0x000000c9,0x0004003d, - 0x0000000f,0x000000f9,0x00000090,0x00050083,0x0000000f,0x000000fa,0x000000f8,0x000000f9, - 0x0003003e,0x000000f5,0x000000fa,0x000200f9,0x000000f7,0x000200f8,0x000000fb,0x0004003d, - 0x0000000f,0x000000fc,0x00000090,0x0004003d,0x0000000f,0x000000fd,0x000000c3,0x00050083, - 0x0000000f,0x000000fe,0x000000fc,0x000000fd,0x0003003e,0x000000f5,0x000000fe,0x000200f9, - 0x000000f7,0x000200f8,0x000000f7,0x0004003d,0x0000000f,0x000000ff,0x000000f5,0x0003003e, - 0x000000e7,0x000000ff,0x0004003d,0x0000000f,0x00000101,0x000000ce,0x0004003d,0x0000000f, - 0x00000102,0x000000e7,0x0007000c,0x0000000f,0x00000103,0x00000001,0x00000044,0x00000101, - 0x00000102,0x0006000c,0x0000000f,0x00000104,0x00000001,0x00000045,0x00000103,0x0003003e, - 0x00000100,0x00000104,0x0004003d,0x0000000f,0x00000105,0x00000100,0x0004003d,0x0000000f, - 0x00000106,0x00000090,0x0004007f,0x0000000f,0x00000107,0x00000106,0x00050094,0x00000006, - 0x00000108,0x00000105,0x00000107,0x000500b8,0x00000023,0x00000109,0x00000108,0x00000096, - 0x000300f7,0x0000010b,0x00000000,0x000400fa,0x00000109,0x0000010a,0x0000010b,0x000200f8, - 0x0000010a,0x0004003d,0x0000000f,0x0000010c,0x00000100,0x0004007f,0x0000000f,0x0000010d, - 0x0000010c,0x0003003e,0x00000100,0x0000010d,0x000200f9,0x0000010b,0x000200f8,0x0000010b, - 0x00050041,0x00000007,0x0000010f,0x000000b8,0x0000005d,0x0004003d,0x00000006,0x00000110, - 0x0000010f,0x00050041,0x00000007,0x00000111,0x000000be,0x0000005d,0x0004003d,0x00000006, - 0x00000112,0x00000111,0x00050081,0x00000006,0x00000113,0x00000110,0x00000112,0x00050041, - 0x00000007,0x00000114,0x00000090,0x0000005d,0x0004003d,0x00000006,0x00000115,0x00000114, - 0x00050085,0x00000006,0x00000116,0x00000057,0x00000115,0x00050083,0x00000006,0x00000117, - 0x00000113,0x00000116,0x0006000c,0x00000006,0x00000118,0x00000001,0x00000004,0x00000117, - 0x00050041,0x00000007,0x00000119,0x000000c9,0x0000005d,0x0004003d,0x00000006,0x0000011a, - 0x00000119,0x00050041,0x00000007,0x0000011b,0x000000c3,0x0000005d,0x0004003d,0x00000006, - 0x0000011c,0x0000011b,0x00050081,0x00000006,0x0000011d,0x0000011a,0x0000011c,0x00050041, - 0x00000007,0x0000011e,0x00000090,0x0000005d,0x0004003d,0x00000006,0x0000011f,0x0000011e, - 0x00050085,0x00000006,0x00000120,0x00000057,0x0000011f,0x00050083,0x00000006,0x00000121, - 0x0000011d,0x00000120,0x0006000c,0x00000006,0x00000122,0x00000001,0x00000004,0x00000121, - 0x00050081,0x00000006,0x00000123,0x00000118,0x00000122,0x00050041,0x00000007,0x00000124, - 0x00000090,0x0000005d,0x0004003d,0x00000006,0x00000125,0x00000124,0x00050088,0x00000006, - 0x00000126,0x00000123,0x00000125,0x0003003e,0x0000010e,0x00000126,0x0004003d,0x00000006, - 0x0000012a,0x0000010e,0x0008000c,0x00000006,0x0000012b,0x00000001,0x00000031,0x00000128, - 0x00000129,0x0000012a,0x00050083,0x00000006,0x0000012c,0x00000027,0x0000012b,0x0003003e, - 0x00000127,0x0000012c,0x0004003d,0x00000006,0x0000012d,0x00000127,0x000500bc,0x00000023, - 0x0000012e,0x0000012d,0x00000096,0x000300f7,0x00000130,0x00000000,0x000400fa,0x0000012e, - 0x0000012f,0x00000130,0x000200f8,0x0000012f,0x0004003d,0x000000b1,0x00000131,0x000000b3, - 0x0004003d,0x0000000d,0x00000132,0x0000006e,0x00040063,0x00000131,0x00000132,0x000000b6, - 0x000100fd,0x000200f8,0x00000130,0x0004003d,0x00000006,0x00000135,0x00000089,0x00050041, - 0x00000007,0x00000136,0x00000090,0x0000005d,0x0004003d,0x00000006,0x00000137,0x00000136, - 0x00060041,0x0000001c,0x00000138,0x00000018,0x0000002a,0x0000001b,0x0004003d,0x00000006, - 0x00000139,0x00000138,0x00050085,0x00000006,0x0000013a,0x00000137,0x00000139,0x00050088, - 0x00000006,0x0000013b,0x00000135,0x0000013a,0x00050085,0x00000006,0x0000013c,0x0000013b, - 0x00000050,0x00060041,0x00000079,0x0000013d,0x00000018,0x00000020,0x0000002b,0x0004003d, - 0x0000000c,0x0000013e,0x0000013d,0x0004006f,0x00000006,0x0000013f,0x0000013e,0x00050085, - 0x00000006,0x00000140,0x0000013c,0x0000013f,0x00060041,0x00000079,0x00000142,0x00000018, - 0x00000020,0x0000002b,0x0004003d,0x0000000c,0x00000143,0x00000142,0x0004006f,0x00000006, - 0x00000144,0x00000143,0x00050085,0x00000006,0x00000145,0x00000141,0x00000144,0x0008000c, - 0x00000006,0x00000146,0x00000001,0x0000002b,0x00000140,0x00000057,0x00000145,0x0003003e, - 0x00000134,0x00000146,0x00050041,0x00000076,0x0000014a,0x0000006e,0x0000002f,0x0004003d, - 0x0000000c,0x0000014b,0x0000014a,0x0004006f,0x00000006,0x0000014c,0x0000014b,0x00050085, - 0x00000006,0x0000014d,0x00000149,0x0000014c,0x00050041,0x00000076,0x0000014f,0x0000006e, - 0x0000002b,0x0004003d,0x0000000c,0x00000150,0x0000014f,0x0004006f,0x00000006,0x00000151, - 0x00000150,0x00050085,0x00000006,0x00000152,0x0000014e,0x00000151,0x00050081,0x00000006, - 0x00000153,0x0000014d,0x00000152,0x0006000c,0x00000006,0x00000154,0x00000001,0x0000000a, - 0x00000153,0x00050085,0x00000006,0x00000155,0x00000148,0x00000154,0x0006000c,0x00000006, - 0x00000156,0x00000001,0x0000000a,0x00000155,0x0003003e,0x00000147,0x00000156,0x0004003d, - 0x00000006,0x00000158,0x00000089,0x0004003d,0x00000006,0x00000159,0x00000089,0x00050085, - 0x00000006,0x0000015a,0x00000158,0x00000159,0x0003003e,0x00000157,0x0000015a,0x0003003e, - 0x0000015b,0x00000096,0x0003003e,0x0000015c,0x0000015d,0x0003003e,0x0000015e,0x00000022, - 0x000200f9,0x0000015f,0x000200f8,0x0000015f,0x000400f6,0x00000161,0x00000162,0x00000000, - 0x000200f9,0x00000163,0x000200f8,0x00000163,0x0004003d,0x0000000c,0x00000164,0x0000015e, - 0x000500b1,0x00000023,0x00000166,0x00000164,0x00000165,0x000400fa,0x00000166,0x00000160, - 0x00000161,0x000200f8,0x00000160,0x0004003d,0x0000000c,0x00000168,0x0000015e,0x0004006f, - 0x00000006,0x00000169,0x00000168,0x00050081,0x00000006,0x0000016a,0x00000169,0x00000050, - 0x00050088,0x00000006,0x0000016c,0x0000016a,0x0000016b,0x0003003e,0x00000167,0x0000016c, - 0x0004003d,0x00000006,0x0000016f,0x00000167,0x00050085,0x00000006,0x00000171,0x0000016f, - 0x00000170,0x0004003d,0x00000006,0x00000172,0x00000147,0x00050081,0x00000006,0x00000173, - 0x00000171,0x00000172,0x00050085,0x00000006,0x00000174,0x0000016e,0x00000173,0x0003003e, - 0x0000016d,0x00000174,0x0004003d,0x00000006,0x00000176,0x0000016d,0x0006000c,0x00000006, - 0x00000177,0x00000001,0x0000000e,0x00000176,0x0004003d,0x00000006,0x00000178,0x0000016d, - 0x0006000c,0x00000006,0x00000179,0x00000001,0x0000000d,0x00000178,0x00050050,0x00000014, - 0x0000017a,0x00000177,0x00000179,0x0004003d,0x00000006,0x0000017b,0x00000134,0x0004003d, - 0x00000006,0x0000017c,0x00000167,0x00050085,0x00000006,0x0000017d,0x0000017b,0x0000017c, - 0x0005008e,0x00000014,0x0000017e,0x0000017a,0x0000017d,0x0003003e,0x00000175,0x0000017e, - 0x0004003d,0x0000000d,0x00000180,0x0000006e,0x0004003d,0x00000014,0x00000181,0x00000175, - 0x0006000c,0x00000014,0x00000182,0x00000001,0x00000001,0x00000181,0x0004006e,0x0000000d, - 0x00000183,0x00000182,0x00050080,0x0000000d,0x00000184,0x00000180,0x00000183,0x0003003e, - 0x0000017f,0x00000184,0x0004003d,0x0000000d,0x00000187,0x0000017f,0x0003003e,0x00000186, - 0x00000187,0x00050039,0x0000000f,0x00000188,0x00000012,0x00000186,0x0004003d,0x0000000f, - 0x00000189,0x00000090,0x00050083,0x0000000f,0x0000018a,0x00000188,0x00000189,0x0003003e, - 0x00000185,0x0000018a,0x0004003d,0x0000000f,0x0000018c,0x00000185,0x0004003d,0x0000000f, - 0x0000018d,0x00000185,0x00050094,0x00000006,0x0000018e,0x0000018c,0x0000018d,0x0003003e, - 0x0000018b,0x0000018e,0x0004003d,0x00000006,0x0000018f,0x0000018b,0x000500b8,0x00000023, - 0x00000191,0x0000018f,0x00000190,0x000300f7,0x00000193,0x00000000,0x000400fa,0x00000191, - 0x00000192,0x00000193,0x000200f8,0x00000192,0x000200f9,0x00000162,0x000200f8,0x00000193, - 0x0004003d,0x0000000f,0x00000196,0x00000185,0x0004003d,0x0000000f,0x00000197,0x00000100, - 0x00050094,0x00000006,0x00000198,0x00000196,0x00000197,0x0004003d,0x00000006,0x00000199, - 0x0000018b,0x0006000c,0x00000006,0x0000019a,0x00000001,0x00000020,0x00000199,0x00050085, - 0x00000006,0x0000019b,0x00000198,0x0000019a,0x0003003e,0x00000195,0x0000019b,0x0004003d, - 0x00000006,0x0000019e,0x00000089,0x00050085,0x00000006,0x0000019f,0x0000019d,0x0000019e, - 0x0004003d,0x00000006,0x000001a1,0x00000089,0x00050085,0x00000006,0x000001a2,0x000001a0, - 0x000001a1,0x0004003d,0x00000006,0x000001a3,0x0000018b,0x0006000c,0x00000006,0x000001a4, - 0x00000001,0x0000001f,0x000001a3,0x0008000c,0x00000006,0x000001a5,0x00000001,0x00000031, - 0x0000019f,0x000001a2,0x000001a4,0x0003003e,0x0000019c,0x000001a5,0x0004003d,0x00000006, - 0x000001a7,0x00000195,0x00050083,0x00000006,0x000001a9,0x000001a7,0x000001a8,0x00050088, - 0x00000006,0x000001ab,0x000001a9,0x000001aa,0x0008000c,0x00000006,0x000001ac,0x00000001, - 0x0000002b,0x000001ab,0x00000096,0x00000027,0x0004003d,0x00000006,0x000001ad,0x0000018b, - 0x0004003d,0x00000006,0x000001ae,0x00000157,0x00050088,0x00000006,0x000001af,0x000001ad, - 0x000001ae,0x00050083,0x00000006,0x000001b0,0x00000027,0x000001af,0x0008000c,0x00000006, - 0x000001b1,0x00000001,0x0000002b,0x000001b0,0x00000096,0x00000027,0x00050085,0x00000006, - 0x000001b2,0x000001ac,0x000001b1,0x0004003d,0x00000006,0x000001b3,0x0000019c,0x00050085, - 0x00000006,0x000001b4,0x000001b2,0x000001b3,0x0003003e,0x000001a6,0x000001b4,0x0004003d, - 0x00000006,0x000001b5,0x000001a6,0x0004003d,0x00000006,0x000001b6,0x0000015b,0x00050081, - 0x00000006,0x000001b7,0x000001b6,0x000001b5,0x0003003e,0x0000015b,0x000001b7,0x0004003d, - 0x00000006,0x000001b8,0x000001a6,0x0004003d,0x00000042,0x000001ba,0x000001b9,0x0004003d, - 0x0000000d,0x000001bb,0x0000017f,0x00050041,0x0000003a,0x000001bc,0x00000018,0x00000020, - 0x0004003d,0x0000000d,0x000001bd,0x000001bc,0x00050050,0x0000000d,0x000001be,0x00000020, - 0x00000020,0x00050082,0x0000000d,0x000001bf,0x000001bd,0x000001be,0x0008000c,0x0000000d, - 0x000001c0,0x00000001,0x0000002d,0x000001bb,0x00000039,0x000001bf,0x00040064,0x00000041, - 0x000001c1,0x000001ba,0x0007005f,0x00000015,0x000001c2,0x000001c1,0x000001c0,0x00000002, - 0x00000022,0x0008004f,0x0000000f,0x000001c3,0x000001c2,0x000001c2,0x00000000,0x00000001, - 0x00000002,0x0005008e,0x0000000f,0x000001c4,0x000001c3,0x000001b8,0x0004003d,0x0000000f, - 0x000001c5,0x0000015c,0x00050081,0x0000000f,0x000001c6,0x000001c5,0x000001c4,0x0003003e, - 0x0000015c,0x000001c6,0x000200f9,0x00000162,0x000200f8,0x00000162,0x0004003d,0x0000000c, - 0x000001c7,0x0000015e,0x00050080,0x0000000c,0x000001c8,0x000001c7,0x00000020,0x0003003e, - 0x0000015e,0x000001c8,0x000200f9,0x0000015f,0x000200f8,0x00000161,0x00060041,0x0000001c, - 0x000001ca,0x00000018,0x00000019,0x0000002b,0x0004003d,0x00000006,0x000001cb,0x000001ca, - 0x0004003d,0x00000006,0x000001cc,0x0000015b,0x00050085,0x00000006,0x000001cd,0x000001cb, - 0x000001cc,0x00050088,0x00000006,0x000001ce,0x000001cd,0x0000016b,0x00050083,0x00000006, - 0x000001cf,0x00000027,0x000001ce,0x0008000c,0x00000006,0x000001d0,0x00000001,0x0000002b, - 0x000001cf,0x00000050,0x00000027,0x0003003e,0x000001c9,0x000001d0,0x0004003d,0x00000006, - 0x000001d1,0x000001c9,0x0004003d,0x00000006,0x000001d3,0x0000008c,0x00050085,0x00000006, - 0x000001d4,0x000001d2,0x000001d3,0x0004003d,0x00000006,0x000001d5,0x0000008c,0x00050041, - 0x00000007,0x000001d6,0x00000090,0x0000005d,0x0004003d,0x00000006,0x000001d7,0x000001d6, - 0x0008000c,0x00000006,0x000001d8,0x00000001,0x00000031,0x000001d4,0x000001d5,0x000001d7, - 0x0008000c,0x00000006,0x000001d9,0x00000001,0x0000002e,0x000001d1,0x00000027,0x000001d8, - 0x0003003e,0x000001c9,0x000001d9,0x0004003d,0x00000006,0x000001da,0x000001c9,0x0004003d, - 0x00000006,0x000001db,0x00000127,0x0008000c,0x00000006,0x000001dc,0x00000001,0x0000002e, - 0x00000027,0x000001da,0x000001db,0x0003003e,0x000001c9,0x000001dc,0x0004003d,0x00000006, - 0x000001de,0x00000127,0x0004003d,0x00000006,0x000001df,0x0000008c,0x00050085,0x00000006, - 0x000001e0,0x000001d2,0x000001df,0x0004003d,0x00000006,0x000001e1,0x0000008c,0x00050041, - 0x00000007,0x000001e2,0x00000090,0x0000005d,0x0004003d,0x00000006,0x000001e3,0x000001e2, - 0x0008000c,0x00000006,0x000001e4,0x00000001,0x00000031,0x000001e0,0x000001e1,0x000001e3, - 0x00050083,0x00000006,0x000001e5,0x00000027,0x000001e4,0x00050085,0x00000006,0x000001e6, - 0x000001de,0x000001e5,0x0003003e,0x000001dd,0x000001e6,0x0004003d,0x000000b1,0x000001e7, - 0x000000b3,0x0004003d,0x0000000d,0x000001e8,0x0000006e,0x0004003d,0x0000000f,0x000001e9, - 0x0000015c,0x00060050,0x0000000f,0x000001ea,0x0000016b,0x0000016b,0x0000016b,0x00050088, - 0x0000000f,0x000001eb,0x000001e9,0x000001ea,0x0004003d,0x00000006,0x000001ec,0x000001dd, - 0x0005008e,0x0000000f,0x000001ed,0x000001eb,0x000001ec,0x0004003d,0x00000006,0x000001ee, - 0x000001c9,0x00050051,0x00000006,0x000001ef,0x000001ed,0x00000000,0x00050051,0x00000006, - 0x000001f0,0x000001ed,0x00000001,0x00050051,0x00000006,0x000001f1,0x000001ed,0x00000002, - 0x00070050,0x00000015,0x000001f2,0x000001ef,0x000001f0,0x000001f1,0x000001ee,0x00040063, - 0x000001e7,0x000001e8,0x000001f2,0x000100fd,0x00010038,0x00050036,0x00000006,0x0000000a, - 0x00000000,0x00000008,0x00030037,0x00000007,0x00000009,0x000200f8,0x0000000b,0x00060041, - 0x0000001c,0x0000001d,0x00000018,0x00000019,0x0000001b,0x0004003d,0x00000006,0x0000001e, - 0x0000001d,0x0004006e,0x0000000c,0x0000001f,0x0000001e,0x000500c7,0x0000000c,0x00000021, - 0x0000001f,0x00000020,0x000500ab,0x00000023,0x00000024,0x00000021,0x00000022,0x000300f7, - 0x00000026,0x00000000,0x000400fa,0x00000024,0x00000025,0x00000026,0x000200f8,0x00000025, - 0x0004003d,0x00000006,0x00000028,0x00000009,0x00050083,0x00000006,0x00000029,0x00000027, - 0x00000028,0x0003003e,0x00000009,0x00000029,0x000200f9,0x00000026,0x000200f8,0x00000026, - 0x00060041,0x0000001c,0x0000002c,0x00000018,0x0000002a,0x0000002b,0x0004003d,0x00000006, - 0x0000002d,0x0000002c,0x0004003d,0x00000006,0x0000002e,0x00000009,0x00060041,0x0000001c, - 0x00000030,0x00000018,0x0000002a,0x0000002f,0x0004003d,0x00000006,0x00000031,0x00000030, - 0x00050083,0x00000006,0x00000032,0x0000002e,0x00000031,0x0007000c,0x00000006,0x00000034, - 0x00000001,0x00000028,0x00000032,0x00000033,0x00050088,0x00000006,0x00000035,0x0000002d, - 0x00000034,0x000200fe,0x00000035,0x00010038,0x00050036,0x0000000f,0x00000012,0x00000000, - 0x00000010,0x00030037,0x0000000e,0x00000011,0x000200f8,0x00000013,0x0004003b,0x00000007, - 0x00000040,0x00000007,0x0004003b,0x00000007,0x00000049,0x00000007,0x0004003b,0x0000004c, - 0x0000004d,0x00000007,0x0004003d,0x0000000d,0x00000038,0x00000011,0x00050041,0x0000003a, - 0x0000003b,0x00000018,0x00000020,0x0004003d,0x0000000d,0x0000003c,0x0000003b,0x00050050, - 0x0000000d,0x0000003d,0x00000020,0x00000020,0x00050082,0x0000000d,0x0000003e,0x0000003c, - 0x0000003d,0x0008000c,0x0000000d,0x0000003f,0x00000001,0x0000002d,0x00000038,0x00000039, - 0x0000003e,0x0003003e,0x00000011,0x0000003f,0x0004003d,0x00000042,0x00000045,0x00000044, - 0x0004003d,0x0000000d,0x00000046,0x00000011,0x00040064,0x00000041,0x00000047,0x00000045, - 0x0007005f,0x00000015,0x00000048,0x00000047,0x00000046,0x00000002,0x00000022,0x00050051, - 0x00000006,0x0000004a,0x00000048,0x00000000,0x0003003e,0x00000049,0x0000004a,0x00050039, - 0x00000006,0x0000004b,0x0000000a,0x00000049,0x0003003e,0x00000040,0x0000004b,0x0004003d, - 0x0000000d,0x0000004e,0x00000011,0x0004006f,0x00000014,0x0000004f,0x0000004e,0x00050050, - 0x00000014,0x00000051,0x00000050,0x00000050,0x00050081,0x00000014,0x00000052,0x0000004f, - 0x00000051,0x00050041,0x00000053,0x00000054,0x00000018,0x00000022,0x0004003d,0x00000014, - 0x00000055,0x00000054,0x00050085,0x00000014,0x00000056,0x00000052,0x00000055,0x0005008e, - 0x00000014,0x00000058,0x00000056,0x00000057,0x00050050,0x00000014,0x00000059,0x00000027, - 0x00000027,0x00050083,0x00000014,0x0000005a,0x00000058,0x00000059,0x0003003e,0x0000004d, - 0x0000005a,0x00050041,0x00000007,0x0000005b,0x0000004d,0x0000002f,0x0004003d,0x00000006, - 0x0000005c,0x0000005b,0x00060041,0x0000001c,0x0000005e,0x00000018,0x0000002a,0x0000005d, - 0x0004003d,0x00000006,0x0000005f,0x0000005e,0x00050085,0x00000006,0x00000060,0x0000005c, - 0x0000005f,0x0004003d,0x00000006,0x00000061,0x00000040,0x00050085,0x00000006,0x00000062, - 0x00000060,0x00000061,0x00050041,0x00000007,0x00000063,0x0000004d,0x0000002b,0x0004003d, - 0x00000006,0x00000064,0x00000063,0x00060041,0x0000001c,0x00000065,0x00000018,0x0000002a, - 0x0000001b,0x0004003d,0x00000006,0x00000066,0x00000065,0x00050085,0x00000006,0x00000067, - 0x00000064,0x00000066,0x0004003d,0x00000006,0x00000068,0x00000040,0x00050085,0x00000006, - 0x00000069,0x00000067,0x00000068,0x0004003d,0x00000006,0x0000006a,0x00000040,0x00060050, - 0x0000000f,0x0000006b,0x00000062,0x00000069,0x0000006a,0x000200fe,0x0000006b,0x00010038 + 0x00006f6c,0x00030005,0x0000015f,0x00637273,0x00030005,0x0000016a,0x00006968,0x00030005, + 0x0000016c,0x00000069,0x00030005,0x00000175,0x00000074,0x00040005,0x0000017b,0x6c676e61, + 0x00000065,0x00040005,0x00000183,0x7366666f,0x00007465,0x00030005,0x0000018d,0x00000071, + 0x00040005,0x00000193,0x6e656573,0x00000000,0x00030005,0x0000019e,0x00000079,0x00030005, + 0x000001a7,0x00000076,0x00040005,0x000001a8,0x61726170,0x0000006d,0x00030005,0x000001ad, + 0x00007676,0x00040005,0x000001b7,0x69736f63,0x0000656e,0x00050005,0x000001be,0x7261656e, + 0x6168735f,0x00006572,0x00030005,0x000001c8,0x00000077,0x00050005,0x000001e1,0x746e6f63, + 0x74736172,0x00000000,0x00050005,0x000001e9,0x5f746f6e,0x74616c66,0x00000000,0x00030005, + 0x000001ee,0x00006f61,0x00040005,0x00000204,0x7065656b,0x00000000,0x00030047,0x00000016, + 0x00000002,0x00050048,0x00000016,0x00000000,0x00000023,0x00000000,0x00050048,0x00000016, + 0x00000001,0x00000023,0x00000008,0x00050048,0x00000016,0x00000002,0x00000023,0x00000010, + 0x00050048,0x00000016,0x00000003,0x00000023,0x00000020,0x00040047,0x00000044,0x00000021, + 0x00000000,0x00040047,0x00000044,0x00000022,0x00000000,0x00040047,0x00000071,0x0000000b, + 0x0000001c,0x00030047,0x000000b3,0x00000019,0x00040047,0x000000b3,0x00000021,0x00000002, + 0x00040047,0x000000b3,0x00000022,0x00000000,0x00040047,0x0000015f,0x00000021,0x00000001, + 0x00040047,0x0000015f,0x00000022,0x00000000,0x00040047,0x0000021d,0x0000000b,0x00000019, + 0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020, + 0x00040020,0x00000007,0x00000007,0x00000006,0x00040021,0x00000008,0x00000006,0x00000007, + 0x00040015,0x0000000c,0x00000020,0x00000001,0x00040017,0x0000000d,0x0000000c,0x00000002, + 0x00040020,0x0000000e,0x00000007,0x0000000d,0x00040017,0x0000000f,0x00000006,0x00000003, + 0x00040021,0x00000010,0x0000000f,0x0000000e,0x00040017,0x00000014,0x00000006,0x00000002, + 0x00040017,0x00000015,0x00000006,0x00000004,0x0006001e,0x00000016,0x00000014,0x0000000d, + 0x00000015,0x00000015,0x00040020,0x00000017,0x00000009,0x00000016,0x0004003b,0x00000017, + 0x00000018,0x00000009,0x0004002b,0x0000000c,0x00000019,0x00000003,0x00040015,0x0000001a, + 0x00000020,0x00000000,0x0004002b,0x0000001a,0x0000001b,0x00000003,0x00040020,0x0000001c, + 0x00000009,0x00000006,0x0004002b,0x0000000c,0x00000020,0x00000001,0x0004002b,0x0000000c, + 0x00000022,0x00000000,0x00020014,0x00000023,0x0004002b,0x00000006,0x00000027,0x3f800000, + 0x0004002b,0x0000000c,0x0000002a,0x00000002,0x0004002b,0x0000001a,0x0000002b,0x00000001, + 0x0004002b,0x0000001a,0x0000002f,0x00000000,0x0004002b,0x00000006,0x00000033,0x33d6bf95, + 0x0005002c,0x0000000d,0x00000039,0x00000022,0x00000022,0x00040020,0x0000003a,0x00000009, + 0x0000000d,0x00090019,0x00000041,0x00000006,0x00000001,0x00000000,0x00000000,0x00000000, + 0x00000001,0x00000000,0x0003001b,0x00000042,0x00000041,0x00040020,0x00000043,0x00000000, + 0x00000042,0x0004003b,0x00000043,0x00000044,0x00000000,0x00040020,0x0000004c,0x00000007, + 0x00000014,0x0004002b,0x00000006,0x00000050,0x3f000000,0x00040020,0x00000053,0x00000009, + 0x00000014,0x0004002b,0x00000006,0x00000057,0x40000000,0x0004002b,0x0000001a,0x0000005d, + 0x00000002,0x00040017,0x0000006f,0x0000001a,0x00000003,0x00040020,0x00000070,0x00000001, + 0x0000006f,0x0004003b,0x00000070,0x00000071,0x00000001,0x00040017,0x00000072,0x0000001a, + 0x00000002,0x00040020,0x00000076,0x00000007,0x0000000c,0x00040020,0x00000079,0x00000009, + 0x0000000c,0x00040020,0x0000008f,0x00000007,0x0000000f,0x0004002b,0x00000006,0x00000096, + 0x00000000,0x00090019,0x000000b1,0x00000006,0x00000001,0x00000000,0x00000000,0x00000000, + 0x00000002,0x00000002,0x00040020,0x000000b2,0x00000000,0x000000b1,0x0004003b,0x000000b2, + 0x000000b3,0x00000000,0x0007002c,0x00000015,0x000000b6,0x00000096,0x00000096,0x00000096, + 0x00000027,0x0005002c,0x0000000d,0x000000ba,0x00000020,0x00000022,0x0005002c,0x0000000d, + 0x000000c5,0x00000022,0x00000020,0x0004002b,0x00000006,0x00000128,0x3b83126f,0x0004002b, + 0x00000006,0x00000129,0x3ca3d70a,0x0004002b,0x00000006,0x00000141,0x3dcccccd,0x0004002b, + 0x00000006,0x00000148,0x4253ee82,0x0004002b,0x00000006,0x00000149,0x3d897143,0x0004002b, + 0x00000006,0x0000014e,0x3bbf4590,0x0006002c,0x0000000f,0x0000015d,0x00000096,0x00000096, + 0x00000096,0x0004003b,0x00000043,0x0000015f,0x00000000,0x0004002b,0x00000006,0x00000165, + 0x3e59b3d0,0x0004002b,0x00000006,0x00000166,0x3f371759,0x0004002b,0x00000006,0x00000167, + 0x3d93dd98,0x0006002c,0x0000000f,0x00000168,0x00000165,0x00000166,0x00000167,0x0004002b, + 0x0000000c,0x00000173,0x0000000c,0x0004002b,0x00000006,0x00000179,0x41400000,0x0004002b, + 0x00000006,0x0000017c,0x40c90fdb,0x0004002b,0x00000006,0x0000017e,0x40e00000,0x0004002b, + 0x00000006,0x000001b2,0x322bcc77,0x0004002b,0x00000006,0x000001bf,0x3e19999a,0x0004002b, + 0x00000006,0x000001c2,0x3ecccccd,0x0004002b,0x00000006,0x000001ca,0x3e800000,0x0004002b, + 0x00000006,0x000001cc,0x3f400000,0x0004002b,0x00000006,0x000001e6,0x3d4ccccd,0x0004002b, + 0x00000006,0x000001ea,0x3d23d70a,0x0004002b,0x00000006,0x000001eb,0x3e23d70a,0x0004002b, + 0x00000006,0x000001f7,0x3f19999a,0x0004002b,0x0000001a,0x0000021c,0x00000008,0x0006002c, + 0x0000006f,0x0000021d,0x0000021c,0x0000021c,0x0000002b,0x00050036,0x00000002,0x00000004, + 0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x0000000e,0x0000006e,0x00000007, + 0x0004003b,0x00000007,0x00000089,0x00000007,0x0004003b,0x00000007,0x0000008c,0x00000007, + 0x0004003b,0x0000008f,0x00000090,0x00000007,0x0004003b,0x0000000e,0x00000091,0x00000007, + 0x0004003b,0x0000008f,0x000000b8,0x00000007,0x0004003b,0x0000000e,0x000000bc,0x00000007, + 0x0004003b,0x0000008f,0x000000be,0x00000007,0x0004003b,0x0000000e,0x000000c1,0x00000007, + 0x0004003b,0x0000008f,0x000000c3,0x00000007,0x0004003b,0x0000000e,0x000000c7,0x00000007, + 0x0004003b,0x0000008f,0x000000c9,0x00000007,0x0004003b,0x0000000e,0x000000cc,0x00000007, + 0x0004003b,0x0000008f,0x000000ce,0x00000007,0x0004003b,0x0000008f,0x000000dc,0x00000007, + 0x0004003b,0x0000008f,0x000000e7,0x00000007,0x0004003b,0x0000008f,0x000000f5,0x00000007, + 0x0004003b,0x0000008f,0x00000100,0x00000007,0x0004003b,0x00000007,0x0000010e,0x00000007, + 0x0004003b,0x00000007,0x00000127,0x00000007,0x0004003b,0x00000007,0x00000134,0x00000007, + 0x0004003b,0x00000007,0x00000147,0x00000007,0x0004003b,0x00000007,0x00000157,0x00000007, + 0x0004003b,0x00000007,0x0000015b,0x00000007,0x0004003b,0x0000008f,0x0000015c,0x00000007, + 0x0004003b,0x00000007,0x0000015e,0x00000007,0x0004003b,0x00000007,0x0000016a,0x00000007, + 0x0004003b,0x00000076,0x0000016c,0x00000007,0x0004003b,0x00000007,0x00000175,0x00000007, + 0x0004003b,0x00000007,0x0000017b,0x00000007,0x0004003b,0x0000004c,0x00000183,0x00000007, + 0x0004003b,0x0000000e,0x0000018d,0x00000007,0x0004003b,0x0000008f,0x00000193,0x00000007, + 0x0004003b,0x00000007,0x0000019e,0x00000007,0x0004003b,0x0000008f,0x000001a7,0x00000007, + 0x0004003b,0x0000000e,0x000001a8,0x00000007,0x0004003b,0x00000007,0x000001ad,0x00000007, + 0x0004003b,0x00000007,0x000001b7,0x00000007,0x0004003b,0x00000007,0x000001be,0x00000007, + 0x0004003b,0x00000007,0x000001c8,0x00000007,0x0004003b,0x00000007,0x000001e1,0x00000007, + 0x0004003b,0x00000007,0x000001e9,0x00000007,0x0004003b,0x00000007,0x000001ee,0x00000007, + 0x0004003b,0x00000007,0x00000204,0x00000007,0x0004003d,0x0000006f,0x00000073,0x00000071, + 0x0007004f,0x00000072,0x00000074,0x00000073,0x00000073,0x00000000,0x00000001,0x0004007c, + 0x0000000d,0x00000075,0x00000074,0x0003003e,0x0000006e,0x00000075,0x00050041,0x00000076, + 0x00000077,0x0000006e,0x0000002f,0x0004003d,0x0000000c,0x00000078,0x00000077,0x00060041, + 0x00000079,0x0000007a,0x00000018,0x00000020,0x0000002f,0x0004003d,0x0000000c,0x0000007b, + 0x0000007a,0x000500af,0x00000023,0x0000007c,0x00000078,0x0000007b,0x000400a8,0x00000023, + 0x0000007d,0x0000007c,0x000300f7,0x0000007f,0x00000000,0x000400fa,0x0000007d,0x0000007e, + 0x0000007f,0x000200f8,0x0000007e,0x00050041,0x00000076,0x00000080,0x0000006e,0x0000002b, + 0x0004003d,0x0000000c,0x00000081,0x00000080,0x00060041,0x00000079,0x00000082,0x00000018, + 0x00000020,0x0000002b,0x0004003d,0x0000000c,0x00000083,0x00000082,0x000500af,0x00000023, + 0x00000084,0x00000081,0x00000083,0x000200f9,0x0000007f,0x000200f8,0x0000007f,0x000700f5, + 0x00000023,0x00000085,0x0000007c,0x00000005,0x00000084,0x0000007e,0x000300f7,0x00000087, + 0x00000000,0x000400fa,0x00000085,0x00000086,0x00000087,0x000200f8,0x00000086,0x000100fd, + 0x000200f8,0x00000087,0x00060041,0x0000001c,0x0000008a,0x00000018,0x00000019,0x0000002f, + 0x0004003d,0x00000006,0x0000008b,0x0000008a,0x0003003e,0x00000089,0x0000008b,0x00060041, + 0x0000001c,0x0000008d,0x00000018,0x00000019,0x0000005d,0x0004003d,0x00000006,0x0000008e, + 0x0000008d,0x0003003e,0x0000008c,0x0000008e,0x0004003d,0x0000000d,0x00000092,0x0000006e, + 0x0003003e,0x00000091,0x00000092,0x00050039,0x0000000f,0x00000093,0x00000012,0x00000091, + 0x0003003e,0x00000090,0x00000093,0x00050041,0x00000007,0x00000094,0x00000090,0x0000005d, + 0x0004003d,0x00000006,0x00000095,0x00000094,0x000500ba,0x00000023,0x00000097,0x00000095, + 0x00000096,0x000400a8,0x00000023,0x00000098,0x00000097,0x000400a8,0x00000023,0x00000099, + 0x00000098,0x000300f7,0x0000009b,0x00000000,0x000400fa,0x00000099,0x0000009a,0x0000009b, + 0x000200f8,0x0000009a,0x00050041,0x00000007,0x0000009c,0x00000090,0x0000005d,0x0004003d, + 0x00000006,0x0000009d,0x0000009c,0x0004003d,0x00000006,0x0000009e,0x0000008c,0x000500be, + 0x00000023,0x0000009f,0x0000009d,0x0000009e,0x000200f9,0x0000009b,0x000200f8,0x0000009b, + 0x000700f5,0x00000023,0x000000a0,0x00000098,0x00000087,0x0000009f,0x0000009a,0x000400a8, + 0x00000023,0x000000a1,0x000000a0,0x000300f7,0x000000a3,0x00000000,0x000400fa,0x000000a1, + 0x000000a2,0x000000a3,0x000200f8,0x000000a2,0x00050041,0x00000007,0x000000a4,0x00000090, + 0x0000005d,0x0004003d,0x00000006,0x000000a5,0x000000a4,0x0004009d,0x00000023,0x000000a6, + 0x000000a5,0x000200f9,0x000000a3,0x000200f8,0x000000a3,0x000700f5,0x00000023,0x000000a7, + 0x000000a0,0x0000009b,0x000000a6,0x000000a2,0x000400a8,0x00000023,0x000000a8,0x000000a7, + 0x000300f7,0x000000aa,0x00000000,0x000400fa,0x000000a8,0x000000a9,0x000000aa,0x000200f8, + 0x000000a9,0x00050041,0x00000007,0x000000ab,0x00000090,0x0000005d,0x0004003d,0x00000006, + 0x000000ac,0x000000ab,0x0004009c,0x00000023,0x000000ad,0x000000ac,0x000200f9,0x000000aa, + 0x000200f8,0x000000aa,0x000700f5,0x00000023,0x000000ae,0x000000a7,0x000000a3,0x000000ad, + 0x000000a9,0x000300f7,0x000000b0,0x00000000,0x000400fa,0x000000ae,0x000000af,0x000000b0, + 0x000200f8,0x000000af,0x0004003d,0x000000b1,0x000000b4,0x000000b3,0x0004003d,0x0000000d, + 0x000000b5,0x0000006e,0x00040063,0x000000b4,0x000000b5,0x000000b6,0x000100fd,0x000200f8, + 0x000000b0,0x0004003d,0x0000000d,0x000000b9,0x0000006e,0x00050082,0x0000000d,0x000000bb, + 0x000000b9,0x000000ba,0x0003003e,0x000000bc,0x000000bb,0x00050039,0x0000000f,0x000000bd, + 0x00000012,0x000000bc,0x0003003e,0x000000b8,0x000000bd,0x0004003d,0x0000000d,0x000000bf, + 0x0000006e,0x00050080,0x0000000d,0x000000c0,0x000000bf,0x000000ba,0x0003003e,0x000000c1, + 0x000000c0,0x00050039,0x0000000f,0x000000c2,0x00000012,0x000000c1,0x0003003e,0x000000be, + 0x000000c2,0x0004003d,0x0000000d,0x000000c4,0x0000006e,0x00050082,0x0000000d,0x000000c6, + 0x000000c4,0x000000c5,0x0003003e,0x000000c7,0x000000c6,0x00050039,0x0000000f,0x000000c8, + 0x00000012,0x000000c7,0x0003003e,0x000000c3,0x000000c8,0x0004003d,0x0000000d,0x000000ca, + 0x0000006e,0x00050080,0x0000000d,0x000000cb,0x000000ca,0x000000c5,0x0003003e,0x000000cc, + 0x000000cb,0x00050039,0x0000000f,0x000000cd,0x00000012,0x000000cc,0x0003003e,0x000000c9, + 0x000000cd,0x00050041,0x00000007,0x000000cf,0x000000be,0x0000005d,0x0004003d,0x00000006, + 0x000000d0,0x000000cf,0x00050041,0x00000007,0x000000d1,0x00000090,0x0000005d,0x0004003d, + 0x00000006,0x000000d2,0x000000d1,0x00050083,0x00000006,0x000000d3,0x000000d0,0x000000d2, + 0x0006000c,0x00000006,0x000000d4,0x00000001,0x00000004,0x000000d3,0x00050041,0x00000007, + 0x000000d5,0x00000090,0x0000005d,0x0004003d,0x00000006,0x000000d6,0x000000d5,0x00050041, + 0x00000007,0x000000d7,0x000000b8,0x0000005d,0x0004003d,0x00000006,0x000000d8,0x000000d7, + 0x00050083,0x00000006,0x000000d9,0x000000d6,0x000000d8,0x0006000c,0x00000006,0x000000da, + 0x00000001,0x00000004,0x000000d9,0x000500b8,0x00000023,0x000000db,0x000000d4,0x000000da, + 0x000300f7,0x000000de,0x00000000,0x000400fa,0x000000db,0x000000dd,0x000000e2,0x000200f8, + 0x000000dd,0x0004003d,0x0000000f,0x000000df,0x000000be,0x0004003d,0x0000000f,0x000000e0, + 0x00000090,0x00050083,0x0000000f,0x000000e1,0x000000df,0x000000e0,0x0003003e,0x000000dc, + 0x000000e1,0x000200f9,0x000000de,0x000200f8,0x000000e2,0x0004003d,0x0000000f,0x000000e3, + 0x00000090,0x0004003d,0x0000000f,0x000000e4,0x000000b8,0x00050083,0x0000000f,0x000000e5, + 0x000000e3,0x000000e4,0x0003003e,0x000000dc,0x000000e5,0x000200f9,0x000000de,0x000200f8, + 0x000000de,0x0004003d,0x0000000f,0x000000e6,0x000000dc,0x0003003e,0x000000ce,0x000000e6, + 0x00050041,0x00000007,0x000000e8,0x000000c9,0x0000005d,0x0004003d,0x00000006,0x000000e9, + 0x000000e8,0x00050041,0x00000007,0x000000ea,0x00000090,0x0000005d,0x0004003d,0x00000006, + 0x000000eb,0x000000ea,0x00050083,0x00000006,0x000000ec,0x000000e9,0x000000eb,0x0006000c, + 0x00000006,0x000000ed,0x00000001,0x00000004,0x000000ec,0x00050041,0x00000007,0x000000ee, + 0x00000090,0x0000005d,0x0004003d,0x00000006,0x000000ef,0x000000ee,0x00050041,0x00000007, + 0x000000f0,0x000000c3,0x0000005d,0x0004003d,0x00000006,0x000000f1,0x000000f0,0x00050083, + 0x00000006,0x000000f2,0x000000ef,0x000000f1,0x0006000c,0x00000006,0x000000f3,0x00000001, + 0x00000004,0x000000f2,0x000500b8,0x00000023,0x000000f4,0x000000ed,0x000000f3,0x000300f7, + 0x000000f7,0x00000000,0x000400fa,0x000000f4,0x000000f6,0x000000fb,0x000200f8,0x000000f6, + 0x0004003d,0x0000000f,0x000000f8,0x000000c9,0x0004003d,0x0000000f,0x000000f9,0x00000090, + 0x00050083,0x0000000f,0x000000fa,0x000000f8,0x000000f9,0x0003003e,0x000000f5,0x000000fa, + 0x000200f9,0x000000f7,0x000200f8,0x000000fb,0x0004003d,0x0000000f,0x000000fc,0x00000090, + 0x0004003d,0x0000000f,0x000000fd,0x000000c3,0x00050083,0x0000000f,0x000000fe,0x000000fc, + 0x000000fd,0x0003003e,0x000000f5,0x000000fe,0x000200f9,0x000000f7,0x000200f8,0x000000f7, + 0x0004003d,0x0000000f,0x000000ff,0x000000f5,0x0003003e,0x000000e7,0x000000ff,0x0004003d, + 0x0000000f,0x00000101,0x000000ce,0x0004003d,0x0000000f,0x00000102,0x000000e7,0x0007000c, + 0x0000000f,0x00000103,0x00000001,0x00000044,0x00000101,0x00000102,0x0006000c,0x0000000f, + 0x00000104,0x00000001,0x00000045,0x00000103,0x0003003e,0x00000100,0x00000104,0x0004003d, + 0x0000000f,0x00000105,0x00000100,0x0004003d,0x0000000f,0x00000106,0x00000090,0x0004007f, + 0x0000000f,0x00000107,0x00000106,0x00050094,0x00000006,0x00000108,0x00000105,0x00000107, + 0x000500b8,0x00000023,0x00000109,0x00000108,0x00000096,0x000300f7,0x0000010b,0x00000000, + 0x000400fa,0x00000109,0x0000010a,0x0000010b,0x000200f8,0x0000010a,0x0004003d,0x0000000f, + 0x0000010c,0x00000100,0x0004007f,0x0000000f,0x0000010d,0x0000010c,0x0003003e,0x00000100, + 0x0000010d,0x000200f9,0x0000010b,0x000200f8,0x0000010b,0x00050041,0x00000007,0x0000010f, + 0x000000b8,0x0000005d,0x0004003d,0x00000006,0x00000110,0x0000010f,0x00050041,0x00000007, + 0x00000111,0x000000be,0x0000005d,0x0004003d,0x00000006,0x00000112,0x00000111,0x00050081, + 0x00000006,0x00000113,0x00000110,0x00000112,0x00050041,0x00000007,0x00000114,0x00000090, + 0x0000005d,0x0004003d,0x00000006,0x00000115,0x00000114,0x00050085,0x00000006,0x00000116, + 0x00000057,0x00000115,0x00050083,0x00000006,0x00000117,0x00000113,0x00000116,0x0006000c, + 0x00000006,0x00000118,0x00000001,0x00000004,0x00000117,0x00050041,0x00000007,0x00000119, + 0x000000c9,0x0000005d,0x0004003d,0x00000006,0x0000011a,0x00000119,0x00050041,0x00000007, + 0x0000011b,0x000000c3,0x0000005d,0x0004003d,0x00000006,0x0000011c,0x0000011b,0x00050081, + 0x00000006,0x0000011d,0x0000011a,0x0000011c,0x00050041,0x00000007,0x0000011e,0x00000090, + 0x0000005d,0x0004003d,0x00000006,0x0000011f,0x0000011e,0x00050085,0x00000006,0x00000120, + 0x00000057,0x0000011f,0x00050083,0x00000006,0x00000121,0x0000011d,0x00000120,0x0006000c, + 0x00000006,0x00000122,0x00000001,0x00000004,0x00000121,0x00050081,0x00000006,0x00000123, + 0x00000118,0x00000122,0x00050041,0x00000007,0x00000124,0x00000090,0x0000005d,0x0004003d, + 0x00000006,0x00000125,0x00000124,0x00050088,0x00000006,0x00000126,0x00000123,0x00000125, + 0x0003003e,0x0000010e,0x00000126,0x0004003d,0x00000006,0x0000012a,0x0000010e,0x0008000c, + 0x00000006,0x0000012b,0x00000001,0x00000031,0x00000128,0x00000129,0x0000012a,0x00050083, + 0x00000006,0x0000012c,0x00000027,0x0000012b,0x0003003e,0x00000127,0x0000012c,0x0004003d, + 0x00000006,0x0000012d,0x00000127,0x000500bc,0x00000023,0x0000012e,0x0000012d,0x00000096, + 0x000300f7,0x00000130,0x00000000,0x000400fa,0x0000012e,0x0000012f,0x00000130,0x000200f8, + 0x0000012f,0x0004003d,0x000000b1,0x00000131,0x000000b3,0x0004003d,0x0000000d,0x00000132, + 0x0000006e,0x00040063,0x00000131,0x00000132,0x000000b6,0x000100fd,0x000200f8,0x00000130, + 0x0004003d,0x00000006,0x00000135,0x00000089,0x00050041,0x00000007,0x00000136,0x00000090, + 0x0000005d,0x0004003d,0x00000006,0x00000137,0x00000136,0x00060041,0x0000001c,0x00000138, + 0x00000018,0x0000002a,0x0000001b,0x0004003d,0x00000006,0x00000139,0x00000138,0x00050085, + 0x00000006,0x0000013a,0x00000137,0x00000139,0x00050088,0x00000006,0x0000013b,0x00000135, + 0x0000013a,0x00050085,0x00000006,0x0000013c,0x0000013b,0x00000050,0x00060041,0x00000079, + 0x0000013d,0x00000018,0x00000020,0x0000002b,0x0004003d,0x0000000c,0x0000013e,0x0000013d, + 0x0004006f,0x00000006,0x0000013f,0x0000013e,0x00050085,0x00000006,0x00000140,0x0000013c, + 0x0000013f,0x00060041,0x00000079,0x00000142,0x00000018,0x00000020,0x0000002b,0x0004003d, + 0x0000000c,0x00000143,0x00000142,0x0004006f,0x00000006,0x00000144,0x00000143,0x00050085, + 0x00000006,0x00000145,0x00000141,0x00000144,0x0008000c,0x00000006,0x00000146,0x00000001, + 0x0000002b,0x00000140,0x00000057,0x00000145,0x0003003e,0x00000134,0x00000146,0x00050041, + 0x00000076,0x0000014a,0x0000006e,0x0000002f,0x0004003d,0x0000000c,0x0000014b,0x0000014a, + 0x0004006f,0x00000006,0x0000014c,0x0000014b,0x00050085,0x00000006,0x0000014d,0x00000149, + 0x0000014c,0x00050041,0x00000076,0x0000014f,0x0000006e,0x0000002b,0x0004003d,0x0000000c, + 0x00000150,0x0000014f,0x0004006f,0x00000006,0x00000151,0x00000150,0x00050085,0x00000006, + 0x00000152,0x0000014e,0x00000151,0x00050081,0x00000006,0x00000153,0x0000014d,0x00000152, + 0x0006000c,0x00000006,0x00000154,0x00000001,0x0000000a,0x00000153,0x00050085,0x00000006, + 0x00000155,0x00000148,0x00000154,0x0006000c,0x00000006,0x00000156,0x00000001,0x0000000a, + 0x00000155,0x0003003e,0x00000147,0x00000156,0x0004003d,0x00000006,0x00000158,0x00000089, + 0x0004003d,0x00000006,0x00000159,0x00000089,0x00050085,0x00000006,0x0000015a,0x00000158, + 0x00000159,0x0003003e,0x00000157,0x0000015a,0x0003003e,0x0000015b,0x00000096,0x0003003e, + 0x0000015c,0x0000015d,0x0004003d,0x00000042,0x00000160,0x0000015f,0x0004003d,0x0000000d, + 0x00000161,0x0000006e,0x00040064,0x00000041,0x00000162,0x00000160,0x0007005f,0x00000015, + 0x00000163,0x00000162,0x00000161,0x00000002,0x00000022,0x0008004f,0x0000000f,0x00000164, + 0x00000163,0x00000163,0x00000000,0x00000001,0x00000002,0x00050094,0x00000006,0x00000169, + 0x00000164,0x00000168,0x0003003e,0x0000015e,0x00000169,0x0004003d,0x00000006,0x0000016b, + 0x0000015e,0x0003003e,0x0000016a,0x0000016b,0x0003003e,0x0000016c,0x00000022,0x000200f9, + 0x0000016d,0x000200f8,0x0000016d,0x000400f6,0x0000016f,0x00000170,0x00000000,0x000200f9, + 0x00000171,0x000200f8,0x00000171,0x0004003d,0x0000000c,0x00000172,0x0000016c,0x000500b1, + 0x00000023,0x00000174,0x00000172,0x00000173,0x000400fa,0x00000174,0x0000016e,0x0000016f, + 0x000200f8,0x0000016e,0x0004003d,0x0000000c,0x00000176,0x0000016c,0x0004006f,0x00000006, + 0x00000177,0x00000176,0x00050081,0x00000006,0x00000178,0x00000177,0x00000050,0x00050088, + 0x00000006,0x0000017a,0x00000178,0x00000179,0x0003003e,0x00000175,0x0000017a,0x0004003d, + 0x00000006,0x0000017d,0x00000175,0x00050085,0x00000006,0x0000017f,0x0000017d,0x0000017e, + 0x0004003d,0x00000006,0x00000180,0x00000147,0x00050081,0x00000006,0x00000181,0x0000017f, + 0x00000180,0x00050085,0x00000006,0x00000182,0x0000017c,0x00000181,0x0003003e,0x0000017b, + 0x00000182,0x0004003d,0x00000006,0x00000184,0x0000017b,0x0006000c,0x00000006,0x00000185, + 0x00000001,0x0000000e,0x00000184,0x0004003d,0x00000006,0x00000186,0x0000017b,0x0006000c, + 0x00000006,0x00000187,0x00000001,0x0000000d,0x00000186,0x00050050,0x00000014,0x00000188, + 0x00000185,0x00000187,0x0004003d,0x00000006,0x00000189,0x00000134,0x0004003d,0x00000006, + 0x0000018a,0x00000175,0x00050085,0x00000006,0x0000018b,0x00000189,0x0000018a,0x0005008e, + 0x00000014,0x0000018c,0x00000188,0x0000018b,0x0003003e,0x00000183,0x0000018c,0x0004003d, + 0x0000000d,0x0000018e,0x0000006e,0x0004003d,0x00000014,0x0000018f,0x00000183,0x0006000c, + 0x00000014,0x00000190,0x00000001,0x00000001,0x0000018f,0x0004006e,0x0000000d,0x00000191, + 0x00000190,0x00050080,0x0000000d,0x00000192,0x0000018e,0x00000191,0x0003003e,0x0000018d, + 0x00000192,0x0004003d,0x00000042,0x00000194,0x0000015f,0x0004003d,0x0000000d,0x00000195, + 0x0000018d,0x00050041,0x0000003a,0x00000196,0x00000018,0x00000020,0x0004003d,0x0000000d, + 0x00000197,0x00000196,0x00050050,0x0000000d,0x00000198,0x00000020,0x00000020,0x00050082, + 0x0000000d,0x00000199,0x00000197,0x00000198,0x0008000c,0x0000000d,0x0000019a,0x00000001, + 0x0000002d,0x00000195,0x00000039,0x00000199,0x00040064,0x00000041,0x0000019b,0x00000194, + 0x0007005f,0x00000015,0x0000019c,0x0000019b,0x0000019a,0x00000002,0x00000022,0x0008004f, + 0x0000000f,0x0000019d,0x0000019c,0x0000019c,0x00000000,0x00000001,0x00000002,0x0003003e, + 0x00000193,0x0000019d,0x0004003d,0x0000000f,0x0000019f,0x00000193,0x00050094,0x00000006, + 0x000001a0,0x0000019f,0x00000168,0x0003003e,0x0000019e,0x000001a0,0x0004003d,0x00000006, + 0x000001a1,0x0000015e,0x0004003d,0x00000006,0x000001a2,0x0000019e,0x0007000c,0x00000006, + 0x000001a3,0x00000001,0x00000025,0x000001a1,0x000001a2,0x0003003e,0x0000015e,0x000001a3, + 0x0004003d,0x00000006,0x000001a4,0x0000016a,0x0004003d,0x00000006,0x000001a5,0x0000019e, + 0x0007000c,0x00000006,0x000001a6,0x00000001,0x00000028,0x000001a4,0x000001a5,0x0003003e, + 0x0000016a,0x000001a6,0x0004003d,0x0000000d,0x000001a9,0x0000018d,0x0003003e,0x000001a8, + 0x000001a9,0x00050039,0x0000000f,0x000001aa,0x00000012,0x000001a8,0x0004003d,0x0000000f, + 0x000001ab,0x00000090,0x00050083,0x0000000f,0x000001ac,0x000001aa,0x000001ab,0x0003003e, + 0x000001a7,0x000001ac,0x0004003d,0x0000000f,0x000001ae,0x000001a7,0x0004003d,0x0000000f, + 0x000001af,0x000001a7,0x00050094,0x00000006,0x000001b0,0x000001ae,0x000001af,0x0003003e, + 0x000001ad,0x000001b0,0x0004003d,0x00000006,0x000001b1,0x000001ad,0x000500b8,0x00000023, + 0x000001b3,0x000001b1,0x000001b2,0x000300f7,0x000001b5,0x00000000,0x000400fa,0x000001b3, + 0x000001b4,0x000001b5,0x000200f8,0x000001b4,0x000200f9,0x00000170,0x000200f8,0x000001b5, + 0x0004003d,0x0000000f,0x000001b8,0x000001a7,0x0004003d,0x0000000f,0x000001b9,0x00000100, + 0x00050094,0x00000006,0x000001ba,0x000001b8,0x000001b9,0x0004003d,0x00000006,0x000001bb, + 0x000001ad,0x0006000c,0x00000006,0x000001bc,0x00000001,0x00000020,0x000001bb,0x00050085, + 0x00000006,0x000001bd,0x000001ba,0x000001bc,0x0003003e,0x000001b7,0x000001bd,0x0004003d, + 0x00000006,0x000001c0,0x00000089,0x00050085,0x00000006,0x000001c1,0x000001bf,0x000001c0, + 0x0004003d,0x00000006,0x000001c3,0x00000089,0x00050085,0x00000006,0x000001c4,0x000001c2, + 0x000001c3,0x0004003d,0x00000006,0x000001c5,0x000001ad,0x0006000c,0x00000006,0x000001c6, + 0x00000001,0x0000001f,0x000001c5,0x0008000c,0x00000006,0x000001c7,0x00000001,0x00000031, + 0x000001c1,0x000001c4,0x000001c6,0x0003003e,0x000001be,0x000001c7,0x0004003d,0x00000006, + 0x000001c9,0x000001b7,0x00050083,0x00000006,0x000001cb,0x000001c9,0x000001ca,0x00050088, + 0x00000006,0x000001cd,0x000001cb,0x000001cc,0x0008000c,0x00000006,0x000001ce,0x00000001, + 0x0000002b,0x000001cd,0x00000096,0x00000027,0x0004003d,0x00000006,0x000001cf,0x000001ad, + 0x0004003d,0x00000006,0x000001d0,0x00000157,0x00050088,0x00000006,0x000001d1,0x000001cf, + 0x000001d0,0x00050083,0x00000006,0x000001d2,0x00000027,0x000001d1,0x0008000c,0x00000006, + 0x000001d3,0x00000001,0x0000002b,0x000001d2,0x00000096,0x00000027,0x00050085,0x00000006, + 0x000001d4,0x000001ce,0x000001d3,0x0004003d,0x00000006,0x000001d5,0x000001be,0x00050085, + 0x00000006,0x000001d6,0x000001d4,0x000001d5,0x0003003e,0x000001c8,0x000001d6,0x0004003d, + 0x00000006,0x000001d7,0x000001c8,0x0004003d,0x00000006,0x000001d8,0x0000015b,0x00050081, + 0x00000006,0x000001d9,0x000001d8,0x000001d7,0x0003003e,0x0000015b,0x000001d9,0x0004003d, + 0x00000006,0x000001da,0x000001c8,0x0004003d,0x0000000f,0x000001db,0x00000193,0x0005008e, + 0x0000000f,0x000001dc,0x000001db,0x000001da,0x0004003d,0x0000000f,0x000001dd,0x0000015c, + 0x00050081,0x0000000f,0x000001de,0x000001dd,0x000001dc,0x0003003e,0x0000015c,0x000001de, + 0x000200f9,0x00000170,0x000200f8,0x00000170,0x0004003d,0x0000000c,0x000001df,0x0000016c, + 0x00050080,0x0000000c,0x000001e0,0x000001df,0x00000020,0x0003003e,0x0000016c,0x000001e0, + 0x000200f9,0x0000016d,0x000200f8,0x0000016f,0x0004003d,0x00000006,0x000001e2,0x0000016a, + 0x0004003d,0x00000006,0x000001e3,0x0000015e,0x00050083,0x00000006,0x000001e4,0x000001e2, + 0x000001e3,0x0004003d,0x00000006,0x000001e5,0x0000016a,0x00050081,0x00000006,0x000001e7, + 0x000001e5,0x000001e6,0x00050088,0x00000006,0x000001e8,0x000001e4,0x000001e7,0x0003003e, + 0x000001e1,0x000001e8,0x0004003d,0x00000006,0x000001ec,0x000001e1,0x0008000c,0x00000006, + 0x000001ed,0x00000001,0x00000031,0x000001ea,0x000001eb,0x000001ec,0x0003003e,0x000001e9, + 0x000001ed,0x00060041,0x0000001c,0x000001ef,0x00000018,0x00000019,0x0000002b,0x0004003d, + 0x00000006,0x000001f0,0x000001ef,0x0004003d,0x00000006,0x000001f1,0x0000015b,0x00050085, + 0x00000006,0x000001f2,0x000001f0,0x000001f1,0x00050088,0x00000006,0x000001f3,0x000001f2, + 0x00000179,0x00050083,0x00000006,0x000001f4,0x00000027,0x000001f3,0x0008000c,0x00000006, + 0x000001f5,0x00000001,0x0000002b,0x000001f4,0x00000050,0x00000027,0x0003003e,0x000001ee, + 0x000001f5,0x0004003d,0x00000006,0x000001f6,0x000001ee,0x0004003d,0x00000006,0x000001f8, + 0x0000008c,0x00050085,0x00000006,0x000001f9,0x000001f7,0x000001f8,0x0004003d,0x00000006, + 0x000001fa,0x0000008c,0x00050041,0x00000007,0x000001fb,0x00000090,0x0000005d,0x0004003d, + 0x00000006,0x000001fc,0x000001fb,0x0008000c,0x00000006,0x000001fd,0x00000001,0x00000031, + 0x000001f9,0x000001fa,0x000001fc,0x0008000c,0x00000006,0x000001fe,0x00000001,0x0000002e, + 0x000001f6,0x00000027,0x000001fd,0x0003003e,0x000001ee,0x000001fe,0x0004003d,0x00000006, + 0x000001ff,0x000001ee,0x0004003d,0x00000006,0x00000200,0x00000127,0x0004003d,0x00000006, + 0x00000201,0x000001e9,0x00050085,0x00000006,0x00000202,0x00000200,0x00000201,0x0008000c, + 0x00000006,0x00000203,0x00000001,0x0000002e,0x00000027,0x000001ff,0x00000202,0x0003003e, + 0x000001ee,0x00000203,0x0004003d,0x00000006,0x00000205,0x00000127,0x0004003d,0x00000006, + 0x00000206,0x000001e9,0x00050085,0x00000006,0x00000207,0x00000205,0x00000206,0x0004003d, + 0x00000006,0x00000208,0x0000008c,0x00050085,0x00000006,0x00000209,0x000001f7,0x00000208, + 0x0004003d,0x00000006,0x0000020a,0x0000008c,0x00050041,0x00000007,0x0000020b,0x00000090, + 0x0000005d,0x0004003d,0x00000006,0x0000020c,0x0000020b,0x0008000c,0x00000006,0x0000020d, + 0x00000001,0x00000031,0x00000209,0x0000020a,0x0000020c,0x00050083,0x00000006,0x0000020e, + 0x00000027,0x0000020d,0x00050085,0x00000006,0x0000020f,0x00000207,0x0000020e,0x0003003e, + 0x00000204,0x0000020f,0x0004003d,0x000000b1,0x00000210,0x000000b3,0x0004003d,0x0000000d, + 0x00000211,0x0000006e,0x0004003d,0x0000000f,0x00000212,0x0000015c,0x00060050,0x0000000f, + 0x00000213,0x00000179,0x00000179,0x00000179,0x00050088,0x0000000f,0x00000214,0x00000212, + 0x00000213,0x0004003d,0x00000006,0x00000215,0x00000204,0x0005008e,0x0000000f,0x00000216, + 0x00000214,0x00000215,0x0004003d,0x00000006,0x00000217,0x000001ee,0x00050051,0x00000006, + 0x00000218,0x00000216,0x00000000,0x00050051,0x00000006,0x00000219,0x00000216,0x00000001, + 0x00050051,0x00000006,0x0000021a,0x00000216,0x00000002,0x00070050,0x00000015,0x0000021b, + 0x00000218,0x00000219,0x0000021a,0x00000217,0x00040063,0x00000210,0x00000211,0x0000021b, + 0x000100fd,0x00010038,0x00050036,0x00000006,0x0000000a,0x00000000,0x00000008,0x00030037, + 0x00000007,0x00000009,0x000200f8,0x0000000b,0x00060041,0x0000001c,0x0000001d,0x00000018, + 0x00000019,0x0000001b,0x0004003d,0x00000006,0x0000001e,0x0000001d,0x0004006e,0x0000000c, + 0x0000001f,0x0000001e,0x000500c7,0x0000000c,0x00000021,0x0000001f,0x00000020,0x000500ab, + 0x00000023,0x00000024,0x00000021,0x00000022,0x000300f7,0x00000026,0x00000000,0x000400fa, + 0x00000024,0x00000025,0x00000026,0x000200f8,0x00000025,0x0004003d,0x00000006,0x00000028, + 0x00000009,0x00050083,0x00000006,0x00000029,0x00000027,0x00000028,0x0003003e,0x00000009, + 0x00000029,0x000200f9,0x00000026,0x000200f8,0x00000026,0x00060041,0x0000001c,0x0000002c, + 0x00000018,0x0000002a,0x0000002b,0x0004003d,0x00000006,0x0000002d,0x0000002c,0x0004003d, + 0x00000006,0x0000002e,0x00000009,0x00060041,0x0000001c,0x00000030,0x00000018,0x0000002a, + 0x0000002f,0x0004003d,0x00000006,0x00000031,0x00000030,0x00050083,0x00000006,0x00000032, + 0x0000002e,0x00000031,0x0007000c,0x00000006,0x00000034,0x00000001,0x00000028,0x00000032, + 0x00000033,0x00050088,0x00000006,0x00000035,0x0000002d,0x00000034,0x000200fe,0x00000035, + 0x00010038,0x00050036,0x0000000f,0x00000012,0x00000000,0x00000010,0x00030037,0x0000000e, + 0x00000011,0x000200f8,0x00000013,0x0004003b,0x00000007,0x00000040,0x00000007,0x0004003b, + 0x00000007,0x00000049,0x00000007,0x0004003b,0x0000004c,0x0000004d,0x00000007,0x0004003d, + 0x0000000d,0x00000038,0x00000011,0x00050041,0x0000003a,0x0000003b,0x00000018,0x00000020, + 0x0004003d,0x0000000d,0x0000003c,0x0000003b,0x00050050,0x0000000d,0x0000003d,0x00000020, + 0x00000020,0x00050082,0x0000000d,0x0000003e,0x0000003c,0x0000003d,0x0008000c,0x0000000d, + 0x0000003f,0x00000001,0x0000002d,0x00000038,0x00000039,0x0000003e,0x0003003e,0x00000011, + 0x0000003f,0x0004003d,0x00000042,0x00000045,0x00000044,0x0004003d,0x0000000d,0x00000046, + 0x00000011,0x00040064,0x00000041,0x00000047,0x00000045,0x0007005f,0x00000015,0x00000048, + 0x00000047,0x00000046,0x00000002,0x00000022,0x00050051,0x00000006,0x0000004a,0x00000048, + 0x00000000,0x0003003e,0x00000049,0x0000004a,0x00050039,0x00000006,0x0000004b,0x0000000a, + 0x00000049,0x0003003e,0x00000040,0x0000004b,0x0004003d,0x0000000d,0x0000004e,0x00000011, + 0x0004006f,0x00000014,0x0000004f,0x0000004e,0x00050050,0x00000014,0x00000051,0x00000050, + 0x00000050,0x00050081,0x00000014,0x00000052,0x0000004f,0x00000051,0x00050041,0x00000053, + 0x00000054,0x00000018,0x00000022,0x0004003d,0x00000014,0x00000055,0x00000054,0x00050085, + 0x00000014,0x00000056,0x00000052,0x00000055,0x0005008e,0x00000014,0x00000058,0x00000056, + 0x00000057,0x00050050,0x00000014,0x00000059,0x00000027,0x00000027,0x00050083,0x00000014, + 0x0000005a,0x00000058,0x00000059,0x0003003e,0x0000004d,0x0000005a,0x00050041,0x00000007, + 0x0000005b,0x0000004d,0x0000002f,0x0004003d,0x00000006,0x0000005c,0x0000005b,0x00060041, + 0x0000001c,0x0000005e,0x00000018,0x0000002a,0x0000005d,0x0004003d,0x00000006,0x0000005f, + 0x0000005e,0x00050085,0x00000006,0x00000060,0x0000005c,0x0000005f,0x0004003d,0x00000006, + 0x00000061,0x00000040,0x00050085,0x00000006,0x00000062,0x00000060,0x00000061,0x00050041, + 0x00000007,0x00000063,0x0000004d,0x0000002b,0x0004003d,0x00000006,0x00000064,0x00000063, + 0x00060041,0x0000001c,0x00000065,0x00000018,0x0000002a,0x0000001b,0x0004003d,0x00000006, + 0x00000066,0x00000065,0x00050085,0x00000006,0x00000067,0x00000064,0x00000066,0x0004003d, + 0x00000006,0x00000068,0x00000040,0x00050085,0x00000006,0x00000069,0x00000067,0x00000068, + 0x0004003d,0x00000006,0x0000006a,0x00000040,0x00060050,0x0000000f,0x0000006b,0x00000062, + 0x00000069,0x0000006a,0x000200fe,0x0000006b,0x00010038 }; diff --git a/gpu/vk/shaders/fg_hud_layer.comp b/gpu/vk/shaders/fg_hud_layer.comp index 81169dc..aebc458 100644 --- a/gpu/vk/shaders/fg_hud_layer.comp +++ b/gpu/vk/shaders/fg_hud_layer.comp @@ -23,6 +23,7 @@ layout(push_constant) uniform P { ivec2 offset; ivec2 size; int prev; } pc; const float kKeep = 0.9; // (of the fit, each frame with something to learn from: the newer frames count more) const float kMinChange = 0.02; // (sum dS.dS: enough change behind the pixel that the picture's rounding is not T) const float kMinFrames = 2.0; +const float kLearnChange = 0.1 * kMinChange; // (dS.dS a frame, once T is known: less is not learned from) float see_through(vec4 f) { return clamp(f.x / f.y, 0.0, 1.0); } bool known(vec4 f) { return f.z >= kMinFrames && f.y >= kMinChange; } @@ -53,7 +54,14 @@ vec4 hud_fit(vec3 s1, vec3 d1, vec3 s0, vec3 d0, bool prev, vec4 f, out vec4 lay if (known(f) && !explains(s1, d1, s0, d0, see_through(f))) return vec4(0.0); const vec3 ds = s1 - s0, dd = d1 - d0; const float change = dot(ds, ds); - if (change > 1e-8) f = vec4(kKeep * f.x + dot(ds, dd), kKeep * f.y + change, min(f.z + 1.0, 255.0), 0.0); + // (once known, what was learned is kept through a calm background behind the HUD (a plain wall, the camera nearly still): + // forgetting by kKeep there made T unknown again, the presented pixel, a halo, while the HUD had not changed, and a change + // that small is mostly the picture's rounding, so it is checked (explains() above) but not learned from. Nor is the fit + // ever forgotten below kMinChange. A changed HUD fails explains() and starts again) + if (change > (known(f) ? kLearnChange : 1e-8)) { + const float keep = known(f) ? max(kKeep, min(1.0, kMinChange / f.y)) : kKeep; + f = vec4(keep * f.x + dot(ds, dd), keep * f.y + change, min(f.z + 1.0, 255.0), 0.0); + } if (!known(f)) return f; const float t = see_through(f); // (the frame is the picture clamped at 1, sRGB-encoded: a scene or HUD brighter than that behind the pixel would make diff --git a/gpu/vk/shaders/fg_hud_layer_comp_spv.h b/gpu/vk/shaders/fg_hud_layer_comp_spv.h index db1d0e7..bd846f3 100644 --- a/gpu/vk/shaders/fg_hud_layer_comp_spv.h +++ b/gpu/vk/shaders/fg_hud_layer_comp_spv.h @@ -1,11 +1,11 @@ -// fg_hud_layer.comp sha256 4afefa537363a368ba747cd69fda9a5c423a889d2c6cb2e6098b07ee65ee768b (tests/test_fsr3fi_hud_layer.py --write: glslangValidator -V --target-env vulkan1.3 --vn FG_HUD_LAYER_COMP_SPV) +// fg_hud_layer.comp sha256 91f3aec5e7d09dc7be4ac1418e27f6cdbabdabb5fcb9435a8c8322772c87e934 (tests/test_fsr3fi_hud_layer.py --write: glslangValidator -V --target-env vulkan1.3 --vn FG_HUD_LAYER_COMP_SPV) // 1116.6.0 #pragma once const uint32_t FG_HUD_LAYER_COMP_SPV[] = { - 0x07230203,0x00010600,0x0008000b,0x00000183,0x00000000,0x00020011,0x00000001,0x0006000b, + 0x07230203,0x00010600,0x0008000b,0x00000198,0x00000000,0x00020011,0x00000001,0x0006000b, 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, - 0x000d000f,0x00000005,0x00000004,0x6e69616d,0x00000000,0x00000110,0x00000118,0x0000012d, - 0x00000134,0x00000142,0x0000014c,0x00000151,0x00000158,0x00060010,0x00000004,0x00000011, + 0x000d000f,0x00000005,0x00000004,0x6e69616d,0x00000000,0x00000125,0x0000012d,0x00000142, + 0x00000149,0x00000157,0x00000161,0x00000166,0x0000016d,0x00060010,0x00000004,0x00000011, 0x00000008,0x00000008,0x00000001,0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004, 0x6e69616d,0x00000000,0x00070005,0x0000000b,0x5f656573,0x6f726874,0x28686775,0x3b346676, 0x00000000,0x00030005,0x0000000a,0x00000066,0x00050005,0x00000010,0x776f6e6b,0x6676286e, @@ -22,131 +22,133 @@ const uint32_t FG_HUD_LAYER_COMP_SPV[] = { 0x0000006d,0x00040005,0x000000aa,0x61726170,0x0000006d,0x00040005,0x000000ac,0x61726170, 0x0000006d,0x00040005,0x000000ae,0x61726170,0x0000006d,0x00040005,0x000000b0,0x61726170, 0x0000006d,0x00030005,0x000000b7,0x00007364,0x00030005,0x000000bb,0x00006464,0x00040005, - 0x000000bf,0x6e616863,0x00006567,0x00040005,0x000000da,0x61726170,0x0000006d,0x00030005, - 0x000000e2,0x00000074,0x00040005,0x000000e3,0x61726170,0x0000006d,0x00040005,0x000000f0, - 0x61726170,0x0000006d,0x00040005,0x000000f2,0x61726170,0x0000006d,0x00040005,0x000000f4, - 0x61726170,0x0000006d,0x00040005,0x000000f6,0x61726170,0x0000006d,0x00040005,0x000000f8, - 0x61726170,0x0000006d,0x00030005,0x0000010d,0x00000067,0x00080005,0x00000110,0x475f6c67, - 0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x00000044,0x00030005,0x00000116,0x00000050, - 0x00050006,0x00000116,0x00000000,0x7366666f,0x00007465,0x00050006,0x00000116,0x00000001, - 0x657a6973,0x00000000,0x00050006,0x00000116,0x00000002,0x76657270,0x00000000,0x00030005, - 0x00000118,0x00006370,0x00030005,0x00000123,0x00000071,0x00030005,0x00000129,0x00003173, - 0x00040005,0x0000012d,0x6f666562,0x00006572,0x00030005,0x00000133,0x00003164,0x00040005, - 0x00000134,0x65746661,0x00000072,0x00040005,0x00000142,0x6579616c,0x00000072,0x00030005, - 0x0000014c,0x00746966,0x00030005,0x00000150,0x00003073,0x00050005,0x00000151,0x76657270, - 0x6665625f,0x0065726f,0x00030005,0x00000157,0x00003064,0x00050005,0x00000158,0x76657270, - 0x7466615f,0x00007265,0x00040005,0x0000015e,0x76657270,0x00000000,0x00030005,0x00000162, - 0x00000066,0x00030005,0x0000016b,0x0000006c,0x00040005,0x0000016c,0x61726170,0x0000006d, - 0x00040005,0x0000016e,0x61726170,0x0000006d,0x00040005,0x00000170,0x61726170,0x0000006d, - 0x00040005,0x00000172,0x61726170,0x0000006d,0x00040005,0x00000174,0x61726170,0x0000006d, - 0x00040005,0x00000176,0x61726170,0x0000006d,0x00040005,0x00000178,0x61726170,0x0000006d, - 0x00040047,0x00000110,0x0000000b,0x0000001c,0x00030047,0x00000116,0x00000002,0x00050048, - 0x00000116,0x00000000,0x00000023,0x00000000,0x00050048,0x00000116,0x00000001,0x00000023, - 0x00000008,0x00050048,0x00000116,0x00000002,0x00000023,0x00000010,0x00040047,0x0000012d, - 0x00000021,0x00000000,0x00040047,0x0000012d,0x00000022,0x00000000,0x00040047,0x00000134, - 0x00000021,0x00000001,0x00040047,0x00000134,0x00000022,0x00000000,0x00030047,0x00000142, - 0x00000019,0x00040047,0x00000142,0x00000021,0x00000005,0x00040047,0x00000142,0x00000022, - 0x00000000,0x00040047,0x0000014c,0x00000021,0x00000004,0x00040047,0x0000014c,0x00000022, - 0x00000000,0x00040047,0x00000151,0x00000021,0x00000002,0x00040047,0x00000151,0x00000022, - 0x00000000,0x00040047,0x00000158,0x00000021,0x00000003,0x00040047,0x00000158,0x00000022, - 0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006, - 0x00000020,0x00040017,0x00000007,0x00000006,0x00000004,0x00040020,0x00000008,0x00000007, - 0x00000007,0x00040021,0x00000009,0x00000006,0x00000008,0x00020014,0x0000000d,0x00040021, - 0x0000000e,0x0000000d,0x00000008,0x00040017,0x00000012,0x00000006,0x00000003,0x00040020, - 0x00000013,0x00000007,0x00000012,0x00040020,0x00000014,0x00000007,0x00000006,0x00080021, - 0x00000015,0x0000000d,0x00000013,0x00000013,0x00000013,0x00000013,0x00000014,0x00040020, - 0x0000001d,0x00000007,0x0000000d,0x000a0021,0x0000001e,0x00000007,0x00000013,0x00000013, - 0x00000013,0x00000013,0x0000001d,0x00000008,0x00000008,0x00040015,0x00000028,0x00000020, - 0x00000000,0x0004002b,0x00000028,0x00000029,0x00000000,0x0004002b,0x00000028,0x0000002c, - 0x00000001,0x0004002b,0x00000006,0x00000030,0x00000000,0x0004002b,0x00000006,0x00000031, - 0x3f800000,0x0004002b,0x00000028,0x00000035,0x00000002,0x0004002b,0x00000006,0x00000038, - 0x40000000,0x0004002b,0x00000006,0x0000003e,0x3ca3d70a,0x0004002b,0x00000006,0x0000004f, - 0x3ccccccd,0x0004002b,0x00000006,0x0000005e,0x3a800000,0x00040017,0x00000063,0x0000000d, - 0x00000003,0x0004002b,0x00000006,0x0000006f,0x461c4000,0x0004002b,0x00000006,0x00000083, - 0x437f0000,0x0007002c,0x00000007,0x00000089,0x00000030,0x00000030,0x00000030,0x00000030, - 0x0007002c,0x00000007,0x00000090,0x00000030,0x00000030,0x00000030,0x00000031,0x0004002b, - 0x00000006,0x00000093,0xbf800000,0x0007002c,0x00000007,0x00000094,0x00000030,0x00000030, - 0x00000030,0x00000093,0x0004002b,0x00000006,0x000000c4,0x322bcc77,0x0004002b,0x00000006, - 0x000000c8,0x3f666666,0x0006002c,0x00000012,0x000000e9,0x00000031,0x00000031,0x00000031, - 0x00040015,0x0000010a,0x00000020,0x00000001,0x00040017,0x0000010b,0x0000010a,0x00000002, - 0x00040020,0x0000010c,0x00000007,0x0000010b,0x00040017,0x0000010e,0x00000028,0x00000003, - 0x00040020,0x0000010f,0x00000001,0x0000010e,0x0004003b,0x0000010f,0x00000110,0x00000001, - 0x00040017,0x00000111,0x00000028,0x00000002,0x0005001e,0x00000116,0x0000010b,0x0000010b, - 0x0000010a,0x00040020,0x00000117,0x00000009,0x00000116,0x0004003b,0x00000117,0x00000118, - 0x00000009,0x0004002b,0x0000010a,0x00000119,0x00000001,0x00040020,0x0000011a,0x00000009, - 0x0000010b,0x00040017,0x0000011d,0x0000000d,0x00000002,0x0004002b,0x0000010a,0x00000125, - 0x00000000,0x00090019,0x0000012a,0x00000006,0x00000001,0x00000000,0x00000000,0x00000000, - 0x00000001,0x00000000,0x0003001b,0x0000012b,0x0000012a,0x00040020,0x0000012c,0x00000000, - 0x0000012b,0x0004003b,0x0000012c,0x0000012d,0x00000000,0x0004003b,0x0000012c,0x00000134, - 0x00000000,0x00090019,0x00000140,0x00000006,0x00000001,0x00000000,0x00000000,0x00000000, - 0x00000002,0x00000002,0x00040020,0x00000141,0x00000000,0x00000140,0x0004003b,0x00000141, - 0x00000142,0x00000000,0x0004002b,0x0000010a,0x00000145,0x00000002,0x00040020,0x00000146, - 0x00000009,0x0000010a,0x0004003b,0x00000141,0x0000014c,0x00000000,0x0004003b,0x0000012c, - 0x00000151,0x00000000,0x0004003b,0x0000012c,0x00000158,0x00000000,0x0004002b,0x00000028, - 0x00000181,0x00000008,0x0006002c,0x0000010e,0x00000182,0x00000181,0x00000181,0x0000002c, + 0x000000bf,0x6e616863,0x00006567,0x00040005,0x000000c4,0x61726170,0x0000006d,0x00040005, + 0x000000cd,0x7065656b,0x00000000,0x00040005,0x000000ce,0x61726170,0x0000006d,0x00040005, + 0x000000ef,0x61726170,0x0000006d,0x00030005,0x000000f7,0x00000074,0x00040005,0x000000f8, + 0x61726170,0x0000006d,0x00040005,0x00000105,0x61726170,0x0000006d,0x00040005,0x00000107, + 0x61726170,0x0000006d,0x00040005,0x00000109,0x61726170,0x0000006d,0x00040005,0x0000010b, + 0x61726170,0x0000006d,0x00040005,0x0000010d,0x61726170,0x0000006d,0x00030005,0x00000122, + 0x00000067,0x00080005,0x00000125,0x475f6c67,0x61626f6c,0x766e496c,0x7461636f,0x496e6f69, + 0x00000044,0x00030005,0x0000012b,0x00000050,0x00050006,0x0000012b,0x00000000,0x7366666f, + 0x00007465,0x00050006,0x0000012b,0x00000001,0x657a6973,0x00000000,0x00050006,0x0000012b, + 0x00000002,0x76657270,0x00000000,0x00030005,0x0000012d,0x00006370,0x00030005,0x00000138, + 0x00000071,0x00030005,0x0000013e,0x00003173,0x00040005,0x00000142,0x6f666562,0x00006572, + 0x00030005,0x00000148,0x00003164,0x00040005,0x00000149,0x65746661,0x00000072,0x00040005, + 0x00000157,0x6579616c,0x00000072,0x00030005,0x00000161,0x00746966,0x00030005,0x00000165, + 0x00003073,0x00050005,0x00000166,0x76657270,0x6665625f,0x0065726f,0x00030005,0x0000016c, + 0x00003064,0x00050005,0x0000016d,0x76657270,0x7466615f,0x00007265,0x00040005,0x00000173, + 0x76657270,0x00000000,0x00030005,0x00000177,0x00000066,0x00030005,0x00000180,0x0000006c, + 0x00040005,0x00000181,0x61726170,0x0000006d,0x00040005,0x00000183,0x61726170,0x0000006d, + 0x00040005,0x00000185,0x61726170,0x0000006d,0x00040005,0x00000187,0x61726170,0x0000006d, + 0x00040005,0x00000189,0x61726170,0x0000006d,0x00040005,0x0000018b,0x61726170,0x0000006d, + 0x00040005,0x0000018d,0x61726170,0x0000006d,0x00040047,0x00000125,0x0000000b,0x0000001c, + 0x00030047,0x0000012b,0x00000002,0x00050048,0x0000012b,0x00000000,0x00000023,0x00000000, + 0x00050048,0x0000012b,0x00000001,0x00000023,0x00000008,0x00050048,0x0000012b,0x00000002, + 0x00000023,0x00000010,0x00040047,0x00000142,0x00000021,0x00000000,0x00040047,0x00000142, + 0x00000022,0x00000000,0x00040047,0x00000149,0x00000021,0x00000001,0x00040047,0x00000149, + 0x00000022,0x00000000,0x00030047,0x00000157,0x00000019,0x00040047,0x00000157,0x00000021, + 0x00000005,0x00040047,0x00000157,0x00000022,0x00000000,0x00040047,0x00000161,0x00000021, + 0x00000004,0x00040047,0x00000161,0x00000022,0x00000000,0x00040047,0x00000166,0x00000021, + 0x00000002,0x00040047,0x00000166,0x00000022,0x00000000,0x00040047,0x0000016d,0x00000021, + 0x00000003,0x00040047,0x0000016d,0x00000022,0x00000000,0x00020013,0x00000002,0x00030021, + 0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006, + 0x00000004,0x00040020,0x00000008,0x00000007,0x00000007,0x00040021,0x00000009,0x00000006, + 0x00000008,0x00020014,0x0000000d,0x00040021,0x0000000e,0x0000000d,0x00000008,0x00040017, + 0x00000012,0x00000006,0x00000003,0x00040020,0x00000013,0x00000007,0x00000012,0x00040020, + 0x00000014,0x00000007,0x00000006,0x00080021,0x00000015,0x0000000d,0x00000013,0x00000013, + 0x00000013,0x00000013,0x00000014,0x00040020,0x0000001d,0x00000007,0x0000000d,0x000a0021, + 0x0000001e,0x00000007,0x00000013,0x00000013,0x00000013,0x00000013,0x0000001d,0x00000008, + 0x00000008,0x00040015,0x00000028,0x00000020,0x00000000,0x0004002b,0x00000028,0x00000029, + 0x00000000,0x0004002b,0x00000028,0x0000002c,0x00000001,0x0004002b,0x00000006,0x00000030, + 0x00000000,0x0004002b,0x00000006,0x00000031,0x3f800000,0x0004002b,0x00000028,0x00000035, + 0x00000002,0x0004002b,0x00000006,0x00000038,0x40000000,0x0004002b,0x00000006,0x0000003e, + 0x3ca3d70a,0x0004002b,0x00000006,0x0000004f,0x3ccccccd,0x0004002b,0x00000006,0x0000005e, + 0x3a800000,0x00040017,0x00000063,0x0000000d,0x00000003,0x0004002b,0x00000006,0x0000006f, + 0x461c4000,0x0004002b,0x00000006,0x00000083,0x437f0000,0x0007002c,0x00000007,0x00000089, + 0x00000030,0x00000030,0x00000030,0x00000030,0x0007002c,0x00000007,0x00000090,0x00000030, + 0x00000030,0x00000030,0x00000031,0x0004002b,0x00000006,0x00000093,0xbf800000,0x0007002c, + 0x00000007,0x00000094,0x00000030,0x00000030,0x00000030,0x00000093,0x0004002b,0x00000006, + 0x000000c7,0x3b03126f,0x0004002b,0x00000006,0x000000c8,0x322bcc77,0x0004002b,0x00000006, + 0x000000d4,0x3f666666,0x0006002c,0x00000012,0x000000fe,0x00000031,0x00000031,0x00000031, + 0x00040015,0x0000011f,0x00000020,0x00000001,0x00040017,0x00000120,0x0000011f,0x00000002, + 0x00040020,0x00000121,0x00000007,0x00000120,0x00040017,0x00000123,0x00000028,0x00000003, + 0x00040020,0x00000124,0x00000001,0x00000123,0x0004003b,0x00000124,0x00000125,0x00000001, + 0x00040017,0x00000126,0x00000028,0x00000002,0x0005001e,0x0000012b,0x00000120,0x00000120, + 0x0000011f,0x00040020,0x0000012c,0x00000009,0x0000012b,0x0004003b,0x0000012c,0x0000012d, + 0x00000009,0x0004002b,0x0000011f,0x0000012e,0x00000001,0x00040020,0x0000012f,0x00000009, + 0x00000120,0x00040017,0x00000132,0x0000000d,0x00000002,0x0004002b,0x0000011f,0x0000013a, + 0x00000000,0x00090019,0x0000013f,0x00000006,0x00000001,0x00000000,0x00000000,0x00000000, + 0x00000001,0x00000000,0x0003001b,0x00000140,0x0000013f,0x00040020,0x00000141,0x00000000, + 0x00000140,0x0004003b,0x00000141,0x00000142,0x00000000,0x0004003b,0x00000141,0x00000149, + 0x00000000,0x00090019,0x00000155,0x00000006,0x00000001,0x00000000,0x00000000,0x00000000, + 0x00000002,0x00000002,0x00040020,0x00000156,0x00000000,0x00000155,0x0004003b,0x00000156, + 0x00000157,0x00000000,0x0004002b,0x0000011f,0x0000015a,0x00000002,0x00040020,0x0000015b, + 0x00000009,0x0000011f,0x0004003b,0x00000156,0x00000161,0x00000000,0x0004003b,0x00000141, + 0x00000166,0x00000000,0x0004003b,0x00000141,0x0000016d,0x00000000,0x0004002b,0x00000028, + 0x00000196,0x00000008,0x0006002c,0x00000123,0x00000197,0x00000196,0x00000196,0x0000002c, 0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b, - 0x0000010c,0x0000010d,0x00000007,0x0004003b,0x0000010c,0x00000123,0x00000007,0x0004003b, - 0x00000013,0x00000129,0x00000007,0x0004003b,0x00000013,0x00000133,0x00000007,0x0004003b, - 0x00000013,0x00000150,0x00000007,0x0004003b,0x00000013,0x00000157,0x00000007,0x0004003b, - 0x0000001d,0x0000015e,0x00000007,0x0004003b,0x00000008,0x00000162,0x00000007,0x0004003b, - 0x00000008,0x00000164,0x00000007,0x0004003b,0x00000008,0x0000016b,0x00000007,0x0004003b, - 0x00000013,0x0000016c,0x00000007,0x0004003b,0x00000013,0x0000016e,0x00000007,0x0004003b, - 0x00000013,0x00000170,0x00000007,0x0004003b,0x00000013,0x00000172,0x00000007,0x0004003b, - 0x0000001d,0x00000174,0x00000007,0x0004003b,0x00000008,0x00000176,0x00000007,0x0004003b, - 0x00000008,0x00000178,0x00000007,0x0004003d,0x0000010e,0x00000112,0x00000110,0x0007004f, - 0x00000111,0x00000113,0x00000112,0x00000112,0x00000000,0x00000001,0x0004007c,0x0000010b, - 0x00000114,0x00000113,0x0003003e,0x0000010d,0x00000114,0x0004003d,0x0000010b,0x00000115, - 0x0000010d,0x00050041,0x0000011a,0x0000011b,0x00000118,0x00000119,0x0004003d,0x0000010b, - 0x0000011c,0x0000011b,0x000500af,0x0000011d,0x0000011e,0x00000115,0x0000011c,0x0004009a, - 0x0000000d,0x0000011f,0x0000011e,0x000300f7,0x00000121,0x00000000,0x000400fa,0x0000011f, - 0x00000120,0x00000121,0x000200f8,0x00000120,0x000100fd,0x000200f8,0x00000121,0x0004003d, - 0x0000010b,0x00000124,0x0000010d,0x00050041,0x0000011a,0x00000126,0x00000118,0x00000125, - 0x0004003d,0x0000010b,0x00000127,0x00000126,0x00050080,0x0000010b,0x00000128,0x00000124, - 0x00000127,0x0003003e,0x00000123,0x00000128,0x0004003d,0x0000012b,0x0000012e,0x0000012d, - 0x0004003d,0x0000010b,0x0000012f,0x00000123,0x00040064,0x0000012a,0x00000130,0x0000012e, - 0x0007005f,0x00000007,0x00000131,0x00000130,0x0000012f,0x00000002,0x00000125,0x0008004f, - 0x00000012,0x00000132,0x00000131,0x00000131,0x00000000,0x00000001,0x00000002,0x0003003e, - 0x00000129,0x00000132,0x0004003d,0x0000012b,0x00000135,0x00000134,0x0004003d,0x0000010b, - 0x00000136,0x00000123,0x00040064,0x0000012a,0x00000137,0x00000135,0x0007005f,0x00000007, - 0x00000138,0x00000137,0x00000136,0x00000002,0x00000125,0x0008004f,0x00000012,0x00000139, - 0x00000138,0x00000138,0x00000000,0x00000001,0x00000002,0x0003003e,0x00000133,0x00000139, - 0x0004003d,0x00000012,0x0000013a,0x00000129,0x0004003d,0x00000012,0x0000013b,0x00000133, - 0x000500b4,0x00000063,0x0000013c,0x0000013a,0x0000013b,0x0004009b,0x0000000d,0x0000013d, - 0x0000013c,0x000300f7,0x0000013f,0x00000000,0x000400fa,0x0000013d,0x0000013e,0x0000013f, - 0x000200f8,0x0000013e,0x0004003d,0x00000140,0x00000143,0x00000142,0x0004003d,0x0000010b, - 0x00000144,0x0000010d,0x00040063,0x00000143,0x00000144,0x00000090,0x00050041,0x00000146, - 0x00000147,0x00000118,0x00000145,0x0004003d,0x0000010a,0x00000148,0x00000147,0x000500aa, - 0x0000000d,0x00000149,0x00000148,0x00000125,0x000300f7,0x0000014b,0x00000000,0x000400fa, - 0x00000149,0x0000014a,0x0000014b,0x000200f8,0x0000014a,0x0004003d,0x00000140,0x0000014d, - 0x0000014c,0x0004003d,0x0000010b,0x0000014e,0x0000010d,0x00040063,0x0000014d,0x0000014e, - 0x00000089,0x000200f9,0x0000014b,0x000200f8,0x0000014b,0x000100fd,0x000200f8,0x0000013f, - 0x0004003d,0x0000012b,0x00000152,0x00000151,0x0004003d,0x0000010b,0x00000153,0x00000123, - 0x00040064,0x0000012a,0x00000154,0x00000152,0x0007005f,0x00000007,0x00000155,0x00000154, - 0x00000153,0x00000002,0x00000125,0x0008004f,0x00000012,0x00000156,0x00000155,0x00000155, - 0x00000000,0x00000001,0x00000002,0x0003003e,0x00000150,0x00000156,0x0004003d,0x0000012b, - 0x00000159,0x00000158,0x0004003d,0x0000010b,0x0000015a,0x00000123,0x00040064,0x0000012a, - 0x0000015b,0x00000159,0x0007005f,0x00000007,0x0000015c,0x0000015b,0x0000015a,0x00000002, - 0x00000125,0x0008004f,0x00000012,0x0000015d,0x0000015c,0x0000015c,0x00000000,0x00000001, - 0x00000002,0x0003003e,0x00000157,0x0000015d,0x00050041,0x00000146,0x0000015f,0x00000118, - 0x00000145,0x0004003d,0x0000010a,0x00000160,0x0000015f,0x000500ab,0x0000000d,0x00000161, - 0x00000160,0x00000125,0x0003003e,0x0000015e,0x00000161,0x0004003d,0x0000000d,0x00000163, - 0x0000015e,0x000300f7,0x00000166,0x00000000,0x000400fa,0x00000163,0x00000165,0x0000016a, - 0x000200f8,0x00000165,0x0004003d,0x00000140,0x00000167,0x0000014c,0x0004003d,0x0000010b, - 0x00000168,0x0000010d,0x00050062,0x00000007,0x00000169,0x00000167,0x00000168,0x0003003e, - 0x00000164,0x00000169,0x000200f9,0x00000166,0x000200f8,0x0000016a,0x0003003e,0x00000164, - 0x00000089,0x000200f9,0x00000166,0x000200f8,0x00000166,0x0004003d,0x00000012,0x0000016d, - 0x00000129,0x0003003e,0x0000016c,0x0000016d,0x0004003d,0x00000012,0x0000016f,0x00000133, - 0x0003003e,0x0000016e,0x0000016f,0x0004003d,0x00000012,0x00000171,0x00000150,0x0003003e, - 0x00000170,0x00000171,0x0004003d,0x00000012,0x00000173,0x00000157,0x0003003e,0x00000172, - 0x00000173,0x0004003d,0x0000000d,0x00000175,0x0000015e,0x0003003e,0x00000174,0x00000175, - 0x0004003d,0x00000007,0x00000177,0x00000164,0x0003003e,0x00000176,0x00000177,0x000b0039, - 0x00000007,0x00000179,0x00000026,0x0000016c,0x0000016e,0x00000170,0x00000172,0x00000174, - 0x00000176,0x00000178,0x0004003d,0x00000007,0x0000017a,0x00000178,0x0003003e,0x0000016b, - 0x0000017a,0x0003003e,0x00000162,0x00000179,0x0004003d,0x00000140,0x0000017b,0x0000014c, - 0x0004003d,0x0000010b,0x0000017c,0x0000010d,0x0004003d,0x00000007,0x0000017d,0x00000162, - 0x00040063,0x0000017b,0x0000017c,0x0000017d,0x0004003d,0x00000140,0x0000017e,0x00000142, - 0x0004003d,0x0000010b,0x0000017f,0x0000010d,0x0004003d,0x00000007,0x00000180,0x0000016b, - 0x00040063,0x0000017e,0x0000017f,0x00000180,0x000100fd,0x00010038,0x00050036,0x00000006, + 0x00000121,0x00000122,0x00000007,0x0004003b,0x00000121,0x00000138,0x00000007,0x0004003b, + 0x00000013,0x0000013e,0x00000007,0x0004003b,0x00000013,0x00000148,0x00000007,0x0004003b, + 0x00000013,0x00000165,0x00000007,0x0004003b,0x00000013,0x0000016c,0x00000007,0x0004003b, + 0x0000001d,0x00000173,0x00000007,0x0004003b,0x00000008,0x00000177,0x00000007,0x0004003b, + 0x00000008,0x00000179,0x00000007,0x0004003b,0x00000008,0x00000180,0x00000007,0x0004003b, + 0x00000013,0x00000181,0x00000007,0x0004003b,0x00000013,0x00000183,0x00000007,0x0004003b, + 0x00000013,0x00000185,0x00000007,0x0004003b,0x00000013,0x00000187,0x00000007,0x0004003b, + 0x0000001d,0x00000189,0x00000007,0x0004003b,0x00000008,0x0000018b,0x00000007,0x0004003b, + 0x00000008,0x0000018d,0x00000007,0x0004003d,0x00000123,0x00000127,0x00000125,0x0007004f, + 0x00000126,0x00000128,0x00000127,0x00000127,0x00000000,0x00000001,0x0004007c,0x00000120, + 0x00000129,0x00000128,0x0003003e,0x00000122,0x00000129,0x0004003d,0x00000120,0x0000012a, + 0x00000122,0x00050041,0x0000012f,0x00000130,0x0000012d,0x0000012e,0x0004003d,0x00000120, + 0x00000131,0x00000130,0x000500af,0x00000132,0x00000133,0x0000012a,0x00000131,0x0004009a, + 0x0000000d,0x00000134,0x00000133,0x000300f7,0x00000136,0x00000000,0x000400fa,0x00000134, + 0x00000135,0x00000136,0x000200f8,0x00000135,0x000100fd,0x000200f8,0x00000136,0x0004003d, + 0x00000120,0x00000139,0x00000122,0x00050041,0x0000012f,0x0000013b,0x0000012d,0x0000013a, + 0x0004003d,0x00000120,0x0000013c,0x0000013b,0x00050080,0x00000120,0x0000013d,0x00000139, + 0x0000013c,0x0003003e,0x00000138,0x0000013d,0x0004003d,0x00000140,0x00000143,0x00000142, + 0x0004003d,0x00000120,0x00000144,0x00000138,0x00040064,0x0000013f,0x00000145,0x00000143, + 0x0007005f,0x00000007,0x00000146,0x00000145,0x00000144,0x00000002,0x0000013a,0x0008004f, + 0x00000012,0x00000147,0x00000146,0x00000146,0x00000000,0x00000001,0x00000002,0x0003003e, + 0x0000013e,0x00000147,0x0004003d,0x00000140,0x0000014a,0x00000149,0x0004003d,0x00000120, + 0x0000014b,0x00000138,0x00040064,0x0000013f,0x0000014c,0x0000014a,0x0007005f,0x00000007, + 0x0000014d,0x0000014c,0x0000014b,0x00000002,0x0000013a,0x0008004f,0x00000012,0x0000014e, + 0x0000014d,0x0000014d,0x00000000,0x00000001,0x00000002,0x0003003e,0x00000148,0x0000014e, + 0x0004003d,0x00000012,0x0000014f,0x0000013e,0x0004003d,0x00000012,0x00000150,0x00000148, + 0x000500b4,0x00000063,0x00000151,0x0000014f,0x00000150,0x0004009b,0x0000000d,0x00000152, + 0x00000151,0x000300f7,0x00000154,0x00000000,0x000400fa,0x00000152,0x00000153,0x00000154, + 0x000200f8,0x00000153,0x0004003d,0x00000155,0x00000158,0x00000157,0x0004003d,0x00000120, + 0x00000159,0x00000122,0x00040063,0x00000158,0x00000159,0x00000090,0x00050041,0x0000015b, + 0x0000015c,0x0000012d,0x0000015a,0x0004003d,0x0000011f,0x0000015d,0x0000015c,0x000500aa, + 0x0000000d,0x0000015e,0x0000015d,0x0000013a,0x000300f7,0x00000160,0x00000000,0x000400fa, + 0x0000015e,0x0000015f,0x00000160,0x000200f8,0x0000015f,0x0004003d,0x00000155,0x00000162, + 0x00000161,0x0004003d,0x00000120,0x00000163,0x00000122,0x00040063,0x00000162,0x00000163, + 0x00000089,0x000200f9,0x00000160,0x000200f8,0x00000160,0x000100fd,0x000200f8,0x00000154, + 0x0004003d,0x00000140,0x00000167,0x00000166,0x0004003d,0x00000120,0x00000168,0x00000138, + 0x00040064,0x0000013f,0x00000169,0x00000167,0x0007005f,0x00000007,0x0000016a,0x00000169, + 0x00000168,0x00000002,0x0000013a,0x0008004f,0x00000012,0x0000016b,0x0000016a,0x0000016a, + 0x00000000,0x00000001,0x00000002,0x0003003e,0x00000165,0x0000016b,0x0004003d,0x00000140, + 0x0000016e,0x0000016d,0x0004003d,0x00000120,0x0000016f,0x00000138,0x00040064,0x0000013f, + 0x00000170,0x0000016e,0x0007005f,0x00000007,0x00000171,0x00000170,0x0000016f,0x00000002, + 0x0000013a,0x0008004f,0x00000012,0x00000172,0x00000171,0x00000171,0x00000000,0x00000001, + 0x00000002,0x0003003e,0x0000016c,0x00000172,0x00050041,0x0000015b,0x00000174,0x0000012d, + 0x0000015a,0x0004003d,0x0000011f,0x00000175,0x00000174,0x000500ab,0x0000000d,0x00000176, + 0x00000175,0x0000013a,0x0003003e,0x00000173,0x00000176,0x0004003d,0x0000000d,0x00000178, + 0x00000173,0x000300f7,0x0000017b,0x00000000,0x000400fa,0x00000178,0x0000017a,0x0000017f, + 0x000200f8,0x0000017a,0x0004003d,0x00000155,0x0000017c,0x00000161,0x0004003d,0x00000120, + 0x0000017d,0x00000122,0x00050062,0x00000007,0x0000017e,0x0000017c,0x0000017d,0x0003003e, + 0x00000179,0x0000017e,0x000200f9,0x0000017b,0x000200f8,0x0000017f,0x0003003e,0x00000179, + 0x00000089,0x000200f9,0x0000017b,0x000200f8,0x0000017b,0x0004003d,0x00000012,0x00000182, + 0x0000013e,0x0003003e,0x00000181,0x00000182,0x0004003d,0x00000012,0x00000184,0x00000148, + 0x0003003e,0x00000183,0x00000184,0x0004003d,0x00000012,0x00000186,0x00000165,0x0003003e, + 0x00000185,0x00000186,0x0004003d,0x00000012,0x00000188,0x0000016c,0x0003003e,0x00000187, + 0x00000188,0x0004003d,0x0000000d,0x0000018a,0x00000173,0x0003003e,0x00000189,0x0000018a, + 0x0004003d,0x00000007,0x0000018c,0x00000179,0x0003003e,0x0000018b,0x0000018c,0x000b0039, + 0x00000007,0x0000018e,0x00000026,0x00000181,0x00000183,0x00000185,0x00000187,0x00000189, + 0x0000018b,0x0000018d,0x0004003d,0x00000007,0x0000018f,0x0000018d,0x0003003e,0x00000180, + 0x0000018f,0x0003003e,0x00000177,0x0000018e,0x0004003d,0x00000155,0x00000190,0x00000161, + 0x0004003d,0x00000120,0x00000191,0x00000122,0x0004003d,0x00000007,0x00000192,0x00000177, + 0x00040063,0x00000190,0x00000191,0x00000192,0x0004003d,0x00000155,0x00000193,0x00000157, + 0x0004003d,0x00000120,0x00000194,0x00000122,0x0004003d,0x00000007,0x00000195,0x00000180, + 0x00040063,0x00000193,0x00000194,0x00000195,0x000100fd,0x00010038,0x00050036,0x00000006, 0x0000000b,0x00000000,0x00000009,0x00030037,0x00000008,0x0000000a,0x000200f8,0x0000000c, 0x00050041,0x00000014,0x0000002a,0x0000000a,0x00000029,0x0004003d,0x00000006,0x0000002b, 0x0000002a,0x00050041,0x00000014,0x0000002d,0x0000000a,0x0000002c,0x0004003d,0x00000006, @@ -191,10 +193,12 @@ const uint32_t FG_HUD_LAYER_COMP_SPV[] = { 0x00000007,0x0004003b,0x00000013,0x000000ac,0x00000007,0x0004003b,0x00000013,0x000000ae, 0x00000007,0x0004003b,0x00000014,0x000000b0,0x00000007,0x0004003b,0x00000013,0x000000b7, 0x00000007,0x0004003b,0x00000013,0x000000bb,0x00000007,0x0004003b,0x00000014,0x000000bf, - 0x00000007,0x0004003b,0x00000008,0x000000da,0x00000007,0x0004003b,0x00000014,0x000000e2, - 0x00000007,0x0004003b,0x00000008,0x000000e3,0x00000007,0x0004003b,0x00000013,0x000000f0, - 0x00000007,0x0004003b,0x00000013,0x000000f2,0x00000007,0x0004003b,0x00000013,0x000000f4, - 0x00000007,0x0004003b,0x00000013,0x000000f6,0x00000007,0x0004003b,0x00000014,0x000000f8, + 0x00000007,0x0004003b,0x00000008,0x000000c4,0x00000007,0x0004003b,0x00000014,0x000000cd, + 0x00000007,0x0004003b,0x00000008,0x000000ce,0x00000007,0x0004003b,0x00000014,0x000000d1, + 0x00000007,0x0004003b,0x00000008,0x000000ef,0x00000007,0x0004003b,0x00000014,0x000000f7, + 0x00000007,0x0004003b,0x00000008,0x000000f8,0x00000007,0x0004003b,0x00000013,0x00000105, + 0x00000007,0x0004003b,0x00000013,0x00000107,0x00000007,0x0004003b,0x00000013,0x00000109, + 0x00000007,0x0004003b,0x00000013,0x0000010b,0x00000007,0x0004003b,0x00000014,0x0000010d, 0x00000007,0x00050041,0x00000014,0x00000068,0x00000024,0x0000002c,0x0004003d,0x00000006, 0x00000069,0x00000068,0x000500be,0x0000000d,0x0000006a,0x00000069,0x00000030,0x000300f7, 0x0000006c,0x00000000,0x000400fa,0x0000006a,0x0000006b,0x0000006c,0x000200f8,0x0000006b, @@ -247,43 +251,55 @@ const uint32_t FG_HUD_LAYER_COMP_SPV[] = { 0x000000bc,0x000000bd,0x0003003e,0x000000bb,0x000000be,0x0004003d,0x00000012,0x000000c0, 0x000000b7,0x0004003d,0x00000012,0x000000c1,0x000000b7,0x00050094,0x00000006,0x000000c2, 0x000000c0,0x000000c1,0x0003003e,0x000000bf,0x000000c2,0x0004003d,0x00000006,0x000000c3, - 0x000000bf,0x000500ba,0x0000000d,0x000000c5,0x000000c3,0x000000c4,0x000300f7,0x000000c7, - 0x00000000,0x000400fa,0x000000c5,0x000000c6,0x000000c7,0x000200f8,0x000000c6,0x00050041, - 0x00000014,0x000000c9,0x00000024,0x00000029,0x0004003d,0x00000006,0x000000ca,0x000000c9, - 0x00050085,0x00000006,0x000000cb,0x000000c8,0x000000ca,0x0004003d,0x00000012,0x000000cc, - 0x000000b7,0x0004003d,0x00000012,0x000000cd,0x000000bb,0x00050094,0x00000006,0x000000ce, - 0x000000cc,0x000000cd,0x00050081,0x00000006,0x000000cf,0x000000cb,0x000000ce,0x00050041, - 0x00000014,0x000000d0,0x00000024,0x0000002c,0x0004003d,0x00000006,0x000000d1,0x000000d0, - 0x00050085,0x00000006,0x000000d2,0x000000c8,0x000000d1,0x0004003d,0x00000006,0x000000d3, - 0x000000bf,0x00050081,0x00000006,0x000000d4,0x000000d2,0x000000d3,0x00050041,0x00000014, - 0x000000d5,0x00000024,0x00000035,0x0004003d,0x00000006,0x000000d6,0x000000d5,0x00050081, - 0x00000006,0x000000d7,0x000000d6,0x00000031,0x0007000c,0x00000006,0x000000d8,0x00000001, - 0x00000025,0x000000d7,0x00000083,0x00070050,0x00000007,0x000000d9,0x000000cf,0x000000d4, - 0x000000d8,0x00000030,0x0003003e,0x00000024,0x000000d9,0x000200f9,0x000000c7,0x000200f8, - 0x000000c7,0x0004003d,0x00000007,0x000000db,0x00000024,0x0003003e,0x000000da,0x000000db, - 0x00050039,0x0000000d,0x000000dc,0x00000010,0x000000da,0x000400a8,0x0000000d,0x000000dd, - 0x000000dc,0x000300f7,0x000000df,0x00000000,0x000400fa,0x000000dd,0x000000de,0x000000df, - 0x000200f8,0x000000de,0x0004003d,0x00000007,0x000000e0,0x00000024,0x000200fe,0x000000e0, - 0x000200f8,0x000000df,0x0004003d,0x00000007,0x000000e4,0x00000024,0x0003003e,0x000000e3, - 0x000000e4,0x00050039,0x00000006,0x000000e5,0x0000000b,0x000000e3,0x0003003e,0x000000e2, - 0x000000e5,0x0004003d,0x00000012,0x000000e6,0x0000001f,0x0004003d,0x00000012,0x000000e7, - 0x00000020,0x0007000c,0x00000012,0x000000e8,0x00000001,0x00000028,0x000000e6,0x000000e7, - 0x000500ba,0x00000063,0x000000ea,0x000000e8,0x000000e9,0x0004009a,0x0000000d,0x000000eb, - 0x000000ea,0x000300f7,0x000000ed,0x00000000,0x000400fa,0x000000eb,0x000000ec,0x000000ed, - 0x000200f8,0x000000ec,0x0004003d,0x00000007,0x000000ee,0x00000024,0x000200fe,0x000000ee, - 0x000200f8,0x000000ed,0x0004003d,0x00000012,0x000000f1,0x0000001f,0x0003003e,0x000000f0, - 0x000000f1,0x0004003d,0x00000012,0x000000f3,0x00000020,0x0003003e,0x000000f2,0x000000f3, - 0x0004003d,0x00000012,0x000000f5,0x00000021,0x0003003e,0x000000f4,0x000000f5,0x0004003d, - 0x00000012,0x000000f7,0x00000022,0x0003003e,0x000000f6,0x000000f7,0x0004003d,0x00000006, - 0x000000f9,0x000000e2,0x0003003e,0x000000f8,0x000000f9,0x00090039,0x0000000d,0x000000fa, - 0x0000001b,0x000000f0,0x000000f2,0x000000f4,0x000000f6,0x000000f8,0x000300f7,0x000000fc, - 0x00000000,0x000400fa,0x000000fa,0x000000fb,0x000000fc,0x000200f8,0x000000fb,0x0004003d, - 0x00000012,0x000000fd,0x00000020,0x0004003d,0x00000006,0x000000fe,0x000000e2,0x0004003d, - 0x00000012,0x000000ff,0x0000001f,0x0005008e,0x00000012,0x00000100,0x000000ff,0x000000fe, - 0x00050083,0x00000012,0x00000101,0x000000fd,0x00000100,0x0004003d,0x00000006,0x00000102, - 0x000000e2,0x00050051,0x00000006,0x00000103,0x00000101,0x00000000,0x00050051,0x00000006, - 0x00000104,0x00000101,0x00000001,0x00050051,0x00000006,0x00000105,0x00000101,0x00000002, - 0x00070050,0x00000007,0x00000106,0x00000103,0x00000104,0x00000105,0x00000102,0x0003003e, - 0x00000025,0x00000106,0x000200f9,0x000000fc,0x000200f8,0x000000fc,0x0004003d,0x00000007, - 0x00000107,0x00000024,0x000200fe,0x00000107,0x00010038 + 0x000000bf,0x0004003d,0x00000007,0x000000c5,0x00000024,0x0003003e,0x000000c4,0x000000c5, + 0x00050039,0x0000000d,0x000000c6,0x00000010,0x000000c4,0x000600a9,0x00000006,0x000000c9, + 0x000000c6,0x000000c7,0x000000c8,0x000500ba,0x0000000d,0x000000ca,0x000000c3,0x000000c9, + 0x000300f7,0x000000cc,0x00000000,0x000400fa,0x000000ca,0x000000cb,0x000000cc,0x000200f8, + 0x000000cb,0x0004003d,0x00000007,0x000000cf,0x00000024,0x0003003e,0x000000ce,0x000000cf, + 0x00050039,0x0000000d,0x000000d0,0x00000010,0x000000ce,0x000300f7,0x000000d3,0x00000000, + 0x000400fa,0x000000d0,0x000000d2,0x000000da,0x000200f8,0x000000d2,0x00050041,0x00000014, + 0x000000d5,0x00000024,0x0000002c,0x0004003d,0x00000006,0x000000d6,0x000000d5,0x00050088, + 0x00000006,0x000000d7,0x0000003e,0x000000d6,0x0007000c,0x00000006,0x000000d8,0x00000001, + 0x00000025,0x00000031,0x000000d7,0x0007000c,0x00000006,0x000000d9,0x00000001,0x00000028, + 0x000000d4,0x000000d8,0x0003003e,0x000000d1,0x000000d9,0x000200f9,0x000000d3,0x000200f8, + 0x000000da,0x0003003e,0x000000d1,0x000000d4,0x000200f9,0x000000d3,0x000200f8,0x000000d3, + 0x0004003d,0x00000006,0x000000db,0x000000d1,0x0003003e,0x000000cd,0x000000db,0x0004003d, + 0x00000006,0x000000dc,0x000000cd,0x00050041,0x00000014,0x000000dd,0x00000024,0x00000029, + 0x0004003d,0x00000006,0x000000de,0x000000dd,0x00050085,0x00000006,0x000000df,0x000000dc, + 0x000000de,0x0004003d,0x00000012,0x000000e0,0x000000b7,0x0004003d,0x00000012,0x000000e1, + 0x000000bb,0x00050094,0x00000006,0x000000e2,0x000000e0,0x000000e1,0x00050081,0x00000006, + 0x000000e3,0x000000df,0x000000e2,0x0004003d,0x00000006,0x000000e4,0x000000cd,0x00050041, + 0x00000014,0x000000e5,0x00000024,0x0000002c,0x0004003d,0x00000006,0x000000e6,0x000000e5, + 0x00050085,0x00000006,0x000000e7,0x000000e4,0x000000e6,0x0004003d,0x00000006,0x000000e8, + 0x000000bf,0x00050081,0x00000006,0x000000e9,0x000000e7,0x000000e8,0x00050041,0x00000014, + 0x000000ea,0x00000024,0x00000035,0x0004003d,0x00000006,0x000000eb,0x000000ea,0x00050081, + 0x00000006,0x000000ec,0x000000eb,0x00000031,0x0007000c,0x00000006,0x000000ed,0x00000001, + 0x00000025,0x000000ec,0x00000083,0x00070050,0x00000007,0x000000ee,0x000000e3,0x000000e9, + 0x000000ed,0x00000030,0x0003003e,0x00000024,0x000000ee,0x000200f9,0x000000cc,0x000200f8, + 0x000000cc,0x0004003d,0x00000007,0x000000f0,0x00000024,0x0003003e,0x000000ef,0x000000f0, + 0x00050039,0x0000000d,0x000000f1,0x00000010,0x000000ef,0x000400a8,0x0000000d,0x000000f2, + 0x000000f1,0x000300f7,0x000000f4,0x00000000,0x000400fa,0x000000f2,0x000000f3,0x000000f4, + 0x000200f8,0x000000f3,0x0004003d,0x00000007,0x000000f5,0x00000024,0x000200fe,0x000000f5, + 0x000200f8,0x000000f4,0x0004003d,0x00000007,0x000000f9,0x00000024,0x0003003e,0x000000f8, + 0x000000f9,0x00050039,0x00000006,0x000000fa,0x0000000b,0x000000f8,0x0003003e,0x000000f7, + 0x000000fa,0x0004003d,0x00000012,0x000000fb,0x0000001f,0x0004003d,0x00000012,0x000000fc, + 0x00000020,0x0007000c,0x00000012,0x000000fd,0x00000001,0x00000028,0x000000fb,0x000000fc, + 0x000500ba,0x00000063,0x000000ff,0x000000fd,0x000000fe,0x0004009a,0x0000000d,0x00000100, + 0x000000ff,0x000300f7,0x00000102,0x00000000,0x000400fa,0x00000100,0x00000101,0x00000102, + 0x000200f8,0x00000101,0x0004003d,0x00000007,0x00000103,0x00000024,0x000200fe,0x00000103, + 0x000200f8,0x00000102,0x0004003d,0x00000012,0x00000106,0x0000001f,0x0003003e,0x00000105, + 0x00000106,0x0004003d,0x00000012,0x00000108,0x00000020,0x0003003e,0x00000107,0x00000108, + 0x0004003d,0x00000012,0x0000010a,0x00000021,0x0003003e,0x00000109,0x0000010a,0x0004003d, + 0x00000012,0x0000010c,0x00000022,0x0003003e,0x0000010b,0x0000010c,0x0004003d,0x00000006, + 0x0000010e,0x000000f7,0x0003003e,0x0000010d,0x0000010e,0x00090039,0x0000000d,0x0000010f, + 0x0000001b,0x00000105,0x00000107,0x00000109,0x0000010b,0x0000010d,0x000300f7,0x00000111, + 0x00000000,0x000400fa,0x0000010f,0x00000110,0x00000111,0x000200f8,0x00000110,0x0004003d, + 0x00000012,0x00000112,0x00000020,0x0004003d,0x00000006,0x00000113,0x000000f7,0x0004003d, + 0x00000012,0x00000114,0x0000001f,0x0005008e,0x00000012,0x00000115,0x00000114,0x00000113, + 0x00050083,0x00000012,0x00000116,0x00000112,0x00000115,0x0004003d,0x00000006,0x00000117, + 0x000000f7,0x00050051,0x00000006,0x00000118,0x00000116,0x00000000,0x00050051,0x00000006, + 0x00000119,0x00000116,0x00000001,0x00050051,0x00000006,0x0000011a,0x00000116,0x00000002, + 0x00070050,0x00000007,0x0000011b,0x00000118,0x00000119,0x0000011a,0x00000117,0x0003003e, + 0x00000025,0x0000011b,0x000200f9,0x00000111,0x000200f8,0x00000111,0x0004003d,0x00000007, + 0x0000011c,0x00000024,0x000200fe,0x0000011c,0x00010038 }; diff --git a/gpu/vk/vk_aa.cpp b/gpu/vk/vk_aa.cpp index 59c4f4f..f32ef0f 100644 --- a/gpu/vk/vk_aa.cpp +++ b/gpu/vk/vk_aa.cpp @@ -539,6 +539,15 @@ int aa_mode() { const int choice = choice_now(); // ((Triforce, FSR3-06, FSR4-5) with an upscaler after the bloom, none: aa_rows.h effective) const int want = ar::effective(choice, upscaler_now(), temporal_before_bloom(), env_choice() >= 0); + // ((Triforce, 11-26, a player's report: "Upscale Before Bloom gets rid of Evil HD's ambient occlusion") the AO and the + // light shafts are drawn in the stand-in for the game's SMAA composition (ao_after), which an upscaler before the bloom + // leaves to the game (GAME): said once. Drawing them there too is to come (the render-size depth, before the bloom) + if (want == ar::GAME && evil_hd_now() && temporal_before_bloom() && ar::upscaler_own(upscaler_now())) { + static bool told; + if (!told) + told = true, logf("vk: Evil HD's ambient occlusion and light shafts: not drawn while the upscaler works before the " + "bloom (the Upscale before bloom row)"); + } frame_begun(s, frame, want); mode_now.store(want, std::memory_order_release); frame_read.store(frame, std::memory_order_release); diff --git a/gpu/vk/vk_draw.cpp b/gpu/vk/vk_draw.cpp index 3b01263..d47315e 100644 --- a/gpu/vk/vk_draw.cpp +++ b/gpu/vk/vk_draw.cpp @@ -1211,6 +1211,68 @@ bool pcache_from_file = false; // (a temporary in the call's full expression), and pcache_let_go destroys it once the PC's RAM runs short and nobody is // inside (pcache_gate.h has why). Closed, pcache_use() gives no cache: the creation goes without one) pcache_gate::Gate pcache_door; +// ((Triforce, 11-26) NVIDIA's driver: pipelines come from its own disk cache (pcache_init, precompile_keeps_all) +bool nv_own_cache_serves() { return dev.props.vendorID == 0x10DE; } +// ((Triforce, 11-26) RX_VK_PCACHE_NV=1 (OFF by default): on NVIDIA the file is not read (pcache_init). Measured after it shipped +// to the owner as the default: the working set -3 GB, but a pipeline made in play took 4.4-5.3 ms from the driver's own cache +// against ~1 ms from ours, 100-150 of them in an area's first seconds: 80 -> 50 fps dips walking into new places) +// ((Triforce, 11-26) RX_VK_PCACHE_COMPACT=1: on NVIDIA the main cache has a file of its own, mkw_vk_pipelines_nv.bin, which holds +// only what this PC's sessions made: it starts empty, every pipeline a session makes goes into it (no play cache: its +// creations asked the main cache with FAIL_ON_PIPELINE_COMPILE_REQUIRED, which the driver's own disk cache answered at 4.4 ms +// each, so nothing ever reached the play cache), and the usual saves write it as it grows. A preparation that builds into it +// writes nothing this session (it would hold every pipeline again). The 2.8 GB file (+3.3 GB of RAM held by the driver) is +// neither read nor written while it is on) +// ON BY DEFAULT on NVIDIA since 11-26 (RX_VK_PCACHE_COMPACT=0: the big file, as before). Four-area tour, the owner's PC: a new +// compact cache's first session (seeded with the order's pipelines and their stage libraries, 4.2 s at that start) 0.43 ms a +// pipeline made in play, 19 stalls, 3 late frames, 88.6 fps, working set 13.7 GB, private 22.0 GB; the big file's 1.05 ms, 19, +// 8, 90.2, 17.0 GB, 25.6 GB; its second session 0.92-1.32 ms, 15 stalls. The file was 263-378 MB against 2.75 GB) +std::string pipe_order_path(); +// ((Triforce, 11-26) On NVIDIA both pipeline files hold what the driver answers from its own shader disk cache, not the +// compiled code: on a PC whose driver cache does not keep the game's (the control panel's Shader Cache Size too small for +// it beside the other games', or cleared) every pipeline of a session compiled in play. Lab, the walk with NVIDIA's cache +// emptied (__GL_SHADER_DISK_CACHE_PATH): the compact file 1% low 12.5 fps, 30 frames over 100 ms, 130 ms a pipeline, a 10 s +// stall; the big file 13.3 fps, 23, 126 ms once its start left the libraries to the draws (and 32.5 when it made them +// again). A player's RTX 5080 log (v0.8.3) found the libraries cold at every start, and the game "rebuilt shaders after +// every restart". Such a start's library check (lib_check_cold) makes them again before the game (44.1 fps, 1 frame over +// 100 ms in the same walk) and leaves this file beside the game: from the next start the driver keeps the game's shaders in a +// folder of its own beside the game (triforce_nvidia_cache) with 10 GB of room (vk_main.cpp create_instance sets +// __GL_SHADER_DISK_CACHE_PATH and _SIZE before the driver loads, which Windows' driver honours: a probe at 100 MB stayed +// there), where other games' shaders do not push them out. Removing the file uses the driver's own folder again +std::string nv_own_folder_mark_path() { + const std::string o = pipe_order_path(); + return o.substr(0, o.find_last_of("\\/") + 1) + "triforce_nvidia_cache.own"; +} +bool nv_compact_on() { + static const bool v = [] { + if ((getenv("RX_VK_PCACHE_COMPACT") && atoi(getenv("RX_VK_PCACHE_COMPACT")) == 0) || getenv("RX_VK_PCACHE_LOAD") || + !nv_own_cache_serves()) + return false; + if (getenv("RX_VK_PCACHE_COMPACT")) return true; // (=1: on whatever the order says) + // ((Triforce, 11-26) and only once this PC's order (triforce_pipeline_order.bin) names enough pipelines to seed it: a new + // player, or one whose order is short, keeps the big file the preparation built, and its pipelines at ~1 ms from the + // start. A compact cache seeded with little made each pipeline of a session's new places at 4.4-6 ms from the driver's + // own cache: the 80 -> 50 fps dips) + uint64_t keys = 0; + if (FILE* f = fopen(pipe_order_path().c_str(), "rb")) { + _fseeki64(f, 0, SEEK_END); + const int64_t sz = _ftelli64(f); + fclose(f); + keys = sz > 24 ? (uint64_t)(sz - 24) / 8 : 0; + } + if (keys < 1024) { + logf("vk: pipeline cache: the big file, not the compact one: this PC's order names %llu pipelines (under 1024 to seed it; " + "RX_VK_PCACHE_COMPACT=1: compact all the same)", (unsigned long long)keys); + return false; + } + return true; + }(); + return v; +} +bool nv_pcache_skip() { + static const bool v = getenv("RX_VK_PCACHE_NV") && atoi(getenv("RX_VK_PCACHE_NV")) != 0 && !getenv("RX_VK_PCACHE_LOAD") && + nv_own_cache_serves(); + return v; +} using PcacheUse = pcache_gate::Use; PcacheUse pcache_use() { return PcacheUse(pcache_door, pcache); } void pcache_play_open(bool same); @@ -1224,9 +1286,20 @@ std::atomic pcache_play_saved{0}; std::atomic pcache_preparing{0}; std::atomic pcache_main_built{0}, st_play_made{0}; std::atomic pcache_fold{false}; +bool nv_compact_on(); +static bool pcache_no_save = false; // ((Triforce) RX_VK_PCACHE_LOAD=0 and the rules that set it: not read, not saved) struct PcachePreparing { // (prepare_run, for its length) + int64_t built0 = pcache_main_built.load(); PcachePreparing() { pcache_preparing++; } - ~PcachePreparing() { pcache_preparing--; } + ~PcachePreparing() { + pcache_preparing--; + // ((Triforce, 11-26) RX_VK_PCACHE_COMPACT: a preparation that built into the compact cache: nothing written this session) + if (nv_compact_on() && pcache_main_built.load() > built0 && !pcache_no_save) { + pcache_no_save = true; + logf("vk: pipeline cache: the preparation built into the compact cache: it is not saved this session (it would hold " + "every pipeline)"); + } + } }; // ((Triforce, 11-22, the performance audit's PIPE-23, after Source A's; precompile_save.h) RX_VK_PRECOMPILE_SAVE_S: the // seconds of building from which a keep-all precompile's end saves the cache before the title (30; 0: never, and the @@ -1495,7 +1568,6 @@ static uint64_t linux_ram_bytes() { // (Triforce) RX_VK_PCACHE_LOAD=0: mkw_vk_pipelines.bin is neither read nor saved (pcache_init, pipeline_cache_save). An A/B of // what the file costs in memory (read whole and held by the driver all session): the cache starts empty and the driver's own // shader cache is all there is. Not set: as before -static bool pcache_no_save = false; void pcache_init() { if (pcache) return; uint64_t ws0 = 0, priv0 = 0; // ((Triforce) what the cache costs the RAM once the driver has it: the line below) @@ -1505,6 +1577,22 @@ void pcache_init() { std::string dir(exe, n); dir = dir.substr(0, dir.find_last_of("\\/") + 1); pcache_path = dir + "mkw_vk_pipelines.bin"; + if (nv_compact_on()) { + pcache_path = dir + "mkw_vk_pipelines_nv.bin"; + logf("vk: pipeline cache: the compact one of what this PC's sessions made, %s (RX_VK_PCACHE_COMPACT=0: the big file)", pcache_path.c_str()); + // (grown past RX_VK_PCACHE_COMPACT_MAX_MB (1024) over the sessions: made again from the last sessions' order at this start) + static const int64_t max_mb = getenv("RX_VK_PCACHE_COMPACT_MAX_MB") ? atoll(getenv("RX_VK_PCACHE_COMPACT_MAX_MB")) : 1024; + if (FILE* f = fopen(pcache_path.c_str(), "rb")) { + _fseeki64(f, 0, SEEK_END); + const int64_t sz = _ftelli64(f); + fclose(f); + if (max_mb > 0 && sz > (max_mb << 20)) { + remove(pcache_path.c_str()); + logf("vk: pipeline cache: the compact one has grown to %lld MB (over %lld): made again from the last sessions' order", + (long long)(sz >> 20), (long long)max_mb); + } + } + } // (Triforce, 11-14) The file is kept for one set of translated shaders: the ones named beside it (.for, the programs' // stamp). The driver's data only ever grows: every update that changes the translator (and a Setup build after a lab one: // another C++ library, other SPIR-V) added its ~650 MB of pipelines to the pipelines of shaders that no longer exist, and @@ -1563,6 +1651,17 @@ void pcache_init() { if (pcache_no_save) logf("vk: RX_VK_PCACHE_LOAD=0: pipeline cache %s not read, and not saved this run (the driver's own cache serves)", pcache_path.c_str()); + // ((Triforce, 11-26) NVIDIA's driver, RX_VK_PCACHE_LOAD unset: the file is not read either. The driver serves most pipelines + // from its own disk cache all the same (it reports ~460 of ~12,900 precompiled ones as found in ours), and it holds what it + // is handed for the whole session: the owner's 2.8 GB file put +3.3 GB into the working set at every start, and letting the + // cache go later gave none of it back (11-16). Four-area tour on his PC with the precompile not keeping its pipelines + // either (precompile_keeps_all): working set 17.0 -> 14.0 GB, private 25.6 -> 22.8 GB, 90.2 / 89.7 fps, no draw left out + // and no wait for a pipeline, fewer late frames (8 -> 2). RX_VK_PCACHE_LOAD=1: read, as before) + if (!pcache_no_save && nv_pcache_skip()) { + pcache_no_save = true; + logf("vk: pipeline cache %s not read, and not saved this run: NVIDIA's driver serves the pipelines from its own cache " + "(RX_VK_PCACHE_LOAD=1: read)", pcache_path.c_str()); + } if (FILE* f = pcache_no_save ? nullptr : fopen(pcache_path.c_str(), "rb")) { _fseeki64(f, 0, SEEK_END); const int64_t sz = _ftelli64(f); @@ -1680,6 +1779,10 @@ void pcache_init() { void pcache_play_open(bool same) { pcache_play_path = pcache_path.substr(0, pcache_path.size() - 4) + "_play.bin"; static const bool on = !(getenv("RX_VK_PCACHE_PLAY_FILE") && atoi(getenv("RX_VK_PCACHE_PLAY_FILE")) == 0); + if (nv_compact_on()) { // ((Triforce, 11-26) RX_VK_PCACHE_COMPACT: everything into the compact cache) + logf("vk: pipeline cache: no play file (the compact cache takes what a run makes)"); + return; + } if (!on || !pcache || !dev.vk13.pipelineCreationCacheControl || pcache_libs_only) { // ((Triforce, 11-22, PIPE-78) lean: none) logf("vk: pipeline cache: no play file (%s): what a run compiles goes into the cache above", !on ? "RX_VK_PCACHE_PLAY_FILE=0" : pcache_libs_only ? "libraries only, RX_VK_PCACHE_LIBS_ONLY" @@ -13675,6 +13778,24 @@ bool lib_check_cold(const std::string& prepared, uint64_t warmed) { "or its draws are left out (RX_VK_LIB_CHECK=0: not looked at)", t.cold, t.got, t.answered, t.first_median, t.again_median, ms, pcache_path.c_str()); } + // ((Triforce, 11-26) found cold on NVIDIA: the driver's shader cache did not keep the game's (nv_own_folder_mark_path). + // This start makes the libraries again before the game whatever the record says (left to the draws, every pipeline of + // the session compiled in play: the lab's 10 s stall), and the next start gives the driver a folder of its own for them + if (nv_own_cache_serves() && v != lib_check::Verdict::Warm && v != lib_check::Verdict::Unknown) { + FILE* m = fopen(nv_own_folder_mark_path().c_str(), "rb"); + const bool had = m != nullptr; + if (m) fclose(m); + if (!had) + if (FILE* f = fopen(nv_own_folder_mark_path().c_str(), "wb")) { + fputs("NVIDIA's shader cache did not keep the game's: from the next start it has a folder of its own beside the " + "game (triforce_nvidia_cache). Remove this file to use the driver's own folder again\n", f); + fclose(f); + } + logf("vk: NVIDIA's shader cache did not keep the game's libraries: made again now, before the game%s (%s)", + had ? "" : "; from the next start the driver keeps them in a folder of their own beside the game, with 10 GB of room", + nv_own_folder_mark_path().c_str()); + return true; + } return d == lib_check::Do::Again; } /// prepare_run's, the part made again after lib_check_cold (made) or left out by warm_begin (not made): recorded, so that a start @@ -14165,6 +14286,13 @@ uint64_t built_computes_key() { bool precompile_keeps_all() { const char* e = getenv("RX_VK_PRECOMPILE_KEEP"); if (e && strcmp(e, "auto")) return atoi(e) != 0; + // ((Triforce, 11-26) NVIDIA's driver serving from its own cache (pcache_init): nothing kept, the driver holds each kept one's + // binary for the session (15,877 kept: +5 GB of working set when the cache was not read) + if (!e && nv_own_cache_serves()) { + logf("vk: precompile: the pipelines it builds go to the caches and are not kept on NVIDIA's driver: they come from the " + "caches at their first draw (RX_VK_PRECOMPILE_KEEP=1: kept)"); + return false; + } { uint64_t used = 0, allowed = 0; if (vram_usage(&used, &allowed) && allowed < (6656ull << 20)) { @@ -14702,6 +14830,7 @@ void precompile_run(void (*progress)(size_t done, size_t total)) { return dev.foliage_rate && n.n == 0 && depth_aspect((VkFormat)n.depth_format) ? mix(n.key, kRateLibrary) : n.key; }; bool rebuilt = false; // ((Triforce, 11-22, PIPE-21) the record not trusted this start: built_check_cold) + std::unordered_set seed; // ((Triforce, 11-26) RX_VK_PCACHE_COMPACT: a new compact cache's seed, below) if (light) { built = built_read(built_stamp); computes_built = built.count(computes_key) != 0; @@ -14709,7 +14838,28 @@ void precompile_run(void (*progress)(size_t done, size_t total)) { // (built_check.h). Cold, nothing is left out below: everything noted and listed is built again, and recorded anew) if (!built.empty() && built_check_cold(notes, built, built_key, computes_built, computes_listed, built_stamp)) built.clear(), computes_built = false, rebuilt = true; - std::erase_if(notes,[&](const std::unique_ptr& n) { return built.count(built_key(*n)) != 0; }); + // ((Triforce, 11-26) RX_VK_PCACHE_COMPACT with no compact file read: the pipelines the last sessions' draws first needed + // (triforce_pipeline_order.bin) are built into it now, not kept, though the record says the caches have them: the driver's + // own cache answers at 4.4-6 ms a pipeline, ours at ~1.3, and a session on an empty compact cache dipped at each new place) + if (nv_compact_on() && !pcache_from_file) { + std::lock_guard ok(pipe_order_file_mu); + const std::vector& order = order_before_locked(); + // (the newest sessions' first, as the file keeps them: RX_VK_PCACHE_COMPACT_SEED=; unset: all of them, what this PC plays) + static const size_t most = getenv("RX_VK_PCACHE_COMPACT_SEED") ? (size_t)std::max(0, atoi(getenv("RX_VK_PCACHE_COMPACT_SEED"))) : pipe_order::kKeysMax; + seed.insert(order.begin(), order.begin() + std::min(order.size(), most)); + } + size_t seeded = 0; + std::erase_if(notes, [&](const std::unique_ptr& n) { + if (!built.count(built_key(*n))) return false; + if (seed.count(n->key)) return seeded++, false; + return true; + }); + if (!seed.empty()) + logf("vk: precompile: the compact cache is new: %zu pipelines the last sessions drew are built into it now (%zu in their " + "order)%s", seeded, seed.size(), computes_built ? ", and the compute programs play dispatched" : ""); + // (and the compute programs play dispatched: made at their first dispatch from the driver's own cache, 3.1 ms each against + // 0.4 from the big file, 89 of them in an area's arrival frames) + if (!seed.empty()) computes_built = false; logf("vk: precompile: RAM spared (RX_VK_PRECOMPILE_KEEP=1: as before): %zu of %zu noted pipelines were built by " "an earlier start and are left to their first draw%s", noted_n - notes.size(), noted_n, computes_built ? ", the compute programs' too" : ""); @@ -14773,11 +14923,13 @@ void precompile_run(void (*progress)(size_t done, size_t total)) { std::atomic graphics_begun{false}; bool abandoned = false; bool light = false; // ((Triforce) the graphics pipelines built for the caches and let go: precompile_keeps_all) + std::unordered_set seed; // ((Triforce, 11-26) RX_VK_PCACHE_COMPACT's seed: their stage libraries built too PrepTimes times; // ((Triforce) the timing line: 0 the compute pipelines, 1 the mesh fallbacks, 2 the graphics pipelines) }; const size_t graphics_n = notes.size(), computes_n = computes.size(), fallbacks_n = fallbacks.size(); Pre* pre = new Pre; pre->light = light; + pre->seed = std::move(seed); pre->notes = std::move(notes), pre->computes = std::move(computes), pre->fallbacks = std::move(fallbacks); auto& next = pre->next; auto& done = pre->done; @@ -14842,6 +14994,13 @@ void precompile_run(void (*progress)(size_t done, size_t total)) { pre->times.add(2, built_from); pre->graphics_begun = true; if (first.owns_lock()) first.unlock(); + // ((Triforce, 11-26) a compact cache's seed: the pipeline's stage libraries too, which play's fast links are made from + // (without them the new cache's first session made each from the driver's own cache: 0.5-0.75 s of pipelines at + // an area's arrival, against 25 ms with the big file) + if (pre->light && gpl_wanted() && pre->seed.count(n.key)) + for (int part = p->mesh ? 1 : 0; part < 4; part++) + if (const VkPipeline lib = build_graphics(*p, n.s, note_targets(n), (VkPrimitiveTopology)n.topo, part)) + vkDestroyPipeline(dev.device, lib, nullptr); if (pre->light) { // ((Triforce) in the caches now: its first draw builds it from there) if (made) vkDestroyPipeline(dev.device, made, nullptr); } else { @@ -16374,7 +16533,9 @@ void pipeline_cache_save(bool force) { // 4 GB at its worst), a commit spike and seconds of disk load in the middle of play, for a few hundred KB new. // What play builds is in the driver's own cache at once, and the save at the game's close takes all of it static const size_t play_grow = (size_t)(getenv("RX_VK_PCACHE_PLAY_MB") ? std::max(0ll, atoll(getenv("RX_VK_PCACHE_PLAY_MB"))) : 64) << 20; - if (!force && pcache_saved_size > (1u << 20) && n < pcache_saved_size + play_grow) return; + // ((Triforce, 11-26) the compact cache (RX_VK_PCACHE_COMPACT): written at 32 MB of growth, a file of some hundred MB) + const size_t grow = nv_compact_on() ? std::min(play_grow, 32u << 20) : play_grow; + if (!force && pcache_saved_size > (1u << 20) && n < pcache_saved_size + grow) return; // ((Triforce) In play, not while a copy of it would not fit in the RAM available with 2 GB to spare // (mem_parts.h copy_fits): the data is fetched whole into memory, 2 to 3 GB with the stage libraries, and with // the RAM short that is what Windows pages out under the game. It waits for the next check, or the game's close) diff --git a/gpu/vk/vk_fsr3.cpp b/gpu/vk/vk_fsr3.cpp index 5965a57..63a3819 100644 --- a/gpu/vk/vk_fsr3.cpp +++ b/gpu/vk/vk_fsr3.cpp @@ -538,6 +538,12 @@ bool supported() { vkGetPhysicalDeviceProperties2(dev.physical, &p2); const VkSubgroupFeatureFlags want = VK_SUBGROUP_FEATURE_BASIC_BIT | VK_SUBGROUP_FEATURE_QUAD_BIT; g.wave = (sg.supportedOperations & want) == want && (sg.supportedStages & VK_SHADER_STAGE_COMPUTE_BIT); + // ((Triforce, 11-26, a GTX 1080 Ti's report: big blue and yellow blocks and a yellow drift with FSR 3.1, driver + // 531.79) RX_VK_FSR3_WAVE=0: the pyramids' passes without subgroup operations, for an A/B on such a card + if (const char* w = getenv("RX_VK_FSR3_WAVE"); w && atoi(w) == 0 && g.wave) { + g.wave = false; + logf("vk: fsr3: the passes without subgroup operations (RX_VK_FSR3_WAVE=0)"); + } logf("vk: fsr3: AMD FSR 3.1 can run on this GPU"); return true; }(); diff --git a/gpu/vk/vk_internal.h b/gpu/vk/vk_internal.h index c051084..06f6e40 100644 --- a/gpu/vk/vk_internal.h +++ b/gpu/vk/vk_internal.h @@ -434,6 +434,12 @@ bool memory_gpu_writes_any(); bool uniform_snapshot_on(); /// (vk_replay.cpp) The GPU's progress on the recordings' timeline, and a wait for it to reach v uint64_t vk_timeline_completed(); +// ((Triforce, 11-26) RX_VK_EARLY_WB (vk_memory.cpp): a segment's early write-backs, their submit, and a readback's wait for them +void memory_segment_early_wb(VkCommandBuffer cmd, uint64_t seg, bool allowed); +void memory_segment_early_submitted(uint64_t seg, uint64_t seq); +bool memory_early_wb_seq(uint64_t guest, uint64_t size, uint64_t v, uint64_t* seq); +uint64_t vk_rec_seq_now(); // ((Triforce, 11-26, diagnostics) vk_replay.cpp: recordings submitted so far +uint64_t vk_rec_done_now(); // (and done on the GPU) /// (vk_replay.cpp) The value the timeline reaches only after every recording made so far is done on the GPU (0: never) uint64_t vk_retirement_value(); bool memory_direct_wb(); // ((Triforce) vk_memory.cpp: RX_VK_DIRECT_WB=1, off unless set) @@ -453,6 +459,7 @@ void late_fix_flush_locked(); void vk_late_queue_stats(int64_t* waits, int64_t* wait_ns, int64_t* timeouts); uint64_t memory_late_fix_pending(); void memory_late_fix_apply(uint64_t done); +void memory_note_event_word(uint64_t gpu); // ((Triforce, 11-26) RX_VK_LATE_EVENTS: a GPU-signalled event word's page (vk_memory.cpp) /// ((Triforce, wp20) of this thread's last vk_timeline_wait, the part after the writer's recording was done (ns): wb_rec_wait.h) int64_t vk_timeline_wait_held_last(); WriteGen memory_generation(); diff --git a/gpu/vk/vk_main.cpp b/gpu/vk/vk_main.cpp index 3087efa..bf200fc 100644 --- a/gpu/vk/vk_main.cpp +++ b/gpu/vk/vk_main.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -133,7 +134,48 @@ bool has_extension(const std::vector& all, const char* na return false; } +/// (vk_draw.cpp nv_own_folder_mark_path's file: beside the game) +std::string nv_own_folder_mark_path() { + char exe[MAX_PATH]; + const DWORD n = game_module_path(exe, MAX_PATH); + const std::string dir(exe, n); + return dir.substr(0, dir.find_last_of("\\/") + 1) + "triforce_nvidia_cache.own"; +} +/// ((Triforce, 11-26) a PC whose NVIDIA shader cache did not keep the game's (vk_draw.cpp nv_own_folder_mark_path has the lab +/// numbers and the player's report): the driver's cache in a folder of the game's own, triforce_nvidia_cache beside it, with +/// 10 GB of room, so other games' shaders do not push the game's out. Before the first Vulkan call, when the driver loads and +/// reads them; a path or size the player set wins. Windows' driver honours both (a probe at 100 MB stayed there); Linux's +/// main sets the size for every player already (host/hos_main.c driver_cache_room) +static void nv_own_folder() { + FILE* m = fopen(nv_own_folder_mark_path().c_str(), "rb"); + if (!m) return; + fclose(m); + const std::string mark = nv_own_folder_mark_path(); + const std::string dir = mark.substr(0, mark.find_last_of("\\/") + 1) + "triforce_nvidia_cache"; + if (getenv("__GL_SHADER_DISK_CACHE_PATH")) { + logf("vk: NVIDIA's shader cache: __GL_SHADER_DISK_CACHE_PATH is set already, kept (%s)", getenv("__GL_SHADER_DISK_CACHE_PATH")); + return; + } + std::error_code ec; + std::filesystem::create_directories(dir, ec); +#ifdef _WIN32 + // (the CRT's copy and the process's: the driver may read either) + _putenv_s("__GL_SHADER_DISK_CACHE_PATH", dir.c_str()); + SetEnvironmentVariableA("__GL_SHADER_DISK_CACHE_PATH", dir.c_str()); + if (!getenv("__GL_SHADER_DISK_CACHE_SIZE")) { + _putenv_s("__GL_SHADER_DISK_CACHE_SIZE", "10737418240"); + SetEnvironmentVariableA("__GL_SHADER_DISK_CACHE_SIZE", "10737418240"); + } +#else + setenv("__GL_SHADER_DISK_CACHE_PATH", dir.c_str(), 0); + setenv("__GL_SHADER_DISK_CACHE_SIZE", "10737418240", 0); +#endif + logf("vk: NVIDIA's shader cache: a folder of the game's own, %s, %s bytes (this PC's driver did not keep the game's in its " + "own folder: %s; remove that file to use the driver's folder again)", dir.c_str(), getenv("__GL_SHADER_DISK_CACHE_SIZE"), + mark.c_str()); +} bool create_instance() { + nv_own_folder(); uint32_t version = VK_API_VERSION_1_0; if (vkEnumerateInstanceVersion) vkEnumerateInstanceVersion(&version); if (version < VK_API_VERSION_1_3) { @@ -1993,7 +2035,22 @@ void new_refused() { const bool known = new_commit_left(&avail); if (!new_wait::waits(known, avail, new_wait::t_waited_ms, max_ms, new_wait::t_no_wait)) throw std::bad_alloc(); static std::atomic told{0}; - if (told.fetch_add(1) < 8) + const int n = told.fetch_add(1); + if (n == 0) { // ((Triforce, 11-26) as host/mkw_glue.c hos_commit_limit_mark: the next start says so, once) + // (no allocation here: this is the new handler, at the commit limit) + char path[MAX_PATH + 32]; + const DWORD len = game_module_path(path, MAX_PATH); + char* slash = len ? strrchr(path, '\\') : nullptr; + if (!slash && len) slash = strrchr(path, '/'); + if (slash) { + snprintf(slash + 1, sizeof path - (size_t)(slash + 1 - path), "triforce_commit_limit.txt"); + if (FILE* f = fopen(path, "w")) { + fputs("Windows' commit limit (RAM and page file) was reached in the last session: the next start says so\n", f); + fclose(f); + } + } + } + if (n < 8) logf("vk: an allocation refused with %llu MB of the system's commit left: tried again for up to %d ms (HOS_COMMIT_WAIT_MS)", (unsigned long long)(avail >> 20), max_ms); Sleep(new_wait::kStepMs); diff --git a/gpu/vk/vk_memory.cpp b/gpu/vk/vk_memory.cpp index 61a9955..90cc468 100644 --- a/gpu/vk/vk_memory.cpp +++ b/gpu/vk/vk_memory.cpp @@ -2224,7 +2224,15 @@ uint64_t cap_spare_max() { if (capped && !small_card) logf("vk: capture buffers: 32 MB of spares at most, a PC of %llu MB of RAM (RX_VK_CAP_SPARE_MB=0: as before)", (unsigned long long)(total >> 20)); - return capped ? 32ull << 20 : ~0ull; + if (capped) return 32ull << 20; + // ((Triforce, 11-26) and 128 MB on a bigger PC, but on AMD (above: a buffer made anew costs ~100 ms there). The retired + // buffers of loads (40-60 MB each) stayed spares for good: the allocator's blocks in system memory 1.1 GB at the owner's + // spot (63 capture buffers, 1076 MB made in a tour), steady play's own captures ~110 MB. A new one is ~2 ms on NVIDIA) + if (total) { + logf("vk: capture buffers: 128 MB of spares at most (RX_VK_CAP_SPARE_MB=0: no bound, as before)"); + return 128ull << 20; + } + return ~0ull; }(); return v; } @@ -2802,6 +2810,65 @@ bool late_part_on() { static const bool v = !getenv("RX_VK_LATE_PART") || atoi(getenv("RX_VK_LATE_PART")) != 0; return v; } +// ((Triforce, 11-26) RX_VK_LATE_EVENTS=1: the partial rule (late_partial) for the pages that hold GPU-signalled event words only, +// every other late page waited for as by default. At the owner's spot every late page of every take was one page, 0x100d6c8000, +// the game's queue-ordering events (19 words the command buffers signal and the CPU writes): the held submits' first take of a +// frame found it written back in part by the frame before, and its queue submit waited for the GPU to finish that frame (~1.5 ms +// a frame, which the Presentation Thread and the game's readbacks then waited for in turn). Synced in part, the CPU's words go in +// and the GPU's signalled words in flight stay the GPU's in the mirror, nothing waits. RX_VK_LATE_INLINE (the rule for every late +// page, with the other rules off) flickered (139 cell blinks per 100 frames): this is that rule on the event page alone. +// The pages are noted at the replay of each event signal (memory_note_event_word)) +std::mutex event_pages_mu; +std::unordered_set event_pages; // (event_pages_mu: guest pages holding a GPU-signalled event word) +std::atomic event_pages_n{0}; +// ((Triforce, 11-26) RX_VK_LATE_GPU=1: a take's late pages, where RX_VK_LATE_QUEUE would put their second copy off to the queue +// (the write-back sent already, no texture storage), are copied again ON THE GPU instead: from guest memory into their mirror, +// in the uploads of the take's own submission, after a full barrier (memory_rb_refresh: the older submissions' write-backs into +// guest memory are done by then, the queue's order). No fix is noted, so no queue submit waits for the write-back: the held +// submits' first take of a frame (~100 late pages of a per-frame pool and the event page at the owner's spot) held the +// Presentation Thread and the game's readbacks behind the GPU's frame before, ~1.5 ms a frame. The CPU's replay reads none of +// those slots there (0 replay reads of a pending slot in every run). Off: as before) +// (and the capture's own slot, guest memory -> capture buffer, as the CPU's fix did: a later submission's mirror sync may copy +// the page from this capture, "from earlier ones'") +struct LateGpuPage { + uint32_t page; + VkBuffer cap; + uint64_t off; + uint8_t n = 0; // (RX_VK_LATE_GPU=2: the ranges still in flight, the GPU's write-backs; 0 with whole: all) + bool whole = true; + uint16_t r[8][2]; +}; +std::mutex late_gpu_mu; +std::vector late_gpu_pages; // (late_gpu_mu: pages for the next readback refresh, memory_rb_refresh) +std::atomic st_late_gpu{0}, st_late_gpu_takes{0}; +// ((Triforce, 11-26) ON BY DEFAULT as 2 since 11-26 (the late pages' in-flight ranges, from guest memory on the GPU), with +// RX_VK_REC_LAST, which it needs: without it a readback's wait came back at the first part of a submission recorded in parts, +// before the write-back, and the exposure meter ran away (white flashes). The four-area tour 86.3-86.4 -> 88.4-90.5 fps (two +// pairs, every area but the owner's spot ~4% faster; the spot itself ~1-2% slower), 0 cell blinks at the spot. +// RX_VK_LATE_GPU=0, or RX_VK_REC_LAST=0: the CPU's wait for the late pages, as before) +// ((Triforce, 11-26 evening) OFF AGAIN by default: on the walking route (forward and back with the camera turning, the owner's +// "walking/turning" hitches) it made the frames much less even than v0.8.3 and than with it off: frame time sd 1.73-2.06 vs +// 1.06, frame-to-frame jitter 1.89-2.05 vs 0.81, 88-97 spikes over 1.5x the median vs 26, 1% low 47-57 vs 62, fps 87.7-89.5 vs +// 92.8. The tours' +2-5% average was the wrong measure. RX_VK_LATE_GPU=2 (with RX_VK_REC_LAST=1): on) +int late_gpu_mode() { + static const int v = [] { + if (const char* e = getenv("RX_VK_LATE_GPU")) return atoi(e); + return 0; + }(); + return v; +} +bool late_gpu_on() { return late_gpu_mode() != 0; } +bool late_gpu_ranges() { return late_gpu_mode() == 2 || late_gpu_mode() == 3; } // (2 or 3: the in-flight ranges only) +bool late_gpu_from_mirror() { return late_gpu_mode() == 3; } // (3: those ranges from the mirror into the capture only) +bool late_events_on() { + static const bool v = getenv("RX_VK_LATE_EVENTS") && atoi(getenv("RX_VK_LATE_EVENTS")) != 0; + return v; +} +bool is_event_page(uint32_t page) { + if (!event_pages_n.load(std::memory_order_relaxed)) return false; + std::lock_guard lk(event_pages_mu); + return event_pages.count(page) != 0; +} int64_t st_tk_late_n; // (the takes that waited for the GPU for their late pages) // (a capture was ever made: the replay thread's; without it nothing owns pages) // ---- texture storage in the capture ---- @@ -4247,6 +4314,9 @@ std::atomic late_fix_top{0}; // (the highest value a pending fix constexpr size_t kLateFixMax = 4; std::atomic st_lq_deferred{0}, st_lq_tex{0}, st_lq_unsent{0}, st_lq_full{0}, st_lq_reads{0}, st_lq_applied{0}; void late_fix_note_read() { st_lq_reads.fetch_add(1, std::memory_order_relaxed); } +void late_gpu_stats(int64_t* takes, int64_t* pages) { // ((Triforce, 11-26) RX_VK_LATE_GPU's counts since the last call) + *takes = st_late_gpu_takes.exchange(0), *pages = st_late_gpu.exchange(0); +} /// whether the capture slot (gen, slot) is a late one whose fix is pending; *value: the write-back to wait for bool late_fix_slot_pending(WriteGen gen, uint32_t slot, uint64_t* value) { if (!late_fix_top.load(std::memory_order_acquire)) return false; @@ -4277,8 +4347,44 @@ void memory_late_fix_apply(uint64_t done) { } late_fix_top.store(late_fixes.empty() ? 0 : late_fixes.back().value, std::memory_order_release); } +// ((Triforce, 11-26, diagnostics) RX_VK_LOG_LATE_RANGE=-: a guest range traced: its late pages at a take, every +// capture of its pages, its readback refreshes (and vk_replay.cpp: its readbacks after their wait); 1500 lines in all + +// ((Triforce, 11-26) RX_VK_LOG_LATE_RANGE read once: it was asked of getenv at every written binding, write-back run and take) +bool trace_on() { + static const bool v = getenv("RX_VK_LOG_LATE_RANGE") != nullptr; + return v; +} +int64_t trace_now_ns() { // (steady ns, the trace lines' clock) + return std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()).count(); +} +bool trace_range(uint64_t g) { + static const std::pair lr = [] { + std::pair r{0, 0}; + if (const char* e = getenv("RX_VK_LOG_LATE_RANGE")) { + char* end = nullptr; + r.first = strtoull(e, &end, 16); + if (end && *end == '-') r.second = strtoull(end + 1, nullptr, 16); + } + return r; + }(); + static std::atomic n{0}; + static const uint64_t from = getenv("RX_VK_LOG_TRACE_FROM") ? strtoull(getenv("RX_VK_LOG_TRACE_FROM"), nullptr, 10) : 0; + return lr.second && g >= lr.first && g < lr.second && vk_timeline_completed() >= from && + n.fetch_add(1, std::memory_order_relaxed) < 1500; +} bool take_capture(std::unique_ptr c, uint64_t value, uint64_t completed) { const auto tk0 = std::chrono::steady_clock::now(); + if (trace_on() && c->map) + for (size_t i = 0; i < c->pages.size(); i++) { + const uint64_t g = (uint64_t)c->pages[i] << kPageShift; + if (!trace_range(g)) continue; + cap_ready(*c, (uint32_t)i); + const uint32_t* cw = (const uint32_t*)((const uint8_t*)c->map + i * 4096); + const uint32_t* gw = (const uint32_t*)((const uint8_t*)host->guest_base() + g); + logf("vk: trace capture %#llx: take %llu, done %llu, late value %llu | capture %08x | guest %08x", (unsigned long long)g, + (unsigned long long)value, (unsigned long long)vk_timeline_completed(), (unsigned long long)c->late_value, cw[0], gw[0]); + } // (RX_VK_LATE_QUEUE: this take's late pages' second copy left to the queue: lq; the value and the slots, noted with its buffer) bool lq = false; uint64_t lq_value = 0; @@ -4317,9 +4423,16 @@ bool take_capture(std::unique_ptr c, uint64_t value, uint64_t completed // ((Triforce, 11-22, the performance audit's MEM-80, after Source B's) RX_VK_LATE_INLINE=1 or the knob lateinline: the // partial rule alone, the other three off (late_inline.h); unset, the rules are RX_VK_LATE_NEW's as before static const char* late_inline_env = getenv("RX_VK_LATE_INLINE"); - const late_inline::Rules rules = late_inline::rules(late_new_env || lab_ab::on("latenew"), // (lab: the knob turns the rules on for its phases) - late_inline::on(late_inline_env, lab_ab::on("lateinline")), late_same_on(), - late_part_on(), late_defer_on()); + late_inline::Rules rules = late_inline::rules(late_new_env || lab_ab::on("latenew"), // (lab: the knob turns the rules on for its phases) + late_inline::on(late_inline_env, lab_ab::on("lateinline")), late_same_on(), + late_part_on(), late_defer_on()); + // ((Triforce, 11-26) RX_VK_LATE_EVENTS: with no other rule, the partial rule for the event pages alone (late_events_on)) + bool events_only = false; + if (!rules.any && late_events_on() && event_pages_n.load(std::memory_order_relaxed)) { + for (uint32_t i : c->late) + if (is_event_page(c->pages[i])) { events_only = true; break; } + if (events_only) rules.any = true, rules.part = true; + } const bool late_all = !rules.any; uint64_t v = c->late_value; if (!late_all) { @@ -4361,7 +4474,9 @@ bool take_capture(std::unique_ptr c, uint64_t value, uint64_t completed continue; } } - if (rules.part && std::binary_search(c->slots.begin(), c->slots.end(), i)) late_part_cand.push_back(i); + if (rules.part && (!events_only || is_event_page(c->pages[i])) && + std::binary_search(c->slots.begin(), c->slots.end(), i)) + late_part_cand.push_back(i); else need.push_back(i); } } @@ -4503,7 +4618,9 @@ bool take_capture(std::unique_ptr c, uint64_t value, uint64_t completed else if (pending >= kLateFixMax) st_lq_full.fetch_add(1, std::memory_order_relaxed); else lq = true, lq_value = v; } - if (const uint64_t done0 = vk_timeline_completed(); !lq && v > done0 && !lab_ab::on("nolatewait")) { + bool lg = false; // (RX_VK_LATE_GPU: the second copy made by the GPU in this submission's uploads, no fix) + if (lq && late_gpu_on()) lg = true, lq = false, st_late_gpu_takes.fetch_add(1, std::memory_order_relaxed); + if (const uint64_t done0 = vk_timeline_completed(); !lq && !lg && v > done0 && !lab_ab::on("nolatewait")) { const auto tw = std::chrono::steady_clock::now(); vk_timeline_wait(v); const double waited = std::chrono::duration(std::chrono::steady_clock::now() - tw).count(); @@ -4541,6 +4658,49 @@ bool take_capture(std::unique_ptr c, uint64_t value, uint64_t completed if (diff_now) diff_logged++; for (uint32_t i : c->late) { cap_ready(*c, i); // ((Triforce) copied ahead, as every late page: its second copy is not overwritten by its first) + { // ((Triforce, 11-26, diagnostics) RX_VK_LOG_LATE_RANGE=-: each late page in that guest range, its + // take's value, the GPU's done value, the late value and the first words of the capture and guest memory; 400 lines + static const std::pair lr = [] { + std::pair r{0, 0}; + if (const char* e = getenv("RX_VK_LOG_LATE_RANGE")) { + char* end = nullptr; + r.first = strtoull(e, &end, 16); + if (end && *end == '-') r.second = strtoull(end + 1, nullptr, 16); + } + return r; + }(); + static std::atomic lr_n{0}; + const uint64_t g = (uint64_t)c->pages[i] << kPageShift; + if (lr.second && g >= lr.first && g < lr.second && lr_n.fetch_add(1) < 400) { + const uint32_t* cw = (const uint32_t*)((const uint8_t*)c->map + (uint64_t)i * 4096); + const uint32_t* gw = (const uint32_t*)((const uint8_t*)host->guest_base() + g); + logf("vk: late page %#llx: take %llu, done %llu, late value %llu, %s | capture %08x %08x %08x %08x | guest %08x %08x %08x %08x", + (unsigned long long)g, (unsigned long long)value, (unsigned long long)vk_timeline_completed(), + (unsigned long long)v, lg ? "gpu" : lq ? "queue" : "waited", cw[0], cw[1], cw[2], cw[3], gw[0], gw[1], gw[2], gw[3]); + } + } + if (lg) { // (RX_VK_LATE_GPU: its second copy by the GPU, guest memory -> mirror, in this submission's uploads) + LateGpuPage l{c->pages[i], c->buffer, (uint64_t)i * 4096}; + // (RX_VK_LATE_GPU=2: only the ranges the write-backs still in flight write: the CPU's bytes stay the capture's, + // as submitted, and nothing the CPU stored in the page since reaches the GPU. Not known: the whole page) + if (late_gpu_ranges()) { + std::pair g[8]; + int gn = 0; + bool known; + { + std::lock_guard wk(wb_pages_mu); + known = wb_inflight_in(c->pages[i], c->late_done, g, 8, &gn); + } + if (known) { + l.whole = false, l.n = (uint8_t)gn; + for (int k = 0; k < gn; k++) l.r[k][0] = g[k].first, l.r[k][1] = g[k].second; + } + } + std::lock_guard gk(late_gpu_mu); + late_gpu_pages.push_back(l); + st_late_gpu.fetch_add(1, std::memory_order_relaxed); + continue; + } if (lq) { // (RX_VK_LATE_QUEUE: its second copy left to the queue, once the write-back is done: the fix) lq_slots.push_back({i, c->pages[i]}); continue; @@ -5692,6 +5852,7 @@ struct WriteBack { Pool* pool; uint64_t lo, hi; // offsets in the pool bool event = false; // (an NVN event's word, written by a command buffer's signal: memory_bind_event_write) + uint64_t early_seg = 0; // ((Triforce, 11-26) RX_VK_EARLY_WB: a parallel replay segment's small write of pages the CPU reads back) }; std::vector writebacks; // (hookshot, 11-07) The counter reports the replay writes into guest memory on the CPU (vk_replay.cpp NOP_REPORT_COUNTER), by @@ -6383,7 +6544,7 @@ void memory_bind_event_write(bool on) { // none. RX_VK_RB_REFRESH_EACH=1: in every recording, as before namespace { std::unordered_map rb_pages; // (guest page -> mirror_epoch it was last read at) -std::atomic st_rb_refresh{0}, st_rb_held{0}; +std::atomic st_rb_refresh{0}, st_rb_held{0}, st_rb_skipped{0}; // (the open submission the recording this thread is making joined; 0: none: it opens one, or comes after one's end) thread_local uint64_t rb_joined = 0; // (the GPU write hazards of submission rb_hazards_epoch, by guest address, with their recording's place in the queue @@ -6402,6 +6563,20 @@ void rb_hazard_locked(uint64_t lo, uint64_t hi) { // (pools_mu held) rb_hazards.push_back({lo, hi, texture_segment()}); } } +void memory_note_event_word(uint64_t gpu) { + if (!late_events_on()) return; + static thread_local uint64_t last = 0; + if ((gpu >> 12) == last) return; + last = gpu >> 12; + uint64_t guest = gpu; + if (gpu >= (1ull << 40)) { // (as memory_note_gpu_write) + uint64_t avail = 0; + if (!host->gpu_ptr(gpu, &avail) || avail < 4) return; + guest = host->gpu_guest(gpu); + } + std::lock_guard lk(event_pages_mu); + if (event_pages.insert((uint32_t)(guest >> kPageShift)).second) event_pages_n.fetch_add(1, std::memory_order_relaxed); +} void memory_note_readback(uint64_t guest, uint64_t size) { static const bool off = getenv("RX_VK_NO_RB_REFRESH") != nullptr; if (off || !size || size > 0x4000) return; // (small results only: meters and counters) @@ -6434,6 +6609,103 @@ void memory_rb_segments_begin(uint64_t base, uint64_t n) { std::lock_guard lk(pools_mu); rb_segs = {mirror_epoch, base, n, 0}; } +// ((Triforce, 11-26) RX_VK_EARLY_WB=1 (off by default): the early write-back. A parallel replay segment's small writes (up to +// 16 KB) of pages the CPU reads back (rb_pages: the exposure meter, the camera blocks, counters) are copied back to guest +// memory at that segment's own end, not at the end of the whole submission, and the readback of them waits for that segment's +// number on the recordings' timeline (every segment signals one while the occlusion queries run). Measured at the owner's +// spot: the meter's writer sits in a segment ~7 recordings before the submission's end, which is what the game's readback +// waited for (~1.2-1.4 ms a frame). Such a range leaves the submission's own write-back: a copy at its end would put the GPU's +// sum back over the 0 the CPU stored after its early read (the exposure blow-out) +bool early_wb_on() { + static const bool v = getenv("RX_VK_EARLY_WB") && atoi(getenv("RX_VK_EARLY_WB")) != 0; + return v; +} +uint64_t early_wb_segment(uint64_t lo, uint64_t hi, bool event) { // (pools_mu held) the segment to write it back at, or 0 + if (!early_wb_on() || event || hi <= lo || hi - lo > 0x4000) return 0; + const uint64_t seg = texture_segment(); + if (rb_segs.epoch != mirror_epoch || seg < rb_segs.base || seg - rb_segs.base >= rb_segs.n) return 0; + for (uint64_t pg = lo >> kPageShift; pg <= (hi - 1) >> kPageShift; pg++) + if (rb_pages.count((uint32_t)pg)) return seg; + return 0; +} +struct EarlyWb { + uint64_t hi, value, seq; +}; +std::mutex early_mu; // (after pools_mu) +std::map early_wbs; // (guest lo -> the submission's value and the segment's number: early_mu) +std::map>> early_made; // (segment -> guest ranges copied back at its end: pools_mu) +std::atomic st_early_ranges{0}, st_early_waits{0}, st_early_dropped{0}; +/// (a segment's job, its thread, before its command buffer ends) its early write-backs, with the barriers around them +void memory_segment_early_wb(VkCommandBuffer cmd, uint64_t seg, bool allowed) { + if (!early_wb_on() || !allowed || !seg) return; + std::lock_guard lk(pools_mu); + bool any = false; + for (size_t i = 0; i < writebacks.size();) { + WriteBack& w = writebacks[i]; + if (w.early_seg != seg || !w.pool || w.pool->mstate != Pool::MIRROR_ON || !w.pool->mirror) { + i++; + continue; + } + if (!any) full_barrier(cmd, "barrier (early write-back)"), any = true; + Pool& p = *w.pool; + lazy_settle(p.lo + w.lo, p.lo + w.hi, wb_lazy::BY_GPU); + const VkBufferCopy r{w.lo, w.lo, w.hi - w.lo}; + vkCmdCopyBuffer(cmd, p.mirror, p.buffer, 1, &r); + shadow_forget(p, w.lo, w.hi - w.lo); + early_made[seg].push_back({p.lo + w.lo, p.lo + w.hi}); + st_early_ranges.fetch_add(1, std::memory_order_relaxed); + writebacks[i] = writebacks.back(); + writebacks.pop_back(); + } + if (any) full_barrier(cmd, "barrier (early write-back)"); +} +/// (the replay thread, the segment submitted with that number on the recordings' timeline, 0: not) its ranges noted +void memory_segment_early_submitted(uint64_t seg, uint64_t seq) { + if (!early_wb_on()) return; + std::lock_guard lk(pools_mu); + auto it = early_made.find(seg); + if (it == early_made.end()) return; + for (const auto& [lo, hi] : it->second) { + wb_pages_note(lo, hi, mem_rec_value); + std::lock_guard ek(early_mu); + if (seq) early_wbs[lo] = {hi, mem_rec_value, seq}; + else early_wbs.erase(lo); + } + early_made.erase(it); + if (early_made.size() > 4096) early_made.clear(); +} +/// (a later write-back of the same submission over an early range: the early one no longer says when its bytes are there) +void early_wb_overlap(uint64_t lo, uint64_t hi, uint64_t value) { + if (!early_wb_on()) return; + std::lock_guard ek(early_mu); + if (early_wbs.empty()) return; + auto it = early_wbs.upper_bound(lo); + if (it != early_wbs.begin()) --it; + while (it != early_wbs.end() && it->first < hi) { + if (it->second.hi > lo && it->second.value == value) { + it = early_wbs.erase(it); + st_early_dropped.fetch_add(1, std::memory_order_relaxed); + } else { + ++it; + } + } +} +/// (invalidate) the range written back early by the submission of value v alone: the recordings' number to wait for +bool memory_early_wb_seq(uint64_t guest, uint64_t size, uint64_t v, uint64_t* seq) { + if (!early_wb_on() || !size) return false; + std::lock_guard ek(early_mu); + auto it = early_wbs.upper_bound(guest); + if (it == early_wbs.begin()) return false; + --it; + if (it->first > guest || it->second.hi < guest + size || it->second.value != v) return false; + *seq = it->second.seq; + const int64_t n = st_early_waits.fetch_add(1, std::memory_order_relaxed) + 1; + if (n % 3000 == 0) + logf("vk: early write-backs (RX_VK_EARLY_WB): %lld ranges copied back at their segment's end, %lld readbacks waited for " + "their segment alone, %lld dropped (written again later in the submission)", (long long)st_early_ranges.load(), + (long long)n, (long long)st_early_dropped.load()); + return true; +} /// Records the refresh copies into the submission's upload command buffer; true when it recorded any bool memory_rb_refresh(VkCommandBuffer up) { std::lock_guard lk(pools_mu); @@ -6448,18 +6720,79 @@ bool memory_rb_refresh(VkCommandBuffer up) { ahead_made = ahead_made && k < 64 && (rb_segs.made & below) == below; if (k < 64) rb_segs.made |= 1ull << k; } - if (rb_pages.empty() || !up) return false; + if (!up) return false; + if (rb_pages.empty()) { + std::lock_guard gk(late_gpu_mu); + if (late_gpu_pages.empty()) return false; + } auto written_ahead = [&](uint64_t lo, uint64_t hi) { // (may be, by a recording ahead of this one in its submission) if (rb_hazards_epoch != mirror_epoch) return false; for (const RbHazard& h : rb_hazards) if (h.seg < seg && h.lo < hi && lo < h.hi) return true; return false; }; + // ((Triforce, 11-26) RX_VK_RB_REFRESH_WRITTEN (on; =0 off): only the pages this recording may write itself (its GPU write hazards): the + // refresh is for the GPU adding into what the CPU stored since the submit (the exposure meter's sums), and a recording that + // writes nothing there needs nothing newer than its capture. Every page every recording, ~1,250 copies and 6.4 MB a frame at the + // owner's spot (0.42 ms of GPU), most of them for recordings that never touch the meter) + // (on by default since 11-26: his spot 90.0-90.2 -> 91.9 fps, a four-area tour 90.8 -> 92.3, the same brightness steps and + // fewer cell blinks; =0: every page, as before) + static const bool written_only = !(getenv("RX_VK_RB_REFRESH_WRITTEN") && atoi(getenv("RX_VK_RB_REFRESH_WRITTEN")) == 0); + auto written_here = [&](uint64_t lo, uint64_t hi) { + if (rb_hazards_epoch != mirror_epoch) return false; + for (const RbHazard& h : rb_hazards) + if (h.seg == seg && h.lo < hi && lo < h.hi) return true; + return false; + }; std::map> by_pool; + { // ((Triforce, 11-26) RX_VK_LATE_GPU: this submission's take's late pages, from guest memory after the write-backs before) + std::vector lp; + { + std::lock_guard gk(late_gpu_mu); + lp.swap(late_gpu_pages); + } + bool barrier_made = false; + for (const LateGpuPage& l : lp) { + const uint64_t g = (uint64_t)l.page << kPageShift; + auto pit = imported.upper_bound(g); + if (pit == imported.begin()) continue; + --pit; + Pool& p = pit->second; + if (g < p.lo || g >= p.hi || !p.buffer) continue; + const uint64_t a = g - p.lo, n = std::min(g + 4096, p.hi) - g; + VkBufferCopy rs[8]; + uint32_t nr = 0; + if (l.whole) rs[nr++] = {a, l.off, n}; + else + for (int k = 0; k < l.n; k++) + if (l.r[k][0] < n) rs[nr++] = {a + l.r[k][0], l.off + l.r[k][0], std::min(l.r[k][1], n) - l.r[k][0]}; + if (!nr) continue; + if (late_gpu_from_mirror()) { // (=3: the mirror's words for the ranges in flight, what lands in guest memory) + if (!l.cap || p.mstate != Pool::MIRROR_ON || !p.mirror || l.whole) continue; + if (!barrier_made) full_barrier(up), barrier_made = true; + vkCmdCopyBuffer(up, p.mirror, l.cap, nr, rs); + continue; + } + if (l.cap) { // (the capture's slot: guest memory as it is after the write-backs before, as the CPU's fix copied it) + if (!barrier_made) full_barrier(up), barrier_made = true; + lazy_settle(g, g + n, wb_lazy::BY_GPU); + vkCmdCopyBuffer(up, p.buffer, l.cap, nr, rs); + } + if (p.mstate == Pool::MIRROR_ON && p.mirror) + for (uint32_t k = 0; k < nr; k++) by_pool[&p].push_back({rs[k].srcOffset, rs[k].srcOffset, rs[k].size}); + } + } for (auto it = rb_pages.begin(); it != rb_pages.end();) { if (it->second + 600 < mirror_epoch) { it = rb_pages.erase(it); continue; } // (not read for a while) const uint64_t g = (uint64_t)it->first << kPageShift; ++it; + if (written_only && !written_here(g, g + 4096)) { + st_rb_skipped++; + continue; + } + if (trace_range(g)) + logf("vk: trace refresh %#llx: recording %llu, done %llu | guest %08x", (unsigned long long)g, (unsigned long long)mem_rec_value, + (unsigned long long)vk_timeline_completed(), *(const uint32_t*)((const uint8_t*)host->guest_base() + g)); auto pit = imported.upper_bound(g); if (pit == imported.begin()) continue; --pit; @@ -6496,8 +6829,8 @@ bool memory_rb_refresh(VkCommandBuffer up) { } static std::atomic n{0}; if (++n % 3000 == 1) - logf("vk: readback pages refreshed from guest memory: %lld pages so far (%lld held: may be written ahead in their submission)", - (long long)st_rb_refresh.load(), (long long)st_rb_held.load()); + logf("vk: readback pages refreshed from guest memory: %lld pages so far (%lld held: may be written ahead in their submission; %lld not written by their recording, left: RX_VK_RB_REFRESH_WRITTEN)", + (long long)st_rb_refresh.load(), (long long)st_rb_held.load(), (long long)st_rb_skipped.load()); return true; } @@ -6783,6 +7116,10 @@ BufferRef gpu_buffer_bind(uint64_t gpu, uint64_t size, bool written) { guest = host->gpu_guest(gpu); } if (deferred_late_n.load(std::memory_order_relaxed)) late_deferred_bound(guest, size); // (Triforce: a page put off, bound now) + if (written && trace_on() && trace_range(guest & ~4095ull)) // ((Triforce, 11-26, diagnostics) the writer's binding + logf("vk: trace write bind %#llx +%#llx: recording %llu, segment %llu, recordings submitted %llu, at %.3f ms", (unsigned long long)guest, + (unsigned long long)size, (unsigned long long)mem_rec_value, (unsigned long long)texture_segment(), + (unsigned long long)vk_rec_seq_now(), (trace_now_ns() % 1000000000000ll) / 1e6); // (the same read, while that stamp still stands: the buffer and the offset are the ones found before. a miss // runs the lookup below, including a mirror sync, and remembers what it returned. a write is not remembered) auto remember = [&](BufferRef ref) { @@ -6972,7 +7309,7 @@ BufferRef gpu_buffer_bind(uint64_t gpu, uint64_t size, bool written) { "%lld KB; RX_VK_WB_EXCL_CLIP=0: copied)", (unsigned long long)(p->lo + off), (unsigned long long)(wb_end - off), (unsigned long long)dropped, (long long)(k + 1), (long long)(st_clipped_bytes.load(std::memory_order_relaxed) >> 10)); } else { - writebacks.push_back({p, off, wb_end, tl_event_write}); + writebacks.push_back({p, off, wb_end, tl_event_write, early_wb_segment(p->lo + off, p->lo + wb_end, tl_event_write)}); } } rb_hazard_locked(p->lo + off, p->lo + std::min(off + size, p->hi - p->lo)); // (memory_rb_refresh) @@ -9104,6 +9441,11 @@ void memory_end_submission(VkCommandBuffer cmd) { for (const auto& e : event_runs) if (r.dstOffset >= e.first && r.dstOffset + r.size <= e.second) { event_only = true; break; } if (event_only) { st_wb_event_runs++; continue; } + early_wb_overlap(p->lo + r.dstOffset, p->lo + r.dstOffset + r.size, mem_rec_value); + if (trace_on() && trace_range(p->lo + r.dstOffset)) + logf("vk: trace wb %#llx +%#llx: recording %llu, recordings submitted %llu, at %.3f ms", (unsigned long long)(p->lo + r.dstOffset), + (unsigned long long)r.size, (unsigned long long)mem_rec_value, (unsigned long long)vk_rec_seq_now(), + (trace_now_ns() % 1000000000000ll) / 1e6); wb_pages_note(p->lo + r.dstOffset, p->lo + r.dstOffset + r.size, mem_rec_value); } { // (hookshot) RX_VK_LOG_WRITEBACK=1: the pools written back the most, every 600 write-back submissions diff --git a/gpu/vk/vk_menu.cpp b/gpu/vk/vk_menu.cpp index 1f55bad..ada42ca 100644 --- a/gpu/vk/vk_menu.cpp +++ b/gpu/vk/vk_menu.cpp @@ -1937,7 +1937,7 @@ Row rows[] = { // (Triforce, 11-13: vk_temporal.cpp pre_wanted. Shown with DLSS or FSR: row_shown) {TAB_GRAPHICS, "Upscale before bloom", &opts.upscale_pre, 0, 1, 1, tx_onoff, "On: the upscaler works on the scene before the game's glow and tone mapping, which are then made at full size. " - "Applies after a restart.", nullptr, true, true}, + "Evil HD's ambient occlusion and light shafts are not drawn with this on. Applies after a restart.", nullptr, true, true}, {TAB_GRAPHICS, "Sharpness", &opts.sharpness, 0, 100, 10, tx_percent, "With DLSS, DLAA or AMD FSR as the Upscaler, the 3D before the HUD (FSR's own sharpening; AMD's RCAS for DLSS); with " "the game's own upscaler, the picture at the window. 0 is off. Too much shows halos around edges.", hn_sharpness}, @@ -6536,7 +6536,9 @@ void files_pictures_load() { for (int slot = 0; slot < 12; slot++) { // (the game looks for slot_00 to slot_11) if (known >= 0 && slot != known) continue; char path[save_file_rows::kPath + 32]; - snprintf(path, sizeof path, "%s%02d\\caption.sav", save_files.pictures[i], slot); + // (the folder's own separator: host/save_files.c writes the start of the path with '/' on Linux, where fopen + // takes no '\') + snprintf(path, sizeof path, "%s%02d%ccaption.sav", save_files.pictures[i], slot, strchr(save_files.pictures[i], '\\') ? '\\' : '/'); FILE* f = fopen(path, "rb"); if (!f) continue; std::string bytes(size_t(1) << 20, '\0'); // (a save's caption is some tens of kilobytes) diff --git a/gpu/vk/vk_mods.cpp b/gpu/vk/vk_mods.cpp index 3f3de77..47bf029 100644 --- a/gpu/vk/vk_mods.cpp +++ b/gpu/vk/vk_mods.cpp @@ -27,6 +27,22 @@ #undef min #undef max #include "vk_paths.h" +#else +// (Linux: the save files' pictures (JPEG, in each save's caption.sav) and the salesman's PNGs through stb_image (third_party, +// MIT/public domain; private to this file, as vk_texture.cpp's PNG-only copy is to that one). Windows uses WIC below) +#define STB_IMAGE_IMPLEMENTATION +#define STB_IMAGE_STATIC +#define STBI_NO_STDIO +#define STBI_NO_HDR +#define STBI_NO_LINEAR +#define STBI_ONLY_JPEG +#define STBI_ONLY_PNG +#define STBI_MAX_DIMENSIONS 16384 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" // (stb_image declares its GIF loader, left out here) +#include "../../third_party/stb_image/stb_image.h" +#pragma GCC diagnostic pop +#include #endif namespace mkwvk { @@ -1322,8 +1338,36 @@ bool decode_image(const std::string& bytes, int max_w, std::vector 0x7fffffff || max_w < 1) return false; + int iw = 0, ih = 0, comp = 0; + unsigned char* px = stbi_load_from_memory((const stbi_uc*)bytes.data(), (int)bytes.size(), &iw, &ih, &comp, 4); + if (!px) return false; + if (iw < 1 || ih < 1) { + stbi_image_free(px); + return false; + } + int tw = iw, th = ih; + if (tw > max_w) th = std::max(1, (int)((double)ih * max_w / iw)), tw = max_w; + rgba.resize((size_t)tw * th * 4); + if (tw == iw && th == ih) memcpy(rgba.data(), px, rgba.size()); + else + for (int y = 0; y < th; y++) { + const int y0 = (int)((int64_t)y * ih / th), y1 = std::max(y0 + 1, (int)((int64_t)(y + 1) * ih / th)); + for (int x = 0; x < tw; x++) { + const int x0 = (int)((int64_t)x * iw / tw), x1 = std::max(x0 + 1, (int)((int64_t)(x + 1) * iw / tw)); + unsigned sum[4] = {0, 0, 0, 0}; + for (int sy = y0; sy < y1; sy++) + for (int sx = x0; sx < x1; sx++) + for (int k = 0; k < 4; k++) sum[k] += px[((size_t)sy * iw + sx) * 4 + k]; + const unsigned n = (unsigned)((y1 - y0) * (x1 - x0)); + for (int k = 0; k < 4; k++) rgba[((size_t)y * tw + x) * 4 + k] = (unsigned char)((sum[k] + n / 2) / n); + } + } + stbi_image_free(px); + *w = tw, *h = th; + return true; #endif } diff --git a/gpu/vk/vk_renodx.cpp b/gpu/vk/vk_renodx.cpp index 1040204..7c77197 100644 --- a/gpu/vk/vk_renodx.cpp +++ b/gpu/vk/vk_renodx.cpp @@ -92,6 +92,7 @@ bool enabled() { // (Triforce, 11-13: the RenoDX HDR row as it was at the star return renodx_chosen(); } std::atomic replaced_modules{0}; // (modules of the game's that RenoDX's took the place of, this run) +std::atomic encoder_replaced{false}; // ((Triforce, 11-26) and of them its output encoder: the one that makes it HDR bool adapting() { return opts.rdx_tonemap == 1 && opts.rdx_midgray == 2; } // (PsychoV35's alone: RenoDRT, 2, reads none of it) /// (Triforce) The peak a tone mapper is given, in whites, when the encoder shows the picture as a display of gamma g would @@ -307,6 +308,8 @@ const std::vector* renodx_replacement(uint32_t crc) { }(); const auto it = table.find(crc); if (it != table.end()) replaced_modules.fetch_add(1, std::memory_order_relaxed); + for (const auto& s : RENODX_SHADERS) // ((Triforce, 11-26) its output encoder: what the half-minute line below asks after) + if (s.crc == crc && s.kind == 0) encoder_replaced.store(true, std::memory_order_relaxed); return it == table.end() ? nullptr : &it->second; } @@ -361,10 +364,12 @@ void renodx_present() { // named by the CRC-32 of the module this translator makes, so another translation of the same program (a later // change to the emitter, another card's fixes) silently leaves the game's own HDR running static std::atomic presents{0}; - if (enabled() && presents.fetch_add(1, std::memory_order_relaxed) == 1800 && !replaced_modules.load(std::memory_order_relaxed)) - logf("vk: RenoDX: on, and none of its four shaders has replaced one of the game's in 1800 presents: the game's own " - "picture runs. Either HDR is not Native on an HDR10 display (its shaders are the native HDR ones), or this " - "build names them by other checksums (scripts/renodx_shaders.py SHADERS: match them again)"); + // ((Triforce, 11-26) its encoder, not any one of the four: since v0.8.0 the fog alone matched on NVIDIA and hid this) + if (enabled() && presents.fetch_add(1, std::memory_order_relaxed) == 1800 && !encoder_replaced.load(std::memory_order_relaxed)) + logf("vk: RenoDX: on, and its output encoder has not replaced the game's in 1800 presents (%d of its shaders did): " + "the game's own HDR picture runs. Either HDR is not Native on an HDR10 display (its shaders are the native HDR " + "ones), or this build names them by other checksums (scripts/renodx_shaders.py SHADERS and ALSO: match them " + "again)", replaced_modules.load(std::memory_order_relaxed)); } std::lock_guard lk(mu); if (!st.ok) return; diff --git a/gpu/vk/vk_replay.cpp b/gpu/vk/vk_replay.cpp index e9ff28d..0b3a0bb 100644 --- a/gpu/vk/vk_replay.cpp +++ b/gpu/vk/vk_replay.cpp @@ -653,8 +653,31 @@ void queue_flush_poll() { queue_flush_locked(); } } // namespace +// ((Triforce, 11-26) a thread's waits for the GPU (wait_value, vk_timeline_wait, wait_recorded), summed for the slow submit's and +// present's line ("GPU waits"), and each one of 100 ms or more logged with where it was and how far the GPU had come (40 lines): +// the owner's 877 ms submit with 1.3 ms of named work) +thread_local int64_t tl_gpu_wait_ns = 0, tl_gpu_waits = 0; +struct GpuWaitTimer { + const char* where; + uint64_t v; + std::chrono::steady_clock::time_point t0 = std::chrono::steady_clock::now(); + GpuWaitTimer(const char* w, uint64_t value) : where(w), v(value) {} + ~GpuWaitTimer() { + const int64_t ns = std::chrono::duration_cast(std::chrono::steady_clock::now() - t0).count(); + tl_gpu_wait_ns += ns, tl_gpu_waits++; + static std::atomic logged{0}; + if (ns >= 100000000 && logged.fetch_add(1) < 40) + logf("vk: a long GPU wait: %.1f ms in %s for %llu (done now %llu)", ns / 1e6, where, (unsigned long long)v, + (unsigned long long)completed()); + } +}; +template auto gpu_timed(const char* where, F f) { // ((Triforce, 11-26) a present-side wait, timed as GpuWaitTimer's) + GpuWaitTimer t(where, 0); + return f(); +} namespace { void wait_value(uint64_t v) { + GpuWaitTimer gwt("wait_value", v); queue_flush_for(FR_VALUE); VkSemaphoreWaitInfo wi{VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO}; wi.semaphoreCount = 1; @@ -669,6 +692,7 @@ bool wait_recorded(uint64_t f, uint64_t timeout_ns, int* ok); /// RX_VK_RB_SETTLE=1 a readback lets the stopped work whose waits are met go on before it looks its write-back up. /// In-run A/B (lab_ab.h): the knobs reclast, tlrec, rbsettle turn each on for their phases bool rb_fix(int which) { + // ((Triforce, 11-26) RX_VK_REC_LAST off by default again, with RX_VK_LATE_GPU (vk_memory.cpp late_gpu_mode): see there) static const bool env[3] = {getenv("RX_VK_REC_LAST") && atoi(getenv("RX_VK_REC_LAST")) != 0, getenv("RX_VK_TL_REC") && atoi(getenv("RX_VK_TL_REC")) != 0, getenv("RX_VK_RB_SETTLE") && atoi(getenv("RX_VK_RB_SETTLE")) != 0}; @@ -677,6 +701,13 @@ bool rb_fix(int which) { } } // namespace uint64_t vk_timeline_completed() { return timeline ? completed() : 0; } +// ((Triforce, 11-26, diagnostics) the recordings' timeline: submitted so far, and done on the GPU) +uint64_t vk_rec_seq_now() { return rec_seq; } +uint64_t vk_rec_done_now() { + uint64_t v = 0; + if (rec_timeline) vkGetSemaphoreCounterValue(dev.device, rec_timeline, &v); + return v; +} /// ((Triforce, wp20, wb_rec_wait.h) RX_VK_WB_WAIT_REC=1: a wait for a write-back ends once its writer's recording is done /// ((Triforce, 11-22, the performance audit's SYNC-122, after Source B's) a mode: 2 is the check, which ends no wait earlier /// and has a readback's fallback count what 1 would not have waited (readback_fallback_wait); any other text is off) @@ -720,6 +751,7 @@ static void wait_lost(const char* what, uint64_t v) { static thread_local int wb_wait_who = ::mkwvk::wb_rec_wait::kTake; // ((Triforce, 11-22, SYNC-122) the wait's caller: vk_timeline_wait_from) int64_t vk_timeline_wait_held_last() { return wb_held_last_ns; } void vk_timeline_wait(uint64_t v) { // (at most 250 ms: a submission held back behind the caller's thread goes on without it) + GpuWaitTimer gwt("vk_timeline_wait", v); wb_held_last_ns = 0; if (!timeline) return; const uint64_t done0 = completed(); @@ -2840,6 +2872,7 @@ void replay(VkCommandBuffer& cmd, NvnState& s, const uint8_t* p, const uint8_t* case NOP_SIGNAL_EVENT: { if (!worker) { // (in stream order: the replay thread's pass) const auto e = payload(a, avail); + memory_note_event_word(e.gpu); // ((Triforce, 11-26) RX_VK_LATE_EVENTS: the pages that hold GPU-signalled event words) ev_cpu_apply(); auto it = ev_values.find(e.gpu); uint32_t old = it != ev_values.end() ? it->second : 0; @@ -4488,6 +4521,7 @@ const uint8_t* replay_handle_early(VkCommandBuffer& cmd, const uint8_t* h, bool texture_segment_worker(-1); gpu_time_end(*j->r, j->uploads); occ_copy_slot(*j->r); // ((Triforce) RX_VK_OCC_COPY) + memory_segment_early_wb(c, j->order, occ_live && rec_timeline); // ((Triforce, 11-26) RX_VK_EARLY_WB) host_read_barrier(c); vkEndCommandBuffer(j->r->upload); vkEndCommandBuffer(j->r->cmd); @@ -4661,6 +4695,7 @@ const uint8_t* replay_handle_early(VkCommandBuffer& cmd, const uint8_t* h, bool par_st.submit_ns += par_ns(t_sub); if (j->index == 0) par_st.first_ns += par_ns(t_dry0); j->r->submitted = res == VK_SUCCESS; + memory_segment_early_submitted(j->order, j->r->submitted ? occ_seq : 0); // ((Triforce, 11-26) RX_VK_EARLY_WB) if (res != VK_SUCCESS) logf("vk: segment submit %llu failed (%d)", (unsigned long long)j->r->value, (int)res); if (res == VK_ERROR_DEVICE_LOST) device_lost(); } @@ -4963,6 +4998,7 @@ const uint8_t* replay_handle(VkCommandBuffer& cmd, const uint8_t* h, bool may_st texture_segment_worker(-1); gpu_time_end(*j->r, j->uploads); occ_copy_slot(*j->r); // ((Triforce) RX_VK_OCC_COPY) + memory_segment_early_wb(c, j->order, occ_live && rec_timeline); // ((Triforce, 11-26) RX_VK_EARLY_WB) host_read_barrier(c); vkEndCommandBuffer(j->r->upload); vkEndCommandBuffer(j->r->cmd); @@ -5068,6 +5104,7 @@ const uint8_t* replay_handle(VkCommandBuffer& cmd, const uint8_t* h, bool may_st par_st.submit_ns += par_ns(t_sub); if (j->index == 0) par_st.first_ns += par_ns(t_dry0); // (Triforce: the GPU's first work of this command buffer) j->r->submitted = res == VK_SUCCESS; + memory_segment_early_submitted(j->order, j->r->submitted ? occ_seq : 0); // ((Triforce, 11-26) RX_VK_EARLY_WB) if (res != VK_SUCCESS) logf("vk: segment submit %llu failed (%d)", (unsigned long long)j->r->value, (int)res); if (res == VK_ERROR_DEVICE_LOST) device_lost(); } @@ -5206,6 +5243,7 @@ struct SlowWatch { int64_t prof0[PROF_COUNT]; int64_t ms0[4]; // (hookshot: memory sync's parts and the lock wait, at the start) const char* what; + int64_t gw0 = tl_gpu_wait_ns, gwn0 = tl_gpu_waits; // ((Triforce, 11-26) this thread's GPU waits, at the start) explicit SlowWatch(const char* w) : what(w) { std::memcpy(prof0, prof_ns, sizeof prof0); for (int i = 0; i < 3; i++) ms0[i] = memsync_part_ns[i].load(std::memory_order_relaxed); @@ -5234,6 +5272,10 @@ struct SlowWatch { if (a + b + c >= 1.0 || w >= 1.0) k += snprintf(line + k, sizeof line - k, " [memory sync: maps %.1f (lock waits %.1f), capture %.1f, collect %.1f]", a, w, b, c); } + { // ((Triforce, 11-26) this thread's GPU waits in it: GpuWaitTimer) + const double g = (tl_gpu_wait_ns - gw0) / 1e6; + if (g >= 1.0) k += snprintf(line + k, sizeof line - k, " [GPU waits %.1f in %lld]", g, (long long)(tl_gpu_waits - gwn0)); + } logf("%s", line); } }; @@ -6102,6 +6144,7 @@ uint64_t get_replayed() { /// timeline: true when that recording is known (the result in *ok), false when it is not (f not finished yet) bool wait_recorded(uint64_t f, uint64_t timeout_ns, int* ok) { if (!rec_timeline || per_queue_fences_off()) return false; + GpuWaitTimer gwt(timeout_ns ? "wait_recorded" : "wait_recorded (poll)", f); uint64_t seq = 0; { std::lock_guard mk(rec_map_mu); @@ -6596,6 +6639,8 @@ void invalidate(uint64_t gpu, uint64_t size) { const auto w0 = std::chrono::steady_clock::now(); bool w = false; const uint64_t f0 = fence(), c0 = completed(); + static const bool trace_rb = getenv("RX_VK_LOG_LATE_RANGE") != nullptr; // ((Triforce, 11-26, diagnostics) the trace's) + const uint64_t rd0 = trace_rb ? vk_rec_done_now() : 0, rs0 = rec_seq; const bool behind0 = replay_behind(); static const bool no_catchup = getenv("RX_VK_READBACK_NO_CATCHUP") != nullptr; // (A/B: recorded work only) // (hookshot) not on the submitting thread's replay (the default): there what is handed over is recorded at once, and @@ -6623,7 +6668,17 @@ void invalidate(uint64_t gpu, uint64_t size) { else if (behind0 && !no_catchup && !async_on() && rb_fix(2)) sync_settle_at(settle_gate::kReadback), w = true; const auto w1 = std::chrono::steady_clock::now(); const uint64_t v = memory_writeback_value(host->gpu_guest(gpu), size, nullptr); - if (!is_late && v > completed()) { + uint64_t early_seq = 0; // ((Triforce, 11-26) RX_VK_EARLY_WB: written back at its segment's end: that segment alone) + if (!is_late && v > completed() && rec_timeline && memory_early_wb_seq(host->gpu_guest(gpu), size, v, &early_seq)) { + uint64_t rd = 0; + if (vkGetSemaphoreCounterValue(dev.device, rec_timeline, &rd) != VK_SUCCESS || rd < early_seq) { + queue_flush_for(FR_WAIT); + VkSemaphoreWaitInfo wi{VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO}; + wi.semaphoreCount = 1, wi.pSemaphores = &rec_timeline, wi.pValues = &early_seq; + vkWaitSemaphores(dev.device, &wi, UINT64_MAX); + w = true; + } + } else if (!is_late && v > completed()) { int ok = 0; if (!(unforced && wait_recorded(v, UINT64_MAX, &ok))) { if (unforced && !async_on() && replay_behind()) wait_queue_empty(); // (not recorded whole: as before) @@ -6638,6 +6693,20 @@ void invalidate(uint64_t gpu, uint64_t size) { } w = true; } + { // ((Triforce, 11-26, diagnostics) RX_VK_LOG_LATE_RANGE: the traced range's readbacks after their wait + static const uint64_t lo = getenv("RX_VK_LOG_LATE_RANGE") ? strtoull(getenv("RX_VK_LOG_LATE_RANGE"), nullptr, 16) : 0; + static std::atomic tn{0}; + static const uint64_t from = getenv("RX_VK_LOG_TRACE_FROM") ? strtoull(getenv("RX_VK_LOG_TRACE_FROM"), nullptr, 10) : 0; + if (lo && gpu >= lo && gpu < lo + 0x1000 && completed() >= from && tn.fetch_add(1) < 600) { + uint32_t w0w = 0; + host->gpu_read(gpu, &w0w, 4); + const int64_t tn = std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()).count(); + logf("vk: trace readback %#llx: recordings done %llu of %llu, fence %llu, done %llu before, %llu after, write-back %llu, waited %d (%.3f ms), at %.3f ms | %08x", + (unsigned long long)gpu, (unsigned long long)rd0, (unsigned long long)rs0, (unsigned long long)f0, (unsigned long long)c0, (unsigned long long)completed(), + (unsigned long long)v, (int)w, std::chrono::duration(std::chrono::steady_clock::now() - w0).count(), + (tn % 1000000000000ll) / 1e6, w0w); + } + } if (w) { waited++; const int64_t d = std::chrono::duration_cast(std::chrono::steady_clock::now() - w0).count(); @@ -6720,13 +6789,43 @@ void invalidate(uint64_t gpu, uint64_t size) { // (decided by the live textures' storage, not by what the replay has listed: a region guessed to hold buffers // only, after probes that found no texture, left MKW's Grand Prix waiting at its map for a texture's texels) static const bool always = getenv("RX_VK_INVALIDATE_WAIT") != nullptr; + // ((Triforce, 11-26) RX_VK_INVALIDATE_WAIT_SIZES=: the catch-up below for buffer ranges of those sizes too, as + // RX_VK_INVALIDATE_WAIT gives every range; RX_VK_LOG_INVALIDATE_SIZES=1: the sizes of the buffer ranges that would have caught + // up, counted and logged every 3000) + static const std::vector wait_sizes = [] { + std::vector v; + if (const char* e = getenv("RX_VK_INVALIDATE_WAIT_SIZES")) + for (const char* q = e; *q;) { + char* end = nullptr; + const uint64_t x = strtoull(q, &end, 16); + if (end == q) break; + v.push_back(x); + q = *end == ',' ? end + 1 : end; + } + return v; + }(); + static const bool log_sizes = getenv("RX_VK_LOG_INVALIDATE_SIZES") != nullptr; if (!size) return; // (hookshot) and on the submitting thread's replay, the catch-up lets on what may go without forcing anything past its wait // (once the exposure readback above no longer did, this one forced OoT's presentation work on, every frame or two) const bool unforced = !async_on() && sync_waits_on() && !per_queue_fences_off(); if (!texture_gpu_written_in(gpu, size)) { if (!replay_behind()) return; - if (!always && !tex_pages_any(gpu, size)) return; // (no texture's storage there: buffers only) + const bool sized = !wait_sizes.empty() && std::find(wait_sizes.begin(), wait_sizes.end(), size) != wait_sizes.end(); + if (log_sizes && !tex_pages_any(gpu, size)) { + static std::mutex sm; + static std::map by; + static int64_t n; + std::lock_guard lk(sm); + by[size]++; + if (++n % 3000 == 0) { + std::string line; + for (const auto& [sz, k] : by) line += " " + std::to_string(k) + "x" + std::to_string(sz); + logf("vk: invalidates of buffer ranges with the replay behind, by size (3000):%s", line.c_str()); + by.clear(); + } + } + if (!always && !sized && !tex_pages_any(gpu, size)) return; // (no texture's storage there: buffers only) // (Triforce: RX_VK_TEX_EXACT=1, the lab: none in these bytes, no wait: see tex_exact. NOT the default: the wait is the // one that orders the exposure meter. Without it the Market flickered at once, 4,416 cell blinks in 6,732 frames against // 0, for 70.3 fps against 67.6-68.0: the game reads each frame's sums whole, after that frame's replay and GPU work) @@ -9150,7 +9249,7 @@ VkResult image_free(uint64_t timeout_ns) { // ((Triforce, 11-23) the image back from the compositor at its refresh: pacing, not the GPU's work, so not in the host's waits // for the GPU (gpu_wait_kinds.h) that the dynamic resolution's clock reads, ts_dyn_present) const ::gpu_wait_kinds::Exclude compositor; - VkResult r = vkWaitForFences(dev.device, 1, &acquire_fence_now, VK_TRUE, timeout_ns); + VkResult r = gpu_timed("the acquire's fence", [&] { return vkWaitForFences(dev.device, 1, &acquire_fence_now, VK_TRUE, timeout_ns); }); if (r == VK_SUCCESS) r = vkResetFences(dev.device, 1, &acquire_fence_now); return r; } @@ -9294,7 +9393,7 @@ void present_image(VkImage src, uint32_t sw, uint32_t sh, const int crop[4], VkI Frame& f = frames[frame_index]; const int log_slot = frame_index; frame_index = (frame_index + 1) % 3; - if (vkWaitForFences(dev.device, 1, &f.done, VK_TRUE, UINT64_MAX) == VK_ERROR_DEVICE_LOST) device_lost(); + if (gpu_timed("a frame slot's fence", [&] { return vkWaitForFences(dev.device, 1, &f.done, VK_TRUE, UINT64_MAX); }) == VK_ERROR_DEVICE_LOST) device_lost(); framelog_collect(log_slot); uint32_t index = 0; // ((Triforce) RX_VK_ACQUIRE_FENCE: an image held from a swapchain made again since is let go; one still held is looked at @@ -9318,7 +9417,7 @@ void present_image(VkImage src, uint32_t sw, uint32_t sh, const int crop[4], VkI #endif const VkFence fence = acquire_fence_on() && !dlssg::active() ? acquire_fence() : VK_NULL_HANDLE; fenced = fence != VK_NULL_HANDLE; - res = vkAcquireNextImageKHR(dev.device, dev.swapchain, acquire_timeout, fenced ? VK_NULL_HANDLE : f.acquired, fence, &index); + res = gpu_timed("vkAcquireNextImageKHR", [&] { return vkAcquireNextImageKHR(dev.device, dev.swapchain, acquire_timeout, fenced ? VK_NULL_HANDLE : f.acquired, fence, &index); }); if (res == VK_ERROR_DEVICE_LOST) device_lost(); #ifndef _WIN32 if (res == VK_TIMEOUT || res == VK_NOT_READY) { @@ -9602,10 +9701,10 @@ static void present_out(const PresentOut& o, std::unique_lock& qk, b if (dev.present_queue) { if (qk.owns_lock()) qk.unlock(); std::lock_guard pq(dev.present_queue_mu); - res = vkQueuePresentKHR(dev.present_queue, &pi); + res = gpu_timed("vkQueuePresentKHR", [&] { return vkQueuePresentKHR(dev.present_queue, &pi); }); } else { if (!qk.owns_lock()) qk.lock(); - res = vkQueuePresentKHR(dev.queue, &pi); + res = gpu_timed("vkQueuePresentKHR", [&] { return vkQueuePresentKHR(dev.queue, &pi); }); } if (on_thread) present_out_res = res; // ((Triforce) the present thread's acquire ahead: after a present made as it is) if (vk_ft_on()) vk_ft("qpresent %.3f ms", std::chrono::duration(std::chrono::steady_clock::now() - ft_qp0).count()); diff --git a/gpu/vk/vk_vma.cpp b/gpu/vk/vk_vma.cpp index 0be964a..e54288a 100644 --- a/gpu/vk/vk_vma.cpp +++ b/gpu/vk/vk_vma.cpp @@ -712,8 +712,25 @@ static bool buffer_budget_on() { }(); return on; } +// ((Triforce, 11-26, diagnostics) RX_VK_LOG_HOST_ALLOCS=1: each host buffer of 1 MB or more made, with its caller (the map +// file names it): who holds the allocator's blocks in system memory (1.1 GB at the owner's spot). 2000 lines at most +// (the module's base: __ImageBase is the Windows linker's; on Linux the caller's address is logged as it is) +#ifdef _WIN32 +extern "C" char __ImageBase; +static const char* host_alloc_base() { return &__ImageBase; } +#else +static const char* host_alloc_base() { return nullptr; } +#endif +static void host_alloc_note(const char* kind, uint64_t size, VkBufferUsageFlags usage, const void* caller) { + static const bool on = getenv("RX_VK_LOG_HOST_ALLOCS") != nullptr; + static std::atomic n{0}; + if (on && size >= (1u << 20) && n.fetch_add(1) < 2000) + logf("vk: host alloc %s %.1f MB usage %#x caller triforce_vk+%llx", kind, size / 1048576.0, (unsigned)usage, + (unsigned long long)((const char*)caller - host_alloc_base())); +} bool create_buffer(uint64_t size, VkBufferUsageFlags usage, bool host_visible, VkBuffer& buffer, VmaAllocation& allocation, void** mapped, bool dedicated) { + if (host_visible) host_alloc_note("visible", size, usage, __builtin_return_address(0)); VkBufferCreateInfo bi{VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO}; bi.size = size; bi.usage = usage; @@ -748,6 +765,7 @@ bool create_buffer(uint64_t size, VkBufferUsageFlags usage, bool host_visible, V /// threads copy pages into it, the replay reads texture pages out of it and the GPU copies the rest from it) bool create_buffer_cached(uint64_t size, VkBufferUsageFlags usage, VkBuffer& buffer, VmaAllocation& allocation, void** mapped, bool dedicated) { + host_alloc_note("cached", size, usage, __builtin_return_address(0)); VkBufferCreateInfo bi{VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO}; bi.size = size; bi.usage = usage; diff --git a/host/evil_hd.h b/host/evil_hd.h index 9cdcb59..89bbc4b 100644 --- a/host/evil_hd.h +++ b/host/evil_hd.h @@ -49,8 +49,13 @@ static const float evil_hd_foliage_game[EVIL_HD_FOLIAGE_COUNT] = {40.0f, 60.0f, and 105 m (3x) and were steady at 70 and 75 m; the low trees' shoot leaves (the Lost Woods' leaves overhead) flickered at 120 m and were steady at 30 and 70 m. The game's own areas set them no farther than 75 m (Hyrule Castle's ornaments) and 70 m (Zora's Domain's shoot leaves): the foliage system seems to have room for about that many of them. The other six - showed no flicker at 4x and keep the whole factor. 0: no bound */ -static const float evil_hd_foliage_most[EVIL_HD_FOLIAGE_COUNT] = {0.0f, 0.0f, 75.0f, 70.0f, 0.0f, 0.0f, 0.0f, 0.0f}; + showed no flicker at 4x and keep the whole factor. 0: no bound + (11-26, measured on child Kokiri Forest, KokiriForest_Child, by the Lost Woods entrance) The undergrowth too: its low, + uncuttable ground cover popped in and out on camera turns at 4x, 3x, 2.5x and 2.25x and was steady at 2x (80 and 120 m). + With one factor per distance: 80/120 m steady, 80/135 m steady, 90/120 m borderline, 90/135 m, 80/180 m, 160/120 m and + 80/240 m popped. The two kinds seem to share one room (more of one leaves less for the other), so both are kept to the + steady pair, 80 and 120 m: twice the game's. */ +static const float evil_hd_foliage_most[EVIL_HD_FOLIAGE_COUNT] = {80.0f, 120.0f, 75.0f, 70.0f, 0.0f, 0.0f, 0.0f, 0.0f}; /* One distance at a factor: the game's times it, kept to its most */ static inline float evil_hd_foliage_one(int i, float factor) { const float v = factor == 1.0f ? evil_hd_foliage_game[i] : evil_hd_foliage_game[i] * factor; @@ -97,7 +102,7 @@ static inline void evil_hd_foliage(float factor, float out[EVIL_HD_FOLIAGE_COUNT /* Whether the eight floats at the defaults' place are a version of them this rule knows: the game's own, or the game's times a factor of 1 to EVIL_HD_DIST_MOST (what an earlier write of this left). Another game version's bytes: left alone */ static inline int evil_hd_foliage_known(const float have[EVIL_HD_FOLIAGE_COUNT]) { - const float f = have[0] / evil_hd_foliage_game[0]; + const float f = have[5] / evil_hd_foliage_game[5]; /* (the low trees' distance: no most, so it carries the factor) */ if (!(f >= 1.0f && f <= EVIL_HD_DIST_MOST)) return 0; for (int i = 0; i < EVIL_HD_FOLIAGE_COUNT; i++) { const float want = evil_hd_foliage_one(i, f), d = have[i] - want; diff --git a/host/hos.h b/host/hos.h index 3a666fc..bdc300a 100644 --- a/host/hos.h +++ b/host/hos.h @@ -157,6 +157,11 @@ uint64_t hos_thread_mask(HosThread *t); int hos_thread_priority(HosThread *t, int set, int value); int hos_thread_core(HosThread *t); int hos_cores(void); +/* ((Triforce) ProjectReLink's) MXCSR's FTZ and DAZ follow the guest's FPCR.FZ once a lift with A64_NATIVE_FP asked + (hos_fpcr_follow, from its constructor): after its MSR FPCR (hos_fpcr_sync) and at a thread's and a fiber's start */ +void hos_fpcr_follow(void); +void hos_fpcr_sync(Ctx *c); +void hos_fpcr_start(const Ctx *c); /* virtual cores (hos_thread.c, HOS_VCORES=1): a guest thread gives its core up for a block (hos_vcore_away: 1 if it held one, or ran without one since an escape) and takes one again after it (hos_vcore_back); checkpoints hand it to a better waiter that asked */ diff --git a/host/hos_main.c b/host/hos_main.c index 45d5103..4d6382c 100644 --- a/host/hos_main.c +++ b/host/hos_main.c @@ -2563,6 +2563,36 @@ static void memory_notice(void) { ram = ((unsigned long long)si.totalram * si.mem_unit) >> 20, swap = ((unsigned long long)si.totalswap * si.mem_unit) >> 20; #else return; +#endif +#ifdef _WIN32 + /* ((Triforce, 11-26) the last session reached Windows' commit limit (mkw_glue.c hos_commit_limit_mark): said now, once, + before play, with this PC's RAM and page file. Its marker is removed when said (a lab run, headless, leaves it) */ + { + char mark[MAX_PATH]; + const DWORD len = hos_game_path_a(mark, MAX_PATH); + char *slash = len ? strrchr(mark, '\\') : NULL; + if (slash) { + snprintf(slash + 1, (size_t)(mark + MAX_PATH - slash - 1), "triforce_commit_limit.txt"); + FILE *f = fopen(mark, "r"); + if (f) { + fclose(f); + hos_log("boot: the last session reached Windows' commit limit (%llu MB of memory, %llu MB of page file): said " + "once now (%s)", ram, swap, mark); + if (!getenv("HOS_HEADLESS")) { + char said[900]; + snprintf(said, sizeof said, + "The last time Triforce ran, Windows ran out of memory for it: this PC's RAM (%.1f GB) and page file " + "(%.1f GB) were full. That is what closed or froze the game.\n\nTo fix it, let Windows size the page " + "file: search \"Adjust the appearance and performance of Windows\", Advanced tab, Virtual memory: " + "Change, tick \"Automatically manage paging file size for all drives\", OK, then restart the PC. " + "Closing other programs while playing helps too.", + ram / 1024.0, swap / 1024.0); + MessageBoxA(NULL, said, "Triforce: out of memory last time", MB_OK | MB_ICONWARNING); + remove(mark); + } + } + } + } #endif char text[512]; if (!memory_notice_text(ram, swap, text, sizeof text)) { diff --git a/host/hos_sdl.c b/host/hos_sdl.c index ef356ea..db15251 100644 --- a/host/hos_sdl.c +++ b/host/hos_sdl.c @@ -1189,6 +1189,12 @@ static void pad_headphones_forget(void *pad) { /* (the pad closed: its handle if (hp_dev) hos_sdl_hid_close(hp_dev); hp_dev = NULL, hp_pad = NULL, hp_failed = 0, hp_last = -2; } +/* ((Triforce, 11-26) the reader let go while nothing needs the jack (host/pad_speaker.c headphones): its second handle + closed. A report of 11-26 had a DualSense drop seconds after every connection since v0.8.0, with the speaker rows off */ +void hos_sdl_pad_headphones_release(void) { + if (hp_dev) hos_sdl_hid_close(hp_dev); + hp_dev = NULL, hp_pad = NULL, hp_failed = 0, hp_last = -2; +} int hos_sdl_pad_headphones(void *pad) { vib_calls_look(); if (!vib_calls.HidReadTimeout || !vib_calls.HidOpenPath || !vib_calls.HidClose || !pad) return -1; @@ -1209,9 +1215,10 @@ int hos_sdl_pad_headphones(void *pad) { int got = 0; for (int i = 0; i < 256; i++) { /* (up to a second of reports queued: the newest counts) */ const int n = ((int (*)(void *, unsigned char *, size_t, int))vib_calls.HidReadTimeout)(hp_dev, report, sizeof report, 0); - if (n < 0) { + if (n < 0) { /* ((Triforce, 11-26) and not opened again each second: once a pad's life, as a failed open) */ hos_sdl_hid_close(hp_dev); - hp_dev = NULL; + hp_dev = NULL, hp_failed = 1; + hos_log("sdl: the DualSense's input report stopped reading beside SDL's: its headphones are not seen"); return -1; } if (n == 0) break; diff --git a/host/hos_sdl.h b/host/hos_sdl.h index 3cfee4e..ee04d74 100644 --- a/host/hos_sdl.h +++ b/host/hos_sdl.h @@ -134,3 +134,4 @@ void hos_sdl_hid_close(void *hid); when it cannot say) */ int hos_sdl_pad_audio_endpoint(void *pad); int hos_sdl_pad_headphones(void *pad); +void hos_sdl_pad_headphones_release(void); /* ((Triforce, 11-26) its second handle closed: nothing needs the jack */ diff --git a/host/hos_thread.c b/host/hos_thread.c index 9f52807..0933bba 100644 --- a/host/hos_thread.c +++ b/host/hos_thread.c @@ -16,6 +16,7 @@ #include #include #define WIN32_LEAN_AND_MEAN +#include /* ((Triforce) _mm_getcsr / _mm_setcsr: hos_fpcr_sync) */ #include #ifndef CREATE_WAITABLE_TIMER_HIGH_RESOLUTION /* (older Windows SDKs lack it: Windows 10 1803 and later take it) */ #define CREATE_WAITABLE_TIMER_HIGH_RESOLUTION 0x00000002 @@ -615,14 +616,52 @@ Ctx *hos_boot_main_thread(uint64_t stack_size) { cur = t; track(t); hos_vcore_back(); /* (virtual cores: before any guest code) */ + hos_fpcr_start(&t->ctx); return &t->ctx; } +/* (Triforce, 11-26: ProjectReLink's, pixl27) The host's MXCSR follows the guest's FPCR.FZ: results flushed to zero (FTZ) and + subnormal operands read as zeros (DAZ), which is what Arm's flush-to-zero mode does. With the lift option A64_NATIVE_FP + (nx2/nativefp.py) the hot functions' floating point runs on the host's own instructions, and those flush as the guest + expects only with both bits set; the exact helpers keep their values under them (with FZ they flush what they compute + themselves). Such a lift's constructor calls hos_fpcr_follow() before main, and its code calls hos_fpcr_sync() after every + MSR FPCR; the host syncs again at a thread's and a fiber's start (MXCSR is a thread's, and a fiber's with + FIBER_FLAG_FLOAT_SWITCH). A lift without the option never asks: MXCSR is left alone, as before. HOS_FPCR_SYNC=0: left + alone in any build (then a native lift's FZ is the host's default, no flush: a measurement switch only). */ +static volatile LONG fpcr_follow; +static int fpcr_sync_on(void) { + static int on = -1; + if (on < 0) { + const char *e = getenv("HOS_FPCR_SYNC"); + on = !(e && e[0] == '0'); + } + return on; +} +static void fpcr_apply(const Ctx *c) { +#if defined(__x86_64__) || defined(_M_X64) + const unsigned want = ((uint32_t)c->fpcr & (1u << 24)) ? 0x8040u : 0u; + const unsigned now = _mm_getcsr(); + if ((now & 0x8040u) != want) _mm_setcsr((now & ~0x8040u) | want); +#else + (void)c; +#endif +} +void hos_fpcr_follow(void) { + if (fpcr_sync_on()) InterlockedExchange(&fpcr_follow, 1); +} +void hos_fpcr_sync(Ctx *c) { + if (fpcr_follow) fpcr_apply(c); +} +void hos_fpcr_start(const Ctx *c) { + if (fpcr_follow) fpcr_apply(c); +} + static DWORD WINAPI thread_main(void *p) { HosThread *t = (HosThread *)p; hos_stack_guarantee(); cur = t; Ctx *c = &t->ctx; + hos_fpcr_start(c); c->x[0] = t->arg; c->x[30] = 0; c->x[31] = (t->stack + t->stack_size) & ~15ULL; @@ -1639,6 +1678,7 @@ static void WINAPI fiber_main(void *p) { c->x[0] = f->arg; c->x[30] = 0; c->x[31] = (f->stack + f->size) & ~15ULL; + hos_fpcr_start(c); /* (a new fiber has the default MXCSR and the FPCR of whoever started it) */ a64_icall(c, f->fn); /* FiberType* (*)(void*) */ const uint64_t next = c->x[0]; f->done = 1; diff --git a/host/hos_update.c b/host/hos_update.c index 258d155..88e9ea7 100644 --- a/host/hos_update.c +++ b/host/hos_update.c @@ -126,6 +126,18 @@ void hos_update_check(void) { char have[128], builder[MAX_PATH * 3], skipped[128] = "", tag[128]; _snwprintf(file, MAX_PATH + 64, L"%ls\\triforce_version.txt", dir); if (!read_value(file, "version", have, sizeof have) || !safe_tag(have)) return; + { /* ((Triforce, 11-26, a player's report: "the launcher is updated to 0.8.3 but in the folder it remains 0.8.1") the + program's own version over the file's: a folder whose triforce_version.txt says the new release while its program + is still the old one was never offered the update again */ + const char *hos_version(void); + char mine[128]; + snprintf(mine, sizeof mine, "%s", hos_version()); + mine[strcspn(mine, " +")] = 0; + if (safe_tag(mine) && strcmp(mine, have)) { + fprintf(stderr, "update: triforce_version.txt says %s but this program is %s: taken as %s\n", have, mine, mine); + snprintf(have, sizeof have, "%s", mine); + } + } _snwprintf(file, MAX_PATH + 64, L"%ls\\user\\triforce_update_skip.txt", dir); read_value(file, "skip", skipped, sizeof skipped); if (!latest_tag(tag, sizeof tag)) { diff --git a/host/mkw_glue.c b/host/mkw_glue.c index 3948e01..d1aa265 100644 --- a/host/mkw_glue.c +++ b/host/mkw_glue.c @@ -32,8 +32,26 @@ int hos_commit_wait_ms(void) { if (ms < 0) ms = host_alloc_wait_ms(getenv("HOS_COMMIT_WAIT_MS")); return ms; } +/* ((Triforce, 11-26) A session that reached Windows' commit limit leaves triforce_commit_limit.txt beside the game, once: the + next start's notice (hos_main.c memory_notice) says why before play. Three reports of 11-26 (an RX 7900 XTX after the Deku + Tree, another on pausing after 3 hours, a third loading a save) ended there with a page file of a fixed 0.6 to 8 GB, the + game holding 28 to 38 GB: their message box at the moment, over a full-screen game, was not seen) */ +void hos_commit_limit_mark(void) { + static volatile LONG done; + if (InterlockedExchange(&done, 1)) return; + char path[MAX_PATH]; + const DWORD len = hos_game_path_a(path, MAX_PATH); + char *slash = len ? strrchr(path, '\\') : NULL; + if (!slash) return; + snprintf(slash + 1, (size_t)(path + MAX_PATH - slash - 1), "triforce_commit_limit.txt"); + FILE *f = fopen(path, "w"); + if (!f) return; + fputs("Windows' commit limit (RAM and page file) was reached in the last session: the next start says so\n", f); + fclose(f); +} static int commit_wait(void *p, SIZE_T size) { static volatile LONG made, given_up; + hos_commit_limit_mark(); const int tries = host_alloc_tries(hos_commit_wait_ms()); /* ((Triforce, OS-04) 100 for the 5 s; 0: the refusal stands at once) */ for (int i = 0; i < tries; i++) { Sleep(50); @@ -940,6 +958,7 @@ static DWORD WINAPI sample_all_thread(void *p) { const long ms = (long)((hos_now_ns() - t0) / 1000000); for (int i = 0; i < nt; i++) { if (SuspendThread(th[i]) == (DWORD)-1) continue; + const int64_t at = hos_now_ns(); /* ((Triforce, 11-26) the sample's own time: scripts/chain.py puts it on HOS_CHAIN's clock */ CONTEXT ctx = {0}; ctx.ContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER; const BOOL got = GetThreadContext(th[i], &ctx); @@ -965,7 +984,7 @@ static DWORD WINAPI sample_all_thread(void *p) { if (!unwind_step(&ctx, stack)) break; } ResumeThread(th[i]); - fprintf(out, "%s\n", line); + fprintf(out, "# at %lld\n%s\n", (long long)at, line); } } return 0; @@ -1243,11 +1262,66 @@ static void census_figures(GcCensus *c) { #endif } +/* ((Triforce, 11-26, diagnostics) HOS_HEAP_WALK=: once, that long after the start, every heap of the process walked + (HeapLock, HeapWalk): its busy bytes and blocks by size, its committed regions, its biggest blocks. Which owner holds the + "heaps and other private memory" of the memory line (7 GB at the owner's spot). Never by default */ +#ifdef _WIN32 +#include +static void heap_walk_report(void) { + HANDLE heaps[256]; + const DWORD n = GetProcessHeaps(256, heaps); + const HANDLE proc = GetProcessHeap(); + const HANDLE crt = (HANDLE)_get_heap_handle(); + hos_log("mem: heap walk: %lu heaps (the process heap %p, the C runtime's %p)", (unsigned long)n, (void *)proc, (void *)crt); + for (DWORD i = 0; i < n && i < 256; i++) { + uint64_t busy = 0, committed = 0, uncommitted = 0, blocks = 0, by[6] = {0}, by_bytes[6] = {0}, top[6] = {0}; + PROCESS_HEAP_ENTRY e; + memset(&e, 0, sizeof e); + if (!HeapLock(heaps[i])) continue; + const int64_t t0 = hos_now_ns(); + while (HeapWalk(heaps[i], &e)) { + if (e.wFlags & PROCESS_HEAP_REGION) { + committed += e.Region.dwCommittedSize, uncommitted += e.Region.dwUnCommittedSize; + } else if (e.wFlags & PROCESS_HEAP_ENTRY_BUSY) { + const uint64_t sz = e.cbData; + busy += sz, blocks++; + const int k = sz < 256 ? 0 : sz < 4096 ? 1 : sz < 65536 ? 2 : sz < (1u << 20) ? 3 : sz < (16u << 20) ? 4 : 5; + by[k]++, by_bytes[k] += sz; + for (int t = 0; t < 6; t++) + if (sz > top[t]) { + for (int u = 5; u > t; u--) top[u] = top[u - 1]; + top[t] = sz; + break; + } + } + } + HeapUnlock(heaps[i]); + if (busy < (16ull << 20)) continue; /* (the small ones: not the question) */ + hos_log("mem: heap %p%s: %.0f MB busy in %llu blocks (regions committed %.0f MB, uncommitted %.0f MB; walked in %.0f ms); " + "by size: <256 B %llu (%.0f MB), <4 KB %llu (%.0f MB), <64 KB %llu (%.0f MB), <1 MB %llu (%.0f MB), <16 MB %llu (%.0f MB), " + "16 MB+ %llu (%.0f MB); biggest %.1f, %.1f, %.1f, %.1f, %.1f, %.1f MB", + (void *)heaps[i], heaps[i] == proc ? " (the process heap)" : heaps[i] == crt ? " (the C runtime's)" : "", + busy / 1048576.0, (unsigned long long)blocks, committed / 1048576.0, uncommitted / 1048576.0, (hos_now_ns() - t0) / 1e6, + (unsigned long long)by[0], by_bytes[0] / 1048576.0, (unsigned long long)by[1], by_bytes[1] / 1048576.0, + (unsigned long long)by[2], by_bytes[2] / 1048576.0, (unsigned long long)by[3], by_bytes[3] / 1048576.0, + (unsigned long long)by[4], by_bytes[4] / 1048576.0, (unsigned long long)by[5], by_bytes[5] / 1048576.0, + top[0] / 1048576.0, top[1] / 1048576.0, top[2] / 1048576.0, top[3] / 1048576.0, top[4] / 1048576.0, top[5] / 1048576.0); + } +} +#else +static void heap_walk_report(void) {} +#endif + static DWORD WINAPI census_main(void *unused) { (void)unused; hos_host_thread_register_self("hos memory census"); + const char *hw = getenv("HOS_HEAP_WALK"); + const int heap_walk_at = hw ? atoi(hw) : 0; + int elapsed = 0, heap_walked = 0; for (;;) { Sleep((DWORD)census_every * 1000); + elapsed += census_every; + if (heap_walk_at > 0 && !heap_walked && elapsed >= heap_walk_at) heap_walked = 1, heap_walk_report(); GcCensus c; memset(&c, 0, sizeof c); census_figures(&c); diff --git a/host/nn_audio_in.c b/host/nn_audio_in.c index 27ab2c4..5a8c788 100644 --- a/host/nn_audio_in.c +++ b/host/nn_audio_in.c @@ -173,6 +173,14 @@ static int find_device(const Source *src, uint32_t *id) { const int n = hos_sdl_mic_list(ids, names, MAX_DEVICES); return pick(ids, names, n, src, id); } +/* ((Triforce, 11-26) the system has a microphone at all: with none (Windows' Recording tab empty), SDL's open of the default + blocks for seconds before it fails (WASAPI: "can't find requested audio endpoint"), on the game's thread, at every retry: + a report had the Ocarina freeze the game 1 to 15 s at a time while it was out. The list is SDL's own, made at no cost) */ +static int any_mic(void) { + uint32_t ids[MAX_DEVICES]; + char names[MAX_DEVICES][128]; + return hos_sdl_mic_list(ids, names, MAX_DEVICES) > 0; +} static const char *wanted(const Source *src) { return src->mode == 2 ? src->want : "the default microphone"; } static void close_mic(Source *src, int64_t now) { if (src->mic) { @@ -197,7 +205,7 @@ static void missed(Source *src, int64_t now, const char *why) { } static void stand_in(Source *src, int64_t now) { /* (the default, while the wanted one cannot be had) */ if (src->standin) return; - void *standin = hos_sdl_mic_open(0, src->rate, src->channels, sdl_format(src->format)); + void *standin = any_mic() ? hos_sdl_mic_open(0, src->rate, src->channels, sdl_format(src->format)) : NULL; if (standin) use(src, standin, 1, now); else close_mic(src, now); } @@ -218,7 +226,7 @@ static void connect(Source *src) { } uint32_t id = 0; /* (the system's default) */ void *mic = NULL; - const int found = src->mode == 1 || find_device(src, &id); + const int found = src->mode == 1 ? any_mic() : find_device(src, &id); if (found) mic = hos_sdl_mic_open(id, src->rate, src->channels, sdl_format(src->format)); if (mic) { if (!src->failures) hos_log("audio in: %s open (%d Hz, %d channel%s)", wanted(src), src->rate, src->channels, diff --git a/host/nn_os_sync.c b/host/nn_os_sync.c index f1d82e9..f39fd98 100644 --- a/host/nn_os_sync.c +++ b/host/nn_os_sync.c @@ -930,7 +930,64 @@ static int event_wait_atomic(Obj *e, int64_t timeout_ns, int try_only) { /* (H if (got && wake_lat_on()) wake_lat_note(slept ? 2 : 1, slept ? hos_now_ns() - signaled_at : 0); return got; } +/* (Triforce, 11-26) Which stage limits the frame. OoT's frame is two stages that overlap: the game's update (main thread and + its job threads) and the drawing (the Presentation Thread's submits, where the replay runs, and its present). They meet + twice a frame: the Presentation Thread waits for the main thread's hand-over of the next frame (a message queue receive, + lr 0x834a3084), and the main thread waits for the Presentation Thread's present (an event, lr 0x81207a6c). Whichever + side waits is the faster one. Every 5 s: "stages: ..." with both waits a frame and which stage limits. A test of a change to + one stage at a spot the other limits reads no gain (the drawing thread waited 2.7 ms a frame at the owner's spot, 11-26: + the game's update limited it). HOS_STAGE_LOG=0: off */ +static int stage_on(void) { + static int on = -1; + if (on < 0) { const char *e = getenv("HOS_STAGE_LOG"); on = !(e && e[0] == '0'); } + return on; +} +static volatile LONG64 stage_ns[2], stage_t0, stage_p0; +static int stage_of(void) { + if (!stage_on()) return -1; + const Ctx *c = hos_ctx(); + if (!c) return -1; + const int k = c->x[30] == 0x834a3084ULL ? 0 : c->x[30] == 0x81207a6cULL ? 1 : -1; + if (k < 0) return -1; + /* (the queue receive at 0x834a3084 is the game's own, its job threads wait there too: only the presenting thread's wait + and the main thread's count; the thread's kind looked up once) */ + static _Thread_local int who = -1; /* (0 the Presentation Thread, 1 the main thread, 2 another) */ + if (who < 0) { + HosThread *self = hos_self(); + const char *n = self ? hos_thread_name(self) : NULL; + who = n && !strcmp(n, "Presentation Thread") ? 0 : n && !strcmp(n, "sead::MainThread") ? 1 : 2; + } + return who == k ? k : -1; +} +static void stage_note(int k, int64_t ns) { + extern volatile LONG64 hos_present_count; /* display.c */ + InterlockedAdd64(&stage_ns[k], ns); + const int64_t now = hos_now_ns(), t0 = stage_t0; + if (!t0) { InterlockedCompareExchange64(&stage_t0, now, 0); stage_p0 = hos_present_count; return; } + if (now - t0 < 5000000000LL || InterlockedCompareExchange64(&stage_t0, now, t0) != t0) return; + const int64_t p = hos_present_count, frames = p - stage_p0; + stage_p0 = p; + const double draw_w = InterlockedExchange64(&stage_ns[0], 0) / 1e6, game_w = InterlockedExchange64(&stage_ns[1], 0) / 1e6; + if (frames <= 0) return; + const double dw = draw_w / (double)frames, gw = game_w / (double)frames, fms = (now - t0) / 1e6 / (double)frames; + const char *lim = dw >= 0.5 && dw > gw ? "the game's update (its threads; the drawing thread waits for it)" + : gw >= 0.5 && gw > dw ? "the drawing (the replay and the present; the game waits for it)" + : "neither by more than 0.5 ms (close)"; + hos_log("stages (%lld frames, %.2f ms each): the drawing thread waited %.2f ms a frame for the game's hand-over, the game " + "waited %.2f ms a frame for the present: the frame is limited by %s (HOS_STAGE_LOG=0: off)", (long long)frames, + fms, dw, gw, lim); +} + +static int event_wait_body(Obj *e, int64_t timeout_ns, int try_only); static int event_wait(Obj *e, int64_t timeout_ns, int try_only) { + const int k = try_only ? -1 : stage_of(); + if (k < 0) return event_wait_body(e, timeout_ns, try_only); + const int64_t t0 = hos_now_ns(); + const int got = event_wait_body(e, timeout_ns, try_only); + stage_note(k, hos_now_ns() - t0); + return got; +} +static int event_wait_body(Obj *e, int64_t timeout_ns, int try_only) { if (event_atomic()) return event_wait_atomic(e, timeout_ns, try_only); int64_t deadline = timeout_ns > 0 ? hos_now_ns() + timeout_ns : 0; const int was_set = e->signaled > 0; @@ -1257,7 +1314,16 @@ static int queue_put(Obj *q, uint64_t v, int jam, int try_only) { return 1; } /* take: remove it; timeout_ns: < 0 forever, 0 try, > 0 timed. Returns 1 if a value was read. */ -static int queue_get(Obj *q, uint64_t *out, int take, int64_t timeout_ns) { +static int queue_get_body(Obj *q, uint64_t *out, int take, int64_t timeout_ns); +static int queue_get(Obj *q, uint64_t *out, int take, int64_t timeout_ns) { /* ((Triforce) the stage note: stage_of) */ + const int k = timeout_ns != 0 ? stage_of() : -1; + if (k < 0) return queue_get_body(q, out, take, timeout_ns); + const int64_t t0 = hos_now_ns(); + const int got = queue_get_body(q, out, take, timeout_ns); + stage_note(k, hos_now_ns() - t0); + return got; +} +static int queue_get_body(Obj *q, uint64_t *out, int take, int64_t timeout_ns) { int64_t deadline = timeout_ns > 0 ? hos_now_ns() + timeout_ns : 0; const int was_set = q->qlen > 0; const int chain = timeout_ns != 0 && !was_set && hos_chain_on; /* ((Triforce) HOS_CHAIN) */ diff --git a/host/nvn_native.c b/host/nvn_native.c index 6a97c55..6b7e40b 100644 --- a/host/nvn_native.c +++ b/host/nvn_native.c @@ -1307,6 +1307,17 @@ NV(nvnSyncWait) { (unsigned long long)s->fence, (unsigned long long)U64(1), (unsigned long long)c->x[30], (unsigned long long)rx_nvn_fence(), (unsigned long long)rx_nvn_replayed()); if (!s->fenced) { RET(NVN_SYNC_WAIT_RESULT_TIMEOUT_EXPIRED); return; } + { /* ((Triforce, 11-26, LAB ONLY) HOS_SYNC_SKIP_LR=: a blocking wait from that return address answers "signalled" at + once: what the game's own per-frame GPU wait costs, its readbacks left to their own write-back waits. NOT correct for + anything the game reads without a readback; never on by default) */ + static uint64_t skip_lr = ~0ull; + if (skip_lr == ~0ull) skip_lr = getenv("HOS_SYNC_SKIP_LR") ? strtoull(getenv("HOS_SYNC_SKIP_LR"), NULL, 16) : 0; + if (skip_lr && c->x[30] == skip_lr && U64(1)) { + if (s->fenced == 1 && s->fence > rx_nvn_fence()) held_flush(); + RET(NVN_SYNC_WAIT_RESULT_CONDITION_SATISFIED); + return; + } + } if (s->fenced == 1 && s->fence > rx_nvn_fence()) held_flush(); /* (a wait flushes what it waits for) */ if (rx_nvn_wait(s->fence, 0)) { RET(NVN_SYNC_WAIT_RESULT_ALREADY_SIGNALED); return; } static int block = -1; /* HOS_NVN_SYNC_BLOCK=1 (experiment): a poll waits for the GPU */ diff --git a/host/oot_menu.c b/host/oot_menu.c index 0621836..167ce0d 100644 --- a/host/oot_menu.c +++ b/host/oot_menu.c @@ -31,7 +31,7 @@ void rx_option_set(int id, int value); /* rx_backend.c */ /* ((Triforce, 11-22) Both halves': the guest reads, a screen's list of entries and its buttons' boxes, and benchmark mode's presses through the start's screens (bench_menu). Without them the Linux half pressed nothing, and the benchmark stood - on the title screen (#bug-tracker, 11-21). The mouse, Quit and Mods stay the Windows half's */ + on the title screen (#bug-tracker, 11-21). The mouse, Quit and Mods are the first half's (Windows and Linux) */ #include #include #include "hos_bench.h" /* ((Triforce, 11-19) benchmark mode) */ @@ -123,7 +123,10 @@ static void autoload_menu(uint64_t screen, uint64_t vt) { if (hos_oot_autoload_menu(vt, l.index)) hos_hid_tap("0:A/120"); } -#if defined(_WIN32) && !defined(HOS_OOT_MENU_NO_MOUSE) /* (the macro: tests/test_oot_menu_mouse.py builds the other half on Windows) */ +#if !defined(HOS_OOT_MENU_NO_MOUSE) /* (the macro: tests/test_oot_menu_mouse.py builds the other half. Linux runs this half too: the + System page's Mods and Quit entries (Quit Game / Restart Game: gpu/vk/vk_menu.cpp end_game, whose WM_CLOSE and WM_APP + 9 + host/posix/display_sdl.c hos_posix_post_message takes as the Insert menu's). Its mouse bridges are inert there: no free + mouse in the game's menus, keyboard and pads only) */ #include #include #include @@ -1238,7 +1241,7 @@ void hos_oot_menu_tick(Ctx *c, uint64_t screen) { if (screen == pause_screen_now()) InterlockedIncrement(&ticks); } #else -/* Not Windows: the mouse in the game's menus is the Windows window's (display.c), not here. The game's own Options +/* HOS_OOT_MENU_NO_MOUSE (the tests' build): no mouse, Quit or Mods entry here. The game's own Options screen is named all the same, each frame it runs, so the options' tabs sit in it as on Windows: they are the only way to our options since the keys that opened them over the game went (gpu/vk/vk_menu.cpp overlay_allowed), and with this left out a Linux build had none at all (2026-11-14). The screen is the one whose update the lifted game is running diff --git a/host/pad_sdl.c b/host/pad_sdl.c index fe28718..e52de3b 100644 --- a/host/pad_sdl.c +++ b/host/pad_sdl.c @@ -17,6 +17,7 @@ #include #include #include +#include /* ((Triforce, 11-26) sqrt: a stick's full push */ #define WIN32_LEAN_AND_MEAN #include #include "hos_sdl.h" @@ -801,6 +802,19 @@ static void pads_poll(void) { the dead zone. The values are clamped already and the circle keeps them, so nothing else changes) */ hos_filter_stick((int16_t)v[0], (int16_t)v[1], z, own[0], v); hos_filter_stick((int16_t)v[2], (int16_t)v[3], z, own[1], v + 2); + /* ((Triforce, 11-26, a player's input recording: "clicking the left stick stops rolling when moving forward") A + push past 92% of the travel is a full one, in its direction. SDL's Switch driver widens an axis's range to the + furthest it has read: after a hard click at full tilt the same full push forward read 31083, then ~30600 (93-95%), + and the game rolls only from a full one (angled pushes, past 32767 together, still rolled) */ + for (int st = 0; st < 4; st += 2) { + const double m = sqrt((double)v[st] * v[st] + (double)v[st + 1] * v[st + 1]); + if (m >= 30146.0 && m < 32767.0) { /* (30146: 92% of 32767) */ + for (int a = st; a < st + 2; a++) { + const double x = v[a] * 32767.0 / m; + v[a] = x >= 32767 ? 32767 : x <= -32767 ? -32767 : (int32_t)(x < 0 ? x - 0.5 : x + 0.5); + } + } + } /* Camera inversion changes output, not whether the physical stick crossed its rest position. Otherwise toggling the setting admits a held phantom axis, which stays admitted after the setting is restored. */ if (inv_x) v[2] = -v[2]; diff --git a/host/pad_speaker.c b/host/pad_speaker.c index ccaec73..1ec52f8 100644 --- a/host/pad_speaker.c +++ b/host/pad_speaker.c @@ -432,6 +432,14 @@ void hos_pad_speaker_forget(void *pad) { /* Headphones in the jack: what the pad says (-1: it does not say), or the switch over it, each second */ static void headphones(void *pad) { int plugged = env_int("HOS_PAD_SPEAKER_HEADPHONES", -1, 0, 1); + /* ((Triforce, 11-26) the pad's jack read only while a row uses it: the Headphones row on, or a class of sounds sent to the + pad. Read every second with them all off (the default), a second handle on the DualSense drained its reports, and a + player's pad dropped seconds after each connection since v0.8.0 (unproven as the cause; the only new code on it) */ + const int needed = atomic_read(&hp_mode) != HOS_PAD_HEADPHONES_OFF || atomic_read(&any_class); + if (plugged < 0 && !needed) { + hos_sdl_pad_headphones_release(); + plugged = 0; + } if (plugged < 0) plugged = pad ? hos_sdl_pad_headphones(pad) : 0; if (plugged < 0) plugged = 0; if (plugged != atomic_read(&hp_plugged)) hos_log("pad speaker: headphones %s the pad's jack", plugged ? "in" : "out of"); diff --git a/host/posix/display_sdl.c b/host/posix/display_sdl.c index 181fbbd..6d7ed67 100644 --- a/host/posix/display_sdl.c +++ b/host/posix/display_sdl.c @@ -41,6 +41,15 @@ int hos_mouse_take(int32_t *dx, int32_t *dy) { /* (nn_hid.c) the game's menus do not take the mouse here: its capture, and with it its buttons, stay the game's */ int hos_mouse_in_game_menu(void) { return 0; } +/* (host/oot_menu.c's first half, built here for the System page's Mods and Quit entries: the game's menus get no free mouse + on this window, so it finds none (0) and leaves the cursor and the wheel alone; host/display.c has the Windows ones) */ +void hos_mouse_game_menu(void) {} +void hos_mouse_game_menu_gone(void) {} +int hos_mouse_wheel_take(void) { return 0; } +int hos_mouse_game_pointer(int *x, int *y, int *w, int *h, uint32_t *pressed, int *wheel) { + *x = *y = *w = *h = 0, *pressed = 0, *wheel = 0; + return 0; +} /* (mouse_native.c) motion taken and not used, put back for the next taker (the player camera's) */ void hos_mouse_give_back(int32_t dx, int32_t dy) { diff --git a/host/save_files.c b/host/save_files.c index 4c02dbe..ebbfb8b 100644 --- a/host/save_files.c +++ b/host/save_files.c @@ -148,7 +148,9 @@ static int last_saved(int file, char *when, size_t when_cap, char *picture, size /* ((Triforce) 11-18, his picture of the game's own load list beside the card: "the screenshot doesn't match the last autosave either nor does the time". The slot written last cannot be told from the disk: the game writes them all again whenever it saves one. Where the slots are, then, and the menu reads each one's own time out of it) */ - if (saved && snprintf(picture, picture_cap, "%s\\save\\%s\\slot_", dir, fd.cFileName) >= (int)picture_cap) picture[0] = 0; + /* (the menu opens these with its own fopen, not through the Find shim: the folder's own separator, '/' on Linux) */ + const char sep = strchr(dir, '\\') ? '\\' : '/'; + if (saved && snprintf(picture, picture_cap, "%s%csave%c%s%cslot_", dir, sep, sep, fd.cFileName, sep) >= (int)picture_cap) picture[0] = 0; /* ((Triforce) 11-18, his picture: File 2, a new game started and not yet saved, said "Saved game" with no picture. The game makes account.sav as it starts on a file: a file has a save once it has a slot) */ if (!saved) when[0] = 0; diff --git a/launcher/App/Host/LinuxHost.cs b/launcher/App/Host/LinuxHost.cs index 82929a1..eaa085f 100644 --- a/launcher/App/Host/LinuxHost.cs +++ b/launcher/App/Host/LinuxHost.cs @@ -5,8 +5,8 @@ using Photino.NET; namespace Triforce.Launcher.Host; /// Linux: Photino (WebKitGTK) in a window the desktop frames (on a Steam Deck in Game Mode, gamescope shows it full -/// screen). Photino will not open a page on its own scheme as the first page, so the page is handed over as a string with -/// a base address on app://localhost/ui/, and everything it loads after that comes through the app:// scheme. +/// screen). The page opens at app://localhost/ui/index.html, so it and everything it loads come through the app:// scheme +/// on one origin. /// Dropped files: WebKitGTK puts file:// links in the drop's text/uri-list, so the page sends them in the JSON. public sealed class LinuxHost : IHost { @@ -56,9 +56,9 @@ public sealed class LinuxHost : IHost public void Run() { - var page = content.Get("ui/index.html")!.Value.data; - var html = Encoding.UTF8.GetString(page).Replace("", ""); - win.LoadRawString(html); + // From the app scheme itself, as on Windows: a raw string would be about:blank with a null origin, so every fetch of + // the page's own files (the music, read for Web Audio) would be cross-origin and fail in WebKitGTK. + win.Load(new Uri(Origin + "ui/index.html" + Environment.GetEnvironmentVariable("TRIFORCE_START"))); win.WaitForClose(); } diff --git a/launcher/ui/app.js b/launcher/ui/app.js index e7cc49c..7885c7c 100644 --- a/launcher/ui/app.js +++ b/launcher/ui/app.js @@ -106,11 +106,31 @@ function startBuffer(m, t) { src.start(); m.src = src; m.g = g; m.v = v; m.loading = false; } +/* An