FidelityFX SDK 1.1.4 frame interpolation and optical flow built into totk.exe behind frame_gen, contexts created and destroyed only, no frame-path change

The SDK subset, its compat header and the SPIR-V shader header come from Savage Wind (MIT); tools/ffx_shaders.py regenerates the header with glslangValidator, build_game.py compiles the SDK sources with ffx_compat.h force-included, and runtime/vk_fg.cpp makes the backend, optical flow and frame interpolation contexts after the device exists when frame_gen = 1 (default 0, read at start).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Revivedx <82332536+Revivedx@users.noreply.github.com>
This commit is contained in:
committed 2026-11-20 09:40:26 +03:00
1 parent 25a53e5ef2
commit 4e48669c86
114 files changed
+46877 -6

No files matched your search

+16 -3
View File
@@ -360,7 +360,8 @@ def runtime_sources(skip=()):
"""Every runtime/*.c, *.cpp, platform/*.c, *.rc, the in-game menu (ui/*.cpp) and Dear ImGui of this OS except the
names in skip, so a task adds a file without editing this script."""
pats = ('*.c', '*.cpp', 'platform/*.c', '*.rc', 'ui/*.cpp', 'third_party/imgui/*.cpp',
'third_party/imgui/backends/*.cpp')
'third_party/imgui/backends/*.cpp', 'third_party/FidelityFX/sdk/src/shared/*.cpp', 'third_party/FidelityFX/sdk/src/backends/vk/*.cpp',
'third_party/FidelityFX/sdk/src/components/*/*.cpp')
return sorted(p for pat in pats for p in RUNTIME.glob(pat) if p.name not in skip and not other_os(p.name))
@@ -485,7 +486,10 @@ def ninja_file(gen, out, mods, pool_depth, skip=(), prebuilt=(), runtime_lib=Non
inc = f'-I {cmd_path(RUNTIME)} -I {cmd_path(gen)}'
vma = f'{cmd_path(DEPS / "include")} -I {cmd_path(DEPS / "include" / "vma")}' if DEPS else cmd_path(vma_include())
imgui = cmd_path(RUNTIME / 'third_party' / 'imgui')
rt_inc = f'{inc} -I {cmd_path(out)} -I {vma} -I {imgui}' # romfs_config.h, vk_mem_alloc.h (+ deps headers), imgui.h
ffx = RUNTIME / 'third_party' / 'FidelityFX'
ffx_inc = ' '.join(f'-I {cmd_path(d)}' for d in (ffx / 'sdk' / 'include', ffx / 'sdk' / 'src' / 'backends' / 'shared',
ffx / 'spirv')) # FidelityFX/host headers, ffx_shader_blobs.h, ffx_shaders_vk.h
rt_inc = f'{inc} -I {cmd_path(out)} -I {vma} -I {imgui} {ffx_inc}' # romfs_config.h, vk_mem_alloc.h (+ deps headers), imgui.h
libs = [f'-L {cmd_path(DEPS / "lib")}'] + (LLVM_LINK_LIBS if WIN else LINK_LIBS) if DEPS else LINK_LIBS
lines = [
'# Written by tools/build_game.py; do not edit.',
@@ -508,6 +512,14 @@ def ninja_file(gen, out, mods, pool_depth, skip=(), prebuilt=(), runtime_lib=Non
' depfile = $out.d',
' description = CC $in',
'',
# AMD's FidelityFX SDK sources (runtime/third_party/FidelityFX/sdk/src): ffx_compat.h is force-included so they
# build with clang (what MSVC's headers bring in on their own, the _s string functions); -w: AMD's code is not ours to fix
'rule cc_ffx',
f' command = $cc $rtflags -include ffx_compat.h -I {cmd_path(ffx)} -I {cmd_path(ffx / "sdk" / "src" / "shared")} -w -MD -MF $out.d -c $in -o $out',
' deps = gcc',
' depfile = $out.d',
' description = CC $in',
'',
'rule rc',
f' command = {tool_arg(WINDRES)} -I {cmd_path(RUNTIME)} -O coff $in -o $out',
' description = RC $in',
@@ -544,7 +556,8 @@ def ninja_file(gen, out, mods, pool_depth, skip=(), prebuilt=(), runtime_lib=Non
f'{ninja_path(RUNTIME / "totk.ico")}')
else:
stamp_dep = (' | ' if not pgo else ' ') + ninja_path(stamp) if stamp else ''
lines.append(f'build {ninja_path(o)}: cc_rt {ninja_path(src)}{pgo}{stamp_dep}')
rule = 'cc_ffx' if src.is_relative_to(ffx / 'sdk') else 'cc_rt'
lines.append(f'build {ninja_path(o)}: {rule} {ninja_path(src)}{pgo}{stamp_dep}')
rt.append(o)
objs['runtime'] = rt
every = [o for v in objs.values() for o in v]