Skip to content

GPU: a skin bake's own sources are uploaded while the card's budget holds them, not only under the texture line - #1422

Open
Granite900 wants to merge 1 commit into
fxceless:mainfrom
Granite900:fix/bake-sources-budget
Open

Granite900 wants to merge 1 commit into
fxceless:mainfrom
Granite900:fix/bake-sources-budget

Conversation

@Granite900

Copy link
Copy Markdown

With VICTORY_BAKE_SOURCES=1, a skin-bake draw's own sources are uploaded only while resource::room() says yes. room() counts the room kept for buffer copies and render targets not made yet (up to 4.3 GB while a world loads) as used, and stops at 90 % of the budget. The bakes run while the world loads, so on a card far under its budget nearly every one of those uploads was refused, and the faces they bake came out black or blotched for the run.

There were two gates:

  1. bake_sources_pass asks room() before the upload: 106 skipped with the card at 6.7 GB of a 15.4 GB budget.
  2. The texture pass the upload runs in asks room() itself, at its start and every 32 MiB. With gate 1 opened, 309 of 336 waiting sources were still not made, and none of them were counted as skipped.

Change: both gates ask a new resource::within_budget(bytes) instead: what is in use, plus the draw's own VICTORY_BAKE_SOURCES_MB, under 95 % of the budget, the margin Dawn's D3D12 residency keeps. Nothing kept for copies not made yet is counted. =full, =count and every other texture upload are unchanged. 42 lines in draw.rs and resource.rs.

Measured on an RX 9070 XT (16 GB, driver 32.0.32029.2010), the café scene of the opening, diagnostics build, the test switch set plus VICTORY_TILES_SMALL_WHEN_FULL_MB=512 and VICTORY_TEXTURE_ROOM_PERCENT=96:

bake draws sampling a missing texture uploaded ahead skipped for room
=1 before 233 101 55 (63 MB) 106
=1 with gate 1 only 153 11 27 0
=1 with this change 189 0 83 (98 MB) 0

The card peaked at 12.7 GB of 13.9 GB. There was no device loss. The black-shirt case reported in #1264 was with =full and a 1 GB cap, and did not appear here.

What this does not fix: faces that stay black because their ordinary textures are never made for lack of room. With the change, one person in the café still had a black face, and 29,059 title textures had no host copy at the end of that run (14.0 GB). Black skin of that kind goes away with more room (VICTORY_CARD_WINDOWS_MB=512), at a cost in frame time and churn on this card.

Not measured: the frame-time cost. There is one run each way and the scenes differ, but the uploads are small (98 MB over the whole load).

Checks: cargo clippy -p victory-gpu -p victory --all-targets --locked -- -D warnings is clean. cargo test -p victory-gpu -- --test-threads=1 gives 237 passed with tiles::tests::card_wrote_failure_does_not_poison_card_mask skipped: it ends the process with an access violation on main as well (reported in #1416).

Builds on #1264 (UwUCammie).

AI-assisted (Claude Code); no game data.

🤖 Generated with Claude Code

…olds them, not only under the texture line

With VICTORY_BAKE_SOURCES=1 the upload before a skin-bake draw asked
resource::room, which counts the room kept for buffer copies and render
targets not made yet (up to 4.3 GB while a world loads) as used and stops
at 90 % of the budget. The bakes run while the world loads, so nearly every
such upload was refused on a card far under its budget (RX 9070 XT: 106
skipped at 6.7 GB of 15.4 GB), and the texture pass the upload runs asked
room itself again (309 of 336 sources not made once the first gate was
passed). A source missing at the bake is baked as nothing for the run:
black or blotched faces.

Both now ask resource::within_budget: what is in use plus the draw's own
bytes (VICTORY_BAKE_SOURCES_MB) under 95 % of the budget. =full is
unchanged. Measured on an RX 9070 XT (café scene of the opening): bake
draws sampling a missing texture 101 -> 0, 98 MB uploaded ahead of 189
bake draws, card peak 12.7 of 13.9 GB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bihanikeshav added a commit to bihanikeshav/victory-fork that referenced this pull request Nov 27, 2026
…y under the texture line

With VICTORY_BAKE_SOURCES=1 a skin-bake draw's own sources were uploaded
only while resource::room() said yes. room() counts the room kept for
buffer copies and render targets not made yet as used, so while a world
loads it refused most such uploads on a card well under its budget, and
the faces baked from them came out black or blotched.

Both gates (bake_sources_pass and the texture pass's room checks for a
bake draw's own run) now ask a new resource::within_budget(bytes): what is
in use plus the draw's VICTORY_BAKE_SOURCES_MB under 95% of the budget,
not counting room kept for copies not made yet. =full, =count and all
other texture uploads are unchanged.

Source: fxceless/victory-fork pull request fxceless#1422 (GPL-3.0)
fxceless#1422

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