Skip to content

d3d12-gpu: writes kept for a one-shot bake are compacted, not dropped - #3048

Open
Kal0s-design wants to merge 1 commit into
ProjectLeonida:mainfrom
Kal0s-design:fix/bake-writes-keep-coverage
Open

Kal0s-design wants to merge 1 commit into
ProjectLeonida:mainfrom
Kal0s-design:fix/bake-writes-keep-coverage

Conversation

@Kal0s-design

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: D3D12-GPU-BAKE-WRITES-KEEP-COVERAGE (#2570 (comment))

What and why

texture_slots_page_written in d3d12/crates/leonida-gpu/src/descriptor/host.rs keeps the physical-page writes it does not make due in the heap's bake_page_written, for the next one-shot decoration/ped bake. Past 16,384 ranges it dropped the lowest of them (drain after join's sort), so textures written there kept their old bytes through the bake. DirectStorage can finish many batches between two bakes.

The change: the ranges are made fewer with the existing compact (neighbours joined, every changed byte still covered), as the pending texture changes already are, in a small retain_bake_writes. Rebased on #2852 (writes kept per heap).

This ports the bake-writes part of TaynanGT's fix from the sibling VIctory tree (TaynanGT/Vice-Tay af7a9ed, GPL-3.0), credited as co-author.

Tested

  • New test descriptor::host::tests::bake_writes_keep_every_change_across_batches: three batches of 32,768 disjoint ranges each; after every batch at most 16,384 are kept and every changed range is still covered by one. With main's drop in place it fails (batch 0: 16,384 ranges no kept range covers); with the change it passes.
  • cargo test -p leonida-gpu --lib: 669 passed, 0 failed, 59 ignored.
  • cargo clippy -p leonida-gpu --lib --tests: no warning in the changed lines.
  • Windows only, unit tests; the title wasn't run.

GPUs tested: n/a (CPU unit tests)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

texture_slots_page_written keeps the physical-page writes it does not
make due for the next one-shot decoration/ped bake. Past 16,384 ranges it
dropped the lowest of them (drain after the sort by join), so the
textures written there kept their old bytes through the bake; DirectStorage
can finish many batches between two bakes. The ranges are now made fewer
with compact (neighbours joined, every changed byte still covered), as
the pending texture changes already are, in retain_bake_writes.

After TaynanGT's fix in TaynanGT/Vice-Tay (af7a9ed, its bake-writes part).

Co-Authored-By: TaynanGT <157688638+TaynanGT@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant