pub struct Decoded {
pub kind: ProgramType,
pub major: u32,
pub minor: u32,
pub declarations: Vec<Declaration>,
pub instructions: Vec<Instruction>,
}Expand description
A decoded token stream: its target, declarations and instructions, each in program order.
Fields§
§kind: ProgramTypeThe program’s stage.
major: u32The shader model’s major version.
minor: u32The shader model’s minor version.
declarations: Vec<Declaration>The declarations, in program order.
instructions: Vec<Instruction>The instructions, in program order.
Implementations§
Source§impl Decoded
impl Decoded
Sourcepub fn target(&self) -> String
pub fn target(&self) -> String
The target’s name (ps_5_0).
Examples found in repository?
examples/inspect_dxbc.rs (line 10)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let path = std::env::args().nth(1).ok_or("usage: inspect <shader.dxbc>")?;
5 let container = std::fs::read(path)?;
6 let code = dxbc_reader::code(&container)?; // the SHDR/SHEX part as 32-bit words
7 let program = dxbc_reader::decode(&code)?;
8 println!(
9 "{} with {} instructions",
10 program.target(),
11 program.instructions.len()
12 );
13
14 // Reflection and signatures straight from the container:
15 if let Some(rdef) = dxbc_reader::rdef(&container)? {
16 for binding in &rdef.bindings {
17 println!("{} at register {}", binding.name, binding.register);
18 }
19 }
20 let (stage, inputs, outputs) = dxbc_reader::signature_elements(&container)?;
21 println!("{stage:?}: {} inputs, {} outputs", inputs.len(), outputs.len());
22 Ok(())
23}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Decoded
impl RefUnwindSafe for Decoded
impl Send for Decoded
impl Sync for Decoded
impl Unpin for Decoded
impl UnsafeUnpin for Decoded
impl UnwindSafe for Decoded
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more