mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:20:53 +01:00
[PR #1798] [MERGED] d3d12_vulkan: a title texture destroyed inside the registry is removed after the registry lets go (RT-TITLE-TEXTURE-GONE) #1812
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1812
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1798
Author: @ImLele69
Created: 11/25/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @QemmHD
Base:
main← Head:rt-title-texture-gone📝 Commits (2)
5f549cfd3d12_vulkan: a title texture destroyed inside the registry is removed after the registry lets go152cee2d3d12_vulkan: a texture destroyed inside the registry leaves gpu_placements at once📊 Changes
1 file changed (+43 additions, -6 deletions)
View changed files
📝
runtime/shims/d3d12_vulkan_device.cpp(+43 -6)📄 Description
Claimed in the coordination issue as: RT-TITLE-TEXTURE-GONE — https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7162151750
What and why
~ResourcecallsDeviceState::title_texture_gone, which takestitle_texture_mutex. The comment above the registry already says the caller of a removal holds that mutex while the resource is destroyed. But the last reference to a slot-70 texture can be a descriptor thatwrite_placed_texture_viewoverwrites while it holds the mutex:place_title_view→write_title_srv→CreateShaderResourceViewreleases the old view's resource, its destructor runs, and the same thread takes the samestd::mutexagain.MSVC's
std::mutexdetects that and throwsstd::system_error(resource_deadlock_would_occur). Under Wine,msvcp140.dlldoes not implementstd::_Throw_Cpp_error, so the process aborts instead:Startup trace exception record, with a linker map of that build:
kernelbase<MSVCP140< … <~Resource<Device::CreateShaderResourceView<write_title_srv<write_placed_texture_view<proxy_create_placed_view_x<proxy_slot<70>, on a title thread during the story load (16,808 registered images).Change
title_texture_gonecheckst_in_title_textures, which is set exactly while a thread is inside the registry holdingtitle_texture_mutex(InTitleTextures). There, the entry only stops naming the resource (resource = nullptr, no erase, so no iterator of a caller walkingtitle_texturesis touched), and(resource, address)goes totitles_gone.drain_titles_goneremoves those entries and their GPU placements with the mutex taken normally, right afterwrite_placed_texture_view's registry block and afterrefresh_title_texturesunlocks.place_title_viewtreats an entry without a resource as absent.Outside the registry nothing changes.
Tested
gta6rt.execross-built (clang-cl 20 + xwin) from this branch's commit onmain0d80bc5df.c7e82e26ewith local changes, and0d80bc5dfexactly as in this branch) ran to the world start (36,000-40,480 registered images) without it. They end on the known world-start device loss, which is unrelated. The race needs a slot-70 view overwritten while it holds the last reference, so one run without the abort proves little on its own; six do not prove it either, but the abort did not come back.std::system_errorout ofCreateShaderResourceViewrather than an abort.AI-assisted: yes (Claude Code).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.