Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
f1fa9d5
Shaders: a value with no DXIL form stays missing through a join only …
MfDev0 Nov 24, 2026
d185b55
GPU: VICTORY_D3D12_WARP=0 picks the hardware adapter again
MfDev0 Nov 24, 2026
c60710a
Shaders: test that a built program is SSA and every read is dominated
MfDev0 Nov 24, 2026
61cece3
Shaders: a heap view written anywhere is a UAV in every access, and g…
MfDev0 Nov 24, 2026
a53a5a5
Shaders: cube-map arrays sample their slice and face, not layer 0's +…
MfDev0 Nov 24, 2026
f427da3
Shaders: only a timestamp stays missing through joins, not every value
MfDev0 Nov 24, 2026
f45400c
docs: victory-formats decodes BCPack; it is no longer planned
MfDev0 Nov 24, 2026
5b93bd0
Docs: drop the private intra-doc link to MICRO in texture.rs
catminou4 Nov 24, 2026
d56d408
Shaders: gate the constant_color test helper to Windows
catminou4 Nov 24, 2026
8cd5f10
GPU: unbind vertex buffer slots for null view arrays
fuzeofficlal Nov 24, 2026
1169a3b
GPU: use the host upload path for texture staging copies
EatCodeSleep2 Nov 24, 2026
d45ef2e
Docs: rustdoc builds the loader, GPU and shader crates without warnings
lameloball2813-ui Nov 24, 2026
b197a34
GPU diagnostics: describe a buffer UAV by its range, not as uav None
SantannaCarlos Nov 24, 2026
9ba912d
Shaders: decode GFX10 packed inline constants by operand type
AlanQiang0418 Nov 24, 2026
e488762
Shaders: centroid position with conservative depth
SAitken91 Nov 24, 2026
510d880
Shaders: v_cmp_lg is ordered on AMD hosts too (olt | ogt, not fcmp one)
Lyrnc Nov 24, 2026
7137932
Shaders: the test module builds without warnings off Windows
MfDev0 Nov 24, 2026
be15b44
GPU: write half subnormals from f32 rectangle outputs
enzoduarte1 Nov 24, 2026
c48acf0
Shaders: reads of uninitialized SGPRs read as zero, as VGPRs do
Proudnoob4 Nov 24, 2026
17ef0d2
GPU: upload CPU-written textures before CopyResource and region copies
fuzeofficlal Nov 24, 2026
600e362
Loader tests: build the probe fixture under CARGO_TARGET_TMPDIR
lameloball2813-ui Nov 24, 2026
005497e
Shaders: compute samples clamped by _cl keep the console's lanes
MfDev0 Nov 24, 2026
244cd02
Shaders: image_sample_o with constant offsets
SAitken91 Nov 24, 2026
0c8ec39
GPU: give null texture UAVs the title's view dimension
juliocesarshopify-maker Nov 24, 2026
bc188e3
GPU: the larger dynamic range only where the heap still fits
hophaver Nov 24, 2026
626937d
core: test that a data_dir inside the repo is refused
AdvaitPalve11 Nov 24, 2026
872361e
Shaders: per-lane descriptors and the console's waterfall loops
r4tedx Nov 24, 2026
ac62f72
GPU: view heaps stay within the device's descriptor limit
MfDev0 Nov 24, 2026
f32ed74
GPU: B5G5R5A1 and B4G4R4A4 targets are made as RGBA8
MfDev0 Nov 24, 2026
73b2ae6
GPU: a copied texture uploads again once the title rewrites its memory
MfDev0 Nov 24, 2026
079e387
GPU: run indirect mesh dispatches through indirect execution
artor410 Nov 24, 2026
4ab908f
GPU: a capped view heap keeps 2^18 dynamic slots
MfDev0 Nov 24, 2026
2fae4db
GPU: record resource-backed texture UAV clears
fuzeofficlal Nov 24, 2026
92fde68
Pilot: a Windows test machine that reports crashes and picks up fixes…
MfDev0 Nov 24, 2026
d9198ed
Shaders: med3 tests its operands for NaN on their bits
raphael-riesner Nov 24, 2026
7c60b93
HLE: a null or empty subkey under our OEM key opens the key itself
Peppacodes Nov 24, 2026
98f0fcf
HLE: GetProcAddress on our modules sets the last error on a miss
Peppacodes Nov 24, 2026
a513e77
Loader: find a title DLL whatever its name's case
Peppacodes Nov 24, 2026
4012fe9
loader: ensure stack headroom before RtlCaptureStackBackTrace on Wind…
DrTardis1963 Nov 24, 2026
162b70b
HLE: a display deferral stands where the system has no display power …
MfDev0 Nov 24, 2026
565af2d
shader: lower v_mad_u64_u32 and v_mad_i64_i32
9hvn9yt2vk-netizen Nov 24, 2026
6cd5aab
shader: lower v_ldexp_f32, v_frexp_mant_f32 and v_frexp_exp_i32_f32
9hvn9yt2vk-netizen Nov 24, 2026
11f3dd8
shader: run the console's 64-lane waves on hosts without them (NVIDIA)
9hvn9yt2vk-netizen Nov 24, 2026
90720f1
scripts: VIctory Try, a one-exe way to build this fork and run a game…
MfDev0 Nov 24, 2026
4e0c298
scripts: VIctory Try adds upstream VIctory's new fixes by itself
MfDev0 Nov 24, 2026
58bc72f
Shaders: always-false and always-true float compares lower as constants
Peppacodes Nov 24, 2026
9471462
Shaders: apply v_cmp_class_f32 abs/neg modifiers bitwise
AndyLatimer Nov 24, 2026
3a7a75e
Shaders: sign-extend SDWA WORD_0 results with UNUSED_SEXT on 16-bit ops
AndyLatimer Nov 24, 2026
5d048cc
GPU: preserve NaN and round normals to nearest even in f32_to_half
AndyLatimer Nov 24, 2026
3fb0864
Shaders: an image atomic gets its own u32 handle, not a cached f32 one
NicolaiVdS Nov 24, 2026
e208b06
GPU: validate sub-16 alignments and use fallible allocation in alloca…
AndyLatimer Nov 24, 2026
b90cf88
HLE: XApu writes samples to the title's output as bytes, never as [f32]
MfDev0 Nov 24, 2026
10648ae
XGameSave: ignore noncanonical save version names
THE-PRO-GAME Nov 24, 2026
b5abd82
gameinput: a host slot that never reported input is not a pad
Numbers-iwnl Nov 24, 2026
5c78110
GPU: ID3D12GraphicsCommandList::ClearState (slot 0x58)
MfDev0 Nov 24, 2026
7d285fd
GPU: implement DiscardResource on command lists with region and state…
geiyiliyabumo Nov 24, 2026
38bc82e
GPU: establish state for first-use render target and depth discard
fuzeofficlal Nov 24, 2026
a15a724
GPU: implement SetPredication, SetMarker, BeginEvent, and EndEvent on…
geiyiliyabumo Nov 24, 2026
0b8deb6
Saturate indirect workload budget with a shared reject path
Nov 24, 2026
824ab27
HLE: fail WSAConnectByList and GetAddrInfoExA where the host lacks them
Nov 24, 2026
83d578a
Shaders: one returning block per program
Nov 24, 2026
5785b6d
GPU: mirror heap slots the title writes into its own memory
Nov 24, 2026
1b03a42
GPU: bind root SRVs as bounded one-view tables
Nov 24, 2026
17fe4d5
Watch: ask the kernel once per range per submission under Wine
Nov 24, 2026
a9eeeba
Shader tests: skip the DXIL hash refusal check under Wine
Nov 24, 2026
d11c249
shader: give unwritten VGPR/SGPR reads a zero-valued input
Nov 24, 2026
1aad9e5
gpu: VICTORY_DUMP_SHADERS writes each translated shader's DXIL to a d…
Nov 24, 2026
5737773
GPU diagnostics: identify shader stages and direct root arguments in …
lucaseddd Nov 24, 2026
e62e645
gpu: normalize mip levels for auto-sized textures in GetDesc (fixes #…
Xvania7 Nov 24, 2026
09f6f3f
GPU: say once when a present has several planes
MfDev0 Nov 24, 2026
89b7210
BCPack: read BC7 dictionary indices from the right offset
Nov 24, 2026
f4325b4
Shaders: refuse per-lane reads of mesh v5 in v5 writes and after joins
Nov 24, 2026
73dcab3
GPU: use selected mip extents for MSAA resolves
fuzeofficlal Nov 24, 2026
778fe01
Shaders: lower tbuffer_store_format_* that need no conversion
mercuryVM Nov 24, 2026
1cda09f
Shaders: v_mul_legacy_f32 treats denormal operands as zero
senchsus Nov 24, 2026
2ef80b4
shader: support f16 omod and saturate/apply modifiers in v_cvt_{u16,i…
DenRakEiw Nov 24, 2026
6415628
Shaders: bound root view accesses by the size the host binds
wbkepler Nov 24, 2026
960fbb5
GPU: select the readable format and plane for depth/stencil SRVs
peter-bonanni Nov 24, 2026
80314c3
GPU: upload partially-resident streamed textures
nathanbzrr Nov 24, 2026
4d3c4e6
GPU: spill oversized root signatures' user data to root CBVs
MfDev0 Nov 24, 2026
e217770
Shaders: guard conditional exports
Halfect Nov 24, 2026
3e602fe
Shaders: zero unavailable mixed-precision FMA halves
Halfect Nov 24, 2026
ad5ecc3
Shaders: fix whole-wave EXEC inline constant sign-extension and prefi…
nathanbzrr Nov 24, 2026
0782abb
Shaders: lower image_gather4_l and image_gather4_l_o
LAKSHYA-cmd-tech Nov 24, 2026
9afaf12
GPU: the depth bounds test (pipeline streams and OMSetDepthBounds)
MfDev0 Nov 24, 2026
d6bc254
GPU: let the frame-wait test tolerate a loaded scheduler
iurysf Nov 24, 2026
d79c35e
Shaders: find the PC test compiler independently of the validator
Dathinel Nov 24, 2026
0489fce
xg: validate null tiling output, slice bounds, and checked copy spans
DenRakEiw Nov 24, 2026
6823873
DSP: return XDSP_E_NO_DEVICE_RESOURCES past the stream limit
Nov 24, 2026
bda19ff
DSP: refuse XDspDisconnect while streams are still active
Nov 24, 2026
c88bc0c
Shaders: print only the operands an instruction has in SP3 text
Nov 24, 2026
ab5ead9
Input: report the character each held key types
lameloball2813-ui Nov 24, 2026
1277a3e
HLE: implement XUser maximum-users slot 0x30 (#348, #622)
LAKSHYA-cmd-tech Nov 24, 2026
bebf1a4
gpu: expand console primitive topologies into host list index buffers
wbkepler Nov 24, 2026
46a825e
GPU: build the Linux tests again (view_format is Windows-only)
MfDev0 Nov 24, 2026
33cd521
GPU: build the indirect argument clamp with Wine's compiler too
Nov 24, 2026
fcd5c56
GPU: build the indirect rectangle passes with Wine's compiler too
MfDev0 Nov 24, 2026
22869c8
GPU: no blending on integer render targets in host pipelines
pablogonz12 Nov 24, 2026
7dfeb97
Shaders: carry-ins on untracked masks, inline 0 and -1 select masks
MfDev0 Nov 24, 2026
be98ae6
Shaders: a view only read as data takes its kind from its table's range
MfDev0 Nov 24, 2026
90a182d
Shaders: a lane mask spilled to a VGPR lane is still that mask
undeadhuman37 Nov 24, 2026
e1b2e42
Shaders: a scalar joining a lane mask and a number lowers in pixel an…
undeadhuman37 Nov 24, 2026
b096277
Shaders: mesh primitives with indices past the vertex count are culled
jlefebure Nov 24, 2026
b7e8d83
Shaders: spin-wait loops stop after 4096 iterations, not 2^20
claude Nov 24, 2026
d8476f8
GPU: refuse pipelines whose mandatory stage has no DXIL
IgorRend Nov 24, 2026
817be66
GPU: bound indirect mesh work and submit each list on its own
arthercz Nov 24, 2026
7cf728b
PE: read long-format import descriptors
enzoduarte1 Nov 24, 2026
a582598
GPU: unit tests for the OPTIONS, ARCHITECTURE and MULTISAMPLE feature…
LouisRiverstone Nov 24, 2026
471a670
HLE: test that XGSuggestSwizzleMode picks linear for a 1D texture
LouisRiverstone Nov 24, 2026
c57338d
victory-shader: add forced-var propagation and UNSAT memoization to B…
Sakura-Byte Nov 24, 2026
b0cbac8
Loader: a clwb in the last bytes of a page is emulated instead of fau…
BastienRodz Nov 24, 2026
d4bdd4c
HLE: XSystemGetXboxLiveSandboxId refuses a buffer under 16 bytes
LouisRiverstone Nov 24, 2026
02ec479
policy: resolve a `..` in the not-yet-existing part of a path
nino-exe Nov 24, 2026
9e9ecf4
Isolate the write-watch fixture from reused virtual addresses
Nov 24, 2026
0f1d438
GPU: GetDeviceRemovedReason reports the host device's state instead o…
BastienRodz Nov 24, 2026
ddfb868
Shaders: 16-bit compares read the low halves whatever op_sel says, as…
BastienRodz Nov 24, 2026
1288b01
Check that SDWA half-word selection survives the VOP3 compare fix
Nov 24, 2026
0805408
Shaders: half_src's comment says 16-bit compares ignore op_sel
BastienRodz Nov 24, 2026
8308c18
Pipeline: delimit converter id in cache keys
enzoduarte1 Nov 24, 2026
8a334f6
Shaders: handle s_buffer_load SMEM uses in descriptor_data (#798)
MartinIndra02 Nov 24, 2026
e6379de
Shaders: helper lanes keep their own value in pixel v_readfirstlane
Sakura-Byte Nov 24, 2026
e50bf48
GPU: run ExecuteIndirect signatures that set root constants (#757)
MartinIndra02 Nov 24, 2026
90e0f8d
VIctory Try 1.2
MfDev0 Nov 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,10 @@ cargo build --profile diag -p victory --features diagnostics # target\diag\vic
| `VICTORY_D3D12_DRED=1` | on a GPU failure, the allocation hit and the commands in flight |
| `VICTORY_SKIP_PIPELINES=<hash>,...` | omit draws and dispatches, including indirect ones, whose pipeline contains a listed 16-digit shader hash |
| `VICTORY_GPU_TIMING=1` | with the above, each list of a submission run and timed on its own; slow lists logged with their slowest commands |
| `VICTORY_D3D12_WARP=1` | host device on the software adapter (slow; cannot reset the driver) |
| `VICTORY_D3D12_WARP=1` | host device on the software adapter (slow; cannot reset the driver); `=0` turns it back off, so one shell variable can stay set between runs |
| `VICTORY_ADAPTER=<name>` | select a D3D12 adapter by case-insensitive substring (default: high-performance GPU) |
| `VICTORY_SHADER_LOOP_LIMIT=<n>` | translated shader loops stop after `n` iterations per lane instead of 2^20 (own shader cache entries); if a lower `n` makes world frames much faster, loops hitting the limit are what makes them slow |
| `VICTORY_SHADER_LOOP_LIMIT=<n>` | translated shader loops stop after `n` iterations per lane instead of 2^20 (own shader cache entries; works in release builds too); if a lower `n` makes world frames much faster, loops hitting the limit are what makes them slow |
| `VICTORY_SHADER_SPIN_LIMIT=<n>` | loops that only reread memory until another workgroup or queue changes it (spin waits) stop after `n` iterations per lane instead of 4096 (own shader cache entries); `1048576` restores the general limit for them |
| `VICTORY_AUDIO_CAPTURE=<file.wav>` | records what the title plays (our process only) |
| `VICTORY_XMA_DUMP=<dir>` | saves the first 32 XMA voices' context and input |

Expand Down
17 changes: 13 additions & 4 deletions apps/victory/src/translate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,11 @@ fn translate(
Ok(program) => {
t.translated += 1;
t.instructions += program.blocks.iter().map(|b| b.insts.len()).sum::<usize>();
let res = match resource::track(&program, &p.layout, p.stage) {
// Per-lane descriptors are traced on the per-lane form; its
// failure is listed after the resources' and I/O's.
let structured = structure::structure(&program);
let lanes = structured.as_ref().ok();
let res = match resource::track(&program, &p.layout, p.stage, lanes) {
Ok(r) => {
tally_resources(&p, &r, t);
Some(r)
Expand Down Expand Up @@ -379,7 +383,7 @@ fn translate(
Err(e) => t.fail(e.to_string(), || format!("{} {:?}", example(), p.stage)),
}
}
let structured = match structure::structure(&program) {
let structured = match structured {
Ok(s) => {
tally_structured(&program, &s, t);
Some(s)
Expand Down Expand Up @@ -558,7 +562,7 @@ fn tally_resources(p: &NativeProgram, r: &resource::Resources, t: &mut Tally) {
let mut traced = HashSet::new();
for leaf in r.descriptors.iter().flat_map(|d| d.source.leaves()) {
let a = match *leaf {
resource::Source::Loaded { load, .. } => {
resource::Source::Loaded { load, .. } | resource::Source::Fetched { load, .. } => {
t.loaded += 1;
address(load)
}
Expand All @@ -571,7 +575,12 @@ fn tally_resources(p: &NativeProgram, r: &resource::Resources, t: &mut Tally) {
t.constant += 1;
None
}
resource::Source::Phi { .. } => unreachable!("leaves are no phis"),
resource::Source::Phi { .. }
| resource::Source::Select { .. }
| resource::Source::Lanes { .. }
| resource::Source::LanePhi { .. } => {
unreachable!("leaves are no phis, selects or per-lane choices")
}
};
// Heaps hold dynamic resources, which no used entry lists; code
// tables are no root parameter.
Expand Down
10 changes: 10 additions & 0 deletions crates/victory-core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1598,6 +1598,16 @@ mod tests {
assert!(cfg.cache_subdir("x").is_err());
}

#[test]
fn data_inside_repo_is_refused() {
let inside = Path::new(env!("CARGO_MANIFEST_DIR")).join("data");
let cfg = Config {
data_dir: inside,
..Default::default()
};
assert!(cfg.data_subdir("x").is_err());
}

/// A path that is absolute on the host (`/x` is not absolute on Windows).
#[test]
fn folder_overlap_folds_case_only_when_asked() {
Expand Down
17 changes: 17 additions & 0 deletions crates/victory-core/src/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ fn resolve(
rest.push(name.to_os_string());
existing = parent;
}
// `file_name()` is None for a trailing `..`; keep it so `normalize` resolves it.
(Some(parent), None) if existing.ends_with("..") => {
rest.push("..".into());
existing = parent;
}
_ => {
return Err(PolicyError::Io {
path: path.to_path_buf(),
Expand Down Expand Up @@ -240,4 +245,16 @@ mod tests {
Err(PolicyError::InsideRepo { .. })
));
}

#[test]
fn resolves_dot_dot_in_a_path_that_does_not_exist_yet() {
let base = std::env::temp_dir().join("victory-policy-no-such");
let path = base.join("a").join("..").join("b");
let resolved = resolve(&path, |p: &Path| std::fs::canonicalize(p))
.expect("a `..` in the missing tail must resolve lexically");
assert_eq!(
resolved,
resolve(&base.join("b"), |p: &Path| std::fs::canonicalize(p)).unwrap()
);
}
}
21 changes: 18 additions & 3 deletions crates/victory-formats/src/bcpack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ impl Tables {
/// alpha 64 B and colour 256 B, BC4 64 B, BC5 64 B), 512 u16 BC7 control
/// words, then 255 dictionary entries per format in format order: BC1
/// 6 + 16 B, BC3 8 + 32 B, BC4 2 + 16 B, BC5 4 + 32 B, BC6H (u8 mode,
/// 12 u16, u8 mode, 16 i16), BC7 (u16 control, 24 u16, 2 u8, 32 i16).
/// Little-endian, no padding. Every model must tile 65536.
/// 12 u16, u8 mode, 16 i16), BC7 (u16 control, 24 u16, 2 u8, 2 B,
/// 16 + 15 i16). Little-endian, no padding. Every model must tile 65536.
pub fn parse(bytes: &[u8]) -> Result<Tables, Error> {
if bytes.len() != TABLES_SIZE {
return Err(Error("table file has the wrong size"));
Expand Down Expand Up @@ -222,7 +222,10 @@ impl Tables {
bits: [r.u8(), r.u8()],
..Default::default()
};
for v in ix.ix.as_flattened_mut() {
// Unused: the widths again in all entries but the first.
r.u16();
// Only 15 slots for set 1, which no entry uses (0 bits).
for v in &mut ix.ix.as_flattened_mut()[..31] {
*v = r.u16() as i16;
}
(ep, ix)
Expand Down Expand Up @@ -1590,4 +1593,16 @@ mod tests {
}
assert!(n > 0);
}

/// A dictionary entry stands in for a block the decoder made: a set with
/// 0 index bits holds no indices, and pixel 0 is the anchor (top bit clear).
#[test]
fn bc7_dictionary_indices_line_up() {
let t = Tables::builtin().unwrap();
for (k, (_, ix)) in t.bc7.iter().enumerate() {
let anchor = 0..1 << (ix.bits[0] - 1);
let ok = (ix.bits[1] != 0 || ix.ix[1] == [0; 16]) && anchor.contains(&ix.ix[0][0]);
assert!(ok, "entry {k}: {:?}", ix.ix);
}
}
}
2 changes: 1 addition & 1 deletion crates/victory-formats/src/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//! (`ComputeSurfaceInfoMacroTiled`, `ComputeThinBlockDimension`,
//! `GetMipTailDim`, `GetMaxNumMipsInTail`, `HwlComputeSurfaceInfoLinear`,
//! `ComputeSurfaceAddrFromCoordMacroTiled`), and the 256-byte micro tile
//! patterns in [`MICRO`] from `gfx10SwizzlePattern.h` (the RB+ tables, as on
//! patterns in `MICRO` from `gfx10SwizzlePattern.h` (the RB+ tables, as on
//! RDNA2). addrlib carries this notice:
//!
//! Copyright (C) 2007-2026 Advanced Micro Devices, Inc. All rights reserved.
Expand Down
50 changes: 50 additions & 0 deletions crates/victory-gpu/src/descriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ pub(crate) struct Heap {
host: std::sync::OnceLock<Option<host::HostHeap>>,
#[cfg(windows)]
pending: std::sync::Mutex<Vec<u32>>,
/// The write-watch asking (see [`crate::watch::writes`]) up to which
/// the host heap has caught up with what the title wrote into its
/// memory itself (see [`resync_title_writes`]).
#[cfg(windows)]
synced: std::sync::atomic::AtomicU64,
}

pub(crate) fn heap<'a>(this: This) -> &'a Heap {
Expand Down Expand Up @@ -148,6 +153,49 @@ fn mirror(handle: u64) {
}
}

/// Brings the host heaps up to date with descriptors the title wrote into
/// heap memory itself (copies of whole slots, which no create or copy call
/// reports), before a submission runs: slots read directly by index (not
/// through a table) are made only from what was mirrored, so a slot the
/// title turned from a texture into a constant buffer kept the texture,
/// whose upper half the shader read as a buffer at address 0: a GPU page
/// fault and a lost device in the world. Only the 64 KiB blocks written
/// since the last call are looked at; heaps in memory the kernel does not
/// watch (ours, not the title's) are left as they are.
#[cfg(windows)]
pub(crate) fn resync_title_writes() {
use std::sync::atomic::Ordering::Relaxed;
// Held throughout: registered heaps stay alive while it is.
let heaps = SHADER_HEAPS.lock().unwrap_or_else(|e| e.into_inner());
for &(start, end, at) in heaps.iter() {
// SAFETY: registered heaps are live (removed when dropped).
let heap = unsafe { &*(at as *const Heap) };
let (Some(Some(host)), Some(step)) = (heap.host.get(), increment(heap.desc.kind)) else {
continue; // no host heap yet: its first use mirrors everything
};
let page = crate::watch::PAGE as u64;
let (first, last) = (start / page * page, end.div_ceil(page) * page);
let Some((now, written)) = crate::watch::writes(first as usize, last as usize, true) else {
continue;
};
let before = heap.synced.swap(now, Relaxed);
let step = u64::from(step);
for (p, asked) in written {
if asked <= before {
continue;
}
let from = (p as u64 * page).max(start);
let to = ((p as u64 + 1) * page).min(end);
for i in (from - start) / step..(to - start).div_ceil(step) {
let i = i as u32;
if i < heap.desc.count {
host.mirror(i, start + u64::from(i) * step, false);
}
}
}
}
}

/// Gives back dynamic slots of the host heap behind the title heap at
/// `heap`, if that heap still exists.
#[cfg(windows)]
Expand Down Expand Up @@ -624,6 +672,8 @@ pub(crate) extern "system" fn create_heap(
host: std::sync::OnceLock::new(),
#[cfg(windows)]
pending: Default::default(),
#[cfg(windows)]
synced: std::sync::atomic::AtomicU64::new(0),
});
#[cfg(windows)]
if visible {
Expand Down
Loading
Loading