D3D12.X: title textures keep per-page hashes and hash only written pages #2385

Open
opened 2026-11-25 17:43:22 +00:00 by KOLESNiii · 0 comments
KOLESNiii commented 2026-11-25 17:43:22 +00:00 (Migrated from github.com)
Contributor

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-25T17:43:22Z.


Part of #2390.

When any page of a kept-in-step title texture comes back from the write watch, upload_all reads and hashes the whole texture to see if it changed (content_hash(&title_bytes(va, size)), crates/xcl/src/hle/d3d12x/title_textures.rs:1099-1107 on main 3f4495a). A 16 MiB texture with one written 4 KiB page is hashed in full. Most of the time the result is "unchanged". In my title's menus (RTX 2070 SUPER, main 3f4495a), the "uploads left out" count reached 1,024 at 39 s, 2,048 at 43 s and 4,096 at 52 s. Each of those was a full-texture hash that changed nothing.

Proposal: keep a hash per page for each texture (or per 64 KiB, to match the tiles), as sparse.rs already does for its chunks. Hash only the pages the write watch reported, compare them with the stored hashes, and record which pages really changed. #2396 uses that list.

Test: writing a page with the same bytes does not upload; writing a different byte in one page uploads and updates only that page's hash. Remapping (#504) still forces an upload.

Found by code reading with Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:ivall/xcl:issue:6610266883 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/2395). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-25T17:43:22Z. --- Part of #2390. When any page of a kept-in-step title texture comes back from the write watch, `upload_all` reads and hashes the **whole** texture to see if it changed (`content_hash(&title_bytes(va, size))`, `crates/xcl/src/hle/d3d12x/title_textures.rs:1099-1107` on `main` 3f4495a). A 16 MiB texture with one written 4 KiB page is hashed in full. Most of the time the result is "unchanged". In my title's menus (RTX 2070 SUPER, `main` 3f4495a), the "uploads left out" count reached 1,024 at 39 s, 2,048 at 43 s and 4,096 at 52 s. Each of those was a full-texture hash that changed nothing. **Proposal:** keep a hash per page for each texture (or per 64 KiB, to match the tiles), as `sparse.rs` already does for its chunks. Hash only the pages the write watch reported, compare them with the stored hashes, and record which pages really changed. #2396 uses that list. **Test:** writing a page with the same bytes does not upload; writing a different byte in one page uploads and updates only that page's hash. Remapping (#504) still forces an upload. *Found by code reading with Claude Code (Claude Opus 5.5).*
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl#2385
No description provided.