Skip to content

Merge candidate: triaged ready-to-merge PRs built and tested together (draft, in progress) - #3327

Draft
pes7 wants to merge 284 commits into
Marvisak:mainfrom
pes7:merge/best-2026-11-26
Draft

pes7 wants to merge 284 commits into
Marvisak:mainfrom
pes7:merge/best-2026-11-26

Conversation

@pes7

@pes7 pes7 commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Draft, work in progress. A merge candidate: main plus the open pull requests that a triage marked ready to merge, merged together, built and tested together, conflicts between them resolved by hand. Posted so others can see the merge work and not repeat it; coordination in #1633.

Nothing here closes or replaces any pull request: each one stays open and is closed only when it lands in main. This PR is not meant to be merged as is; it shows which set works together and which pull requests need a rebase.

How the set was chosen

1 494 open pull requests (26.11) → 1 004 mergeable into main, with a green check, not drafts → 968 touching code. Left out: diagnostics and opt-in switches, benchmarks, CI, README/CLI, Wine/Linux-only, stacked pull requests, more than 600 changed lines or 6 files, known duplicates, build-profile changes. The rest scored on: a correctness/crash/performance fix, its author already merged upstream, small, has tests. 134 picked, merged oldest first after ours.

Unlike the Forge train (#1624, every PR that merges and passes cargo check), this is a triaged subset, and each step runs clippy and the full test suite, plus the title itself.

Status (base 63bcca43c)

merged cleanly 97 (this branch, merge/best-2026-11-26)
merged with conflicts resolved by hand 18 more on merge/pass2, not yet built
already covered by a merged PR 2
need a rebase (semantic conflicts) 17

Checked locally on Windows for this branch:

Two commits of mine on top, both needed by the set, not by any single PR:

In this branch (97)

Conflicts resolved on merge/pass2 (18, building next)

Covered by a merged PR

Need a rebase onto this set

🤖 Generated with Claude Code

BastienRodz and others added 30 commits November 25, 2026 08:59
src64 sign-extends a literal for operations named *_i64 (Marvisak#447), but
v_mad_i64_i32's addend is S2.i64 too, and its name ends in _i32, so a
negative literal there was zero-extended: 0 * 0 + -100 gave 0xffffff9c
with a high dword of 0. RDNA 2 ISA 6.2.1: a 64-bit signed integer source
sign-extends its literal. v_mad_u64_u32 keeps zero-extending.

Co-Authored-By: Gemini 4 Neon <noreply@google.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review on Marvisak#1787: host textures are made with their castable formats, and
D3D12 allows ALLOW_UNORDERED_ACCESS when a format the texture can be cast
to takes typed unordered access (B5G5R5A1_UNORM's 16-bit aliases such as
R16_UINT on NVIDIA). Dropping the use whenever the texture's own format
lacks it lost writes through those aliases.

host_desc now drops it only when neither the format nor any castable
format takes typed unordered access. make_texture's fallback without
castable formats (CreateCommittedResource3 refused or no Device10) drops
it when the format alone lacks it, since there the alias is gone and the
flag is illegal. The test makes the textures through make_texture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adapt fxceless/victory-fork#971 to cover translate, its cache warm-up,
pipeline pack discovery, and shader-info. Resolve file symlinks for
type and size checks while preserving each caller's regular-file
metadata policy and shader-info's warning for large regular files.

Thanks to avt0m4t48 for independently verifying the translate fix and
identifying the remaining shader-info gap in fxceless/victory-fork#971.
With the node's base taken from a root descriptor ("Built"), the node's byte
offset was shifted and added in 32 bits and then zero-extended to 64: a BVH
larger than 2 GiB has offsets that do not fit, and any negative intermediate
(the adds are signed) became about 4 GiB too large instead of sign-extending.
The explicit-descriptor path next to it already does the shift in 64 bits,
so the two halves of the same instruction disagreed.

The offset is now built in 64 bits for a raw (title-memory) base — shift,
constant, and the computed part — and only the buffer-view path keeps the
32-bit form D3D12 takes for a buffer's offset.

`intersections_with_64_bit_pointers_on_the_gpu_equal_the_reference` covers
this path on the card; it and the rest of the lib suite are green (247
passed, 3 ignored). A case that *fails* before this needs a BVH of more than
2 GiB, which this machine does not hold, so the change is argued from the
arithmetic rather than from a red test — if a title-side repro shows up, this
is the first place to look.
Review feedback on Marvisak#2501: the comment said the 64-bit shift also fixed a
negative offset becoming about 4 GiB too large, but `built_offset` gives `k`
as `u32` and the computed part goes through `Cast::ZExt`, so the new code
zero-extends too; the old 32-bit add wrapped instead. Drop the claim.

Add the test the review asked for: `run_cases` gains a `high` mode that sets
bit 29 of the node pointer and maps the page 4 GiB higher in the page table to
a second copy of the nodes, with zeros in the page below. With the old 32-bit
shift the offset wraps back to the zeros and no case matches the reference;
with the 64-bit shift the pointer reaches its copy. `page_table_high` adds the
level-1 entry for the 256 MiB region 4 GiB up and a block for it.
…fore it runs

Since 52d14b1 a heap slot whose texture view is left null (a placed
texture written into the heap, or one given up since 69d1e8e) is
forgotten (forget_read) so that its next read marks it again and
take_reads, after the submission, has its view made. Both happen before
the submission runs (sync_heaps, evict_unused), but the forgotten marks
were only cleared inside take_reads, after it ran: the mark a shader of
that very submission had just set was wiped with them. The slot was made
only after a later submission read it again (another frame of a null
view), or never if nothing read it again.

The marks of slots forgotten since the last submission are now cleared
just before the next one runs (clear_forgotten_reads); take_reads still
clears those forgotten while it ran.

Co-Authored-By: Gemini 4 Neon <noreply@google.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lone

Since 69d1e8e, giving up a host texture (idle, or past the card's
budget) nulls every heap slot viewing it (HostHeap::evict). Since
ed25c0e it finds them by scanning `kept`, which covers the dynamic slots
too: the descriptor tables lists build for their draws. A recorded list
not yet reset still uses those (the dynamic slots it took are not
released until then), and its table is not made again before it runs,
so its draws read a null 2D view, and the slot no longer held the
texture. resource.rs: "Lists recorded before hold it until they are
reset, so no GPU work reads it freed".

evict now leaves dynamic slots a list still holds (taken in `next`), and
holds `made` and `next` across the scan and the clearing.

Co-Authored-By: Gemini 4 Neon <noreply@google.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Until the slot is next made, not until its list is reset (review by
fyernald).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hi entry

Since 286a00e the DXIL writer takes a branch on a constant as a branch to
its one target, drops phi entries of edges that are gone, and folds an
empty block with one predecessor into it. Plan::edge decided whether a
phi of block x keeps its entry from b by following b's successors
through folded blocks (`to`). For `CondBr(true, empty, join)` with
`empty` folded (`empty` branches to `join`) and a phi in `join` with
entries from `empty` and from the untaken direct edge, the direct entry
was kept as well: the phi got two entries for its one predecessor,
which is invalid IR.

An entry stays when b's own terminator, constant branches taken as
branches, still has x among its successors; a folded block's entry
still stays and is written from the block it was folded into.

Co-Authored-By: Gemini 4 Neon <noreply@google.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e host's

The title asks for 1 245 184 descriptor slots, more than the 1 000 000 a host
heap holds, and it walks them in increasing order. "Log when the high-water
mark moves" is therefore one line per distinct slot: 199 846 of the first
200 000 lines of a run, ~8 000 a second, on the thread recording the frame.

That was the whole of the first frame's stall:

    before   310 932 lines in the run, first frame 21 433 ms
    after        231 lines in the run, first frame     33 ms

Same build, same warm caches (926 MB pipeline library, 1 347 MB shader cache),
same 150 s window. What the line said - that slots above the host heap's count
are not mirrored - is what the one line now says.

The underlying problem is not this change: 245 184 title slots can never be
mirrored because they exceed the tier-2 heap limit, which needs either several
host heaps with the index arithmetic adjusted or the views above 1 M placed
elsewhere. That is why the first world frames get null views.

cargo test --workspace --locked; both clippy configurations with -D warnings;
cargo xtask policy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… as buffer copies' are

What was wrong: a tracker leaves pages that touch memory other than the
runtime's untracked, "copied whole at each use" (280b150), and such a
tracker is never clean. A texture's refresh asked only the tracker's
changed pages (`Tracked::take`) and, since cc5f961, re-detiled only the
subresources those pages touch: a subresource lying wholly in untracked
pages was never touched, so it was not uploaded at all, not even the
first time (before cc5f961 the first refresh read the whole texture).

What changed: the refresh also takes the tracker's untracked parts
(`Tracked::untracked`) as candidates. Subresources in them are read and
their bytes decide by hash, as for a page shared with other data; the
"a whole changed page" shortcut still looks at tracked pages only.

Test: `draw::tests::a_mip_off_the_runtimes_memory_is_uploaded` (a
two-mip linear texture whose mip 0 lies in plain committed memory after a
reserved page: both mips uploaded at first, mip 0 again after a write).
On main it fails: "both mips at first", left 1, right 2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Translated shaders clamp every heap index they compute below HEAP_VIEWS,
and NULL_BUFFER_VIEW = HEAP_VIEWS - 2 is the slot a shader reads instead of
a slot with no buffer view. HEAP_VIEWS was 1 << 21 = 2 097 152, the
console-shaped heap the indices were first written for, but
D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_2 is 1 000 000
(victory-gpu's PORTABLE_VIEWS): the clamp allowed an index 32 MB past the
end of any heap that can exist, and what is there is read as a descriptor.
The code knew - "a host that caps its heaps below HEAP_VIEWS (NVIDIA)
faults on an index past them" - and on the title it never got as far as
the null slots:

    host view heap capped at 1000000 count=1245184
    no room for the null buffer views: ... count=934464 total=1000000

HEAP_VIEWS is now the largest heap a host may create (1 000 000), so every
index the clamp can produce is inside the heap and NULL_BUFFER_VIEW is
999 998. A heap capped at PORTABLE_VIEWS keeps the top of itself for those
two slots (MIN_DYNAMIC - NULL_RESERVE dynamic slots), so the title slots
and the dynamic ones end below them and the warning above no longer
happens; measured on the title, warm caches: "null buffer views: 0".

The title asks for 1 245 184 slots, more than a host will hold, so slots
above the capped heap's title region are still unmirrored - they read a
null slot now, which is the safe answer the clamp was meant to give, not a
read outside the heap.

HEAP_VIEWS is baked into translated shaders, so the shader cache is
translated once more (SOURCE_HASH changes); the pipeline library is keyed
by the title's shaders and is unaffected.

cargo test --workspace --locked; both clippy configurations with -D
warnings; cargo xtask policy.
pes7 and others added 29 commits November 26, 2026 21:43
…hen run

Two arms with it set (ncb1/cb1 and cb2 in one A/B) died before the world:
`0xc0000005` reading `0x8` and `0x80000003`, both in the title's own image, and
both arms without it ran 6-7 minutes each with 0 removals and 0 exceptions.

That is what the rule beside it already said in words - a list that computed
from zeros hands the title garbage pointers - so the switch is documented as
the demonstration of that, not as something to use.

Measured on the same driver, same scene, 240 s arms: withholding is not what
keeps the game from advancing; the missing copies are the problem, and the
switch shows fixing it the wrong way round breaks the title.
…12 KiB policy limit

The merged PRs grow lower.rs from 520 563 to 544 760 bytes; the asset
policy test refuses files past 524 288. Marvisak#3097 does the same move but
conflicts with the merged set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.