Measured against the host runtime's DXGI on an RTX 5070 Ti and on WARP (Windows 11), both agreeing:
- The adapter answers IDXGIAdapter4. GetDesc3 gives what GetDesc1 gives, plus the
preemption granularities; a null description is E_INVALIDARG.
- GetRestrictToOutput on a swap chain created without an output is S_OK with a null
output, not DXGI_ERROR_NOT_FOUND.
- ResizeBuffers refuses NONPREROTATED, FULLSCREEN_VIDEO and every bit from 0x4000 up
with DXGI_ERROR_INVALID_CALL, and FOREGROUND_LAYER, YUV_VIDEO and 0x2000 on a chain
created without them with E_INVALIDARG (a sweep of all 32 bits on the host).
- A null out-pointer on GetBuffer, GetHwnd, GetLastPresentCount and GetRestrictToOutput
is DXGI_ERROR_INVALID_CALL, not E_POINTER or E_INVALIDARG.
dxgi_host_parity_test compares the layer with the host for each of these (PROBE_WARP=1
for WARP): 18 of 26 rows differ before, 0 after, on both. dxgi_device_test and
dxgi_swapchain_test now expect the host's answers.
AI-assisted: yes
Both were hardcoded (FLIP_DISCARD, RENDER_TARGET_OUTPUT). The host and WARP report the creation values:
FLIP_SEQUENTIAL, RENDER_TARGET_OUTPUT | SHADER_INPUT, or 0. dxgi_host_answers: 6 of 7 rows differ on main against
the NVIDIA host and against WARP, 0 with both commits.
AI-assisted: yes
Both returned E_NOTIMPL, which Microsoft documents only for the Windows 7 Platform Update. They now return S_OK with a unique cookie for UnregisterStereoStatus; stereo is never enabled so nothing is notified. Test: dxgi_swapchain.
IDXGIAdapter::CheckInterfaceSupport(IDXGIDevice) reported a user-mode
driver version of 0. Host DXGI reports the adapter's, which titles read
as the driver version. The layer now reads it the way DXGI does,
D3DKMTOpenAdapterFromLuid + D3DKMTQueryAdapterInfo(
KMTQAITYPE_UMD_DRIVER_VERSION) on the adapter's Vulkan deviceLUID,
looked up from gdi32 at run time (0 kept when missing or failing, e.g.
under Wine); the host dxgi.dll isn't used. Measured equal to host DXGI
on an RTX 5060 Ti (0x0020000000100842, driver 621.14) and on WARP.
dxgi_swapchain_test compares it with the host adapter of the same LUID
(host dxgi.dll loaded at run time); fails on main with 0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
IDXGISwapChain2::SetMatrixTransform/GetMatrixTransform stored and
returned a matrix on every swapchain. A matrix transform belongs to
composition swapchains (CreateSwapChainForComposition, E_NOTIMPL in the
layer); host DXGI answers DXGI_ERROR_INVALID_CALL to both on an HWND
swapchain, with a matrix and with null (Windows 11, RTX 5060 Ti, driver
621.14). Both now give that answer, and the stored matrix goes.
dxgi_swapchain_test asserted the round-trip; it now checks the host's
answer for the four calls (fails on main).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SetSourceSize answered S_OK and ignored its arguments, and GetSourceSize always
reported the back-buffer size, so a game that scales its source region could not
read back what it set.
Host-measured on Windows 11 with the system DXGI (RX 7900 XTX): a fresh
swapchain reports the back-buffer extent; SetSourceSize(64,32) round-trips while
GetDesc1 keeps the buffer size; a region larger than either buffer dimension is
DXGI_ERROR_INVALID_CALL and keeps the stored value; zero is accepted and stored;
GetSourceSize needs both pointers; and ResizeBuffers resets the source size to
the new back-buffer extent.
Present still does not scale by the source region; that stays a documented
difference and is not part of this change.
- Upgrade dxgi_com.h to dxgi1_6.h for IDXGIOutput6 / DXGI_OUTPUT_DESC1.
- Enumerate Win32 monitors via EnumDisplayMonitors / EnumDisplaySettingsW with headless 1920x1080@60 fallback.
- Implement Output (IDXGIOutput..IDXGIOutput6) and wire Adapter::EnumOutputs and SwapChain::GetContainingOutput against host dxgi.dll behavior.
- Add D3D-313 unit and host-comparison coverage in dxgi_swapchain_test.cpp (synthetic, no game data).
AI-assisted.
A description with width 16385 and MSAA 4, one buffer or a bad format is
DXGI_ERROR_INVALID_CALL on the host runtime's DXGI, not E_INVALIDARG
(found by Kam471 in the review of #3531). Five multi-fault cases added
to the side-by-side comparison.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Measured on RTX 5070 / 621.14: bitblt effects, window-incompatible
scaling and alpha modes, flags outside 0x2/0x20/0x40/0x800/0x1000/0x2000,
shared/read-only/discard-on-present/UAV usage, a null or non-queue
device, null window/description/output are DXGI_ERROR_INVALID_CALL; a
side above 16384 is E_INVALIDARG. dxgi_swapchain_test compares 40
descriptions with the host. The CoreWindow path keeps its old checks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SetPrivateData, SetPrivateDataInterface and GetPrivateData accepted the data and discarded it, so GetPrivateData always returned DXGI_ERROR_NOT_FOUND. They now store a copy of the bytes, hold a reference for an interface until it is replaced or removed, and answer DXGI_ERROR_MORE_DATA for a buffer that is too small. Test: dxgi_swapchain.
The method returned E_NOTIMPL and a zero cookie. It now returns S_OK with a unique cookie for UnregisterVideoMemoryBudgetChangeNotification; the budget is recomputed on every QueryVideoMemoryInfo, so the event is never signalled. Test: dxgi_swapchain.
CreateDXGIFactory2(IID_IDXGIFactory7) and QueryInterface for
IDXGIFactory6/7 failed on the layer's factory, which stopped at
IDXGIFactory5.
- EnumAdapterByGpuPreference returns the one Vulkan adapter at index 0
for every preference.
- RegisterAdaptersChangedEvent / UnregisterAdaptersChangedEvent keep a
cookie registry. The adapter list never changes, so the event is
never signalled.
Every return code follows the host dxgi.dll, measured on Windows 11
with an RTX 3070:
- a preference outside the enum is accepted;
- a null out is DXGI_ERROR_INVALID_CALL;
- past the end is DXGI_ERROR_NOT_FOUND with *out cleared;
- a non-adapter riid is E_NOINTERFACE;
- a null event or cookie, and an event registered twice, are
DXGI_ERROR_INVALID_CALL;
- cookies start at 1 and are separate from the occlusion cookies;
- an unknown cookie is DXGI_ERROR_NOT_FOUND.
dxgi_swapchain_test checks each answer. With main's factory it fails
at QueryInterface(IDXGIFactory6/7).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The factory answered S_OK for every flags value, while the host rejects anything
outside DXGI_MWA_NO_WINDOW_CHANGES, DXGI_MWA_NO_ALT_ENTER and
DXGI_MWA_NO_PRINT_SCREEN with DXGI_ERROR_INVALID_CALL (measured on Windows 11
with the system DXGI), so an invalid call looked accepted. Reject unknown bits
before recording the window, and cover the accepted combinations and two unknown
bits in the swapchain test.
ResizeTarget answered S_OK and ignored its argument, so a windowed game that
switches resolution through the DXGI 1.0 path kept the old window: the host
moves the target's client area to the mode's Width x Height and leaves the back
buffers alone until ResizeBuffers (where 0 means the new client area).
Measured on Windows 11 with the system DXGI (RX 7900 XTX): ResizeTarget(nullptr)
is DXGI_ERROR_INVALID_CALL, ResizeTarget(0x0) is accepted and the window's
minimum tracking size decides the result, ResizeTarget(234x156) gives a 234x156
client area with the buffers at 128x128, and ResizeBuffers(0, 0, 0) then takes
234x156. The swapchain test now covers the same sequence on the shim.
Implements CreateSwapChainForCoreWindow on Factory for UWP / Game Core Scarlett titles by querying ICoreWindowInterop for the underlying Win32 HWND, and implements RegisterOcclusionStatusWindow / RegisterOcclusionStatusEvent returning sequential cookies.
Adds mock ICoreWindow unit tests in dxgi_swapchain_test covering argument validation, null HWND failure, functional swapchain presentation, and occlusion status registration.