Fix hooked video darkening for *_SRGB-backbuffer games
The host sampled the shared backbuffer copy through a view typed exactly like the game's backbuffer. For games whose backbuffer is an *_SRGB format (e.g. Life is Strange: Before the Storm -- confirmed R8G8B8A8_UNORM_SRGB / fmt 29 via the hook log), the GPU decoded sRGB->linear on the sample, and the host then wrote those linear values straight to its plain-UNORM swapchain with no re-encode, so the mirror came out noticeably darker than the game. Sample the copy as the plain-UNORM sibling of the format (srgb_to_unorm) so the bytes pass through unchanged -- matching what WGC already does. The UNORM and *_SRGB formats share a typeless group, so CopyResource from the producer's sRGB texture into the host's UNORM copy is allowed. Non-sRGB formats are unaffected. Adds srgb_format_test locking the mapping. All 6 tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -59,6 +59,12 @@ target_link_libraries(audio_hook_test PRIVATE
|
||||
|
||||
add_test(NAME audio_hook_test COMMAND audio_hook_test)
|
||||
|
||||
# Unit test for the sRGB->UNORM format mapping the hooked video path uses to avoid
|
||||
# darkening *_SRGB-backbuffer games. Header-only, no device.
|
||||
add_executable(srgb_format_test srgb_format_test.cpp)
|
||||
target_include_directories(srgb_format_test PRIVATE ${CMAKE_SOURCE_DIR}/host/src)
|
||||
add_test(NAME srgb_format_test COMMAND srgb_format_test)
|
||||
|
||||
# In-process self-test for the Present-hook video path. Reuses the shipping
|
||||
# present_hook.cpp and drives a real D3D11 swapchain in the same process, so it
|
||||
# exercises the IDXGISwapChain::Present inline hook, the shared keyed-mutex
|
||||
|
||||
Reference in New Issue
Block a user