gpu, shader: a guessed pixel program's user SGPR count from its register image (#432) #455
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!455
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-451"
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?
@lautarocherro on GitHub · 2026-11-27 20:14 UTC · original
lautarocherro:fix/ps-user-sgprs-from-image→main· +156 −31 · 4 files · 1 commits · merged 2026-11-28 00:28 UTCWhat this changes
Refs #436.
A guessed pixel program's user SGPR count now comes from its register image.
SPI_SHADER_PGM_RSRC2_PS. ItsUSER_SGPRfield (bits 1-5) is the word at 0x3c when the image's word 1 is 4, and at 0x50 when it is 6 (graphics::ps_user_sgprs). The word 0x14 bytes later has the same field.COMPUTE_PGM_RSRC2(constants_to_the_end). Without a count, your guess fromba51b833stays: as far as the program reads on entry.effdd754ccbf3efd), which @alexballvideos-netizen found is the only writer of the 2560x1440 picture (#258), reads its b500 as s9, s10 and s12. Its image gives 13 user SGPRs. On main it is refused as "a hardware SGPR input" (s12).Not covered: 7 more pixel programs refused as "a hardware SGPR input" read their real primitive mask (s17, which the image confirms) for more than M0. That is a different problem.
How it was tested
cargo test -p victory-shader -p victory-gpu -p xtask(arm64, with the Metal Shader Converter): all pass. New tests:graphics::tests::the_pixel_user_sgprs_are_read_from_the_register_image_by_its_kindgraphics::tests::a_pixel_programs_last_root_constants_reach_its_register_images_user_sgprs: the upscale program's shape (reads s9, s10 and s12). Without the count it is refused as "a hardware SGPR input"; with 13 its constants take s9 to s12 and it translates, also through the container.-D warnings, andcargo xtask policy: pass.b998bb65, each pixel container rebuilt with its image's count (what the host now does at pipeline creation; 9,991 of 10,001 have an image, none disagree),tools/corpus/compare.shagainst main:effdd754ccbf3efd,6ceb02f77b5024e6,c371ae91d6e36c4a.616aee4a0258dad2reads s13 as a number. On main its primitive mask was guessed at s11, so s13 was above the initialized SGPRs and read 0. Its image gives 15 user SGPRs, so s13 is now the fourth dword of its root constants (s10 to s14).b998bb65against this branch with the same settings (M5 Pro, 48 GB, macOS 27.2.1). Both reached the time limit with no GPU errors.7a7f9ab1d7449a22, pixeleffdd754ccbf3efd) is refused, and 45 "draws dropped" lines name it.781c6db63689ba78here, because the container now carries the count. One draw is dropped, 0.7 s after its first bind, while the pipeline was still being built (it was ready 11.7 s later); none after that, for the last 80 s of the run.3a0627643418e45d,6856b09fdb1de38b,c19f3a46d6c1e89b,cf1751613af42af9), which is #419. Their pixel programs translate. The primitive-mask case above (8cb18f43378f99c9) was bound only in the main run.Checklist
VICTORY_*variable and documented (none)