Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6e06665
D3D12.X: R9G9B9E5 render targets and UAVs are half floats
T-Crypt Nov 23, 2026
c842289
Lazy physical pages: a thread that loses the race to commit a page re…
T-Crypt Nov 23, 2026
4bbb90d
KernelX: GPU-visible title memory outside the windows is write-watche…
T-Crypt Nov 23, 2026
2d2a4ce
Physical pages: a scatter or map home of n pages costs O(n), not O(n²)
T-Crypt Nov 23, 2026
0bc116f
Shaders: O(1) LRU shader cache, compile coalescing, and mesh CS caching
T-Crypt Nov 23, 2026
06c9125
Precompile --pipelines: driver compiles on threads of their own, the …
T-Crypt Nov 23, 2026
473b632
XGameRuntime: XCL's own XAsync when the system runtime refuses to ini…
T-Crypt Nov 23, 2026
f3dcd22
Compute groups that are not whole waves: padded where the program can…
T-Crypt Nov 23, 2026
a8ffa01
Recompiler: image_sample_b_o / d_o / cd_o / c_o move the offset by th…
T-Crypt Nov 23, 2026
b82c6c1
Diagnostics: thread dumps unwind a copy of the stopped thread's stack
T-Crypt Nov 23, 2026
f38044a
XGameRuntime: try_update instead of the deprecated fetch_update
T-Crypt Nov 23, 2026
5d48cf6
SSE4a on Intel CPUs: MOVNTSS and MOVNTSD emulated
T-Crypt Nov 23, 2026
a4e30e3
TLS: preserve Characteristics alignment and fix on_thread_attach cont…
T-Crypt Nov 23, 2026
05d026d
Recompiler: complete remaining RDNA2 integer CLAMP=1 saturation (#105)
T-Crypt Nov 23, 2026
6ff7ee8
DirectStorage: BCPack entropy stage for all modes, BC1 blocks rebuilt
T-Crypt Nov 23, 2026
51b4fbc
Config: recreate xcl.toml only on NotFound and resolve memory mode ca…
T-Crypt Nov 23, 2026
4099e53
Present: configure HDR swapchain color space via SetColorSpace1 (#103)
T-Crypt Nov 23, 2026
91aa44b
Report: lock-safe crash report persistence under contention and re-en…
T-Crypt Nov 23, 2026
91fe052
Recomp: clamp 64-bit float results to [0.0, 1.0] instead of saturate …
T-Crypt Nov 23, 2026
50619c5
fix(gpu/run): keep descriptor heaps alive, harden device loss handling
T-Crypt Nov 23, 2026
f9989c2
reaches its title screen and menus: GPU title memory in large pages, …
T-Crypt Nov 23, 2026
1c2c601
Merge branch 'main' into bathyal/xcl-prs-2
T-Crypt Nov 23, 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
4 changes: 3 additions & 1 deletion HANDOFF.md
Original file line number Diff line number Diff line change
Expand Up @@ -1820,7 +1820,9 @@ right after its first `CreateShaderResourceView` (the first descriptor written i
the Zen 2 instructions such a CPU lacks – `clwb` (Intel: Ice Lake+), `clzero`, `rdpru`, `monitorx` / `mwaitx`
(AMD only), `rdpid` – and the vectored handler (`eh::emulate_console_only`) emulates them and steps over
(`clwb` / `monitorx` / `mwaitx`: nothing, the PC's memory is coherent; `clzero`: 64 zero bytes at rAX; `rdpru`:
QueryPerformanceCounter; `rdpid`: the processor number). Logged once per instruction. Any other illegal instruction
QueryPerformanceCounter; `rdpid`: the processor number). SSE4a (AMD only): `extrq` / `insertq` on the exception's
XMM registers, `movntss` / `movntsd` as a plain store of the low dword / quadword (fs / gs-relative ones are not
emulated). Logged once per instruction. Any other illegal instruction
(and `ud2`, a title's own trap) is logged with its 16 code bytes, in the first-chance handler and in the crash line.
SHA-NI is not emulated (also missing on those CPUs): add it if a title's code bytes show `0F 38 C8..CD`.

Expand Down
3 changes: 3 additions & 0 deletions THIRD_PARTY.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ carry a note in their header about its origin and the date of changes (GPL-2.0
| [FFmpeg](https://ffmpeg.org/) | LGPL-2.1+ | XMA1/XMA2 decoder and tables (`crates/xcl/src/hle/xma2/`) – after `libavcodec/wmaprodec.c`, `wmaprodata.h`, `wma.c`, `sinewin_tablegen.h`, `libavutil/float_dsp.c`, `tx_template.c` | port to safe Rust with annotation |
| [AMD Machine-Readable GPU ISA](https://gpuopen.com/machine-readable-isa/) | MIT | `crates/xcl/src/gpu/rdna2_spec.rs` (generated by `scripts/gen_rdna2.py`) | encoding and instruction tables |
| [AMD addrlib](https://gitlab.freedesktop.org/mesa/mesa/-/tree/main/src/amd/addrlib) (Mesa) | MIT | `crates/xcl/src/gpu/tiling_tables.rs` (generated by `scripts/gen_tiling.py` from `gfx10SwizzlePattern.h`); GFX10 mip chain / mip tail layout in `gpu/tiling.rs` (after `Gfx10Lib::ComputeSurfaceInfoMacroTiled`) | swizzle tables; layout logic ported with annotation |
| [silicon-rans](https://github.com/microsoft/silicon-rans) (Microsoft) | MIT | BCPack entropy stage: the rANS lane in `crates/xcl/src/hle/bcpack/lanes.rs` (after the `decoder` module of `mdu_minirans.v`) and its model tables in `hle/bcpack/rans_tables.rs` (generated by `scripts/gen_bcpack_tables.py` from the same file) | port to Rust with annotation; tables |
| [bcpack-decoder](https://github.com/Tim0219800/bcpack-decoder) (Tim0219800), [bcpack-rs](https://github.com/Ahmet-Dedeler/bcpack-rs) (Ahmet Dedeler) | MIT | no code; the BCPack stream layout, lane widths, byte feeder rule and BC1 block rule in `hle/bcpack/` follow their format notes (`docs/SPEC.md`, `docs/BCPACK_SPEC.md`) | specification |
| bcpack-rs by Ahmet Dedeler (https://github.com/Ahmet-Dedeler/bcpack-rs) | MIT (notice in the file) | `crates/xcl/src/hle/bcpack/bc1_fitted.rs` (generated by `scripts/gen_bcpack_bc1_tables.py` from `data/bc1_window.json` and `data/bc1_quad_table.json`): the two tables of BC1 constants BCPack streams do not carry, as bcpack-rs estimated them from retail data | data tables (estimates; codec constants, not game content) |
| [LLVM](https://github.com/llvm/llvm-project) | Apache-2.0 WITH LLVM-exception | `tests/data/llvm-amdgpu/*` (test data, not part of the program); GFX10 buffer format values (`UfmtSymbolicGFX10`) in `gpu/recomp/emit.rs` | test vectors; hardware facts |
| [WinDurango](https://github.com/WinDurango/WinDurango) | LGPL-3.0 | no code; d3d12_x.dll export numbers (facts) in `crates/xcl/data/stubdb.toml` | reference only |
| [libHttpClient](https://github.com/microsoft/libHttpClient) | MIT | no code; XTaskQueue/XAsync contract | specification |
Expand Down
63 changes: 57 additions & 6 deletions crates/xcl/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl Config {
if let Some(m) = &m {
from.push(format!("title memory {m}"));
}
self.title_memory = m.unwrap_or_else(|| "standard".into()).to_ascii_lowercase();
self.title_memory = m.unwrap_or_else(|| "standard".into()).trim().to_ascii_lowercase();
}
// the standard budgets; "advanced" adds memory the console docs do not give publicly –
// the standard figure stays (xcl.toml can raise it)
Expand Down Expand Up @@ -220,8 +220,7 @@ impl Config {
}
// only a missing file gets the defaults written: an unreadable one (locked, not UTF-8)
// must not be replaced by them (issue #106)
Err(e) if e.kind() != std::io::ErrorKind::NotFound => Err(format!("{}: {e}", path.display())),
Err(_) => {
Err(e) if e.kind() == std::io::ErrorKind::NotFound => {
let c = Config::default();
let body = toml::to_string_pretty(&c).map_err(|e| e.to_string())?;
if let Some(d) = path.parent() {
Expand All @@ -230,6 +229,7 @@ impl Config {
let _ = std::fs::write(path, format!("{HEADER}{body}"));
Ok(c)
}
Err(e) => Err(format!("{}: {e}", path.display())),
}
}

Expand Down Expand Up @@ -355,14 +355,65 @@ mod tests {

#[test]
fn title_memory_is_read_in_any_case() {
let manifest = crate::manifest::Manifest { anaconda_memory: Some("Advanced".into()), ..Default::default() };
for (setting, m) in [("Auto", Some(&manifest)), ("ADVANCED", None)] {
let manifest_adv = crate::manifest::Manifest { anaconda_memory: Some("Advanced".into()), ..Default::default() };
let manifest_std = crate::manifest::Manifest { anaconda_memory: Some("Standard".into()), ..Default::default() };
for (setting, m, expected_mode, expected_uma) in [
("auto", Some(&manifest_adv), "advanced", 4095),
("Auto", Some(&manifest_adv), "advanced", 4095),
("AUTO", Some(&manifest_adv), "advanced", 4095),
(" aUtO ", Some(&manifest_adv), "advanced", 4095),
("auto", Some(&manifest_std), "standard", 2048),
("Auto", None, "standard", 2048),
("advanced", None, "advanced", 4095),
("Advanced", None, "advanced", 4095),
("ADVANCED", None, "advanced", 4095),
(" AdVaNcEd ", None, "advanced", 4095),
("standard", None, "standard", 2048),
("Standard", None, "standard", 2048),
] {
let mut c = Config { title_memory: setting.into(), ..Config::default() };
c.resolve(m);
assert_eq!((c.title_memory.as_str(), c.uma_mb), ("advanced", 4095), "{setting}");
assert_eq!(
(c.title_memory.as_str(), c.uma_mb),
(expected_mode, expected_uma),
"failed for setting {setting:?}"
);
}
}

#[test]
fn load_or_create_only_creates_on_not_found_and_preserves_on_errors() {
let dir = std::env::temp_dir().join(format!("xcl_cfg_robustness_{}", std::process::id()));
let _ = std::fs::create_dir_all(&dir);
let path = dir.join("xcl.toml");

// 1. Missing file: creates default xcl.toml
if path.exists() {
let _ = std::fs::remove_file(&path);
}
let created = Config::load_or_create(&path).expect("creates when missing");
assert_eq!(created.device_type, "anaconda");
assert!(path.exists());
let original_content = std::fs::read_to_string(&path).unwrap();
assert!(original_content.starts_with("# XCL"));

// 2. Corrupted TOML (syntax error): fails and does NOT overwrite file
let corrupted_toml = "device_type = [invalid toml syntax";
std::fs::write(&path, corrupted_toml).unwrap();
let res = Config::load_or_create(&path);
assert!(res.is_err());
assert_eq!(std::fs::read_to_string(&path).unwrap(), corrupted_toml);

// 3. Unreadable / Invalid UTF-8 data: fails and does NOT overwrite file
let invalid_utf8 = [0xFF, 0xFE, 0xFD, 0xFC];
std::fs::write(&path, &invalid_utf8).unwrap();
let res = Config::load_or_create(&path);
assert!(res.is_err());
assert_eq!(std::fs::read(&path).unwrap(), invalid_utf8);

let _ = std::fs::remove_dir_all(&dir);
}

#[test]
fn raytracing_tier_parsing() {
assert_eq!(parse_raytracing_tier("auto"), None);
Expand Down
Loading
Loading