Skip to content

Keep texture refresh notifications through streaming bursts - #896

Open
gomeaw wants to merge 3 commits into
fxceless:mainfrom
gomeaw:fix/keep-texture-changes
Open

gomeaw wants to merge 3 commits into
fxceless:mainfrom
gomeaw:fix/keep-texture-changes

Conversation

@gomeaw

@gomeaw gomeaw commented Nov 25, 2026 •

Copy link
Copy Markdown

Problem

A bindless texture that has finished uploading relies on mapping and storage-write notifications to become due again. When either notification buffer reached 32,768 entries, the next nonadjacent notification cleared every earlier entry. A texture could keep its old upload even after the layer had recorded a change to its memory.

Change

Merge touching and overlapping ranges before looking up affected slots. When the buffer fills, reclaim at least 4,096 entries before appending the next notification. If merging overlaps is insufficient, join just enough neighboring pairs to make room. This preserves coverage and avoids repeatedly sorting the full buffer under the producer lock when merging overlaps would free only one or two entries. The texture pass may check additional slots in those gaps. Diagnostics count the gaps joined at capacity.

Verification

  • The Windows D3D12 software-adapter comparison tested the patch applied to upstream 0b0074e. The original code loses the earliest notification. With the patch, the already-uploaded slot becomes due again through both the remap and completed-write paths. The tests also check coverage across 65,536 disjoint changes and verify that a nearly disjoint queue leaves room after compaction. All 22 descriptor tests passed. Windows comparison
  • An optimized synthetic CPU benchmark on Apple M4 used the production range and slot-lookup helpers. For 16,384 notifications covering 512 address ranges, remap collection and lookup went from 1.12 ms to 0.19 ms and completed-write collection and lookup went from 0.96 ms to 0.19 ms. Both selected the same slots. A 24-notification case added about 0.1 µs.
  • A separate stress case started with 32,767 disjoint ranges and one duplicate already queued, then alternated 256 notifications between two existing ranges. The median CPU time across 31 samples fell from 80.55 ms on the first PR revision to 0.33 ms with the compaction headroom. Both preserved coverage.
  • The asset-policy check passed. Cross-target Clippy completed for the GPU crate in both feature configurations with existing upstream warnings.

Issue #821 shows why a completed-write notification can matter to an already-uploaded texture. #606 handles a remap of a staged texture, and #221 and #733 optimize the later selection of due uploads. This PR covers the earlier loss of notifications at capacity. The frequency of that overflow in gameplay and the effect on frames remain unmeasured.

AI-assisted with Codex. All test and benchmark inputs were synthetic.

Merge overlapping changes before looking up placed views. If the whole pending buffer is disjoint, fold neighboring intervals to preserve coverage within the existing cap.
Merging just one overlap at capacity meant a producer could sort the entire queue again for each following notification. Free one eighth of the queue when exact coalescing leaves less room, joining only enough pairs to reach that target.
e4glevlr added a commit to e4glevlr/victory-fork that referenced this pull request Nov 25, 2026
fxceless#917, fxceless#823 xmem)

- fxceless#916: only mark title memory as written for SLOT_MEMORY shaders that can store by address
- fxceless#896: coalesce pending texture change ranges instead of clearing at 32k capacity
- fxceless#956: add opt-in VICTORY_HEAP_RECHECK_EVERY and VICTORY_HEAP_RECHECK_WHOLE_MB (default off)
- fxceless#917: add opt-in VICTORY_AMBIENT stand-in for CS_ScreenProbes_TemporalResolve (default off)
- fxceless#823 (HLE): coalesce map_alias contiguous runs into single section views
akus-elinius pushed a commit to akus-elinius/victory-fork that referenced this pull request Nov 25, 2026
…#896)


PR: fxceless#896
Head: b1c3be1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Filip722

Filip722 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

I re-ran the burst case on current main 52ac4ec. The unpatched test lost the earliest change. With this PR applied on the same Bazzite 44 and GE-Proton11-14 setup, the physical RTX 5060 Laptop test kept the earlier range and made the already-uploaded view due again through both remaps and completed writes. The disjoint-coverage and compaction-headroom tests also passed.

Updated source-only review branch at f918253a348dea41af2214689a91ee36687e290f. It includes #1357's existing test-file split for the inherited asset-policy size failures and preserves the newer completed-write diagnostics. Windows-target GPU Clippy with warnings denied and the full asset policy passed. Review branch

Assisted by Codex (GPT-6.2-Sol High).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants