Repository navigation
D3D12: expose ID3D12Heap1/ID3D12Resource1 and implement CreateHeap1 without a protected session - #3374
D3D12: expose ID3D12Heap1/ID3D12Resource1 and implement CreateHeap1 without a protected session#3374kapitche wants to merge 1 commit into
Conversation
|
Tested With Synthetic D3D12 tests only; no game files. |
|
Tested c37e7a2 on an RTX 5090 (driver 616.92), Windows 11, MSVC 19.44, Vulkan SDK 1.4.363, RelWithDebInfo:
AI-assisted (Claude Code). |
|
Tested c37e7a2 (merged onto main aa2988c) on RTX 3060 (Ampere), driver 617.14, Windows 11, MSVC 14.44, RelWithDebInfo: pass
AI-assisted: this check was run and written with Claude Code (Anthropic) on my machine; the numbers above are its unedited output. |
…ithout a protected session Heaps and resources did not answer QueryInterface for ID3D12Heap1 and ID3D12Resource1, so GetProtectedResourceSession was unreachable; the host runtime and WARP answer DXGI_ERROR_NOT_FOUND with a null output for an unprotected object. ID3D12Device4::CreateHeap1 was a generated stub returning E_NOTIMPL; with no protected session it is CreateHeap (a session is refused, as CreateCommittedResource1-3 refuse one). Compared with the host in compare_heap_neighbours.
c37e7a2 to
6c0b3c4
Compare
|
Tested 6c0b3c4 (merged onto main 98fa503) on RTX 3060, driver 617.14, Windows 11: pass Ran: ctest, ctest with LEONIDA_VK_VALIDATION=1, the unregistered *_test.exe, and run_gpu_tests.py native and with LEONIDA_W64_EMULATE=1. Failures that also happen on main 98fa503 are excluded: d3d12_clear (format mismatch vs WARP, see #521). AI-assisted: the build and test run were done with Claude Code on my machine; the numbers above are its unedited output. |
|
Tested 6c0b3c4 on NVIDIA GeForce RTX 3070 (Ampere), driver 610.88, Windows 11 Pro 10.0.26200: pass
Built with MSVC through |
|
Tested 6c0b3c4 on Windows 11 (MSVC BuildTools 2022, Ninja, RelWithDebInfo, -j 4; no Vulkan validation layer installed), one GPU at a time, device line confirmed: AMD Radeon RDNA2 iGPU (driver 26.10.1) and NVIDIA RTX 5080 (driver 616.92). Ran AI-assisted. |
|
Verified on Linux: this is the CreateHeap1 gap main's D3D-238 commits explicitly left open (their messages say leave CreateHeap1 to #1846), and main has zero IID_ID3D12Heap1 references (re-checked) — genuinely unlanded work. Two merge notes: the branch conflicts around d3d12_vulkan_device.cpp and its test, and after merging it still calls the old integer form refuse_protected_session(4) while main converted that helper to method-name strings — the CreateHeap1 refusal needs refuse_protected_session("CreateHeap1"), after which the merge is straightforward (adapted and compile-checked that way locally; stubs-generator CMake addition merges cleanly). I could not build the runtime or run the device tests here, so the E_INVALIDARG/DXGI_ERROR_NOT_FOUND behaviour claims rest on CI's legs. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
|
Thanks for checking the merge. Both notes are about the older head: at the current head |
|
Tested 6c0b3c4 on NVIDIA GeForce RTX 4080 (driver 617.42), Windows 11, clang-cl cross-build: d3d12_vulkan_device_test exits 0. The output has no failure lines; the last arena line is "GPU address arena: peak end 24.3 of 256.0 MiB (9.5%), peak live 24.2 MiB (buffers 0.0, descriptor heaps 0.0, shaders 0.0, heaps 24.2), 87 allocations, 0 refused". The new CreateHeap1 and protected-session rows print nothing by name, so this run shows the test passes on this host, not that each new row was reached. AI-assisted. |
|
Heads-up: #1846 (claimed earlier in #1548) adds the same AI-assisted (Claude Code). |
|
@dracbat thanks for the heads-up. Compared the two diffs against current upstream/main. The To check that our rows hold with their Plan: if #1846 lands first, I drop this PR's |
Kam471
left a comment
There was a problem hiding this comment.
Reviewed head 6c0b3c4954ffb5d7e1d8da7f5b6762ae1bbc46fd. Windows 11 26200, MSVC 19.44.35207, Ninja, RelWithDebInfo, Vulkan 1.4.363, RTX 5070 Ti.
d3d12_vulkan_device 1/1; 17 CreateHeap-neighbour cases (8 new), 0 mismatches against the host runtime. New cases: CreateHeap1 S_OK / ID3D12Heap1 / null out (S_FALSE) / wrong IID / size 0 / size 1000, and ID3D12Heap1/ID3D12Resource1::GetProtectedResourceSession = DXGI_ERROR_NOT_FOUND with a null out. git diff --check clean.
Red baseline (revert runtime/shims/d3d12_vulkan_device.cpp only): exit 1, 8 mismatch lines, all E_NOTIMPL/E_NOINTERFACE against the host's S_OK/S_FALSE/E_INVALIDARG/DXGI_ERROR_NOT_FOUND.
Verdict: ready to merge. Additive; CreateHeap, committed resources and the protected-session refusal are unchanged. Overlaps #2590 (ID3D12Resource1/2 + ID3D12Heap1), so whichever lands second rebases the same two class declarations.
First-frame: a title that QIs Heap1/Resource1 during device setup gets S_OK instead of E_NOINTERFACE.
D3D12: expose ID3D12Heap1/ID3D12Resource1 and implement CreateHeap1 without a protected session Independent review: ProjectLeonida#3374 (comment) Fork integration. AI-assisted (Codex).
Claimed in the coordination issue as: #3232 (comment)
What and why
QueryInterfaceforID3D12Heap1/ID3D12Resource1(the log showedunknown IID {9d5e227a-...}), so an application that asks for them to callGetProtectedResourceSessiongot E_NOINTERFACE. The host D3D12 runtime and WARP answerDXGI_ERROR_NOT_FOUNDwith a null output for an unprotected object, whatever IID is asked for. The two interfaces are now generated (runtime/CMakeLists.txtstub list) and implemented that way: the layer has no protected sessions (D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_SUPPORTis NONE), so no object belongs to one.ID3D12Device4::CreateHeap1was a generated stub that returned E_NOTIMPL for every call. With a null protected session it isCreateHeap(host and WARP: same HRESULTs for the same arguments, including S_FALSE for a null output, E_NOINTERFACE for a wrong IID, E_INVALIDARG for size 0). A non-null session is refused with E_INVALIDARG, asCreateCommittedResource1-3already refuse one.Repro:
heap->QueryInterface(IID_PPV_ARGS(&heap1))fails on main;device4->CreateHeap1(&desc, nullptr, IID_PPV_ARGS(&heap))returns 0x80004001 on main.Docs: ID3D12Device4::CreateHeap1 (pProtectedSession is optional), ID3D12Resource1::GetProtectedResourceSession. The NOT_FOUND answer is measured on the host runtime and WARP.
Tested
Eight new rows in
compare_heap_neighboursofd3d12_vulkan_device_test(standalone device with the GPU address arena, each answer compared with the host):CreateHeap1with no session (plain,ID3D12Heap1asked, null output, wrong interface, size 0, size 1000),ID3D12Heap1::GetProtectedResourceSessionandID3D12Resource1::GetProtectedResourceSession.d3d12_vulkan_device_test: pass on RTX 4080 SUPER and on Intel UHD 770 (VK_LOADER_DRIVERS_DISABLE=*nv*).ours 0x80004001, host 0x00000000), exit 1.AI-assisted.
Checklist