Minor error reporting fixes (#607)

This commit is contained in:
Dzmitry Malyshau 2020-04-24 21:58:30 -04:00 committed by GitHub
parent b8f8dd78fd
commit 09d3623885
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -434,7 +434,7 @@ fn checked_u32_as_u16(value: u32) -> u16 {
value as u16
}
fn is_power_or_two(val: u32) -> bool {
fn is_power_of_two(val: u32) -> bool {
val != 0 && (val & (val - 1)) == 0
}
@ -457,7 +457,7 @@ pub fn map_texture_dimension_size(
}
D2 => {
assert!(
sample_size <= 32 && is_power_or_two(sample_size),
sample_size <= 32 && is_power_of_two(sample_size),
"Invalid sample_count of {}",
sample_size
);

View File

@ -1105,7 +1105,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
| binding_model::BindingType::SampledTexture
| binding_model::BindingType::ReadonlyStorageTexture
| binding_model::BindingType::WriteonlyStorageTexture => {
panic!("Mismatched buffer binding type for {:?}. Expected a type of UniformBuffer, StorageBuffer or ReadonlyStorageBuffer but found {:?}", decl, decl.ty)
panic!("Mismatched buffer binding type for {:?}. Expected a type of UniformBuffer, StorageBuffer or ReadonlyStorageBuffer", decl)
}
};
assert_eq!(
@ -1145,7 +1145,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
match decl.ty {
binding_model::BindingType::Sampler
| binding_model::BindingType::ComparisonSampler => {}
found => panic!("Mismatched sampler binding type in {:?}. Expected a type of Sampler or ComparisonSampler but found {:?}", decl.ty, found),
_ => panic!("Mismatched sampler binding type in {:?}. Expected a type of Sampler or ComparisonSampler", decl.ty),
}
let sampler = used
.samplers
@ -1170,7 +1170,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
resource::TextureUse::STORAGE_STORE,
hal::image::Layout::General,
),
found => panic!("Mismatched texture binding type in {:?}. Expected a type of SampledTexture, ReadonlyStorageTexture or WriteonlyStorageTexture but found {:?}", decl, found),
_ => panic!("Mismatched texture binding type in {:?}. Expected a type of SampledTexture, ReadonlyStorageTexture or WriteonlyStorageTexture", decl),
};
let view = used
.views