mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Add InvalidGroupIndex validation at create_shader_module
This commit is contained in:
@@ -1189,6 +1189,18 @@ impl<A: HalApi> Device<A> {
|
||||
}
|
||||
pipeline::ShaderModuleSource::Naga(module) => (module, String::new()),
|
||||
};
|
||||
for (_, var) in module.global_variables.iter() {
|
||||
match var.binding {
|
||||
Some(ref br) if br.group >= self.limits.max_bind_groups => {
|
||||
return Err(pipeline::CreateShaderModuleError::InvalidGroupIndex {
|
||||
bind: br.clone(),
|
||||
group: br.group,
|
||||
limit: self.limits.max_bind_groups,
|
||||
});
|
||||
}
|
||||
_ => continue,
|
||||
};
|
||||
}
|
||||
|
||||
use naga::valid::Capabilities as Caps;
|
||||
profiling::scope!("naga::validate");
|
||||
|
||||
@@ -124,6 +124,14 @@ pub enum CreateShaderModuleError {
|
||||
Validation(#[from] ShaderError<naga::WithSpan<naga::valid::ValidationError>>),
|
||||
#[error(transparent)]
|
||||
MissingFeatures(#[from] MissingFeatures),
|
||||
#[error(
|
||||
"shader global {bind:?} uses a group index {group} that exceeds the max_bind_groups limit of {limit}."
|
||||
)]
|
||||
InvalidGroupIndex {
|
||||
bind: naga::ResourceBinding,
|
||||
group: u32,
|
||||
limit: u32,
|
||||
},
|
||||
}
|
||||
|
||||
impl CreateShaderModuleError {
|
||||
|
||||
Reference in New Issue
Block a user