Repository navigation
d3d12: destroy raw-texture image views at device teardown - #2184
ammonium231 wants to merge 2 commits into
Conversation
set_raw_image_address never registered the title VA, so ~Resource did not forget the views and xbox_raw_2d_stripes and xbox_raw_2d_surface leaked 2 VkImageViews each (VUID-vkDestroyDevice-device-05137).
dc7feaf to
ee0aa61
Compare
|
Independent verification of head Machine: profile M (RTX 4070 SUPER 12 GB desktop, NVIDIA 621.01, Windows 11 Pro 26300), MSVC 14.52 (VS 2026, MSBuild generator), RelWithDebInfo. No game files. Leak, before and after (
So the fix does what it says on NVIDIA too. Full suite (
Diff read: the new body matches No problems found. AI-assisted (Claude Code). |
|
Thanks @Tyrannys for verifying on the 4070 SUPER. Marking ready for review. |
|
Independent RTX 4080 validation of the runtime change in MEASURED at device teardown (
The ordinary harness reported passes despite the baseline diagnostics. I ran an identical local test-only check on both builds that reads the validation error count after the device is destroyed. With that check, baseline passed 8 of 10 textured-draw cases and failed exactly the two above. With #2184, all 10 passed. The PR runtime diff was applied unchanged. Independent evidence review completed. AI-assisted: OpenAI Codex. |
|
#2184 | head ee0aa61 (merged cleanly with main 48bae6c — no conflicts on current |
timbot103
left a comment
There was a problem hiding this comment.
Static audit of ee0aa61a8. No builds or GPU runs. The reported Windows/MSVC validation covers the two raw fixtures, which allocate distinct VAs in runtime/test/d3d12_m2_textured_test.cpp:364. The changed source is in the Windows runtime target (runtime/CMakeLists.txt:2377), which is excluded from the Linux build.
- [MAJOR]
runtime/shims/d3d12_vulkan_device.cpp:8757— Create two raw SRVs with distinct widths at the same aligned VA. The second materialization erases the first SRV's bindless key while its descriptor is live, and console heap resolution can rebuild it against the second backing image. A leak also remains if a sampled slot-133 placement takes over the raw VA and is released before the cached raw SRV is written again. That cache hit creates a view without an address owner, so the raw destructor skips view cleanup. Give each cached backing its own view lifetime, using a synthetic key or a separate ownership index. - [MINOR]
runtime/test/d3d12_m2_textured_test.cpp:723— The validation count is read before the fixture callsvkDestroyDeviceinruntime/test/vk_test_device.h:170, so the existing cases miss leak messages emitted by that call. Check the count after fixture teardown.
For a raw surface with sole ownership of its VA, the descriptor mutex protects entry removal and each non-null view is queued once, ahead of the backing image. The teardown drain runs after vkDeviceWaitIdle and before the owned device is destroyed (runtime/shims/d3d12_vulkan_device.cpp:14361, runtime/src/vulkan_backend.h:511). The raw cache's early erase handles failed image creation before any SRV is built.
AI-assisted.
A second raw SRV at the same VA, or a slot-133 texture placed there, no longer drops a live raw view, and the raw surface frees its views itself. Tests read validation after device teardown.
|
@timbot103 Reproduced both on #2184 + main (RTX 3090, validation on): a second raw SRV of another width at the same VA dropped the first's hash entry (index 4096 → 0), and the slot-133 takeover left 1 VkImageView at vkDestroyDevice. |
|
Independent Wine check of the updated raw-view lifetime tests. I merged
The updated head passed all six selected cases per GPU, including |
|
TAKEN by OreoFR (Windows, RTX 4070 8 GB) |
|
Verified by OreoFR — NO RED (red only with validation on)
AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR. |
set_raw_image_address never registered the title VA, so ~Resource did not forget the views and xbox_raw_2d_stripes and xbox_raw_2d_surface leaked 2 VkImageViews each (VUID-vkDestroyDevice-device-05137).
Claimed in the coordination issue as: RT-RAW-2D-IMAGEVIEW-LEAK
Depends on: none
Fixes: VUID-vkDestroyDevice-device-05137 in xbox_raw_2d_stripes and xbox_raw_2d_surface (no standalone issue).
What and why
set_raw_image_address overwrote image_address_ without note_image_address, so ~Resource skipped forget_image. It now registers the title VA the same way as place_at_title_address.
Tested
LEONIDA_VK_VALIDATION=1 after rebase onto 0b11d86: xbox_raw_2d_stripes and xbox_raw_2d_surface still 2 leaked VkImageViews to 0. Full ctest 472/475; xbox_present and d3d12_set_descriptor_heaps also fail on unpatched main; xmem_no_write_watch failed once under -j 4 and passed twice isolated.
GPUs tested: NVIDIA RTX 3090, driver 621.40, Windows 11
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.