Skip to content

Commit

Permalink
debug_printf: Add DEBUG_PRINTF capability
Browse files Browse the repository at this point in the history
  • Loading branch information
exrook committed Oct 21, 2023
1 parent 8881546 commit 21858bf
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/valid/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:?}"
)]
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/valid/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
3 changes: 3 additions & 0 deletions tests/in/debug-printf.param.ron
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(
god_mode: true,
)
3 changes: 3 additions & 0 deletions tests/in/spv/debug-printf-s.param.ron
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(
god_mode: true,
)

0 comments on commit 21858bf

Please sign in to comment.