mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:05:53 +01:00
[PR #980] [MERGED] vulkan: say once when the device is lost (RT-DEVICE-LOST-LOG) #1016
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#1016
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/980
Author: @CLHelper
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @QemmHD
Base:
main← Head:runtime/device-lost-log📝 Commits (1)
5c1f77evulkan: say once when the device is lost (RT-DEVICE-LOST-LOG)📊 Changes
2 files changed (+37 additions, -6 deletions)
View changed files
📝
runtime/src/vulkan_backend.h(+21 -4)📝
runtime/test/vk_fence_dispatcher_sync_test.cpp(+16 -2)📄 Description
Claimed in the coordination issue as: RT-DEVICE-LOST-LOG (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7137184715)
What and why
When the layer's Vulkan device is lost,
VulkanContext::mark_device_lost()and the fence dispatcher's twoVK_ERROR_DEVICE_LOSTpaths only set the device's lost flag. From then on every fence readsUINT64_MAXand device calls returnDXGI_ERROR_DEVICE_REMOVED, so the title takes its own device-removed path, and nothing in the log said that the device went first.On the retail boot that path is easy to misread. The title's frame wait gets the address of a fence's completed value (fence slot 12), spins on it, and when it reads
~0it calls a fatal routine that ends in anint3atgame_scarlett_master.exe+0x2474606(static reading of my own 1.0.2.1 copy: the wait at+0x4fb0ad0,call +0x2474870when the value is-1, the routine at+0x2474500). WithLEONIDA_SKIP_INT3the title then runs on into reads of garbage addresses. In five runs of @DadaCap'sboot-prototypeon my machine, thatint3and the access violations after it were the only visible stop. The fence values come fromGetCompletedValue. Correction after review elsewhere: I first wrote here that the layer answersUINT64_MAXonly once its lost flag is set. That is not the whole story: on NVIDIA a lost device can first show up asvkGetSemaphoreCounterValuereturningVK_SUCCESSwith a counter ofUINT64_MAX, and then the flag is never set and this pull request alone prints nothing. #1028 (which builds on this one) catches that case and adds the driver's fault report; @DesertGamer measured the same path on a fifth machine (#14).The change (
runtime/src/vulkan_backend.h, plus its test):set_device_lost(flag, where)sets the flag with an exchange and, the first time for a device, prints one line on stderr:[rt] vulkan: the device was lost (<where>); its fences now read UINT64_MAX and device calls return DXGI_ERROR_DEVICE_REMOVED.mark_device_lost()uses it, with an optionalwhere(default: a Vulkan call returnedVK_ERROR_DEVICE_LOST); every existing caller is unchanged. The dispatcher's two direct stores use it with their ownwhere(vkWaitSemaphoresandvkGetSemaphoreCounterValuein the fence dispatcher).device_lost_reportscounts the lines said in the process, for tests. Nothing else changes: the flag, the dispatcher wake-up and every return value behave as before.Tested
Native Windows 11, MSVC 19.44, Ninja, RelWithDebInfo, on
maina28927849(merges cleanly on42d705c85), RTX 4060 Laptop, NVIDIA 576.80, Vulkan SDK 1.4.363:vk_fence_dispatcher_sync_test: case 3 now also checks one line frommark_device_lost()and none from a second call or from the dispatcher waking on the same flag; case 4 checks one line from the dispatcher'svkGetSemaphoreCounterValuepath and none from a latermark_device_lost(). Passes.d3d12_fence_device_lost_counter_testandd3d12_cross_device_validation_test, which lose devices on purpose, pass; the first prints the line once for each device it loses.vk_fence_dispatcher_sync_testat case 3.gta6rtbuilds.GPUs tested: NVIDIA GeForce RTX 4060 Laptop GPU, driver 576.80, Windows 11 (the three tests above).
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.