From 3ec01ae5dc3c8fc3b2d0ccdb36155d0547b93728 Mon Sep 17 00:00:00 2001 From: Jacob Hughes Date: Mon, 16 Oct 2023 11:38:42 -0400 Subject: [PATCH] debug_printf: hlsl-out --- src/back/hlsl/writer.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/back/hlsl/writer.rs b/src/back/hlsl/writer.rs index 7889842197..05e92ae67a 100644 --- a/src/back/hlsl/writer.rs +++ b/src/back/hlsl/writer.rs @@ -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, ");")? } }