diff --git a/crates/spirv-std/macros/src/lib.rs b/crates/spirv-std/macros/src/lib.rs index 9ecc7aef8b..3889d25ca9 100644 --- a/crates/spirv-std/macros/src/lib.rs +++ b/crates/spirv-std/macros/src/lib.rs @@ -613,7 +613,11 @@ fn debug_printf_inner(input: DebugPrintfInput) -> TokenStream { .into_iter() .collect::(); let op_loads = op_loads.into_iter().collect::(); - + // Escapes the '{' and '}' characters in the format string. + // Since the `asm!` macro expects '{' '}' to surround its arguments, we have to use '{{' and '}}' instead. + // The `asm!` macro will then later turn them back into '{' and '}'. + let format_string = format_string.replace('{',"{{").replace('}',"}}"); + let op_string = format!("%string = OpString {format_string:?}"); let output = quote::quote! {