Skip to content

Merge VIctory up to 63bcca4 - #202

Merged
pragyaangaur merged 84 commits into
mainfrom
merge-victory-63bcca4
Nov 26, 2026
Merged

pragyaangaur merged 84 commits into
mainfrom
merge-victory-63bcca4

Conversation

@pragyaangaur

@pragyaangaur pragyaangaur commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

This merges VIctory up to 63bcca4 (78 commits since 67e8ae1) into our main. Main has moved on since the last merge, so this branch also carries the merges of main up to #200.

What upstream brings

  • Shadow copies and write watching: the write-back merge is faster and has an oracle test, a partial refresh of an armed page updates the bytes saved of it, marked buffer refreshes cover whole 64 KiB pages, a page's old bytes are saved before any guard is opened, and a page whose alias cannot be guarded stays changed.
  • Title memory tables: dirty-page bitmaps are pooled and zero words skipped, a released view heap takes its page table with it, and placed descriptor heaps are released before their memory is reused.
  • Pipelines: the pipeline library loads without waiting for a save, a save the host has no memory for waits and does not abort, the early list drops the oldest runs' keys, a shader cache miss hands back its translation, shared WARP device, and no blending on integer render targets.
  • Descriptors and views: placed unordered texture views are mirrored on the shared host texture, a null constant buffer view is written, a null shader view has no alias source, no typed unordered view in a format the host cannot store to, heap samplers keep point mips when anisotropic, and the depth bounds test reaches the host (gpu: preserve the fifth ordinary root constant during binding #158).
  • Shader translation: ds_bpermute stays inside its own 32 lane half, a program's constant table starts after its instructions, lane conditions along live phi edges are values, LDS accesses past the allocation read 0, and a dozen smaller fixes (f16 constants, 64 bit compares, cube faces, denormals, DPP rules, POPS ids, SGPR kills).
  • Other: composited PresentX planes (not taken, see below), password text entry masking, atomic crash records, XAsync cleanup without the completion lock, failed APU heap allocations are reported, DirectStorage and input fixes, R32 integer captures, and new tests (an ISA census, xma tables, BC1).

Conflicts and how they were resolved

19 files conflicted in about 60 places. Our macOS changes stay and upstream's version is taken where it does the same thing.

  • Presenting: upstream composites every plane in a draw pass of its own. We keep our plane choice, VICTORY_PRESENT_COMPOSITE overlay pass and queue replacement, and do not take upstream's compositor or its tests (the blend stays off by default as docs/macos.md says).
  • Shadow and watch: upstream's merge_writeback, update_tracked and the save-before-open order are in. We keep batched write-back, alias pages that are marked and not opened, and the widened copy refresh. Memory that is not tracked keeps copying under a busy range, as our test requires (upstream copies nothing there).
  • Memory tables: the pooled bitmaps and has_missed are in, on top of our victory_formats::pagetable, which also skips a copy whose end overflows.
  • Descriptors: placed heap release is upstream's (memory::release on drop) next to our unregister_heap. Upstream removed the placed unordered texture shortcut and so did we. A made view is also made again on the lock-free fast path when a later unordered view upgraded the memory's host texture.
  • Pipeline library: loads use a separate handle without the lock, the save buffer is allocated fallibly, and the early list keeps its order, with our library file mark and our write of only the early list.
  • Shaders: wave64 ds_bpermute_b32 is per 32 lane half (in halves mode the host wave is the half, so nothing changes there and permute_lanes is gone). live_edges uses upstream's fixed size path sets on our map types. lower.rs stays under the 512 KiB limit with the tests in lower/tests.rs, where upstream's test changes were ported.
  • Smaller: Host::from_device and the shared WARP device (our typed_buffer_access and heap_atomics64 stay), non zero translate jobs next to our --wave32, atomic crash records, the password flag for text entry, and our texture capture changes with upstream's R32 integer capture.

After the merge

  • New upstream tests needed changes for our tree: root signatures passed as parameters (Wine's compiler ignores [RootSignature]), our shader options and Parts fields, our Shader fields, and cfg(windows) where upstream assumes Windows.
  • Tests D3DMetal or Wine cannot run now skip with a reason: WARP does not exist under Wine, wave64 permutes need 64 lanes (a 32 lane host runs them in halves), and Wine's HLSL compiler cannot build the marked write shader (five tests).
  • D3DMetal reports the depth bounds test and does not apply it, so under Wine depth_bounds_supported is false and pipelines are made without bounds. This is in docs/macos.md.

Tests

  • Native cargo test --workspace: 519 passed, 0 failed, 17 ignored.
  • Wine (tools/macos/test-wine.sh --workspace --no-fail-fast): 1015 passed, 0 failed, after clearing D3DMetal cache.
  • cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features, on x86_64-pc-windows-gnullvm: clean.
  • cargo xtask policy: 240 files ok.

Marvis and others added 30 commits November 25, 2026 17:51
The title now plays the intro cutscene and reaches the prologue with the
graphics fully displayed. Splits the two in the stage table, updates the
subsystem rows, the memory requirements and the pipeline pre-build timing.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
XAsyncComplete held the call's `done` lock while the title's provider
ran OP_CLEANUP. A cleanup that waits for a worker thread which is itself
completing the same call (it took the call before the cleanup removed
it) deadlocked: the worker blocks on `done`. The first completion now
claims the call with an atomic flag and runs unlocked; the status is
still published after the cleanup, while the block is valid, and `done`
is set only for the waiters.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* Shaders: reuse SSA sums when tracing memory addresses

Co-Authored-By: GPT 6.2 Sol <noreply@openai.com>

* Shader tests: an address from no root parameter is title memory

Main reads such an address as title memory instead of refusing it.

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

---------

Co-authored-by: GPT 6.2 Sol <noreply@openai.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Fixes #181.

Concurrent WARP (d3d10warp.dll) usage across threads crashes with
0xC0000005 on Windows 11, both when creating/tearing down separate
WARP devices and when compiling pipelines or executing work concurrently
on a single shared WARP device.

Keep one process-wide WARP ID3D12Device in Host::new (for explicit
warp = true, VICTORY_WARP=1, and systems whose default DXGI adapter
has DXGI_ADAPTER_FLAG_SOFTWARE) and serialize WARP root signature
creation, pipeline compilation, draws, and dispatches behind a
process-wide mutex. Hardware D3D12 devices remain unserialized.

Route diff_tests's direct CreateRootSignature calls through
Host::root_signature_bytes so they share the same serialization, and
add a multi-threaded WARP regression test (parallel_warp_pipelines_and_draws).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* GPU: mirror placed unordered texture views (#921)

Resolve `View::Placed(true, ...)` texture descriptors through
`placed_texture` to `View::Unordered` on the shared host texture for
that memory so placed unordered texture views bind real D3D12 UAVs and
transition to `UNORDERED_ACCESS` instead of falling back to null UAVs.

Refresh an already-mirrored placed texture slot when a later unordered
or renderable view upgrades that memory's `HostTexture`, and apply
`alias_source` copies to explicit SRVs superseded in `MEMORY` as well
as placed SRVs so compute writes at one guest address stay visible
regardless of view creation order.

Also resolve `DXGI_FORMAT_UNKNOWN` (`0`) view descriptions from
`resource::view_format` when the host copy is typeless or castable, and
check `typed_store` as well as typed-depth/typeless view exclusions in
`fits` before creating host SRVs/UAVs.

* GPU tests: dispatch a guest shader through a placed texture UAV

* GPU tests: declare the placed UAV tests beside the other pipeline modules

---------

Co-authored-by: andrewpozdnakov7-jpg <andrewpozdnakov7-jpg@users.noreply.github.com>
- Reject --jobs 0 in both translation modes before starting workers.
- Cover the CLI exit and diagnostic without including title files.
RDNA2 flushes denormal operands of the legacy multiplies to zero, so
0 x anything = 0 also holds for them. The lowering only tested for an exact
float zero, whose result also depends on the host's denormal mode. Test the
exponent bits instead. Follow-up to #2.
The early list keeps this run's keys first, then earlier runs' others,
but those came from a HashSet, so once the list was full the keys that
made room were any earlier ones, not the oldest.

Earlier keys now keep their place in the list as loaded. The list is
saved most recent run first, so sorting by that place drops the oldest
runs' keys and keeps the order across saves. A list saved by an earlier
build (in no order) still reads.

`save` also reads the list through `used()`, so a save before anything
read it in this run keeps the saved list instead of writing an empty one.
* xmem: keep the space below 4 GiB for the title's 32-bit memory

XMemVirtualAlloc with the 32-bit address flag has to fit below 4 GiB, where
Windows also puts the host's own memory first (it allocates bottom up). With
a large pipeline cache read at startup, the driver's, heap and cache memory
left 22 MB there, in pieces of at most 14 MB, when Grand Theft Auto VI asked
for a 185 MB 32-bit placeholder; the request was refused
(ERROR_NOT_ENOUGH_MEMORY) and the title stopped at an assertion
(+0x19f4f58). The D3D12 debug layer's memory did the same.

`low_guards::install`, at the start of `run`, reserves the free space below
4 GiB but the lowest 256 MB (left to the host). A 32-bit request that finds
no room releases the smallest guard that fits it (else the largest) and
tries again, then guards what is still free of it.

Tested: the new test releases a guard, takes part of the hole and checks the
rest is guarded again. In the title (RTX 2080, a build with a large cache):
without this the startup failed 2 of 3 times; with it, 5 of 5 starts passed,
3.7 GB below 4 GiB kept for the title.

* Bound low-address allocation retries to existing guards

* xmem: safety comments and formatting for the bounded guard retry

---------

Co-authored-by: swarm <swarm@swarm.swarm>
Co-authored-by: NuraadGit <NuraadGit@users.noreply.github.com>
ir::build fills every instruction's register lists twice. `effects()`
collects `Vec<Reg>` (two allocations), and the caller immediately maps
each one into `Vec<(Reg, Value)>` (two more), freeing the first pair. For
lists that are almost always two to four entries, that is four
allocations and two copies per instruction, on every instruction of every
program.

Have `effects()` and its helpers collect the `(Reg, Value)` pairs
directly, with the placeholder the SSA pass fills in. Two allocations per
instruction instead of four; `Inst` and everything downstream are
unchanged.

Measured with the synthetic bench in #1002 (no game data), ten
interleaved rounds per arm, nanoseconds per instruction, at 256/1k/4k/16k
instructions:

  ir::build   308 -> 269, 375 -> 324, 407 -> 340, 402 -> 353  (0.835-0.878)
  translation 898 -> 872, 898 -> 825, 951 -> 875, 956 -> 912  (0.919-0.971)

gfx10::decode, structure, lower and the rest are unchanged. The emitted
DXIL is byte-identical at all four sizes.

cargo test --workspace --locked: 342 passed, 0 failed, 7 ignored.
Both clippy configurations clean; cargo xtask policy ok.

Co-authored-by: pes7 <pes7@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.

(cherry picked from commit 169efcb84eb5d9d83c0af7fe525a54ada86f3a0d)

Co-authored-by: pgm1207 <104554896+pgm1207@users.noreply.github.com>
Co-authored-by: pablogonz12 <pablogonz12@users.noreply.github.com>
* Shaders: v_med3 orders -0 below +0, as RDNA2 does

The ISA defines v_med3_f32/v_med3_f16 over v_min_f32/v_max_f32, which order
-0 below +0 (#448 settled those), so of three zeros the median is the sign
two of them share; DXIL's plain FMin/FMax chain gives either zero. The zero
the chain leaves now takes that majority's sign (11 instructions). A NaN
still gives the minimum of the three.

Noticed while porting the idea of xcl-dev/xcl#1348 (DavidM1911).

Tests: hardware execution tests in valu_tests for both operand orders and
the halves.

Written with an AI assistant.

* Shaders: keep main's med3 lowering, leave only the signed-zero test

main's max_min_flushed chain (77053a0) already orders -0 below +0, so the
majority-sign select this branch added gives the same result.

---------

Co-authored-by: pgm1207 <104554896+pgm1207@users.noreply.github.com>
Co-authored-by: pablogonz12 <pablogonz12@users.noreply.github.com>
…es on Windows (#1324)

* Pipeline: accept existing entry when concurrent cache publication races on Windows

* Pipeline: exercise the blocked Windows cache publication path

Keep the published entry open without delete sharing and assert that replacement is blocked. The regression fails with the pre-fix publication code and passes with the current implementation.

Validation: 5 pipeline tests passed on x86_64-pc-windows-msvc; pipeline Clippy with warnings denied and formatting checks passed.

* Pipeline: adapt concurrent publication test to new tempfile_in signature
A wireless receiver with its controller switched off still answers
XInputGetState with an all-zero state, which connected the empty slot
and disconnected the keyboard stand-in pad.

Keep each host slot disconnected until its current connection reports
non-rest input, reset that flag on disconnect, and keep scripted
diagnostic keys on the stand-in while no host pad has reported input.

Fixes #845.

Co-authored-by: andrewpozdnakov7-jpg <andrewpozdnakov7-jpg@users.noreply.github.com>
…zle_b32 (#1582)

Co-authored-by: Capt-Speed <302143526+Capt-Speed@users.noreply.github.com>
…-dword i64 compare wrong) (#1599)

* Shaders: 64-bit integer compares on their dwords

v_cmp_{lt,le,gt,ge}_{i64,u64} lowered to one i64 icmp give the wrong
answer on AMD's D3D12 driver when the operands share a dword: `v_cmp_lt_i64
s20, v[1:2], v[2:3]` with v1 = v2 = 0, v3 = 1 (0 < 0x1_00000000) is false
on an RX 9070 (32.0.32029.2010) and on a Ryzen 7700 iGPU, gfx1036
(32.0.21045.29003), as if the dwords were swapped; WARP gets it right.
Disjoint pairs are fine there, and so is equality.

The compare now runs on the dwords: the high ones decide (signed for
i64), equal ones leave it to the low ones (unsigned). It needs no INT64.
The GPU test runs all twelve compares over values whose dword orders
disagree, on disjoint and on shared registers; without the change it fails
on the AMD hardware.

Found by a cross-device fuzzer that compares single VALU instructions on
every adapter and WARP.

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

* Shaders: a signed 64-bit compare's literal sign-extends in the dword split too

main's src64 now sign-extends the 32-bit literal of an _i64 operand
(signed_64_bit_operands_sign_extend_their_literal). The dword compare
read the literal's high dword as zero, so v_cmp_lt_i64 v[1:2], -100
compared against 0x00000000_FFFFFF9C. It now takes the same high dword
src64 would.

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

---------

Co-authored-by: alexdeliu <240865807+alexdeliu@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
v_cubeid/sc/tc/ma_f32 pick a coordinate (or its negation) as the
result, so a denormal coordinate came out as the host's: kept on AMD,
flushed to -0 on WARP, where the console's float mode reads it as a zero
of its sign. The coordinates now go through ftz first, as min and max's
operands do (77053a0).

A semantics probe runs the four over signed zeros, denormals,
infinities and NaN in each coordinate (14,440 inputs) against the RDNA2
model. Without the change: 2,193 model mismatches on an RX 9070, 1,276
on WARP, and the two disagree on 917.

Found by the cross-device fuzzer (#1614).

Co-authored-by: alexdeliu <240865807+alexdeliu@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Every root signature we make declares SAMPLER_HEAP_DIRECTLY_INDEXED, and a
list must have a sampler heap bound before such a signature is set (the
debug layer's id 1419, and NVIDIA removes the device with INVALID_CALL for
it: #1754). bind_heaps only ever bound the heaps the title bound, plus our
view-heap fallback for the case the title binds none, so a compute list that
reads views and no samplers -- the list in that report -- set the signature
with no sampler heap bound at all.

There is now a sampler heap of ours, made on first use with a point sampler
in slot 0, bound whenever the title binds no sampler heap; the decision is a
small function with a test, so which heaps a list must have can be read
without a device.
The RX 5700's driver zero-extends the bytes of a dot4 multiplicand it
sees as a constant, so fspx_programs_run_with_the_hardwares_dot_products
failed on RDNA1 although the DXIL asks for signed bytes. Each operand is
now a literal plus a word loaded from the zeroed UAV.

Fixes #1782

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…#1830)

`show_config` printed `POLICY VIOLATION` for each configured path inside
the source tree but always returned `Ok`, so a script could not tell a
clean configuration from a refused one. It now counts the violations and
fails after printing them; the stdout output is unchanged.

Fixes #831

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
members() tested all 385 register slots to return the few that are live,
twice for every block of a program: 1.27 M tests for a 1,651-block
shader. Walk the seven set words by their lowest set bit instead, in the
same register order. The IR build is 4.5% faster on a synthetic GFX10
program of 12k and 24k instructions, and range::build 4.1% faster.

Co-authored-by: slatefield <slatefield@users.noreply.github.com>
The stub that answers a slot a table does not fill reported only the
object kind, the slot and the caller's offset. Two reporters (#829 and
the #417 thread) had to patch it locally, logging rcx/rdx/r8/r9, to tell
what the call carried; one of them asked for it upstream.

The stub now takes the receiver and the next three registers and logs
them as `args=` alongside the rest, once per slot as before. On win64 all
four are registers, so reading them never touches the caller's stack,
and a call made with fewer real arguments only shows whatever its
registers held. That is enough to tell a call passing an interface GUID
or a module address from one passing flags, a count or an out pointer
without rebuilding with a local patch.

Co-authored-by: pablogonz12 <pablogonz12@users.noreply.github.com>
denkencar-sketch and others added 24 commits November 25, 2026 22:55
changed_here opened the guarded pages and then saved their bytes for armed trackers, and changed opened the faulting range before the pages that alias it. A write by another thread landing in between went unfaulted, and the save then kept the new bytes as the old ones, so copy_back_marked saw no difference and the write was overwritten. Marks and saves of the range and its aliases now come first, and the pages are opened after. Not covered by a test: it is a race between two threads.

Co-authored-by: denkencar-sketch <224703622+denkencar-sketch@users.noreply.github.com>
…2262)

Co-authored-by: andrewpozdnakov7-jpg <andrewpozdnakov7-jpg@users.noreply.github.com>
…on (#2286)

shared_texture() asks GetResourceAllocationInfo for the size it saves, with
the title's description. That description may ask for uses its format does
not take on the host: on NVIDIA, unordered access on B5G5R5A1_UNORM. The
query rejects it, and the device is removed (DXGI_ERROR_INVALID_CALL) a few
seconds into the title on every NVIDIA card.

Ask it of the live texture the description is shared with, as
HostTexture::new does: a description the host made the texture from.

Co-authored-by: Bullet18x <344699838+Bullet18x@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The stream is a byte slice that need not be 8-aligned; the reference made
over it was undefined behaviour and a panic in checked builds.

Co-authored-by: denkencar-sketch <224703622+denkencar-sketch@users.noreply.github.com>
A pixel program with no color output ends with `exp null done vm`. When its
last loop leaves through the usual exit test on its own exit mask
(`s_andn2 X, X, exec`, then the SCC branch), structurisation took that test
for a discard's "no live lane is left" exit: the back edge became always
taken, the lanes that were done were discarded instead of leaving, and every
lane ran the loop to the loop limit (2^20 iterations). On an RTX 5090 each
such draw (a small box, 36 indices) took 203 ms.

A discard's exit ends the program with no lane live. An end that first gives
EXEC a saved mask other than the discard's live mask exports those lanes as
valid: a normal end. Such a block is no longer a kill exit.

Co-authored-by: wrothgaril <211408787+wrothgaril@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
… (#2377)

* GPU: a partial refresh of an armed page updates the bytes saved of it

Since cd94d35, a page armed for marked writes keeps its bytes from before
the title's first write (Tracked::saved), and copy_back_marked takes what
differs from them for the shaders'. A refresh of only part of that page
in the same submission (under or beside a range shaders write) leaves the
page changed and its saved bytes as they were, while the copy now holds
the title's newer bytes there. Copy-back then took the refreshed bytes for
the GPU's, putting them back over later title writes, and missed shader
writes back to the saved value.

Shadow::copy now hands what it copied to Tracked::refreshed, which updates
the saved bytes of the pages it covers, as update_busy does for the
snapshots of unmarked ranges.

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

* GPU: the saved bytes of an armed page are the copy's from before the submission

Docs of Saved and Tracked::saved: refreshes lay what the copy takes over
the bytes saved at the title's first write.

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

---------

Co-authored-by: Gemini 4 Neon <noreply@google.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Vibe Nuage Agent <vibe@mistral.ai>
Co-authored-by: borosf <borosf@users.noreply.github.com>
The title's pixel ordered-section (POPS) wait loop computes:

    s2 = bfe(s_pops, 0, 10)   ; collision wave id
    s5 = bfe(s_pops, 16, 10)  ; this wave id
    s4 = ~s2
    s5 = s5 + s4
    ...
    s_cbranch_vccnz label_body
  label_wait:
    s0 = src_pops_exiting_wave_id + s4
    s_cmp_lt_u32 s5, s0
    s_cbranch_scc0 label_wait

Seeding the POPS hardware SGPR with 0 gives wave_id == collision_id == 0,
making s5 = 0 + ~0 = 0xffff_ffff so s5 <u s0 can never hold for any u32
exiting wave id. While active lanes skip the loop on overlap == 0, any
inactive lane (where EXEC is clear at s_cbranch_vccnz) falls through and
spins to LOOP_LIMIT (1 << 20 iterations).

Seeding 1 << 16 (overlap = 0, wave_id = 1, collision_id = 0) satisfies the
hardware invariant wave_id != collision_id so s5 = 0 and s0 = 0xffff_ffff
with src_pops_exiting_wave_id = 0, exiting immediately on the first check.

Add a WARP draw test reproducing the 1 << 20 spin and verifying it drops
to a single pass.
…(#2449)

D3D12 accepts a null description and initializes BufferLocation=0,
SizeInBytes=0. create_cbv returned early instead, so a later null call
left the previous View (and mirrored host slot) active. Record
Constant(0, 0) so the slot is cleared; host mirroring already nulls
Constant views via null_buffer_view.

Fixes VIC-BT-016 in #1242.
* GPU: a page whose alias cannot be guarded stays changed

guard_aliases ignored what protect returned. While a write the guards
do not see (watch::writing: a kernel read, a DirectStorage write) is
under way through one mapping of a physical page, that mapping stays
open; taking the page through another mapping still guarded it there,
dropped it from the changed pages and dropped the bytes saved of it.
Writes through the open mapping then went unseen by the copy, and when
the write ended (changed without saving) an armed page was left
changed with nothing saved, so copy_back_marked dropped the shaders'
writes to it.

watch.rs: "taking a page guards every address showing it", and "a page
that is mapped but cannot be guarded is left out (it stays changed)".
guard_aliases now returns the pages with a mapping it could not guard;
take and taken leave those changed. title_memory_aliased marks the page
changed when the new mapping of a guarded page cannot be guarded.

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

* GPU: a new mapping that cannot be guarded marks its page changed without saving

Its bytes may already hold the write under way through it; saved as the
page's old bytes, they would be taken for the GPU's at a marked
copy-back (review by fyernald).

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

---------

Co-authored-by: Gemini 4 Neon <noreply@google.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…462)

* GPU: no typed unordered view in a format the host cannot store to

fits() asked the host whether it stores to a typed unordered view's
format only for views cast to another family. A view in the texture's
own format went to CreateUnorderedAccessView unchecked, and on an NVIDIA
card (Windows 10) the title's B5G5R5A1_UNORM unordered views, which that
card does not take, removed the device with DXGI_ERROR_INVALID_CALL
during loading (the debug layer: "The format (0x56, B5G5R5A1_UNORM)
cannot be used with a Typed Unordered Access View", then RemoveDevice).

Every typed unordered view is now checked: one the host cannot store to
is not made, as other views the host does not allow, and its slot stays
null.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018sSQTeDQ6Kc6DEkgPbAww8

* GPU: the store check looks at the format the unordered view is made in

Review of #2462: for a view of a typed texture in another format of its
family that is not castable, fits() makes the view in the texture's own
format, but the store check looked at the requested one. It now checks
the format the view is made in.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Lower::memory previously computed the dirty bitmap bit for the last byte of a write by adding 32-bit wrapped page deltas to the first page's level-2 entry. Writes straddling a 4 GiB boundary wrapped the 32-bit addition to ~512 MiB out-of-bounds in the dirty bitmap UAV, and writes crossing a 256 MiB boundary overflowed the 12-bit page index into the wrong or out-of-bounds level-2 block. Guard the second bitmap update on non-missed 64 KiB page crossings and resolve the end address with 64-bit addition through the page table.
A shader resource view of no resource is an ordinary view, and draw.rs
`readable` hands its null pointer to `alias_source`, which read the
resource's description through it: an access violation at the world's
start (run fps0, frame 1916, victory.exe in alias_source). The helpers
beside it (`host_resource`, `made_copy`) already answer None for null.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* GPU: the depth bounds test reaches the host

Keep the kind-21 enable flag in the graphics state and pipeline cache
key. Use DEPTH_STENCIL1 for vertex and mesh streams that request the
test when the host supports it. Unsupported hosts fall back to the
plain depth-stencil state and warn once.

Forward the title's depth bounds to the host command list and replay
them when binding a graphics pipeline, including after the indirect
clamp. New and reset lists start with D3D12's 0..1 default.

Synthetic title draws and mesh dispatches on an RTX 5070 and WARP
kept excluded pixels at the cleared depth of 0.5 and wrote 0.25 to
included pixels. Fresh and reset lists also wrote 0.25. A forced
unsupported run drew all pixels, and the stream reader regression
failed with the upstream reader. Since the rebase onto 940d32f the
vertex stream also carries the rectangle lists' geometry shader and
both streams the topology type; only the draw ran again, on WARP.
The console subobject layout and call signature still need title-side
verification.

* GPU tests: drop the depth bounds mesh test that starts dxc

The triage on #158 asks for a maintainer's sign-off on new code that
starts an external process; the only such code was the mesh-dispatch
test, which ran dxc from VICTORY_PC_DXC and was skipped without it.
The stream-level test and the vertex draw test stay; the mesh path of
the shared stream builder is no longer exercised on a GPU here.

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

---------

Co-authored-by: r4. <192970269+r4tedx@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Brings in 78 upstream commits since 67e8ae1. Conflicts in 19 files, each
resolved to keep our macOS changes and take upstream's version where it does
the same thing:

- Shadow and watch: upstream's merge_writeback, update_tracked and the
  save-before-open order in watch::changed are in, on top of our batched
  write-back, our alias pages that are marked and not opened, and the widened
  copy refresh.
- Memory: upstream's pooled dirty-page bitmaps and has_missed are in; the
  page table stays in victory_formats::pagetable, which also skips copies
  whose end overflows.
- Descriptors: the placed heap release is upstream's (memory::release on
  drop), our unregister_heap stays; the null view clearing test is added; the
  placed unordered texture shortcut is dropped as upstream removed it.
- Pipeline library: loads go through a separate handle without the lock, the
  save buffer is allocated fallibly, and the early list keeps its order, all
  from upstream, with our write of the library with its mark.
- Presenting: our plane choice, overlay blend pass and swap chain handling
  stay. Upstream's built in compositor and its tests are not taken.
- Shaders: ds_bpermute stays inside its own 32 lane half (halves mode keeps
  working in the host wave), live_edges uses upstream's fixed size path sets
  on our map types, split_wave_barriers and the lower tests file stay split.
- Smaller ones: Host::from_device, shared WARP device, NonZero translate jobs
  with our wave32 flag, atomic crash record append, text entry password flag,
  our texture capture changes plus upstream's R32 integer capture.
…es, remake upgraded placed views on the fast path
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.