diff --git a/src/valid/function.rs b/src/valid/function.rs index 285b2109be..83704f30cd 100644 --- a/src/valid/function.rs +++ b/src/valid/function.rs @@ -144,6 +144,8 @@ pub enum FunctionError { index: usize, source: ExpressionError, }, + #[error("Capability {0:?} is required")] + MissingCapability(super::Capabilities), #[error( "Required uniformity of control flow for {0:?} in {1:?} is not fulfilled because of {2:?}" )] @@ -925,6 +927,15 @@ impl super::Validator { } } S::DebugPrintf { ref arguments, .. } => { + if !self + .capabilities + .contains(super::Capabilities::DEBUG_PRINTF) + { + return Err(FunctionError::MissingCapability( + super::Capabilities::DEBUG_PRINTF, + ) + .with_span_static(span, "debugPrintf")); + } for (index, &expr) in arguments.iter().enumerate() { context .resolve_type_impl(expr, &self.valid_expression_set) diff --git a/src/valid/mod.rs b/src/valid/mod.rs index f593b87535..6f91465dc8 100644 --- a/src/valid/mod.rs +++ b/src/valid/mod.rs @@ -117,6 +117,8 @@ bitflags::bitflags! { const DUAL_SOURCE_BLENDING = 0x2000; /// Support for arrayed cube textures. const CUBE_ARRAY_TEXTURES = 0x4000; + /// Support for `debugPrintf` + const DEBUG_PRINTF = 0x8000; } } diff --git a/tests/in/debug-printf.param.ron b/tests/in/debug-printf.param.ron new file mode 100644 index 0000000000..a0f37d5325 --- /dev/null +++ b/tests/in/debug-printf.param.ron @@ -0,0 +1,3 @@ +( + god_mode: true, +) diff --git a/tests/in/spv/debug-printf-s.param.ron b/tests/in/spv/debug-printf-s.param.ron new file mode 100644 index 0000000000..a0f37d5325 --- /dev/null +++ b/tests/in/spv/debug-printf-s.param.ron @@ -0,0 +1,3 @@ +( + god_mode: true, +)