diff --git a/naga/src/front/spv/ext_inst.rs b/naga/src/front/spv/ext_inst.rs index 4f17bdf9636..23659ac5214 100644 --- a/naga/src/front/spv/ext_inst.rs +++ b/naga/src/front/spv/ext_inst.rs @@ -42,15 +42,19 @@ impl> super::Frontend { "GLSL.std.450" => self.parse_ext_inst_glsl_std( ext_name, inst, ext_inst, span, ctx, emitter, block, block_id, body_idx, ), - "NonSemantic.DebugPrintf" if ext_inst.inst_id == 1 => { - self.parse_ext_inst_debug_printf(inst, span, ctx, emitter, block, body_idx) - } + "NonSemantic.DebugPrintf" => self.parse_ext_inst_debug_printf( + ext_name, inst, ext_inst, span, ctx, emitter, block, body_idx, + ), + _ => Err(Error::UnsupportedExtInst(ext_inst.inst_id, ext_name)), } } + #[allow(clippy::too_many_arguments)] fn parse_ext_inst_debug_printf( &mut self, + ext_name: &'static str, inst: super::Instruction, + ext_inst: ExtInst, span: crate::Span, ctx: &mut super::BlockContext, emitter: &mut crate::proc::Emitter, @@ -58,6 +62,11 @@ impl> super::Frontend { body_idx: usize, ) -> Result<(), Error> { let base_wc = 5; + + if ext_inst.inst_id != 1 { + return Err(Error::UnsupportedExtInst(ext_inst.inst_id, ext_name)); + } + inst.expect_at_least(base_wc + 1)?; let format_id = self.next()?; let format = self.strings.lookup(format_id)?.clone(); @@ -79,7 +88,7 @@ impl> super::Frontend { #[allow(clippy::too_many_arguments)] fn parse_ext_inst_glsl_std( &mut self, - set_name: &'static str, + ext_name: &'static str, inst: super::Instruction, ext_inst: ExtInst, span: crate::Span, @@ -95,7 +104,7 @@ impl> super::Frontend { let base_wc = 5; let gl_op = Glo::from_u32(ext_inst.inst_id) - .ok_or(Error::UnsupportedExtInst(ext_inst.inst_id, set_name))?; + .ok_or(Error::UnsupportedExtInst(ext_inst.inst_id, ext_name))?; let fun = match gl_op { Glo::Round => Mf::Round, @@ -161,7 +170,7 @@ impl> super::Frontend { Glo::FindUMsb | Glo::FindSMsb => Mf::FindMsb, // TODO: https://github.com/gfx-rs/naga/issues/2526 Glo::Modf | Glo::Frexp => { - return Err(Error::UnsupportedExtInst(ext_inst.inst_id, set_name)) + return Err(Error::UnsupportedExtInst(ext_inst.inst_id, ext_name)) } Glo::IMix | Glo::PackDouble2x32 @@ -169,7 +178,7 @@ impl> super::Frontend { | Glo::InterpolateAtCentroid | Glo::InterpolateAtSample | Glo::InterpolateAtOffset => { - return Err(Error::UnsupportedExtInst(ext_inst.inst_id, set_name)) + return Err(Error::UnsupportedExtInst(ext_inst.inst_id, ext_name)) } };