mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:25:52 +01:00
[PR #1705] d3d12: the every-byte hash of a mapped title texture reads write-combined memory through a streaming copy (RT-TITLE-HASH-WC-STREAM) #1719
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#1719
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/1705
Author: @DadaCap
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:title-hash-streaming📝 Commits (1)
abe3f20d3d12: the every-byte hash of a mapped title texture reads write-combined memory through a streaming copy (RT-TITLE-HASH-WC-STREAM)📊 Changes
2 files changed (+61 additions, -1 deletions)
View changed files
📝
runtime/shims/d3d12_vulkan_device.cpp(+11 -1)📝
runtime/test/d3d12_existing_heap_test.cpp(+50 -0)📄 Description
Claimed in the coordination issue as: RT-TITLE-HASH-WC-STREAM (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7157390683)
What and why
refresh_title_textureshashes every byte of a mapped title texture of up to 4 MiB each sixth pass (every_byte()), with ordinary loads straight from the title's pages. In a real boot those pages are write-combined, and ordinary loads from write-combined memory are not cached;copy_guardedin the same file says so and reads them with MOVNTDQA for that reason. The hash did not.Measured on the intro (a temporary timer around
hash_guarded, not in this PR): one every-byte hash takes 36 ms on average and up to 78 ms over 4,096 KiB, so about every sixth pass spends one to two frames of a title that paces itself for 30 Hz. The title then presents 24 frames a second, the launch movie's sound stutters and its picture jumps ahead and back.The change: when the texture's memory is write-combined, the every-byte hash reads it through
copy_guarded's streaming copy into the scratch buffer the fill of the same texture already uses, and hashes the copy. Ordinary pages and the sampled hash are untouched. 12 lines.Measured
Native Windows 11, RTX 5080 16 GB, NVIDIA 621.24, 64 GB, own 1.0.2.1, MSVC RelWithDebInfo with SDL3. Tree for both columns:
main3f81d46ac+ #1558 + #1631 + #1694 (without #1694 this machine does not get past the landing screen).LEONIDA_ARENA_MB=2048 LEONIDA_FRAME_PACING=1 LEONIDA_PRESENT_NO_TEAR=1, keyboard pad with A every 5 s from 30 s, an existing save.title texture hash timeprinted by the runtime, intro and landing screenIn the "before" window all 1,151 hashes were of write-combined memory. The two mapped textures there are 2048x2048 and 1024x1024, format 65.
Tested
d3d12_existing_heap_test: a mapped 1024x512 R8 plane (above 256 KiB, so hashed by samples, and under 4 MiB, so hashed in full each sixth pass) in ordinary pages and in write-combined ones. One byte is changed 1,000 bytes into a page, where the sampled hash does not look, and must reach the GPU within 14 submissions. Both pass.changed == 1.d3d12_existing_heap,d3d12_existing_heap_no_write_watch,d3d12_existing_heap_write_watchpass on the same GPU.Not done, not tested
copy_guarded's streaming path is the existing one.Counters, switch names and timings only; no game data. AI-assisted (Claude Code).
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.