Shaders: model the ES to GS handoff, check the ES half too (#312) #373
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/fxceless--victory-fork!373
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-373"
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?
@Revens2 on GitHub · 2026-11-25 00:02 UTC · original
Revens2:fix/issue-312→main· +1622 −13 · 9 files · 6 commits · openStep 3 of #138, for #312. Stacked on #311 (#367), itself on #309: the diff here includes theirs until they merge; the commit of this step is the last one. Base is
mainbecause the stacked branches are not in this repository.What is in it
handoff::es_record: from the ES program, the record it writes to LDS (ds_write_b32..b128at one base address with constant offsets: dwords, VGPRs, highest dword), whether ans_barrierprecedes the handover, and a refusal of an ES half that does not leave throughs_setpc_b64, reads or does atomics on LDS, writes at two bases, off a dword, or writes nothing.handoff::vertex_reads: from the GS program, its reads of input vertices: an address that is the low or high half of v0 or v1 (v_and_b32 0xffff,v_lshrrev_b32 16,v_bfe_u32, scaled and offset) is vertex 0, 1 or 2's record. A fourth vertex is refused; reads at other addresses are the GS half's own output memory and left to the output step.handoff::handoffchecks the GS half reads only dwords the ES half writes.emit::merged_halvesis the pairing entry point: pair, ES half traced / raised / structured with the merged layout, then the handoff;translate_merged_gsgoes through it before stopping atGS emit.victory translate: ES programs get their ownesline (traced, raised, writing a record, largest record) and no longer fall out of the batch silently.What the LDS in a graphics stage comes to (reading
emit/lower.rs, not tested): LDS exists in the lowering only where a stage declares groupshared memory (compute, mesh). The handoff does not need it: the ES records become vertex outputs, the GS reads become input loads, and the barrier is the stage boundary. That is the model the next step emits.Tested
merged_halvesandtranslate_merged_gs.cargo build --workspace --locked,cargo test --workspace --locked --no-fail-fast -- --test-threads=4: 523 passed, 0 failed, 7 ignored (Windows).Not tested / assumed
victory translateover the title, which I did not.AI use
Written with Claude Code (Claude Sonnet 5.5). The tests are synthetic programs; no title shaders or game files were read.
@Revens2 on GitHub · 2026-11-25 00:18 UTC · original
All four findings fixed in 9acd8f0 (with tests), on top of the #311 fixes (d8e53e1):
s_endpgmnow refuses the ES half (an ES half that does not hand over to the GS half); an end nothing reaches is ignored.v_bfe_u32offsets are read in five bits, so 48 is the high half like 16 and 32 the low half.EsRecord.barrieris true only when ans_barrierprecedes every reachable handover (must-analysis over the CFG); a barrier on one arm or in unreachable code does not count.victory translate: an ES half whose record analysis fails is now counted as a failure (ES record: ...) and listed with--list.Workspace build and
cargo test --workspace --locked --no-fail-fast -- --test-threads=4on the stacked head: 534 passed, 0 failed, 7 ignored.@Revens2 on GitHub · 2026-11-25 07:10 UTC · original
Rebased on main (
a26859f), stacked on #367; head now5386d73. No new conflicts.cargo build --workspace --lockedok;cargo test -p victory-shader -p victory-gpu --locked: 137 + 247 passed, 0 failed. Ready for another review pass.@Revens2 on GitHub · 2026-11-25 09:35 UTC · original
@codex review (head rebased on origin/main; earlier findings were addressed before the rebase)
@chatgpt-codex-connector[bot] on GitHub · 2026-11-25 09:35 UTC · original
Codex Review: Something went wrong. Try again later by commenting “@codex review”.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
@chatgpt-codex-connector[bot] on GitHub · 2026-11-25 00:02 UTC · original · edited 2026-11-25 09:35 UTC
Codex Review Summary: ❌ Failed
This comment shows the latest Codex review activity on this pull request.
We couldn’t complete this review. Comment
@codex reviewto try again.5386d73ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-25 00:08 UTC · original
On
crates/victory-shader/src/handoff.rsline 235 (outdated):If an ES CFG has one reachable
s_setpc_b64exit and another reachables_endpgmexit, this check succeeds, soes_recordandhandoffaccept a pair even though that branch never transfers the record to GS. Validate that every reachable terminal path hands off, rather than only requiring one indirect exit.Useful? React with 👍 / 👎.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-25 00:08 UTC · original
On
crates/victory-shader/src/handoff.rsline 152 (outdated):For a
v_bfe_u32with inline offset 48, this condition accepts the offset, but the branch below labels only exactly 16 as the high half. GFX10 masks BFE offsets to five bits (asemit/lower.rs::bfedoes withoff & 31), so 48 selects bit 16;vertex_readsthen attributes a vertex-1 read to vertex 0, which can make the handoff check validate the wrong record. Classify the masked offset or reject values other than 0 and 16.Useful? React with 👍 / 👎.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-25 00:08 UTC · original
On
crates/victory-shader/src/handoff.rsline 244 (outdated):If an ES CFG has
s_barrieronly in an unreachable block or on a branch that does not reachs_setpc_b64, this assignment still marksEsRecord.barriertrue. The returned record then incorrectly says the handoff path is preceded by a barrier; derive the flag from barriers that precede each reachable handoff instead of any barrier in the program.Useful? React with 👍 / 👎.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-25 00:08 UTC · original
On
apps/victory/src/translate.rsline 450 (outdated):When
es_recordrejects an ES program, thisif let Okdiscards the error. If resource, I/O, and structure checks pass, the later ES-onlycontinueskips emission too, sovictory translateleaves the invalid ES half out oft.failedand--list; record the error in the tally.Useful? React with 👍 / 👎.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.