Files
CoopAllTheThings/vk_layer/CMakeLists.txt
BlackMark 635ef51283 Deduplicate the hook DLL and scrub history from its comments
Consolidate four copies of the keyed-mutex shared-texture setup
(present/opengl/d3d9/vk_capture) into one RAII SharedVideoTexture,
two copies of find_main_window into find_window.hpp, audio_hook's
hand-rolled detour guard into the shared DetourGate, the duplicated
vtable_method into vtable_hook.hpp, and the near-identical
Present/Present1 and SwapBuffers/wglSwapBuffers detour pairs into one
shared body each. The vk_layer and vk_capture_perf_test targets now
compile debug_log.cpp since the shared texture code logs.

Comments no longer narrate the past: drop stress-test/game anecdotes,
"used to"/"the old model" phrasing, plan-step labels, and pointers to
docs that do not exist; fix present_hook.hpp/opengl_hook.hpp claims
that predate the D3D12/D3D9/Vulkan backends. Net -266 lines, no
behavior change (full x64 + x86 suites pass, including the mock-game
hook/unhook storm).
2026-07-12 08:53:58 +02:00

23 lines
1.3 KiB
CMake

# CoopAllTheThings Vulkan capture layer: a real implicit Vulkan layer the loader inserts at
# vkCreateInstance, so it's in the chain before a game (that caches its present pointer at init)
# can resolve vkQueuePresentKHR -- the reliable early-presence path the inline-hook vk_hook can't
# get for immediate-init games. Ships at the bin root (registered for real games), with its JSON
# manifest copied alongside (the manifest's library_path is relative).
coop_require_submodule("Vulkan-Headers" "third_party/Vulkan-Headers/include/vulkan/vulkan.h")
add_library(coop_vk_layer SHARED
coop_vk_layer.cpp
${CMAKE_SOURCE_DIR}/hook/src/vk_capture.cpp # shared off-present-thread read-back (also used by vk_hook)
${CMAKE_SOURCE_DIR}/hook/src/debug_log.cpp) # logging used by the shared capture code
target_include_directories(coop_vk_layer PRIVATE
${CMAKE_SOURCE_DIR}/hook/src # ipc_client.hpp (reused IPC client)
${CMAKE_SOURCE_DIR}/third_party/Vulkan-Headers/include)
target_link_libraries(coop_vk_layer PRIVATE coop_common d3d11 dxgi)
# Drop the manifest next to the built DLL so VK_LAYER_PATH / the registry can find it.
add_custom_command(TARGET coop_vk_layer POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/coop_vk_layer.json $<TARGET_FILE_DIR:coop_vk_layer>/coop_vk_layer.json)