Repository navigation
GPU: card copies of title buffers keep their room from the textures picked by index (VICTORY_CARD_RESERVE=1) - #723
LeonardoS11 wants to merge 1 commit into
Conversation
…icked by index (VICTORY_CARD_RESERVE=1) A title buffer's card copy is made the first time the buffer is used, and only while the card is under four fifths of its budget; it is not tried again. Since textures picked by index are made earlier (310c6eb), they fill the card to their share first, every big buffer used after that stays in the PC's memory, and what shaders write to it is looked for on the CPU: 600-780 MB a frame against 24 with the copies on the card, and frames of 520-590 ms where they were 270. With the switch the textures leave room for the copies not made yet (the most VICTORY_CARD_BUFFERS_MB allows, less the copies alive), and a copy may take the card up to the textures' share instead of four fifths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
A correction to the "Picture" section above, after more launches: on this 12 GB card the switch does cost picture. Counting the first room's walls at 295 s:
So it is not this change in particular: whenever the big buffers get their copies on the card (about 940 MB) and the frame time halves, the walls' textures no longer fit ("textures picked by index: the card has no room for more; they wait"), and whenever the textures win, the buffers stay in the PC's memory and the frame time doubles. On 12 GB the two do not fit together as things are; the switch only chooses which side loses. c96b4f2 was on the fast side too, and had the walls missing in 2 of 3 launches here. That makes the "known" line of 310c6eb the real lever for both — more than half of the texture memory on the card being held for levels the title has not loaded yet. I would keep this PR as an opt-in for now, not a default. (Launches and screenshots by me on the RTX 3080 Ti above; counted and written with Claude Code.) |
|
Closing: 8dd30ab brought the same thing as |
What
Since 310c6eb the first room runs at about half the frame rate on an RTX 3080 Ti (12 GB): 540–660 ms a frame where c96b4f2 gave 270–330. This PR adds
VICTORY_CARD_RESERVE=1(off by default), which brings it back to 275–293 ms.Why it got slower
shadow.rs,card_for), and only while the card is under four fifths of its budget. It is not tried again.VICTORY_TEXTURE_ROOM_PERCENT(90).The per-frame lines show it (plain 310c6eb, same scene, 300 s runs):
VICTORY_TEXTURE_BUDGET_MB=6000VICTORY_TEXTURE_ROOM_PERCENT=75VICTORY_REUPLOAD_WHEN_FULL=0VICTORY_CARD_RESERVE=1So a lower texture budget works around it, the percentage does not (the rest of what is on the card is already past four fifths), and neither
VICTORY_REUPLOAD_WHEN_FULL=0nor #676 changes it.The change
With
VICTORY_CARD_RESERVE=1:resource::roomcounts as used the room of the card copies not made yet: whatVICTORY_CARD_BUFFERS_MBallows, less the copies alive (about 1 GB with the defaults). Textures picked by index stop that much earlier.card_fortakes a copy while the card is under the textures' share instead of four fifths, since the reserve keeps that room for it.The rule is a small pure function,
under_share(budget, used, reserve, percent), with a unit test.Why it is a switch, and what I would suggest
It is off by default because of three things I have not measured:
On a 12 GB card it is a clear win, so on by default looks reasonable to me, perhaps with the reserve capped (a tenth of the budget, say) or dropped once the world has loaded. I leave that to you; a number from an 8 GB card would settle it.
Picture
I cannot show that the picture is unchanged, because the picture of 310c6eb is not stable here from launch to launch. Of 6 launches of plain 310c6eb with no switches, the first room's walls were missing in 1 and the chain-link mesh in the window in 1. The 3 launches of this PR's executable (two with the switch, one without) all had the walls missing, and so had the plain 310c6eb launches with the texture switches of the table, which ran in the same hour. So I see no difference that follows the switch, but 3 launches are too few to say so firmly.
Tested
diagbuild withdiagnostics, base 310c6eb.cargo test --workspace: 511 passed, 0 failed, 9 ignored (on the GPU above). The new test isresource::tests::the_reserve_for_card_copies_counts_as_used.No title data in this PR: counts and times only.
🤖 Generated with Claude Code