Translate texture size queries at a descriptor index (#407) #549
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!549
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-545"
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?
@Olima34 on GitHub · 2026-11-28 02:44 UTC · original
LakshanSivakumar:fix/image-size-query-as-image→main· +864 −118 · 8 files · 9 commits · closed without mergingRefs #411
A four-dword descriptor load at a whole descriptor index whose readers keep only size fields is lowered as a texture size query, not a buffer read, so the 723 programs refused with "a view address field the table gives 0: a buffer's stride or swizzle" translate. The null test of dword 1 is answered through bit 0 of the table's dword 1 (a guess, documented); a buffer entry gives 0 there, an image entry 1.
A program that both samples a descriptor and reads its tail dwords (5-7) as data — the console compiler re-loads a descriptor to size from it — is built those dwords from the view instead of being refused: the console's
SQ_IMG_RSRC_WORD5-7, i.e. the array pitch of a writable view (1, 0 otherwise), the last level (MAX_MIP) and the tuning value 4 (PERF_MOD), with the compression fields 0 and 0 for a null descriptor.A descriptor's address words read as data are served from the host's view addresses: dword 0 of both kinds (the view's address in title memory, the BVH's SRV the family was found with), and a buffer's dword 1 (its address's high half with the binding's stride above it, which the programs that rebuild a resource from those words expect). The table entry becomes 32 bytes, as a heap record is; a null entry reads all eight dwords as 0. Continues the same chain: serving a field uncovers the next one's readers.
Offline corpus, each change against its own parent on this branch's tree: the size-query change alone translated 723; the tail-dword change adds 11 (3 compute, 8 pixel); the address-word change adds 48 (39 blocked on a buffer's dword 0 — 21 pixel, 18 vertex —, 8 on a buffer's dword 1, one on a lane-mask join behind a descriptor read), with 0 regressions and 0 changed outputs anywhere. Totals: 1,532 refused / 2,597 translated before, 1,484 / 2,645 after. The families this PR opens are all at 0.
Tests: lowering (accepted shapes, the kept refusals, the tail dwords), and on the host an image, a writable view, a null entry, a buffer's two address words and a write with the values checked on hardware and WARP. Clippy (Windows target) and
cargo xtask policyclean,cargo test -p victory-shadergreen.Not verified on the game yet; a world run follows.
@AnastasisKon on GitHub · 2026-11-28 18:25 UTC · original
CI diagnosis (run 46109430075,
checkjob, Windows): the only failure isdescriptor::host::tests::a_texture_view_gives_its_image_descriptor_size_fields(crates/victory-gpu/src/descriptor/host.rs:2100) — 315 passed, 1 failed. That module is#[cfg(windows)], so it can't be reproduced on a Mac locally; I worked it out statically instead.On the head
bc3f2966,image_words(descriptor.rs:979) now takesatand returns[u32; 8]in the new layout — word 2 =(w>>2 & 0x3FFF) | (h & 0xFFFF) << 14, word 3 =0xFAC | first<<12 | last<<16 | ty<<28, word 5 =unordered | (count-1)<<4 | 4<<20. The test still asserts the previous layout. For its first case (1000x600, view levels 2-4, at 0x1234_5678_9ABC) the code correctly produces exactly what CI printed asleft:So the fix is to update the expected array in that test to the new layout (the later
words[3]assertions still hold, since the 0xFAC word is index 3 in both layouts).One more thing for when you rebase: #581 (approved, closes #577) fixes the UAV
MipSliceread fromd[4]tod[2]inimage_wordsand updates this same test's unordered line (let uav = [0, 4, 3, 0, 0, ...]). Taking that hunk will keep this test consistent with the fix. And #567 (approved) covers the remaining size-query programs of #411 on current main, in case any of this branch is already landed there via 5cb68393/3a435b56.@Olima34 on GitHub · 2026-11-30 09:17 UTC · original
Closing: this landed in BareMetalVI as 0c263675 ("Translate texture size queries at a descriptor index (#411)"). The project lives at BareMetalVI/BareMetalVI now.
Pull request closed