Repository navigation
[BUNDLE] Computed barycentrics: #453 merged with #176 and #1293, stacked on #1492 - #1504
Closed
MamaLeVrai wants to merge 88 commits into
Closed
MamaLeVrai wants to merge 88 commits into
MamaLeVrai wants to merge 88 commits into
Conversation
Pixel programs that use the I/J VGPRs as plain values (custom interpolation, math on the weights) failed with "barycentrics read directly". They are now channels y and z of an SV_Barycentrics input (SM 6.1+, the emitter targets 6.6) declared with the interpolation mode of their kind (perspective/linear, center/centroid/sample), one element per mode (semantic index 0 and 1), with the Barycentrics shader flag and SFI0 feature. GFX10 interpolates P0 + i (P1 - P0) + j (P2 - P0) with P0 the provoking vertex, which the host's barycentrics weight as vertex 0, so i = y and j = z. The VGPRs are loaded on first use as a value, so programs that only feed them to v_interp_* declare nothing new. A console signature's own SV_Barycentrics row (D3D name 23) is parsed and reused. Pull-model barycentrics stay unsupported. SV_Barycentrics is left unpacked (no row, packing location -1), like other non-packed system values: the DXIL validator refuses it in a row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
v_interp_p1/p2 (and the f16 forms) fed with an i or j that is not the loaded input VGPR now evaluate each half as the hardware does: P0 + i (P1 - P0) for the first, the old dst + j (P2 - P0) for the second, with the vertex values read by attributeAtVertex. That needs the element declared constant, so every other interpolation of the same attribute row is weighed from its vertices with SV_Barycentrics of its mode, and flat reads stay loadInput of the provoking vertex. v_interp_mov of P10 and P20 reads P1 - P0 and P2 - P0 the same way when the program also interpolates the attribute (so the hardware holds the deltas); alone it is still refused. The translate command's tally counts Interp::Weighted as interpolated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
image_sample_d_cl was refused by name, and behind it every program hit a cube sample with explicit gradients, refused as "a cube sample with ... gradients". Both now translate to sampleGrad: - A cube's gradients on GFX10 are of the face coordinates (s, t), four addresses rather than six, so the coordinates follow at 4. They become the direction's gradients through the face's linear part of cube_direction (u = 2s - 3, v = 2t - 3; the major axis does not move), in the new cube_gradient. - `_cl`: the level-of-detail clamp follows the coordinates and is passed as sampleGrad's clamp. translate --validate on shaders.rpf: vertex/pixel 12172 -> 12197 validated; both errors are gone from the list. Not yet compared against the console's sampling at runtime. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… on divergent s_barrier
lower.rs: keep the PR's lazy barycentric VGPR inputs next to main's `Reg::S(n)` arm for uninitialized SGPRs. mod.rs: the barycentric test helper passes the structure to resource::track, which now takes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
DXIL allows at most two SV_Barycentrics input elements, one perspective
and one linear. A program reading both perspective center and centroid
I/J as values declared two perspective elements, which the validator
refuses ("There can only be up to two input attributes of
SV_Barycentrics with different perspective interpolation mode").
The second mode of the same kind is now an Unsupported reason rather
than a second element. Reusing the first element would hand centroid
reads center weights (or the reverse), which differ on edge pixels: a
silent wrong value. Before this PR such reads were refused anyway.
Test: center + centroid values are refused; centroid alone still
translates with one element.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
The ISA's special cases in its order: a NaN numerator or denominator comes back quieted, 0/0 and inf/inf give NaN, x/0 and inf/x a signed infinity, 0/x and x/inf a signed zero, otherwise |S0| with the quotient's sign. Worked on the f32 values of the f16 operands, which are exact.
The ISA's "exponent of S0 all ones -> overflow" check runs before the final |S0| case, so a NaN quotient with a finite, non-zero numerator and denominator gives sign | infinity, as measured on gfx1036 hardware. The zero, infinity and invalid checks still come first.
These write SCC, but their lowering gave no SCC value, so the generic "result is not zero" stood in. The ISA sets it otherwise: - s_min_i32/u32, s_max_i32/u32: SCC = 1 when src0 is the value chosen (src0 < src1 for min, src0 > src1 for max). - s_lshl1..4_add_u32: SCC = 1 when (src0 << n) + src1 overflows 32 bits, through bits shifted out of src0 or the add's carry. So s_min_u32(5, 3) left SCC = 1 (3 is not zero) where the hardware leaves 0, and s_lshl1_add_u32(1, 0xFFFFFFFE) left 0 where it leaves 1; an s_cselect or s_cbranch_scc after them took the wrong side.
The d16 forms of the typed buffer loads return each channel as 16 bits, two per VGPR, low half first; the decoder already sizes their data that way. The lowering only treated `buffer_` names as d16, so a tbuffer_load_format_d16_* went through the 32-bit path: the first VGPR got channel x as a 32-bit value (the f32 bits of 1.0 instead of the f16 pair (1.0, 2.0)) and the other channels were dropped. The format path now packs its channels for d16: integer formats keep their low 16 bits, the other formats become f16 (as the MUBUF d16 path converts them).
SDATA on s_atc_probe and s_atc_probe_buffer is a 7-bit immediate, the buffer resource is four dwords, and GLC/DLC are not operands of either.
buffer_gl0_inv and buffer_gl1_inv name a buffer but read no descriptor, so resource tracking refused them before lowering. Skip descriptor tracking for _inv buffer instructions and lower the pair to nothing, as the existing scalar cache instructions already are. Add a synthetic full-pipeline test.
…e a buffer view A descriptor fetched from the resource heap by index has no used-resource entry, so a scalar buffer load (s_buffer_load_dword*) through it was lowered through a 64 KiB constant buffer handle. When vector buffer loads read the same descriptor, the slot holds a buffer SRV (the title made it one), and reading it through a CBV handle is a descriptor of the wrong type, which D3D12 leaves undefined. Such loads now read the slot as a raw buffer, as table SRVs already do. A descriptor also written through (a UAV) and one only scalar loads read are unchanged. In the title's shaders.rpf this changes 38,829 scalar loads in about 1,900 of 26,084 programs; emit and validation counts are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
s_buffer_load_dword* through a table's UAV took the constant buffer path: a CBV handle at the heap index of a UAV. Reading through it removes the device (WARP: "The GPU device instance has been suspended"). Such a load now reads the UAV raw, as a raw SRV is read and as vector buffer accesses read a UAV. The test writes a value to the VALU tests' raw UAV, reads it back with a scalar buffer load and stores that; it removed the WARP device before this change and passes on the hardware GPU and WARP after. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An s_load_dword* whose address is a root descriptor's, and whose result the program never uses as a descriptor, reads that buffer's data. It stopped with "a descriptor read only as data". It is now read as global loads from a root view already are: a root SRV raw, a root CBV (or a root view the used-resource list does not name) as a constant buffer. A root UAV still stops, with its own reason. Test: dwords 2 and 3 of a root SRV and of a root CBV read with one s_load_dwordx2 and stored, exact on the hardware GPU and WARP; main refuses the program. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An s_load_dword* of a descriptor whose dwords the code reads as numbers (an image's width and levels) but never samples was refused with "a descriptor read only as data": the view's kind came only from a use. Now the table's range names it, and an entry in the resource heap that no range names (a run-time index reaches it) is an image if it is eight dwords, taken for 2D (shortcut noted in the code). Offline over the whole corpus, programs refused: 4123 -> 3749; "a descriptor read only as data" 395 -> 18; compute programs emitted 1441 -> 1743 (validated 1417 -> 1647). Tested with a hand-assembled waterfall program that reads two textures' sizes, on the host GPU and WARP; it fails with the old refusal without the change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…d vertex programs A register can hold a compare result's high dword on one path and a loaded number on another; the compiler only reads it where the number is live. The join's mask side was "a lane mask read as data", which refused the program. A pixel or vertex program now takes the mask's ballot as that incoming value (counts and zero tests mean the same on any wave size). shortcut: the ballot is the host wave's, so a join read some other way would differ from the console. Offline corpus: "a lane mask read as data" 250 -> 212, vertex/pixel programs emitted 12243 -> 12250; the other 31 move on to descriptor/scalar-memory refusals. Synthetic wave64 pixel program fails before, lowers after. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The console compiler spills scalars, lane-mask pairs among them, with
v_writelane_b32 into constant lanes of a VGPR and restores them with
v_readlane_b32 of the same lane. The restored pair was an opaque mask, so
the selects, EXEC writes and joins that used it refused ("a select on an
untracked mask", "an opaque lane mask", "a lane-mask join of an untracked
mask"). structure now follows a constant-lane readlane back through a plain
chain of writelanes to the scalar written to that lane, and gives the
restored pair that scalar pair's mask. A chain with a phi or another write
of the VGPR stays opaque (shortcut noted in code).
Offline corpus, against fix/mask-phi-ballot (neither branch carries Marvisak#585):
vertex/pixel programs emitted 12250 -> 12269, compute 1443 -> 1452,
"a lane-mask join of an untracked mask" 20 -> 0, "an opaque lane mask"
29 -> 8, "a conditional export" 8 -> 0. Synthetic pixel program fails
before, lowers after. Stacked on fix/mask-phi-ballot (shares its test helper).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…fied together Merges Marvisak#156 Marvisak#162 Marvisak#168 Marvisak#169 Marvisak#368 Marvisak#379 Marvisak#456 Marvisak#587 Marvisak#990 Marvisak#1021 Marvisak#1048 Marvisak#1052 Marvisak#1053 Marvisak#1095 Marvisak#1142 Marvisak#1190 Marvisak#1211 Marvisak#1223 Marvisak#1259 Marvisak#1293 on top of the bundle of Marvisak#1402 (which is on Marvisak#1319, on main ffe310e), each head unchanged. Hunks that conflicted in emit/lower.rs, emit/valu_tests.rs and emit/diff_tests.rs were merged by keeping both sides (additions next to each other); a PR was kept only if cargo clippy -p victory-shader --all-targets -- -D warnings still passed with it. No instruction name is handled in two places. Marvisak#98 is not in this version: an offline measurement on a retail dump showed it loses 31 programs that validate on Marvisak#1402. cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features, is clean and cargo test --workspace --locked passes (381 passed, 6 ignored; main has 342 passed, 6 ignored). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…with the resolution of its conflicts with Marvisak#176 and Marvisak#1293 Marvisak#453 evaluates the halves of an interpolation on their own when i or j is computed (SV_Barycentrics, Interp::Weighted). Marvisak#1293 (in the stack) follows plain v_mov_b32 copies to find the barycentric of a pair, and Marvisak#176 (in the stack) pairs packed 16-bit pixel inputs through half_inputs. The conflicts were in io.rs (the pairing), emit/lower.rs (the interpolation lowering and two spots of the phi and helper code) and emit/shader.rs (the feature bits). See the pull request text for how each was resolved. Marvisak#1293's test interpolation_follows_agreeing_phis_and_rejects_mismatched_or_modified_copies asserted that a computed i (a phi of i and j, a negated copy) is refused; with Marvisak#453 it is supported as a Weighted pair, so those two assertions now expect Weighted halves. cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features, is clean and cargo test --workspace --locked passes (391 passed, 6 ignored; main has 342 passed, 6 ignored). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
MamaLeVrai
force-pushed
the
bundle/computed-barycentrics
branch
from
November 24, 2026 19:21
9ed1660 to
1d41891
Compare
MamaLeVrai
added a commit
to MamaLeVrai/VIctory
that referenced
this pull request
Nov 24, 2026
…#1504, verified together Merges Marvisak#1145 Marvisak#343 Marvisak#1042 Marvisak#1303 Marvisak#477 on top of the stack of Marvisak#1504 (Marvisak#1319, Marvisak#1402, Marvisak#1492, Marvisak#1504, on main ffe310e), each head unchanged, no conflicts and no changes of mine. cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features, is clean and cargo test --workspace --locked passes (406 passed, 6 ignored; main has 342 passed, 6 ignored). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Nov 24, 2026
Closed
Open
…on old validators
PSV0 shared one string-table copy of a repeated semantic name (TEXCOORD0
and TEXCOORD1 pointing at the same "TEXCOORD"). DXC's PSV writer writes
one copy per element, and validators before 1.8 compare PSV0 byte for
byte, so any signature repeating a name was rejected there ("Pipeline
State Validation does not match"); 1.8 compares the strings and accepted
both. Checked against dxil.dll 1.7, 1.8 and 1.9.
Validator::version() reads IDxcVersionInfo; the compute-derivative test
skips dxil.dll validation when the validator predates 1.8, which rejects
dx.valver 1.8 outright. Translated shaders never go through dxil.dll.
Reported by @alexdeliu.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
….dll is older than validator 1.8" This reverts commit 119b763.
…tic names per element, skip on validators older than 1.8) The author's head now does what the bundle's own commit did (a validator version query and the skip below 1.8), and fixes the second failing test at its cause; the bundle's commit is reverted just before this merge. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ring The shader chain moved: Marvisak#306 is at its author's new head (e3067ae), and the bundle's own validator commit is reverted. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…centrics The shader chain moved: Marvisak#306 is at its author's new head (e3067ae), and the bundle's own validator commit is reverted. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Nov 24, 2026
This was referenced Nov 24, 2026
KainanP
added a commit
to KainanP/VIctory
that referenced
this pull request
Nov 24, 2026
…sak#98, Marvisak#334 to Marvisak#492, validation) The line rebuilt on the bundles' current heads (Marvisak#1402 119b763, Marvisak#1492 5bbc098 without Marvisak#98, Marvisak#1504 1d41891, Marvisak#1511 ca601f0) with every merge replayed, and the merges after this file's first version (Marvisak#334, Marvisak#346, Marvisak#1024, Marvisak#211, Marvisak#492): merge order, the runner's numbers on 967d3ae (RTX 571, WARP 570 + the known Marvisak#1084 failure, all features 580; Marvisak#98's one test leaves), what is not included (Marvisak#98, Marvisak#282 for Marvisak#346, Marvisak#693 for Marvisak#1024, Marvisak#306's latest commit), and the open pull requests whose head is contained here (109, from the 18:24 collection). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Automated triage for the maintainers. Closing because this pull request re-packages other open pull requests. Each of those is reviewed on its own, so a bundle cannot be merged. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A merge resolution for one PR. #453 (pixel barycentrics through SV_Barycentrics, computed interpolation) gains 182 programs in #1247's benchmark (the "computed barycentrics" wall, 207 programs) and conflicts with two PRs of the stack, #176 and #1293, in the same interpolation code. This is that PR merged onto the stack #1319, #1402 and #1492, with the conflicts resolved and tested. Every head is merged unchanged onto
mainplus #1492, and the result is built and tested together.What is inside
88b34a447Changes made while bundling
No change inside #453. The conflicts, nine hunks in three files, and what each became:
io.rs, the pairing (Halves::pair): Shaders: follow plain v_mov_b32 copies when pairing interpolations #1293 finds the barycentric of a pair by following plainv_mov_b32copies (self.barycentric(j, &mut copied)) and refuses what it cannot find (an interpolation with computed barycentrics). Shaders: pixel barycentrics through SV_Barycentrics (values and computed interpolation) #453 turns that refusal into a result:kindisNonewhen i or j is computed, and the halves are then recorded one by one (Interp::Weighted). Resolution: Shaders: pixel barycentrics through SV_Barycentrics (values and computed interpolation) #453'sOptionflow, with Shaders: follow plain v_mov_b32 copies when pairing interpolations #1293's copy-following lookup in both places (self.barycentric(j, &mut copied)andself.barycentric(i, &mut copied)), and Shaders: follow plain v_mov_b32 copies when pairing interpolations #1293's checks (the first half must exist; a copy needs an unchanged EXEC) kept as they are.vgpr_copy(Shaders: follow plain v_mov_b32 copies when pairing interpolations #1293) andpush_pair(Shaders: pixel barycentrics through SV_Barycentrics (values and computed interpolation) #453) are both kept.io.rs, tests: both PRs' tests are kept. Two assertions of Shaders: follow plain v_mov_b32 copies when pairing interpolations #1293'sinterpolation_follows_agreeing_phis_and_rejects_mismatched_or_modified_copieshad to change: they asserted that a computed i (a phi that passes i on one arm and j on the other, and a negatedv_mov_b32copy) is refused withan interpolation with computed barycentrics. With Shaders: pixel barycentrics through SV_Barycentrics (values and computed interpolation) #453 that is the case being supported, so they now expectInterp::Weightedhalves. The assertion that a negated accumulator copy is refused is unchanged.emit/lower.rs,interp: Shaders: pair packed fp16 pixel inputs with unlisted signature rows #176 reads the packing of a 16-bit input fromself.half_inputs, and Shaders: pixel barycentrics through SV_Barycentrics (values and computed interpolation) #453 rewrote the same lines to read it from the stage data and added atotalclosure (the evaluated channel plus the first half's result). Resolution:self.half_inputs(Shaders: pair packed fp16 pixel inputs with unlisted signature rows #176) for the packing, and Shaders: pixel barycentrics through SV_Barycentrics (values and computed interpolation) #453'sf16test andtotalclosure after it. Shaders: pair packed fp16 pixel inputs with unlisted signature rows #176's map is the one that also pairs rows the stage data does not list, which is what Shaders: pair packed fp16 pixel inputs with unlisted signature rows #176 is for, so it is the one to keep; Shaders: pixel barycentrics through SV_Barycentrics (values and computed interpolation) #453'stotalclosure only needs the(pack2, second row)pair, which it also returns.emit/lower.rs, phi data joins: Shaders: pixel barycentrics through SV_Barycentrics (values and computed interpolation) #453 evaluates a computed barycentric lazily before a data phi reads it (lazy_barycentric), and the stack adds the ballot handling for mask dwords just after. Both stay, Shaders: pixel barycentrics through SV_Barycentrics (values and computed interpolation) #453's first.emit/lower.rs, free functions:linearandinterp_mode(Shaders: pixel barycentrics through SV_Barycentrics (values and computed interpolation) #453) anddivergent_barriers(Shaders: guard mesh output bounds, init all primitives, and omit sync on divergent s_barrier #587) are all kept.emit/shader.rs: theBARYCENTRICSfeature bit (Shaders: pixel barycentrics through SV_Barycentrics (values and computed interpolation) #453) next to the twoATOMIC_INT64ones (Shaders: lower 64-bit image atomics #305).Verification
Windows 11, RX 6950 XT, Rust 1.98.1 (the pinned toolchain):
cargo clippy --workspace --all-targets --locked -- -D warningscargo clippy --workspace --all-targets --all-features --locked -- -D warningscargo test --workspace --lockedmain: 342 passed, 6 ignored)The title was not run, so this says nothing about in-game effect. No game data is used or committed.
Re-verify in one go
To confirm that no component PR moved since this was built, compare each
Headabove withgh pr view <n> --repo Marvisak/VIctory --json headRefOid. If one differs, the branch needs a rebuild: merge the new head in the same order.If this lands
The component heads are in the history unchanged, so each PR's commits and authorship are kept and GitHub should mark them merged. Merging them one by one instead works too, with the exceptions noted above.
AI-assisted (Claude Code); no game data.
🤖 Generated with Claude Code