Shaders: merged ES+GS stage reads its SGPRs, stops at "GS emit" (#138, step 1) #309
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!309
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-309"
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-24 23:29 UTC · original
Revens2:fix/issue-138→main· +617 −12 · 8 files · 2 commits · openStep 1 of #138 (the 195
an address in an SGPR that is no root parameterfailures are one merged ES+GS shader). This does not translate geometry shaders. It makes the GS half read the merged stage's SGPRs, so that failure stops hiding what is left, and it stops cleanly at a named error instead.What is in it
StageIo::Gs: the GS record is now tagged (its stage data is still not read), andio::raiseaccepts it: no exports, and the first two user-data dwords (s8, s9 of the merged stage) areInput::RuntimeTable, the pointer the issue found at user data 0/1, when the root layout puts nothing there.resource::track_merged(the merged layout of both halves), in a geometry program a load through that pair is traced to a newresource::RUNTIME_TABLEaddress (with the load's offset) instead of failing. It applies to the geometry stage only and only to dwords the merged layout leaves free; any other unbound SGPR pair, the same load in other stages, and a geometry program tracked on its own with plaintrackoremit::translatefail as before. A pointer whose high half was overwritten is refused.merged::pair_es_gs: pairs the ES program (vertex container) with the GS program (geometry container): ES and GS stages, same wave size, one meaning per user-data dword (the halves share the SGPRs; both halves' ranges of one table pointer are kept), merged root layout.emit::translate_merged_gs(es, gs)runs a pair through tracing and I/O raising.emit::emitrefuses a geometry program withGS_EMIT("GS emit");emit::translatenow takes a geometry container that far too (it used to say the container had no vertex, pixel, compute or mesh program).victory translate: geometry programs are counted on their owngeometryline (programs, resources traced, I/O raised, stopped at GS emit) and no longer appear in the failure list. The ES half they pair with is not in their container, so the line says user data 0 and 1 are taken as free (an assumption, not a pairing).Tested
translateandtranslate_merged_gstoGS emit.cargo build --workspace --locked,cargo test --workspace --locked -- --test-threads=4: 511 passed, 0 failed, 7 ignored (Windows, this branch on currentmain, after the review fixes).Not tested
victory translateover the title: not run, so the 195 moving from the failure list to thegeometryline is expected, not measured. Those programs may stop earlier on something else (structurisation, an instruction the translator lacks); that would show as a new failure reason.Still to do (not in this PR)
s_barrier,s_setpc_b64), GS input vertices.GS_EMIT/GS_CUT/GS_DONEas DXIL stream emits; LDS in general.Follow-up issues, one per step: #311 (stage data), #312 (ES half and LDS handoff), #313 (GS output and
GS_EMIT/GS_CUT), #314 (pipeline path). #138 stays open.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-24 23:45 UTC · original
Both review findings fixed in the new commit on this branch.
merged.rs):pair_es_gsnow keeps both halves' ranges when they list the same descriptor-table root parameter (same user data, SGPR count and root slot) with a different table offset or base register. A different root parameter or type on the same dword is still a conflict. New test:the_same_table_pointer_with_other_ranges_in_each_half_is_one_parameter.resource.rs): it is made only throughresource::track_merged, i.e. with the merged layout of a pair (translate_merged_gs), no longer by plaintrack. A geometry container on its own (emit::translate) fails again with "an address in an SGPR that is no root parameter", since its ES half could own those dwords.victory translatecannot pair containers, so it still tracks geometry programs withtrack_merged, and its geometry line now says the ES half is unpaired and user data 0 and 1 are taken as free. New tests:the_runtime_table_needs_the_merged_layout,a_geometry_container_alone_does_not_trace.Tested:
cargo build --workspace --locked,cargo test --workspace --locked -- --test-threads=4: 511 passed, 0 failed, 7 ignored (Windows). Not run in game, not measured over the title.Written with Claude Code (Claude Sonnet 5.5).
@Revens2 on GitHub · 2026-11-25 07:10 UTC · original
Rebased on main (
a26859f), head now90ec93b. One conflict (the doc comment oftranslate), resolved by keeping both texts. The two commits and the review fixes are unchanged in meaning.cargo build --workspace --lockedok;cargo test -p victory-shader -p victory-gpu --locked: 137 + 230 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-24 23:29 UTC · original · edited 2026-11-25 09:39 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
90ec93bℹ️ 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-24 23:33 UTC · original
On
crates/victory-shader/src/merged.rsline 79 (outdated):When ES and GS use different ranges of the same descriptor-table root parameter, their
RootParams overlap at the same user-data pointer but can differ intable_offset_dwordsorbase_register. Since aRootParamcan encode a table range, this branch rejects a valid pair as a dword conflict, sotranslate_merged_gsnever reaches resource tracking orGS_EMIT. Treat entries for the same table pointer as compatible while retaining both range mappings.Useful? React with 👍 / 👎.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:33 UTC · original
On
crates/victory-shader/src/resource.rsline 600 (outdated):If the ES half owns user-data dword 0 or 1 but the GS record omits that parameter, this check sees both dwords as free and classifies an
s_loadthroughs8:s9as a runtime-table access. The batch path inapps/victory/src/translate.rs::translate_programscallsresource::trackwith the GS-onlyp.layout, so it can report those root-parameter reads as successfully traced; onlytranslate_merged_gssupplies the union. Use the merged layout for this inference, or avoid making it for an unpaired GS.Useful? React with 👍 / 👎.
@ -305,0 +313,4 @@let first = native.stage.user_sgpr(crate::merged::RUNTIME_TABLE);let taken = native.layout.iter().any(|p| {let at = u32::from(native.stage.user_sgpr(p.user_data));at < u32::from(first) + 2 && u32::from(first) < at + p.sgprs@chatgpt-codex-connector[bot] on GitHub · 2026-11-25 09:39 UTC · original
For a malformed GS FSSM entry with
user_data = 0andsgprsnearu32::MAX,native_programspreserves the rawsgprs, so this end calculation can overflow: overflow-checking builds panic, while wrapping builds can mark s8:s9 as free and report them asRuntimeTableinputs instead of rejecting the layout. Use a checked or bounded end here and inmerged::pair_es_gs, which makes the same calculation.Useful? React with 👍 / 👎.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:33 UTC · original · reviewed
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
5ad26761f2ℹ️ 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 09:39 UTC · original · reviewed
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
90ec93bef6ℹ️ 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".
@slauko on GitHub · 2026-11-26 10:44 UTC · original
A number for step 1, from a Wine run of the title (RTX 3080 Ti, vkd3d-proton
ec20719, uiliannn's line):victory translate --listover the pack names every refusal. Of 228 refused containers, 196 are the title's voxelization geometry shaders, all refused at the same place:(the rest: 29 FidelityFX containers with
no DXIL part (SM5 or older), one shadow-mask compute program witha lane mask holding lanes elsewhere read as data.)What those 196 cost a run: the pipeline library has no pipeline whose stage set includes one of them, so every draw that binds such a pipeline is dropped — in the cell, 340 to 350 of ~5,000 draws a frame (
dropped ... without a host pipeline), and 1,017 pipelines bound once that never get made. That is the title's voxelized (traced-shadow/GI) work, so nothing that would show on screen as geometry; it is the lighting side.If step 1 makes the stage read its SGPRs, that alone would put ~1,000 pipelines and ~350 draws a frame back into the run here. Not a speed claim — the draws are missing, so they would cost frame time — but a picture claim.
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.