Skip to main content

ranges

Function ranges 

Source
pub fn ranges(m: &Module) -> Result<Vec<(Range, String, Option<TypeId>)>>
Expand description

The bound resource ranges of dx.resources (SRVs, UAVs, constant buffers, samplers), each with its variable’s name and the type its variable points to (the resource’s handle type).

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