Add d3d9_hook_test (capture path + D3D9 present-overhead guard)
The D3D9 capture path had no dedicated test. d3d9_hook_test plays game + host:
installs the IDirect3DDevice9::Present hook, drives a real D3D9 device (Clear +
Present), and verifies the full GetRenderTargetData -> BGRA->RGBA swizzle ->
shared keyed-mutex texture path by opening coop_video_<pid> from a D3D11 device
and reading the rendered color back ({51,102,153}).
It also carries the present-thread overhead guard the perf section deferred here,
at a realistic 1280x720: measured capture overhead is ~0.39 ms -- far under one
frame, confirming the cached-memory D3D9 read-back is not a stall (and tripping
the budget if a write-combined-class regression ever lands on the present thread).
Skips cleanly without a D3D9/D3D11 device.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -250,6 +250,24 @@ target_link_libraries(dx12_present_hook_test PRIVATE
|
||||
|
||||
add_test(NAME dx12_present_hook_test COMMAND dx12_present_hook_test)
|
||||
|
||||
# In-process self-test for the D3D9 capture path: installs the IDirect3DDevice9::Present hook, drives
|
||||
# a real D3D9 device (Clear + Present), verifies the GetRenderTargetData -> swizzle -> shared-texture
|
||||
# upload end to end, and guards the present-thread overhead at a realistic resolution. Skips without
|
||||
# a D3D9/D3D11 device.
|
||||
add_executable(d3d9_hook_test
|
||||
d3d9_hook_test.cpp
|
||||
${CMAKE_SOURCE_DIR}/hook/src/d3d9_hook.cpp
|
||||
${CMAKE_SOURCE_DIR}/hook/src/debug_log.cpp
|
||||
${CMAKE_SOURCE_DIR}/hook/src/hook_registry.cpp)
|
||||
target_include_directories(d3d9_hook_test PRIVATE ${CMAKE_SOURCE_DIR}/hook/src)
|
||||
target_link_libraries(d3d9_hook_test PRIVATE
|
||||
coop_common
|
||||
safetyhook::safetyhook
|
||||
d3d9
|
||||
d3d11
|
||||
dxgi)
|
||||
add_test(NAME d3d9_hook_test COMMAND d3d9_hook_test)
|
||||
|
||||
# Comprehensive capture/audio/hook stress test against coop_mock_game: launches the
|
||||
# animated, frame-numbered A/V game, injects coop_hook.dll, decodes captured frame
|
||||
# numbers (DX11 + DX12) to assert a monotonic/advancing mirror, checks audio capture, and
|
||||
@@ -367,6 +385,7 @@ coop_output_subdir(tests
|
||||
srgb_format_test
|
||||
present_hook_test
|
||||
dx12_present_hook_test
|
||||
d3d9_hook_test
|
||||
opengl_hook_test
|
||||
mock_game_test
|
||||
audio_verify_test
|
||||
|
||||
Reference in New Issue
Block a user