Validate the Vulkan backend against a real game (Sphere Spectacle)

Adds coop_vk_validate, a harness that drives the Vulkan capture path end-to-end
against a shipping title (default Sphere Spectacle, a pure-Vulkan game) and asserts
frames reach the shared texture and advance, the captured resolution/colors are
sane, saves a BMP screenshot for visual confirmation, and reports the present rate.

Findings:
- Layer method WORKS: coop_vk_layer mirrors the game correctly at 1920x1080 --
  right colors/brightness, no BGRA/RGBA swizzle, no sRGB darkening (screenshot
  confirmed). The layer captures every present (no drops).
- Suspended-inject "Auto-attach" is NOT applicable to a Steam title that must launch
  through Steam: its exe renders nothing when launched directly, so there's no Vulkan
  present to catch. The layer is the method for Steam Vulkan games (the early-inject
  mechanism itself is covered by mock_game_test's suspended-launch path).
- The layer does video, but the game needs coop_hook.dll co-injected for focus-spoof
  or an unfocused, event-driven game throttles itself to a few fps (looks like a
  capture slowdown but isn't). A present-rate number alone can't prove "no FPS impact"
  -- it's the game's own cadence; capture stays off the critical path (every present
  copied, read-back on its own queue + present-semaphore re-chain).

Also adds SharedTextureSource::read_frame (bulk RGBA readback) for the screenshot.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-23 03:34:22 +02:00
parent 911b543d98
commit 82a6328b1b
6 changed files with 533 additions and 13 deletions

View File

@@ -0,0 +1,16 @@
# Dev harness: validate the injected Vulkan capture backend against a REAL game (Sphere Spectacle).
# Drives both early-presence methods (implicit layer / suspended-inject), asserts capture works +
# the image is sane, saves a BMP screenshot for visual confirmation, and measures the present rate
# while capturing. Reuses the shipping shared-texture reader.
add_executable(coop_vk_validate
main.cpp
${CMAKE_SOURCE_DIR}/host/src/capture/shared_texture.cpp)
target_include_directories(coop_vk_validate PRIVATE ${CMAKE_SOURCE_DIR}/host/src)
target_link_libraries(coop_vk_validate PRIVATE coop_common d3d11 dxgi advapi32 shell32)
# Needs coop_hook.dll (inject method) + coop_vk_layer.dll/.json (layer method) at the deployable root.
add_dependencies(coop_vk_validate coop_hook coop_vk_layer)
coop_output_subdir(tools coop_vk_validate) # dev tool -> bin/<config>/tools/