Skip to content

Commit

Permalink
debug_printf: simple validation of debugPrintf arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
exrook committed Oct 16, 2023
1 parent 34fbbfe commit 822c835
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/valid/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ pub enum FunctionError {
InvalidRayDescriptor(Handle<crate::Expression>),
#[error("Ray Query {0:?} does not have a matching type")]
InvalidRayQueryType(Handle<crate::Type>),
#[error("Printf value argument {index} expression is invalid")]
InvalidPrintfArgument {
index: usize,
source: ExpressionError,
},
#[error(
"Required uniformity of control flow for {0:?} in {1:?} is not fulfilled because of {2:?}"
)]
Expand Down Expand Up @@ -919,8 +924,15 @@ impl super::Validator {
crate::RayQueryFunction::Terminate => {}
}
}
S::DebugPrintf { .. } => {
// FIXME
S::DebugPrintf { ref arguments, .. } => {
for (index, &expr) in arguments.iter().enumerate() {
context
.resolve_type_impl(expr, &self.valid_expression_set)
.map_err_inner(|source| {
FunctionError::InvalidPrintfArgument { index, source }
.with_span_handle(expr, context.expressions)
})?;
}
}
}
}
Expand Down

0 comments on commit 822c835

Please sign in to comment.