Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion crates/xcl/src/hle/d3d12x/texture_upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ mod tests {
let mut at = seed * 37 % size.div_ceil(PAGE) * PAGE;
let mut n = seed;
while at < size && out.len() < 6 {
n = n * 1103515245 + 12345;
n = n.wrapping_mul(1103515245).wrapping_add(12345);
let to = (at + PAGE * (1 + n / 65536 % 4)).min(size);
out.push((at, to));
at = to + PAGE * (1 + n / 16 % (size / PAGE / 5 + 2));
Expand Down
12 changes: 7 additions & 5 deletions crates/xcl/tests/d3d12_mesh_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
//! (`d3d12x::real::dev_create_pipeline_state` / `translated_mesh_stream`), with no game data.
//!
//! Runs on any D3D12 adapter (AMD, NVIDIA, Intel, or WARP) with zero vendor-specific skips:
//! 1. Synthetic console MS placed in the AS slot with no MS slot is refused cleanly with
//! `E_INVALIDARG` and records the `"in the AS slot – refused"` error.
//! 1. Synthetic console MS placed in the AS slot with no MS slot is taken as the mesh shader it
//! is (`real::mesh_shader_slots`) and, having no NGG variant, fails cleanly with
//! `E_INVALIDARG` as an MS translation error, not as an AS-slot refusal.
//! 2. Synthetic console MS paired with an AS subobject is refused cleanly with `E_INVALIDARG`.
//! 3. Empty, truncated, unknown-subobject, and unreadable-shader pipeline streams fail cleanly
//! without panicking or crashing.
Expand Down Expand Up @@ -93,10 +94,11 @@ fn console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly() {
};
let err = unsafe { d2.CreatePipelineState::<ID3D12PipelineState>(&desc) }.expect_err("MS in AS slot must be refused");
assert_eq!(err.code(), E_INVALIDARG);
// translated as the MS (the synthetic container has no NGG variant), not refused for the slot
let errors = real::stats().translation_errors;
assert!(
real::stats().translation_errors.iter().any(|e| e.contains("in the AS slot")),
"expected AS-slot refusal in translation_errors: {:?}",
real::stats().translation_errors
errors.iter().any(|e| e.starts_with("MS: ")) && !errors.iter().any(|e| e.contains("in the AS slot")),
"expected an MS translation error and no AS-slot refusal in translation_errors: {errors:?}"
);

// Case 2: console MS paired with an AS subobject
Expand Down
7 changes: 6 additions & 1 deletion crates/xcl/tests/gpu_compute_e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,13 @@ fn async_compute_pso_registers_real_pso_and_not_standin() {
assert!(!real::is_translated_compute(standin_raw), "stand-in must remain unregistered after background build");
assert!(real::pso_root_signature(real_raw).is_some(), "real compute PSO must have an ABI root signature");

// Releasing the stand-in must release and forget the background-built real PSO too.
// Releasing the stand-in must release and forget the background-built real PSO too. The real
// one goes once the queues are past a fence (`late_release::hold_pipeline`), not in the drop.
drop(pso);
let start = std::time::Instant::now();
while real::is_translated_compute(real_raw) && start.elapsed() < std::time::Duration::from_secs(10) {
std::thread::sleep(std::time::Duration::from_millis(5));
}
assert!(!real::is_translated_compute(real_raw), "forgetting released async compute PSO must clean up TRANSLATED_COMPUTE");
}

Expand Down
6 changes: 6 additions & 0 deletions crates/xcl/tests/gpu_two_pass_cache_e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,12 @@ float4 main(V v) : SV_Target0 { return v.p0; }
assert_eq!(draw_two_pass_and_read(&dev, &gs, 1, true), [0.0, 1.0, 0.0, 1.0]);
assert_eq!(real::two_pass_count(), before + 3);
drop((ms1, ms2, gs));
// (the real pipelines behind the stand-ins go once the queues are past a fence:
// `late_release::hold_pipeline`, not in the drop)
let start = std::time::Instant::now();
while real::two_pass_count() != before && start.elapsed() < std::time::Duration::from_secs(10) {
std::thread::sleep(std::time::Duration::from_millis(5));
}
assert_eq!(real::two_pass_count(), before, "releasing the title PSOs releases their two-pass state");

if dev.cast::<ID3D12InfoQueue>().is_ok() {
Expand Down
Loading