pub fn module(chunks: &[Chunk<'_>], kind: &[u8; 4]) -> Result<Option<Module>>Expand description
The module of a container’s program part of this kind (DXIL, or STAT for the reflection module), if it has one.
Examples found in repository?
examples/inspect_dxil.rs (line 7)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let path = std::env::args().nth(1).ok_or("usage: inspect <shader.dxil>")?;
5 let container = std::fs::read(path)?;
6 let parts = dxil_reader::parts(&container)?;
7 let module = dxil_reader::module(&parts, b"DXIL")?.ok_or("no DXIL part")?;
8 println!("{} functions", module.functions.len());
9
10 // The records the file stores for its entry point:
11 let (inputs, outputs) = dxil_reader::reflection::elements(&module)?;
12 println!(
13 "{} input and {} output signature elements",
14 inputs.len(),
15 outputs.len()
16 );
17 for (range, name, _) in dxil_reader::reflection::ranges(&module)? {
18 println!("{name}: class {} register {}", range.class, range.lower);
19 }
20 Ok(())
21}