mirror of
https://github.com/ivall/xcl.git
synced 2026-11-24 05:14:57 +01:00
Pipeline release fixes; README: no empty cells under What is missing
- A pipeline released for good leaves PSO_RS / TWO_PASS: a later pipeline at the same address inherited its root signature or two-pass compute pass. The compute pass is released with the last TwoPassPso. - Background PSO worker: an orphaned real pipeline is released outside the done lock (the Release override takes PENDING; counts() takes PENDING, then done: deadlock). - The mesh background test scribbles over the stream description after the call. - dxbc test: drop an always-zero expression (clippy error).
This commit is contained in:
+5
-2
@@ -582,8 +582,11 @@ Nothing open.
|
||||
with an empty cache (52 programs compiled in the background, compute waited for at replay) builds BLAS + TLAS.
|
||||
- Releasing a stand-in for good (PipelineState `Release` override) releases its real pipeline and forgets the address
|
||||
(a later object at the same address must not resolve to it); a stand-in released while building: the worker's result is
|
||||
released when it arrives. Tests: `pso_through_hook` returns the real pipeline (works with a cold DXIL cache), the
|
||||
background test restores `XCL_DXIL_CACHE` through a guard.
|
||||
released when it arrives (outside the `done` lock: the Release override takes PENDING, `counts` takes PENDING then
|
||||
`done`). Any pipeline released for good also leaves `PSO_RS` / `TWO_PASS` (`forget_pso`): a later pipeline at the same
|
||||
address must not get its root signature or compute pass; the compute pass is released with the last `TwoPassPso`.
|
||||
Tests: `pso_through_hook` returns the real pipeline (works with a cold DXIL cache), the background test restores
|
||||
`XCL_DXIL_CACHE` through a guard and scribbles over the mesh stream description after the call.
|
||||
|
||||
## Title memory above 4 GB: UMA windows (session 5, 2026-11-21)
|
||||
- **Gap:** shaders addressed one `mem` buffer with the low 32 bits of the address, and D3D12 opens a heap from an
|
||||
|
||||
@@ -68,10 +68,9 @@ measurements and next steps:
|
||||
|
||||
| Needs a game executable | Not done yet | Not planned |
|
||||
|---|---|---|
|
||||
| D3D12.X draw records and `PresentX` / frame pacing | – | Xbox Live, Store licensing (offline by design) |
|
||||
| root arguments → shader registers for graphics | Opus / XMA2 audio decoding | decrypting XVC packages or any DRM |
|
||||
| texture creation in title memory (binding the detiler) | hull / domain / amplification shaders (none in the sample game) | console SDK headers / binaries in the repository |
|
||||
| – | linear / 3D / MSAA tiled textures | |
|
||||
| D3D12.X draw records and `PresentX` / frame pacing | Opus / XMA2 audio decoding | Xbox Live, Store licensing (offline by design) |
|
||||
| root arguments → shader registers for graphics | hull / domain / amplification shaders (none in the sample game) | decrypting XVC packages or any DRM |
|
||||
| texture creation in title memory (binding the detiler) | linear / 3D / MSAA tiled textures | console SDK headers / binaries in the repository |
|
||||
| Bink GPU decoding, rehydrating prebuilt BVHs | performance work (GPU buffers live in system memory) | |
|
||||
|
||||
Every run writes `report.json` (called stubs, unknown D3D12.X slots and interfaces, XGameRuntime
|
||||
|
||||
@@ -134,10 +134,10 @@ mod tests {
|
||||
d.extend_from_slice(&2u32.to_le_bytes());
|
||||
d.extend_from_slice(&8u32.to_le_bytes());
|
||||
let base = 8 + 2 * 32;
|
||||
for (i, (name_off, sv, ct, reg, mask)) in [(0u32, 0u32, 3u32, 0u32, 7u8), (9, 6, 1, 1, 1)].iter().enumerate() {
|
||||
for (name_off, sv, ct, reg, mask) in [(0u32, 0u32, 3u32, 0u32, 7u8), (9, 6, 1, 1, 1)].iter() {
|
||||
d.extend_from_slice(&0u32.to_le_bytes()); // stream
|
||||
d.extend_from_slice(&(base + name_off).to_le_bytes());
|
||||
d.extend_from_slice(&(i as u32 * 0).to_le_bytes());
|
||||
d.extend_from_slice(&0u32.to_le_bytes()); // semantic index
|
||||
d.extend_from_slice(&sv.to_le_bytes());
|
||||
d.extend_from_slice(&ct.to_le_bytes());
|
||||
d.extend_from_slice(®.to_le_bytes());
|
||||
|
||||
@@ -51,14 +51,20 @@ fn queue() -> &'static Mutex<mpsc::Sender<(Arc<Pending>, Job)>> {
|
||||
} else {
|
||||
BUILT.fetch_add(1, Ordering::Relaxed);
|
||||
}
|
||||
let mut done = p.done.lock().unwrap();
|
||||
if p.orphan.load(Ordering::Acquire) {
|
||||
let orphan = {
|
||||
let mut done = p.done.lock().unwrap();
|
||||
let orphan = p.orphan.load(Ordering::Acquire);
|
||||
if !orphan {
|
||||
p.real.store(real, Ordering::Release);
|
||||
}
|
||||
*done = true;
|
||||
p.cv.notify_all();
|
||||
orphan
|
||||
};
|
||||
// outside `done`: the Release override takes PENDING (`counts` takes PENDING, then `done`)
|
||||
if orphan {
|
||||
release(real);
|
||||
} else {
|
||||
p.real.store(real, Ordering::Release);
|
||||
}
|
||||
*done = true;
|
||||
p.cv.notify_all();
|
||||
});
|
||||
}
|
||||
Mutex::new(tx)
|
||||
|
||||
@@ -721,11 +721,23 @@ unsafe extern "system" fn pso_release(this: *mut c_void) -> u32 {
|
||||
let f: unsafe extern "system" fn(*mut c_void) -> u32 = std::mem::transmute(orig_fn(this, 2));
|
||||
let n = f(this);
|
||||
if n == 0 {
|
||||
forget_pso(this as usize);
|
||||
super::pso_async::release(super::pso_async::released(this as usize));
|
||||
}
|
||||
n
|
||||
}
|
||||
|
||||
/// A pipeline state is gone: drop what XCL keeps by its address (a later pipeline may get the
|
||||
/// same address and must not inherit its root signature or compute pass).
|
||||
fn forget_pso(pso: usize) {
|
||||
if let Some(m) = PSO_RS.lock().unwrap().as_mut() {
|
||||
m.remove(&pso);
|
||||
}
|
||||
// the compute pass goes with the last user of its entry (`Drop for TwoPassPso`)
|
||||
let gone = TWO_PASS.lock().unwrap().as_mut().and_then(|m| m.remove(&pso));
|
||||
drop(gone);
|
||||
}
|
||||
|
||||
/// resource #11 GetGPUVirtualAddress for console code
|
||||
unsafe extern "system" fn res_gpu_va_x(this: *mut c_void) -> u64 {
|
||||
if let Some((p, _)) = console_buffer(this as usize) {
|
||||
@@ -1691,6 +1703,13 @@ pub struct TwoPassPso {
|
||||
pub kind: &'static str,
|
||||
}
|
||||
|
||||
impl Drop for TwoPassPso {
|
||||
fn drop(&mut self) {
|
||||
// the compute pipeline state is XCL's (the root signatures are cached or the title's)
|
||||
super::pso_async::release(self.compute);
|
||||
}
|
||||
}
|
||||
|
||||
static TWO_PASS: Mutex<Option<HashMap<usize, std::sync::Arc<TwoPassPso>>>> = Mutex::new(None);
|
||||
|
||||
/// The compute pass of a pipeline state XCL built from console MS / GS code.
|
||||
|
||||
@@ -269,7 +269,7 @@ fn retail_pipelines_built_in_the_background_behind_a_stand_in() {
|
||||
let code = |b: &[u8]| D3D12_SHADER_BYTECODE { pShaderBytecode: b.as_ptr() as _, BytecodeLength: b.len() };
|
||||
let mut rt = D3D12_RT_FORMAT_ARRAY { NumRenderTargets: 1, ..Default::default() };
|
||||
rt.RTFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
let st = Stream {
|
||||
let mut st = Stream {
|
||||
rs: Sub { ty: D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE, v: game_rs.as_raw() },
|
||||
ms: Sub { ty: D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_MS, v: code(&ms) },
|
||||
ps: Sub { ty: D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PS, v: code(&ps) },
|
||||
@@ -281,7 +281,8 @@ fn retail_pipelines_built_in_the_background_behind_a_stand_in() {
|
||||
let mesh: ID3D12PipelineState = unsafe { d2.CreatePipelineState(&desc) }.expect("mesh stand-in");
|
||||
let call = t0.elapsed();
|
||||
let raw = mesh.as_raw() as usize;
|
||||
drop(st); // the title's description is gone; the worker builds from its own copy
|
||||
// the title's description is gone (scribbled over); the worker builds from its own copy
|
||||
unsafe { std::ptr::write_bytes(&mut st as *mut Stream, 0xCD, 1) };
|
||||
assert_ne!(pso_async::resolve_wait(raw), raw);
|
||||
assert!(real::two_pass_of(raw).is_some(), "the two-pass parts through the stand-in");
|
||||
println!("mesh: the call returned after {call:?}, the real pipeline was ready after {:?}", t0.elapsed());
|
||||
|
||||
Reference in New Issue
Block a user