Skip to content

Commit

Permalink
Adds EntryPointError::InvalidMultiDimensionalSubgroupBuiltIn
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed Apr 9, 2024
1 parent 98df726 commit 6c9e772
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions naga/src/valid/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ pub enum EntryPointError {
"Invalid locations {location_mask:?} are set while dual source blending. Only location 0 may be set."
)]
InvalidLocationsWhileDualSourceBlending { location_mask: BitSet },
#[error("Workgroup size is multi dimensional, @builtin(subgroup_id) and @builtin(subgroup_invocation_id) are not supported.")]
InvalidMultiDimensionalSubgroupBuiltIn,
}

fn storage_usage(access: crate::StorageAccess) -> GlobalUse {
Expand Down Expand Up @@ -613,6 +615,17 @@ impl super::Validator {
let mut argument_built_ins = crate::FastHashSet::default();
// TODO: add span info to function arguments
for (index, fa) in ep.function.arguments.iter().enumerate() {
match fa.binding {
Some(crate::Binding::BuiltIn(crate::BuiltIn::SubgroupId))
| Some(crate::Binding::BuiltIn(crate::BuiltIn::SubgroupInvocationId)) => {
if ep.workgroup_size[1..].iter().any(|&s| s > 1) {
return Err(
EntryPointError::InvalidMultiDimensionalSubgroupBuiltIn.with_span()
);
}
}
_ => {}
}
let mut ctx = VaryingContext {
stage: ep.stage,
output: false,
Expand Down

0 comments on commit 6c9e772

Please sign in to comment.