Skip to main content

rspirv_ext/sr/
nonsemantic_debugprintf.rs

1use rspirv::{dr, spirv};
2
3use crate::dr::autogen_nonsemantic_debugprintf::DebugPrintFOpBuilder;
4
5pub trait DebugPrintfBuilder {
6    #[doc = "Appends an DebugPrintf instruction and returns the result id, or return the existing id if the instruction was already present."]
7    fn debug_printf(
8        &mut self,
9        format: impl Into<String>,
10        args: impl IntoIterator<Item = spirv::Word>,
11    ) -> Result<(), dr::Error>;
12}
13impl DebugPrintfBuilder for rspirv::dr::Builder {
14    #[allow(clippy::too_many_arguments)]
15    fn debug_printf(
16        &mut self,
17        format: impl Into<String>,
18        id_ref: impl IntoIterator<Item = spirv::Word>,
19    ) -> Result<(), dr::Error> {
20        let format = self.string(format);
21
22        DebugPrintFOpBuilder::debug_printf(self, format, id_ref).map(|_| ())
23    }
24}