mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:05:53 +01:00
[PR #2267] d3d12: show a staged slot-70 texture only after its first upload (RT-TITLE-TEXTURE-SHOW-AFTER-UPLOAD) #2271
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#2271
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/2267
Author: @Tyrannys
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:rt-title-texture-show-after-upload📝 Commits (1)
7fa9385d3d12: show a staged slot-70 texture only after its first upload (RT-TITLE-TEXTURE-SHOW-AFTER-UPLOAD)📊 Changes
3 files changed (+100 additions, -2 deletions)
View changed files
📝
runtime/CMakeLists.txt(+4 -0)📝
runtime/shims/d3d12_vulkan_device.cpp(+26 -1)📝
runtime/test/d3d12_existing_heap_test.cpp(+70 -1)📄 Description
Claimed in the coordination issue as:
RT-TITLE-TEXTURE-SHOW-AFTER-UPLOAD(https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7185889059)What and why
A slot-70 texture the layer makes itself (
make_title_texture,TitleImageOrigin::streamed) and fills through the staged upload (TitleImageUpload, no host image copy for it) had its T#s bound in the bindless set from its first view on (register_bound_textureat creation, tracker layoutUNDEFINED). Its first upload runs later:LEONIDA_TITLE_FILL_ASYNC=1: the view queues the fill for the worker and writes the descriptor at once;write_staged_title_imagetiming out on pending present work).In that window a shader sampling the T# reads an image that was never written and is still
UNDEFINED, and a draw on another queue can run while the upload'sUNDEFINED -> TRANSFER_DSTbarrier rewrites it (TitleImageUpload::submitmakes only later submissions on other queues wait for it). Reading an uninitialised image with compression metadata is the kind of thing that can fault on some GPUs.Fix: such a texture keeps its T#s pending (
pending_image_keys; they read the fallback at index 0, as apending_streamtexture's already do) untilpublish_streamed_texture, whichfill_title_textureand the fill worker'sfill_unlockedcall right after the first upload has been submitted. The upload already orders every later submission behind it (image barrier on its own queue, timeline-semaphore wait on the others), so any draw that can see the image sees it uploaded. Memory is still bound at creation; only the descriptor waits. No CPU or device waits are added.LEONIDA_TITLE_SHOW_AFTER_UPLOAD=0restores the old behaviour for A/B runs.Not changed: placed (slot-133) staged images and host-copy images (those are zero-filled in
GENERALat creation).Idea from codec-d/cool_fox
docs/findings.md("a slot showed it before its upload had run",VICTORY_SHOW_AFTER), idea only, no code taken.Overlap note: #2240 (RT-TITLE-TEXTURE-MAP-GEN) also touches the TitleTexture path (
title_texture_readable) and adds a case tod3d12_existing_heap_test.cpp. The logic does not overlap (this PR changesResource::create_textureand the fill worker); the test file may need a trivial merge inmain().Tested
d3d12_title_show_after_upload(d3d12_existing_heap_test --title-show-after-upload): on a device without host image copies, withLEONIDA_TITLE_FILL_ASYNC=1and a new test knobLEONIDA_TITLE_FILL_DELAY_MS=500(slow fill worker), writes a slot-70 view of readable synthetic pages and checks the T# has no bindless entry before the upload and has one after it. Passes with the fix; fails withLEONIDA_TITLE_SHOW_AFTER_UPLOAD=0(the old behaviour: "the T# names the image before its upload"). Also passes withLEONIDA_VK_VALIDATION=1(no validation errors; the Khronos layer reports objects still alive atvkDestroyDevicein this mode, with or without the fix, because the retired test texture is released by the 3 s retirement sweep, after the test ends).Synchronization validation cannot see a bindless read of an
UNDEFINEDimage, so the test checks the ordering through the bindless table instead.d3d12_existing_heap,d3d12_existing_heap_no_write_watch,d3d12_existing_heap_write_watch,d3d12_host_prefix,d3d12_mapped_plane_async: pass.ctest -j 4while a boot ran on the same GPU: 472 of 478 passed. 4 of the 6 failures were timeouts/flakes under that load and pass when rerun alone (xs_proxy_mock,d3d12_queue_wait_timeout,d3d12_queue_list_type,d3d12_sparse_queue_family_contract).xbox_present(present VkResult -11) andd3d12_set_descriptor_heaps(line 353,recorded_commands) fail the same way withupstream/main'sd3d12_vulkan_device.cppbuilt in the same tree, so they are not from this change.GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 621.01, Windows 11
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.