Texture blocks: place the title's textures with tight alignment (from #306, alone on main) #459
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/lobomfz--VIctory-xmem!459
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-459"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@LOCKhart07 on GitHub · 2026-12-04 12:32 UTC · original
LOCKhart07:tight-textures-on-main→main· +451 −7 · 1 files · 2 commits · merged 2026-12-04 17:30 UTCOne commit from #306 (
9bba82d), taken out of the hardware ray-tracing stack and put on main by itself. It touchespool.rsonly, nothing of hardware ray tracing, and adds no switch.What changes
Every texture cut from a texture block was asked at 64 KiB, so each took a multiple of 64 KiB, and most of the title's textures are small.
Now a texture is asked with
D3D12_RESOURCE_FLAG_USE_TIGHT_ALIGNMENTwhere the host says it has it (D3D12_FEATURE_D3D12_TIGHT_ALIGNMENT, tier 1 or more), and its piece is the size at the alignment the host answers. A host without the tier is asked as before.This is not the earlier 4 KiB placement (
VICTORY_POOL_SMALL, removed after two device losses on 2026-11-25): that one asked at 4 KiB and, refused, asked again at 0; the flag is never refused. What those losses were was not proven.Checked on main
0fd7614cargo clippy --release -p victory-gpu --all-targetsforx86_64-pc-windows-msvc: 40 warnings, as on main; the one inpool.rsis on main too.pool::andcard_pool::tests under Wine 9.0: 10 passed, 0 failed. The machine has no card, so the two tests that place real textures (a_placed_texture_holds_its_heap,small_textures_placed_back_to_back_keep_their_own_bytes) had no device to place them on: their pass here says nothing.Measured, and what is not
The numbers in the commit message are from the stack, on an RX 9070 XT (RADV), 2560x1440, six minutes, against the run before it (not a pair): rounding 1,161 MB to 108 MB, texture blocks 64 to 56, slots held back for want of room on the card 152 to 0. There the new test compared 500 reads and none differed.
Not measured: a play of this branch alone on main, the new test on a card on this branch, and any card but the RX 9070 XT.
Generated by Claude Code
@Kal0s-design on GitHub · 2026-12-04 14:10 UTC · original
Checked
51704b2on native Windows with one NVIDIA desktop card and WARP.On this setup the change is inert. Both devices answer
CheckFeatureSupport(D3D12_FEATURE(54))with S_OK and tier 0, sotight()(pool.rs:958-970) is false, the flag is never added (pool.rs:988), and every texture is asked at alignment 0 and lands on a 64 KiB multiple exactly like main. The block it replaces asked at 0 twice on main (main pool.rs:963-969), so nothing is lost there. That also means the tight path itself never ran here. What I say about it below comes from reading the code, and the only run of it so far is the RX 9070 XT one in the description.The runtime does know both values. Feature 54 is accepted with a 4 byte struct and refused with 8, while 55 and 200 are refused. Flag 0x400 is taken with no debug message, while 0x200 and 0x800 are rejected as the video LUT flags and 0x1000 as unrecognized bits. The installed SDK header is too old to show either name, so this is the best check I had.
From the code
fills()drops render target, depth and UAV (resource.rs:1596-1598), and the caller also wantssample_count <= 1and no clear value (resource.rs:3062-3063). Block heaps areALLOW_ONLY_NON_RT_DS_TEXTURES(pool.rs:1011).info.SizeInBytesand aligned toinfo.Alignment.max(1)(pool.rs:997-998), andRanges::takerounds each start up to that alignment for that request (pool.rs:148-173). Neighbours with different alignments can't overlap, and I found no fixed 64 KiB outside the tests in pool.rs.Flags(pool.rs:938).reserved). Main does the same, so that's not new.OnceLockrather than per device (pool.rs:959). Harmless with one host device.Local probe (not pushed)
I made a device on each adapter with the debug layer on, asked
GetResourceAllocationInfoat 0, 4 KiB, 64 KiB and with 0x400, and then placed 13 eligible textures back to back in one heap using the PR's rule and again with the flag forced on.Both placements gave 13 of 13 placed with no debug messages and no device removal on either adapter. Three deliberately bad calls (a non-small texture at 4 KiB, a 64 KiB texture at offset 0x100, and a render target in the non-RT/DS heap) each returned E_INVALIDARG with a message, so the layer was listening. One side note is that a 64x64 UAV texture gets 16K at 4K on both adapters, so the reason UAV is kept out is
fills()and not the alignment rule. I didn't probe depth.Tests
small_textures_placed_back_to_back_keep_their_own_bytespasses on both adapters, with 500 reads compared and none differing. In the "tight flag" mode every kind came back 64 KiB at 64 KiB, so on Windows it repeats the alignment 0 mode. The WARP run hadVICTORY_D3D12_DEBUG=1set, but the test doesn't read the message queue, so treat it as a pass and nothing more.pool::filter (which also picks up card_pool) gave 10/10 against 9 on main, texture 11/11 with 3 ignored, and resource 15/16. The failure isbuffer_data_reaches_the_host_textureat resource.rs:4483 under 2 threads. It passes alone and fails the same way on main0fd7614.pool::gave 10/10, resource 16/16 and texture 11/11.One idea for tier 0 hosts. Main's comment meant to ask small textures at 4 KiB, but it set the alignment to 0 before the first ask, so it never did. On both adapters here the plain small-resource rule does work (the 4 KiB column above, e.g. BC1 64x64 at 8K instead of 64K), and the runtime refuses the textures that don't qualify. So a fallback that asks at 4 KiB when the tier is 0 and takes the 64 KiB answer when that's refused would give Windows hosts most of the saving too. That's a separate change though, not something this PR breaks.
From the Windows side there is no regression, because hosts that report tier 0 behave as main does. Whether tight placement is right on a host that reports tier 1 still rests on the RADV run.
AI-assisted: yes
github-bot referenced this pull request2026-12-04 17:15:51 +00:00