Skip to content
Open
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
9 changes: 7 additions & 2 deletions crates/xcl/src/gpu/pack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,17 @@ pub fn scan(d: &[u8], from: usize) -> Vec<Record> {
out
}

/// Inflate a raw deflate slice to `expected` bytes. `None` when the stream is not valid deflate.
pub fn inflate_slice(compressed: &[u8], expected: usize) -> Option<Vec<u8>> {
let unpacked = miniz_oxide::inflate::decompress_to_vec_with_limit(compressed, expected).ok()?;
(unpacked.len() == expected).then_some(unpacked)
}

/// Inflate a record. `None` when the stream is not valid deflate.
pub fn inflate(d: &[u8], r: &Record) -> Option<Vec<u8>> {
let end = r.data.checked_add(r.csize)?;
let compressed = d.get(r.data..end)?;
let unpacked = miniz_oxide::inflate::decompress_to_vec_with_limit(compressed, r.usize).ok()?;
(unpacked.len() == r.usize).then_some(unpacked)
inflate_slice(compressed, r.usize)
}

/// Stage prefix of a shader name (`PS_Foo` → `PS`, `effect:CS_Foo` → `CS`).
Expand Down
10 changes: 10 additions & 0 deletions crates/xcl/src/gpu/recomp/pso.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,16 @@ fn console_mesh_with(
finish_two_pass_compiled(cs, record, ps)
}

/// The mesh-shader (NGG) program of a console MS container for explicit `windows` (used by
/// offline / startup precompilation to populate the exact same `translated/v2` and DXIL caches
/// as `console_mesh`).
pub fn console_mesh_in(blob: &[u8], split_wave64: bool, windows: u32) -> Result<TwoPass, String> {
let dir = dxc::cache_dir();
console_mesh_with(blob, None, split_wave64, windows, &dir, shader_cache(), |code, rodata, ms, wave64| {
compile_console_mesh(blob, code, rodata, ms, wave64, windows, split_wave64)
})
}

/// The mesh-shader (NGG) program of a console MS container; the pass-through carries what
/// the pixel shader `ps` (its container: console or PC) reads.
pub fn console_mesh(blob: &[u8], ps: Option<&[u8]>, split_wave64: bool) -> Result<TwoPass, String> {
Expand Down
Loading
Loading