Skip to main content

elements

Function elements 

Source
pub fn elements(m: &Module) -> Result<(Vec<Element>, Vec<Element>)>
Expand description

The entry point’s input and output elements, by id.

Examples found in repository?
examples/inspect_dxil.rs (line 11)
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}