Skip to content

Commit

Permalink
debug_printf: hlsl-out
Browse files Browse the repository at this point in the history
  • Loading branch information
exrook committed Oct 16, 2023
1 parent bd404ff commit 3ec01ae
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/back/hlsl/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2008,8 +2008,19 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
writeln!(self.out, "{level}}}")?
}
Statement::RayQuery { .. } => unreachable!(),
Statement::DebugPrint { .. } => {
return Err(Error::Unimplemented("debug printf".to_string()));
Statement::DebugPrintf {
ref format,
ref arguments,
} => {
write!(self.out, "{level}")?;
write!(self.out, "printf(\"{format}\",")?;
for (index, argument) in arguments.iter().enumerate() {
if index != 0 {
write!(self.out, ", ")?;
}
self.write_expr(module, *argument, func_ctx)?;
}
writeln!(self.out, ");")?
}
}

Expand Down

0 comments on commit 3ec01ae

Please sign in to comment.