Repository navigation
Shaders/GPU: fixes for #604, #610, #720, #724/#725, #736, plus upstream fixes ported in - #1
Merged
Merged
Conversation
…another join reads `Lower::get` marks the phi a value is read from, and `fill_phis` used that mark to decide whether a missing incoming value fails the program or is silently replaced by zero (or false). A join that only feeds another join is never read through `get`, so it counted as unread: a timestamp read (`s_memtime`, which has no DXIL form) that reaches a branch through two joins translated, while the same read with no join in between was refused with `a scalar memory read as data`. Follow the incoming values of a read phi, so a phi an actually read phi takes a value from is treated as read too. The refusal then reaches the reader, as it does without a join, and a value that is genuinely dead (the group id is read instead) still translates. Found and reported by Dathinel in Marvisak#604; the test is theirs. Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
The switch was read as "is the variable set", so `VICTORY_D3D12_WARP=0` still created the host device on the software adapter: a `0` left in the shell, or set for one command in a batch file, had to be removed instead of turned off. `0` now counts as unset; `1`, an empty value and every other value still select WARP. Reported in Marvisak#610. Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
`ir::build` hands the emitter one value per register dword and a block graph, and the emitter relies on two things it never checked: that a value is written once, and that the block a read is in is dominated by the block that writes it (a phi's argument by its predecessor). A program that broke either would lower a read to a value that does not exist yet, or to the wrong one. The test builds programs at random from every instruction word the decoder accepts (every opcode of every encoding), and checks those invariants against a dominator set computed by the naive iterative algorithm, so the check does not share code with what it checks. Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
…lc makes it globally coherent A descriptor from the SM 6.6 resource heap was annotated SRV or UAV per instruction: the load of a view the program also stores to got an SRV handle ((0xB, 0)) and the store a UAV one ((0x100B, 0)), for one and the same descriptor; a scalar read of it became a constant buffer. Every access now takes IsUAV from all uses of the descriptor (twin loads of the same dwords included) when the root signature says nothing: a store or atomic through any of them makes it a UAV. A known kind still wins. Scalar reads of a UAV are raw UAV loads. A UAV with a plain glc access (skip the per-CU cache, how GFX10 code sees another group's writes) also sets IsGloballyCoherent (0x4000) on all of its handles. glc on an atomic only returns the old value and does not count; glc on a view nothing writes leaves it an SRV. Upstream issues Marvisak#724 and Marvisak#725. Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
…X face For a cube array the console takes the face operand of image_sample* and image_gather4* (dim CUBE) as 8 × slice + face; GFX10 MIMG has no array bit. The lowering always declared a TextureCube and matched the operand against faces 0-5 only, so any slice above 0 sampled slice 0's +X face, silently. A cube descriptor is now a TextureCubeArray (kind 9) when some sample or gather through it builds its face operand that way: a multiply-add by 8.0 (v_fma/v_fmac/v_fmamk/v_fmaak/v_mad/v_mac/v_madmk/v_madak, as Mesa's prepare_cube_coords emits it), an add of a product by 8.0, or a constant of 8 or more (a constant slice folded in). Every access through the descriptor takes that kind, as the view is one. The slice, floor(face / 8), becomes the fourth coordinate and face - 8 × slice the face (both exact in f32). A size query of a cube array reports its layers in faces (6 × cubes), as the hardware does (Mesa divides them by 6 for txs). A bare face id stays a cube, as before. Upstream issue Marvisak#720. Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
The Marvisak#604 fix (f1fa9d5) marked every phi a read phi takes a value from as read, so any missing incoming value of such a join refused the program. Upstream merged the same change as Marvisak#612 and measured it (Marvisak#736): 323 programs that translated and validated before stopped, mostly on descriptor dwords, lane masks and interpolation halves that only joins carry after their last use, where the zero never reaches a reader. Phis read only through other joins are now kept apart from the ones an instruction reads. A missing incoming value refuses such a phi only when zero would silently misrepresent it: an s_memtime or s_memrealtime timestamp, the Marvisak#604 case. Every other value becomes zero on that edge, as before the fix. The test keeps the timestamp case and adds an s_getpc_b64 carried through the same two joins: refused when read directly, translated when only joins carry it. Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Upstream issue Marvisak#761. The Portuguese translation had the same line. Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
rustdoc warns that the module docs link to the private const MICRO (rustdoc::private_intra_doc_links). Plain code formatting keeps the reference without the broken link. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> (cherry picked from commit 0f0c872)
Its only callers (stub_pipeline_is_created, constant_color_validates) are #[cfg(windows)], so on macOS/Linux the helper is dead code and cargo check --all-targets warns 'function constant_color is never used'. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> (cherry picked from commit ab3eb92)
(cherry picked from commit 31ce30f)
Queue the list-owned D3D12 staging upload as a host fill so Wine does not skip it based on the title-memory VirtualQuery check. (cherry picked from commit af22e5d)
(cherry picked from commit 5864aab)
describe looked only for a host texture, so every UAV over a buffer printed 'uav None' in device-removed reports and drop traces, though the view is made. It now prints the buffer's title range, as a buffer shader view does. (cherry picked from commit d74558c)
(cherry picked from commit a0efd2d)
Pixel programs that write SV_DepthLessEqual or SV_DepthGreaterEqual failed validation: "Interpolation mode for PS input position must be linear_noperspective_centroid or linear_noperspective_sample when outputting oDepthGE or oDepthLE". The position is now declared linear_noperspective_centroid in those programs, as DXC declares it; without multisampling the value is the same. translate --validate on shaders.rpf: vertex/pixel 12172 -> 12186 validated; the error is gone from the list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit c249f02)
v_cmp_lg_{f32,f16} ("less or greater") is ordered and not equal: false
when either operand is a NaN, on RDNA2 hardware as in the ISA. It was
lowered to `fcmp one`, which says the same, but the AMD D3D12 driver runs
`fcmp one` as unordered and returns true for a NaN. NVIDIA and WARP get it
right. It now lowers as `olt | ogt`, which all three run alike.
New GPU test v_cmp_lg_is_false_for_nan covers both widths: NaN on either
side, both NaN, a signalling NaN, +0 against -0, inf against inf and
against -inf, and junk in the unread high halves for f16.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 51f1627, upstream Marvisak#706)
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
constant_color became Windows-only (upstream Marvisak#685), which left its two imports unused on Linux; the DXIL of the descriptor-data test is only read by the validator and the host, so its binding is unused there too. Gate the imports and allow the binding off Windows, so `cargo clippy --all-targets -- -D warnings` (the CI gate) passes for victory-shader on Linux. Also drops a redundant rebinding in the Marvisak#604 test. Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
(cherry picked from commit eb30a0d, upstream Marvisak#418; the subnormal path checked against exact ties-to-even rounding for every f32 below 2^-14, both signs) Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Compute programs read SGPRs the hardware does not initialize when two branches make the paths look like they allow a read before a write, even though the branch that skips the write does not reach the read. That stops translation with 'a hardware SGPR input is not supported' and drops the program's dispatches. ComputeIo::initialized_sgprs() counts the user SGPRs, the enabled system ones and the scratch wave offset. A read of a general SGPR (0..=105) at or above that count holds whatever the previous wave left, so no program can depend on its value: read it as zero, as unset VGPRs already are. Reserved registers (VCC, trap temporaries, M0, EXEC) keep their current handling. (cherry picked from commit f4438b3, upstream Marvisak#432 by Proudnoob4) Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
A texture the title fills through memory has its contents in the staging copy until an upload records them; a copy out of it before any draw read it copied the stale host texture. (cherry picked from commits 0064c08 and 4f53d6f, upstream Marvisak#671; adapted to this tree's `&list` handle) Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
(cherry picked from commit 764fa19, upstream Marvisak#666; this tree's VICTORY_HLE_PROBE override for Proton is kept) Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
image_sample_cl and image_sample_b_cl lower like image_sample(_b): outside pixel shaders, as explicit gradients from each quad of lanes. They were missing from implicit_derivatives, so a compute program using only them did not get the console's lane order, and the gradients came from whichever host lanes shared a quad (a debug assertion in tests). Also moves reads_mask_as_data's doc comment back onto it. Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
DXIL takes immediate texel offsets in -8..=7; the console's are 6-bit fields a byte apart in the first address VGPR and may be computed. A constant word in range becomes the immediates; anything else is refused. Outside pixel shaders the sample takes its level from each quad, so it needs the console's lanes like image_sample. (cherry picked from commit 260611a, upstream Marvisak#634; adapted: the offsets also reach this tree's quad-gradient path, plus a regression test) Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
When the host cannot make an unordered-access view (no host texture, a format the host does not allow, a placed texture not mirrored), null_for() wrote a 2D null UAV whatever the title asked for. A shader that writes a 3D texture through it then has a dimension mismatch, which GPU-based validation reports for the world's wind field update. Shader views already get a null view of the title's dimension (null_like); unordered views did not. Null texture UAVs now keep the title's dimension: 1D, 1D and 2D arrays, 3D (WSize -1). Multisampled and unnamed dimensions stay 2D. (cherry picked from commit cbb50b8, upstream Marvisak#205; the title's shader name is left out of the comment and message per the asset policy) Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Command lists take per-draw table slots from a view heap's dynamic range; 2^16 of them ran out seconds into the world (every world run on an RX 9070 XT, each a device removal shortly after; upstream Marvisak#59). View heaps now get 2^18 dynamic slots where the host takes them on top of every title slot, else 2^16 as before (a capped heap, NVIDIA), then the portable cap. (cherry picked from commit e8d3b64, upstream Marvisak#336; heap sizing only: this tree already falls back to the title's slots when a table does not fit, instead of dropping the draw) Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
The test from upstream Marvisak#611 (commit 9a8908c); the rest of that change is already here in a newer form (show_config prints data_dir with its origin). Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Ports upstream Marvisak#566 and the follow-up ffe310e. The console compiler handles a descriptor that differs per lane with a "waterfall" loop: read the first active lane's descriptor (v_readfirstlane), run the access for the lanes that match, drop them, and repeat. Before this, the resource tracker refused every such program ("descriptor-as-data" was the largest refusal class upstream measured in Marvisak#736). - resource.rs: descriptors chosen by s_cselect / s_cmov are traced per SCC outcome. Per-lane loads, per-lane choices and if/else joins are traced per lane. A waterfall loop is accepted only when EXEC selection is proven (the loop really narrows to the matching lanes), and it is lowered as one non-uniform access. - lower.rs: a waterfall's first-lane read becomes the lane's own dword, and the heap index comes from each lane's descriptor. - track() takes the structured program (Option<&Structured>), so structurisation now runs before resource tracking. - New tests: 26 resource/lowering tests plus the GPU-run waterfall_tests.rs (Windows). Merged into this fork by three-way file merge: the tracker keeps its memo of address sums (now in a RefCell, since the tracker is &self upstream), structure keeps select_masks next to paired_masks, and the threading retry path in emit passes the structured program too. (upstream commits a3d3bc9 ffa6635 077ec8b 6285e19 6638098 b1c8306 6c63dea 74a9d33 ffe310e) Co-authored-by: fuzeofficial <bochunran@gmail.com> Co-authored-by: Marvis <marvis@noreply.invalid> Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Like the argument clamp: vkd3d-shader's HLSL compiler (D3DCompile under Wine) has no RWByteAddressBuffer methods and embeds no root signature, so the rectangle expander never built under Proton and indirect rectangle-list draws were dropped. Both passes now read structured buffers of words (byte offsets become word indices; the 64-bit and wider loads and stores split into words) and take root signatures built in code, the same eight constants and root views as before. Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
The console ignores blending on integer render targets and the title leaves it on (the world has a mesh pipeline blending into an R8_UINT target). D3D12 does not allow it: vkd3d-proton refuses such a pipeline with E_INVALIDARG and its draws are lost. The host pipeline now turns blending off on integer targets; with one description for all targets, each target gets its own copy so the others keep theirs. Hand-ported from pablogonz12 ceaf806. (cherry picked from commit ceaf806) Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
v_*_co_ci_u32 refused when its carry-in mask was not one structure followed (a plain SGPR number), and v_cndmask_b32 refused inline 0 and -1 masks. A carry-in now fails as an untracked select does, so compute retries it with console lanes and the lane tests its own bit of the register (pair in wave64); inline 0 and -1 masks are constants. Ported from undeadhuman37 fda0c77 (from upstream PR Marvisak#585, the mask part); our selects had the console-lane fallback already. New test runs on Linux: fails before, passes after. Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
A descriptor whose dwords the code reads as numbers (a size) but never uses was taken only when eight dwords with no range or an SRV range: a 2D texture. Now the range the entry falls in says what it is: a storage image's or a buffer's size (raw, or structured by the range's stride) translates too. Four dwords no range names stay refused. The fork measured "a descriptor read only as data" 395 -> 18 over its corpus with this change (compute emitted 1441 -> 1743). New Linux test: fails before, passes after. Ported from undeadhuman37 9d8df90. Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.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).
The fork measured vertex/pixel programs emitted 12250 -> 12269 and
compute 1443 -> 1452. The test runs on Linux: fails before, passes after.
(cherry picked from commit fec0486)
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.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. The fork measured "a lane mask read as data" 250 -> 212. Hand-ported (the ballot is only taken where the incoming value is missing); the test runs on Linux and fails before. (cherry picked from commit 3e662eb) Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
The console packs a primitive's three vertex indices in 10-bit fields (up to 1023), while the host mesh shader declares max_vertices outputs. EmitIndices with an index at or past that count is undefined; on an RTX 5080 a shadow mesh program hung the GPU on such a draw. A primitive with any index out of range is now culled like bit 31 does (all indices 0, no area). Likewise a console group can have more lanes than the mesh declares vertices or primitives: a lane past the declared count no longer writes a vertex, primitive output or primitive (undefined on the host). From kaoxyd 4f5ffe3 (jlefebure's fork) and Mic0Lee 48fea7b, 2389344, ff65879, hand-ported. Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
A loop that only rereads one address until another workgroup, queue or the command processor changes it (decoupled look-back, persistent-thread queues, locks) waits microseconds on the console. On the host the write may never come: the writer's view can be another host resource, null or not yet mirrored, and the host compiler may hoist a load out of a loop that writes nothing (bufferLoad is readonly). The loop then runs to the 2^20 limit in every lane: about a second per wave of uncached reads, the order of the 650-930 ms world submissions spend on an RX 7600. Such loops are found in the IR (emit/spin.rs): no stores, exports, LDS writes, barriers or messages; every memory read and atomic at an address the loop does not change; and nothing loop-carried made by arithmetic, only lane masks, compares and what was read. They stop at VICTORY_SHADER_SPIN_LIMIT (default 4096, never above the loop limit); the shader cache keys on it. VICTORY_SHADER_LOOP_LIMIT now works in release builds too (PastiiJay e5b117a). Ported from PastiiJay/klbf-lab 1fcaf13 and e5b117a. (cherry picked from commit 1fcaf13) Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
MfDev0
force-pushed
the
arena/59fabb00-victory
branch
from
November 24, 2026 14:31
7a0849e to
b7e8d83
Compare
Check that the mandatory shader stage produced DXIL before calling CreateComputePipelineState / CreateGraphicsPipelineState. On hardware a null bytecode can be accepted, the GPU then runs empty code and removes the device (0x887A0006); on WARP it surfaces as E_INVALIDARG. Refusing early avoids the spurious creation calls and the device removal. From IgorRend 17a35d9, the pipeline part only: its raw-buffer change took a range with no declared stride for a raw buffer and dropped the index, which would read structured buffers of unknown stride at the wrong addresses instead of refusing them. (cherry picked from commit 17a35d9) Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
A mesh record is now clamped to 4,096 groups (captured direct mesh work peaks at 260) and mesh groups have their own per-list budget of 2^15: allowing D3D12's 65,535 let one corrupt indirect record hold an RX 6700 XT until Windows reset it. The budget buffer's two words are zeroed together. Each title list now goes to the queue in its own ExecuteCommandLists: the OS resets a device whose submission runs for about 2 s, and world submissions of every list took 0.5 to 1.8 s, while each list is well under that. The lists are still waited for once, after the last (each on its own with diagnostics timing), so no wait bubble is added per list. From arthercz bba82d4, hand-ported onto the structured-buffer clamp; its per-list waits are left out. Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
(cherry picked from commit adeb9ff) Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
… queries (cherry picked from commit 7d0302b) Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
(cherry picked from commit 246ecea)
…ools::meet (cherry picked from commit 80a235e) Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
…lting emulate_amd_only copies only the bytes left in the faulting page and gated clwb_len on n >= 15 because clwb_len took a fixed [u8; 15]. A 4- to 10-byte clwb starting in the last 14 bytes of a page (or falling back from a clwb_loop that straddles the page end) was therefore skipped, leaving pre-Ice Lake Intel CPUs with an unhandled STATUS_ILLEGAL_INSTRUCTION. Change clwb_len to take &[u8], bounds-checking each byte read and returning Some(len) only when len <= code.len(), and drop the n >= 15 guard in emulate_amd_only. Fixes Marvisak#924. Co-Authored-By: Gemini 4 Neon <noreply@google.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 60d2cf9)
(cherry picked from commit d4306f4)
`resolve` canonicalizes the longest existing prefix and re-appends the rest, but it walks up with `Path::file_name()`, which is None for a trailing `..`. A path such as `<tmp>/a/../b` (nothing exists yet) hit the `_` arm and returned PolicyError::Io, so a cache_dir or data_dir with a `..` in a directory that does not exist yet was rejected, and `normalize`'s `..` handling for the missing tail was never reached. A trailing `..` is now kept in `rest` so `normalize` resolves it lexically. Test: resolves_dot_dot_in_a_path_that_does_not_exist_yet (fails before, passes after). cargo test -p victory-core, cargo fmt --check and cargo clippy --tests are clean. (cherry picked from commit 52f0a09) Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
(cherry picked from commit 95cefda)
…f E_NOTIMPL ID3D12Device::GetDeviceRemovedReason "gets the reason that the device was removed, or S_OK if the device isn't removed" (Microsoft D3D12 reference). Slot 37 (0x128) in the device function table was left on the default handler, returning E_NOTIMPL (0x80004001) on a healthy device, which a title checking FAILED(GetDeviceRemovedReason()) takes as a lost device. Wire slot 37 to removed_reason, which queries the host device's GetDeviceRemovedReason() and returns S_OK on Ok (or when there is no host device) and the error's HRESULT otherwise. Add a unit test verifying slot 0x128 returns S_OK on a healthy device. Co-Authored-By: Gemini 4 Neon <noreply@google.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 033598b) Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
… RDNA2 does Previously `half_src` applied VOP3 `op_sel` bits to every 16-bit operation, causing 16-bit compares (`v_cmp_*` and `v_cmpx_*` on f16, u16, and i16) to read the high half when `op_sel` was set. As measured on gfx1036 (RDNA2) across 146 cases in Marvisak#833 (VGPR, SGPR, literal, inline-constant sources, wave32/wave64, and `v_cmpx_*_e64`), RDNA2 hardware ignores VOP3 `op_sel` on 16-bit compares and always compares the low halves, while non-compare 16-bit ops such as `v_add_nc_u16` still honour `op_sel`. Ignore VOP3 `op_sel` in `half_src` (which `half_fsrc` calls as well) for `v_cmp*` instructions except `v_cmp_class*` (not measured), while keeping SDWA word selects intact, and add an end-to-end VALU test covering f16/u16/i16 compares, `v_cmpx_lt_f16`, and `v_add_nc_u16` as a control. Co-Authored-By: Gemini 4 Neon <noreply@google.com> (cherry picked from commit a8aa1d1) Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
(cherry picked from commit f459735)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit e477c4b)
(cherry picked from commit f7bce85)
) A descriptor whose only use is an s_buffer_load is a raw buffer to the host; descriptor_data fell through to "a scalar memory read as data". Upstream reports 771 -> 0 such failures and +231 programs translated. From upstream PR Marvisak#953 (c42cbb0), hand-ported. Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
DXIL waveReadLaneFirst reads the first active non-helper lane, while the console's WQM keeps helper lanes in EXEC. In a pixel waterfall loop a helper lane never matches the value it reads and spins to the loop limit. In pixel shaders, select the lane's own value when isHelperLane (SM 6.6, opcode 221) holds. From upstream PR Marvisak#946 (c159604), hand-ported. Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
…#757) A command signature with root-constant arguments before its draw or dispatch was dropped. Map each title constant argument onto the host root parameter carrying the user data of the stage that reads it (or an unused range when none does), build a host signature bound to the pipeline's root signature (cached on the pipeline), and clamp the draw/dispatch argument at its offset in each record. The planner is pure and tested on every platform. Not mapped yet: root view arguments, a constant two stages read, a spilled (root CBV) user-data stage, rectangle lists. From upstream PR Marvisak#956 (71967c1), hand-ported. Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
MfDev0
pushed a commit
that referenced
this pull request
Nov 24, 2026
Co-authored-by: ZazaJr24 <218105339+ZazaJr24@users.noreply.github.com>
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.
Fixes and tests taken from open issues in
Marvisak/VIctory, each with a regression test.1.
Shaders:a value with no DXIL form stays missing through a join only another join readsCloses Marvisak#604.
Lower::getmarks the phi a value is read from, andfill_phisused that mark to decide whether a missing incoming value fails the program or is silently replaced by zero (orfalse). A join that only feeds another join is never read throughget, so it counted as unread: a timestamp read (s_memtime, which has no DXIL form) reaching a branch through two joins translated, while the same read with no join in between was refused witha scalar memory read as data.follow_phi_readsnow follows the incoming values of a read phi, so any phi that a read phi takes a value from counts as read too. The refusal then reaches the reader, as it does without a join, and a value that really is dead (the group id is read instead) still translates.The test is the reproducer from the issue. On the base commit it fails with
left: None, right: Some("a scalar memory read as data").2.
GPU:VICTORY_D3D12_WARP=0picks the hardware adapter againCloses Marvisak#610.
The code only checked whether the variable was set, so
VICTORY_D3D12_WARP=0still created the host device on the software adapter.0now counts as unset.1, an empty value and every other value still select WARP. The README row says so.The predicate is split into
warp_switch(value)so the test doesn't have to change the process environment while other tests run.3.
Shaders:test that a built program is SSA and every read is dominatedA new invariant test for
ir::build. It decodes 20,000 random programs across all 18 encodings. For every program that builds, it checks that each value has exactly one definition and that every read is dominated by its definition, using a reference dominator computation written independently ofir::idoms. A 400k-program run found no violations; the committed test is sized to finish in about 0.3 s.4.
Shaders:a heap view written anywhere is a UAV in every access, andglcmakes it globally coherentAddresses Marvisak#724 and Marvisak#725.
For a descriptor from the SM 6.6 resource heap, SRV or UAV was decided per instruction. A load of a view that the program also stores to got an SRV handle
(0xB, 0)and the store got a UAV handle(0x100B, 0), for the same descriptor. A scalar read of it became a constant buffer.uav_bitsnow decidesIsUAVfrom all uses of the descriptor, including twin loads of the same dwords. A store or atomic through any of them makes it a UAV. When the root signature declares a kind, that kind still wins.s_buffer_load) of a UAV are raw UAV loads (11 | 0x1000) instead of a constant buffer.glcaccess also setsIsGloballyCoherent(0x4000, per DXC'sDxilResourceProperties.h) on all of its handles.glcon an atomic only asks for the old value, so it doesn't count.glcon a view that nothing writes leaves it an SRV.The test reads the handle props through a test-only
Lowered::handle_props. It covers load+store in both orders,glc,glcwith no writes, and a scalar read with and without a write. With the inference disabled it fails withleft: [(11, 0), (4107, 0)], right: [(4107, 0)], the mismatch the issue describes.5.
Shaders:cube-map arrays sample their slice and face, not layer 0's +X faceAddresses Marvisak#720.
For a cube array, the console takes the face operand of
image_sample*/image_gather4*(dimCUBE) as8 × slice + face, and GFX10 MIMG has no array bit. The lowering always declared aTextureCubeand matched the operand against faces 0–5 only. So any slice above 0 sampled slice 0's +X face, with no refusal or log line.cube_arraytreats a cube descriptor as aTextureCubeArray(kind 9) when some sample or gather through it builds its face operand in one of these ways:v_fma/v_fmac/v_fmamk/v_fmaak/v_mad/v_mac/v_madmk/v_madak, which is how Mesa'sprepare_cube_coordsemits it);This is decided per descriptor, so every access through it, including
image_get_resinfo, uses the same kind.The slice
floor(face / 8)becomes the fourth coordinate andface − 8 × slicethe face. Both are exact in f32.A size query of a cube array reports its layers in faces (6 × cubes), as the hardware does. radv sets
lower_txs_cube_array, which divides that by 6.A bare face id (
v_cubeid_f32) stays a cube, as before.The test is built on the issue's reproducer. It covers
v_fmacby 8.0,v_mul+v_add, the constant 10.0 (slice 1, face 2), a multiply-add by 4.0 (stays a cube), and a size query alongside an array sample and alongside a bare-face sample. With the inference disabled it fails withleft: 5, right: 9. It hasn't been checked on a GPU. A WARP run with a cube-array view whose texels hold10 × slice + facewould confirm the texels.6.
Shaders:only a timestamp stays missing through joins, not every valueAddresses Marvisak#736 (the regression upstream's JMAN730#612 caused, which section 1 shared).
Section 1 marked every phi that a read phi takes a value from as read, so any missing incoming value of such a join refused the program. Upstream measured the same change in Marvisak#736: 323 programs that used to translate and validate stopped translating. Most of the refusals were on descriptor dwords, lane masks and interpolation halves that only joins carry after their last use, where the zero never reaches a reader.
Phis read only through other joins are now kept apart from phis an instruction reads directly (
phis_read_through_joins). For a phi reached only through joins, a missing incoming value refuses the program only when zero would silently misrepresent it: ans_memtime/s_memrealtimetimestamp, which is the JMAN730#604 case (zero_is_wrong). Every other value becomes zero on that edge, as it did before JMAN730#604. The test keeps the timestamp case and adds ans_getpc_b64carried through the same two joins. It is refused when read directly and translates when only joins carry it. I checked the test by reverting the fix: it fails.7.
Shaders:compute samples clamped by_clkeep the console's lanesOutside pixel shaders,
image_sample_clandimage_sample_b_cllower likeimage_sample(_b): as explicit gradients from each quad of lanes. They were missing fromimplicit_derivatives, so a compute program that used only these forms did not get the console's lane order. The gradients then came from whichever host lanes shared a quad, and a debug assertion fired in tests. The new test lowers each of the five forms in compute. It fails onimage_sample_clwith the old list.8. Docs and housekeeping
docs:architecture.md(and the pt-BR translation) no longer lists BCPack as planned (docs/architecture.md still lists BCPack as planned Marvisak/VIctory#761).Shaders:theemit/mod.rstest module now builds without warnings off Windows. Only the Windows-only imports are gated, andclippy --all-targets -D warningsis clean.9. Upstream fixes ported into this fork
These are merged PRs from
Marvisak/VIctorythat this fork didn't have. Each commit keeps the original author and names the upstream PR. Where the fork's code had diverged, the change was adapted, and the commit message explains how.constant_colortest helper to Windowsv_cmp_lgordered on AMD hosts (conflict resolved by hand)CopyResource/CopyTextureRegionCARGO_TARGET_TMPDIR(the Proton override is kept)image_sample_owith constant offsets. Adapted so the offsets also reach the quad-gradient path, and given a new regression test (in range, both ends of -8..7, out of range, and per-lane offsets)data_dirinside the repo is refused (the rest was already here)Upstream JMAN730#612 is not ported, because section 6 replaces it. The other recent upstream merges were already in this fork, sometimes in a newer form.
10. Upstream JMAN730#566 merged
The per-lane descriptor and waterfall-loop work from upstream JMAN730#566 (upstream commits a3d3bc9, ffa6635, 077ec8b, 6285e19, 6638098, b1c8306, 6c63dea, 74a9d33, ffe310e) is merged in 872361e. The
trackcallers intests/resource_tracking.rswere updated for its new signature. With this merge the shader lib tests go from 114 to 140.11. Crash and hang fixes for reported issues
D3D12_OPTIONS19.MaxViewDescriptorHeapSize, else 1,000,000). A 1,310,720-view heap was created on NVIDIA but refused by the runtime, and the device was removed when it was used. Test:view_heaps_stay_within_the_device_limitB5G5R5A1_UNORM(no UAV on PC) andB4G4R4A4_UNORM(no RT on PC) are made asR8G8B8A8_UNORMthroughtarget_format, the same way R9G9B9E5 becomes RGBA16F. Cross-family copies with such a texture are skipped. Tests:small_unorm_targets_substitute_rgba8,copies_stay_within_a_format_family, and an extended host-creation testcopied_texture_uploads_again_after_the_title_rewrites_itDispatchMeshXruns through indirect execution instead of being dropped. Ported from upstream PR JMAN730#24 (artor410)ClearUnorderedAccessViewUint/Floatare recorded for resource-backed textures instead of hitting the missing-method stub. Ported from fuzeofficlal's commit d359499, which was tested on an RTX 5090 and WARP. Tests:uav_clears_fill_their_slots,uav_clears_tolerate_null_valuesChecked but not changed:
12. Shader, HLE and loader fixes from forks, and the Pilot tool
v_med3_f32tests NaN on its operands' bits instead of with a float compare, which NVIDIA folds away. Ported from raphael-riesner (Kebap11). Test:med3_f32_tests_nan_on_bits_not_a_float_compareGetProcAddresssetsERROR_PROC_NOT_FOUND(127) on a miss. Ported from Peppacodes. Test:a_missing_export_of_our_modules_sets_the_last_errortests/title_dlls.rsRtlCaptureStackBackTrace, which returned 0 frames on Windows 10 when it crossed the guard page. Ported from DrTardis1963PowerSetRequestanswersERROR_NOT_SUPPORTED(headless, Remote Desktop); other refusals keep their error. Idea from geiyiliyabumo, re-done for this tree. Test:a_system_without_display_power_keeps_the_deferralv_mad_u64_u32/v_mad_i64_i32. Ported from 9hvn9yt2vk-netizen. Test:mad_64_of_32_bit_operands_translates(fails before, passes after)v_ldexp_f32,v_frexp_mant_f32,v_frexp_exp_i32_f32. Ported from 9hvn9yt2vk-netizen. Test:ldexp_and_frexp_translateread_lanecallers here now pass on its refusal). On an RTX 4080 (Xeltax) the 114 compute pipelines the host refused on main became 0. Tests:wave64_fixtures::*scripts/pilot/(92fde68) adds VIctory Pilot, a Windows helper. It builds, runs and tests VIctory, catches crashes and hangs, and files them as[Pilot]issues on this fork with a local dashboard athttp://localhost:8765/. It is review-only here because the sandbox has no PowerShell.Checked but not changed:
Testing
On Linux with the toolchain pinned in
rust-toolchain.toml:cargo test -p victory-shader -p victory-formats: 144 shader lib tests (4 ignored) and 3 integration tests pass; formats has 36 passed and 6 ignored.cargo clippy -p victory-shader -p victory-formats -p victory-game --all-targets -- -D warningsreports nothing.rustfmt --checkpasses on every changed file.victory-gpu,victory-loaderandvictory-hleonly build on Windows. So the JMAN730#610 test, the GPU ports (Marvisak#681, Marvisak#680, Marvisak#654, Marvisak#671, JMAN730#205, JMAN730#336, JMAN730#418) and the section 11 GPU fixes and the loader test (Marvisak#666) were not compiled here. They were reviewed against this fork's helpers instead. The JMAN730#418 conversion was also tested on its own, copied into a standalone crate. Thevalu_tests.rspart of Marvisak#706 is Windows-only too.The pure logic of the section 11 fixes was copied into standalone crates and tested there: heap sizing, format substitution, the copy-family check, and the rewrite check.
victory-gpuitself cannot be compiled without a Windows target, so Windows testers should confirm. For Marvisak#735, check that "host view heap capped" is logged and there is no device removal. For Marvisak#747, check that "no dynamic slots" no longer appears.Update (2026-11-24, VIctory Try 1.2)
b7e8d83cspin-wait loops stop after 4096 iterations (PastiiJay);VICTORY_SHADER_SPIN_LIMIT.d8476f8refuse pipelines whose mandatory stage has no DXIL (IgorRend, pipeline part only).817be66bounded indirect mesh work (mesh budget 2^15 groups, 4096 per record) and per-list submissions (arthercz).indirect_plan.rs, spilled stages excluded, no shader change: the clamp's root UAV starts at the argument offset).2026-11-24 (later): more upstream PR ports, VIctory Try 1.3
VICTORY_SHOW_TARGETtakes-<n>(Linux: run under Proton, and fix the world GPU faults Marvisak/VIctory#994 idea).ffe310eb): nothing to sync. Merging this PR brings everything tomain.2026-11-24 (black screen)
09e58dd3Deserialize*PipelineStateX returns E_NOTIMPL with a null out (fixes the 1 s crash; game runs with sound/input).ce790b05crash reports dump faulting code, callers and register targets.00c14f1bVIctory Try 1.7 (failed U build no longer runs the old exe).a0ef8a09every build logs a 4x4 readback of the presented picture, failing Present HRESULTs, and presents with no resource / unwritten texture.3beb1195PresentX multi-plane compositing (after upstream D3D12 Shadows - 4060 ti JMAN730/project-flamingo#211): planes 1.. over plane 0 with premultiplied alpha; start screens live on the UI plane (upstream GPU: the prologue renders into the title's 2560x1440 targets but the 3840x2160 output stays zero (RTX 3090, integration/testers) Marvisak/VIctory#841).2026-11-24 (gameplay: NVIDIA shader translation, world view, copies)
Ports of the work that got this title into the world on NVIDIA (upstream Marvisak#1132 / Marvisak#778 stacks):
v_readfirstlaneunder partial EXEC,group_waves): 106/127 recovered on RTX 2070S in Wave64 on 32-lane hosts: #439, #189 and #734's branch side by side on an RTX 4060 Laptop, plus two dual-GPU test-harness bugs Marvisak/VIctory#1132.v_readfirstlane.s_barrier(device-hung fix); rest of Guide: Windows 10 and GPUs without mesh shaders, where things stand (24 Nov) JMAN730/project-flamingo#489 (spill-table loads on entry, spill only with s16 free).RTX 4060) D3D12 compatibility, 2s TDR submissions, and 16 GB host OOM Marvisak/VIctory#1076 med3 NaN via IEEE bits (NVIDIA foldsfcmp uno). Per-list submission and 67/86/115 format substitution were already in.VICTORY_PRESENT_1440P(mpDomd6897fac, now in every build):1= 2560x1440 world target as plane 0,<w>x<h>, orauto.VICTORY_SHADER_LOOP_LIMIT=1024by default; Series X setsVICTORY_PRESENT_1440P=1.exp/mesh-host-lanesnot needed here: our mesh code never reads masks as data, so its console lane numbering stays consistent.2026-11-24 (world pipelines, Try 2.0-2.2)
82fe2564program part found when a container has no DXIL part (falls back to a part holding the XDAT table); refusals list the container's parts.4f2e4b4433 ms pipeline wait per frame once 64+ requested pipelines wait; E_OUTOFMEMORY pipelines retried (100/400/1600 ms, one at a time).81454da2VICTORY_PRESENT_1440P=autoskips presented planes and menu frames (only frames with 800+ draws), logs the frames' color targets.6a11fb8fFix NVIDIA Ada Lovelace (RTX 4060) D3D12 compatibility, 2s TDR submissions, and 16 GB host OOM Marvisak/VIctory#10760d7b1d33buffer stride from Built descriptor bits (legayclightning22).2796175heavy pipelines no longer hold up the world's draws: Try 2.1 log showed 275 compute programs of 60-78 KB, ~18 s of driver compile each, holding every worker while ~1,600 draw pipelines waited (4-9 made a minute, draws dropped, black picture). Containers past 32 KB go to a heavy lane (1-3 workers); workers are 2/3 of the logical CPUs (2-10) and run at normal priority while a long backlog waits; pipelines slower than 2 s are logged.8e22f5ftitle memory copies of 8 MB+ split over up to 4 threads (160-360 MB copied a frame in the world).7e5228e/5f48ae6VICTORY_DUMP_FAILED=<dir>saves untranslatable and slow shader containers for offline study; Try sets it to%LOCALAPPDATA%\VIctoryTry\failed-shaders.autoworld view), 2.2.2026-11-24 (new base: fxceless/victory-gta6, Try 3.0-3.1)
54ba028the branch now stands on fxceless/victory-gta616849898(merge commit, its history kept as a parent). That fork renders the lit prologue at 2-4 fps on RTX 4070/4060 Ti/3080/3060 Ti with the Series X profile. Our Try, README picture and asset-policy exception are carried over.830e31cour gpu work re-applied on it: 64 MB pipeline-worker stacks (Peppacodes, upstream GPU: NVIDIA's shader compiler overflows the pipeline worker's 2 MB stack and the pipeline is refused as out of memory (fix on a fork) Marvisak/VIctory#966: NVIDIA's compiler overflowed 2 MB and reported E_OUTOFMEMORY), heavy-pipeline lane, parallel title-memory copies,VICTORY_DUMP_FAILED, slow-pipeline log.v_cvt_f32_f64andv_add_f64wave sums, Merge 71 new open upstream pull requests JMAN730/project-flamingo#14 mesh test skip.1dfc306upstream Shaders: a descriptor only read as data takes its kind from its table Marvisak/VIctory#1067 (undeadhuman37) hand-ported: a descriptor read only as data takes its kind from its table (the two interior pixel shaders gta6 Shaders: emit WaveSize(32) for <=32-thread wave64 whole-wave reductions JMAN730/project-flamingo#26 still drops).VICTORY_SHADER_LOOP_LIMIT=256,VICTORY_RELAY=2,VICTORY_SKIP_PIPELINES=eeed82b877b44b5f,b83629b90cd2b7bc(stable settings from gta6 Shaders: image_gather4_l gathers the four texels of its level JMAN730/project-flamingo#18), F toggles the faster late-wait/card-buffer mode (gta6 Optionally compile built-in GPU helper shaders with build-host DXC JMAN730/project-flamingo#27).