Repository navigation
Conversation
…ChainForComposition and the teardown event answer as the host does
Kam471
left a comment
There was a problem hiding this comment.
Built and ran dxgi_factory_args_test at 718f2326 on Windows 11, RTX 5070 Ti: exit 0, layer and host both report "factory and adapter argument answers match the host runtime". The factory/adapter refusals (CreateSoftwareAdapter, GetSharedResourceAdapterLuid, CreateSwapChainForComposition, teardown event) match. No blocking issue.
Flyander
left a comment
There was a problem hiding this comment.
[P2] Validate non-null invalid resource handles
When both arguments are non-null, an invalid handle such as 0x1234 falls through to E_NOTIMPL. Microsoft documents DXGI_ERROR_INVALID_CALL when hResource is invalid: https://learn.microsoft.com/en-us/windows/win32/api/dxgi1_2/nf-dxgi1_2-idxgifactory2-getsharedresourceadapterluid. The test currently combines 0x1234 with a null LUID, so it does not cover this path. Please add a case with a valid LUID and preserve the host error for an invalid handle before returning E_NOTIMPL for unsupported valid resources.
[P2] Validate composition descriptor fields before E_NOTIMPL
Only pointer arguments are checked. A non-null descriptor with SwapEffect other than DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL or Scaling other than DXGI_SCALING_STRETCH currently returns E_NOTIMPL. The API requires both values and returns DXGI_ERROR_INVALID_CALL for invalid data: https://learn.microsoft.com/en-us/windows/win32/api/dxgi1_2/nf-dxgi1_2-idxgifactory2-createswapchainforcomposition. Please add invalid-field probes with non-null arguments before the unsupported-operation fallback.
|
Tested 718f232 on Windows 11 24H2, MSVC 19.44, NVIDIA RTX 3070 / 617.42: For reference only: AI-assisted (Claude). |
…handle; CreateSwapChainForComposition refuses non-flip SwapEffect and ASPECT_RATIO_STRETCH
|
Both points are right that the unsupported-operation fallback came too early, so I measured what the host does and changed the code to match (pushed as 9a748d3). Probed host dxgi.dll with a real D3D12 queue on the RTX 4080 SUPER, Intel UHD 770, the third adapter and WARP (identical on all):
Tested on Windows 11 (MSVC, RelWithDebInfo): |
What broke:
IDXGIFactory::CreateSoftwareAdapter,IDXGIFactory2::GetSharedResourceAdapterLuid,CreateSwapChainForCompositionandIDXGIAdapter3::RegisterHardwareContentProtectionTeardownStatusEventreturnedE_NOTIMPLfor every call. Repro:factory->CreateSoftwareAdapter(nullptr, &adapter)returned 0x80004001; the host dxgi.dll returnsDXGI_ERROR_INVALID_CALL.Fix, measured on the host dxgi.dll with a probe (RTX 4080 SUPER, Intel UHD 770, WARP):
DXGI_ERROR_INVALID_CALL.DXGI_ERROR_INVALID_CALL.DXGI_ERROR_INVALID_CALL(https://learn.microsoft.com/en-us/windows/win32/api/dxgi1_2/nf-dxgi1_2-idxgifactory2-createswapchainforcomposition), as the host does.DXGI_ERROR_INVALID_CALLon the host, otherwise S_OK with a non-zero cookie. The event is registered and never signalled (no hardware content protection here).Calls that pass those checks (a real software adapter DLL, a composition swap chain) stay
E_NOTIMPL.Test: new
dxgi_factory_args_test(ctestdxgi_factory_args) runs the checks on the layer's factory and on the host factory.Tested on Windows 11, MSVC 14.51, worktree built from this commit (only that target): passes on the RTX 4080 SUPER and on the Intel UHD 770 (
VK_LOADER_DRIVERS_DISABLE=*nv*), and the host-factory half of the run agrees. Negative control: withdxgi_com.cppfrom upstream/main it fails (CreateSoftwareAdapter(nullptr, ...) = 0x80004001, expected 0x887A0001).Claimed in #4421 (D3D round 3). Related, not overlapping: #3283 (stereo registration) and #4260 (matrix transform) touch other methods of dxgi_com.cpp.
AI-assisted.