remove duplicate check, it's already present in Device.create_buffer

This commit is contained in:
teoxoy 2024-07-02 15:36:33 +02:00 committed by Teodor Tanasoaia
parent 7b387007a8
commit a971e7f7d4
2 changed files with 2 additions and 7 deletions

View File

@ -180,11 +180,6 @@ impl Global {
trace.add(trace::Action::CreateBuffer(fid.id(), desc));
}
if desc.usage.is_empty() {
// Per spec, `usage` must not be zero.
break 'error CreateBufferError::InvalidUsage(desc.usage);
}
let buffer = match device.create_buffer(desc, false) {
Ok(buffer) => buffer,
Err(e) => {

View File

@ -580,8 +580,6 @@ impl<A: HalApi> Device<A> {
self.require_downlevel_flags(wgt::DownlevelFlags::UNRESTRICTED_INDEX_BUFFER)?;
}
let mut usage = conv::map_buffer_usage(desc.usage);
if desc.usage.is_empty() || desc.usage.contains_invalid_bits() {
return Err(resource::CreateBufferError::InvalidUsage(desc.usage));
}
@ -600,6 +598,8 @@ impl<A: HalApi> Device<A> {
}
}
let mut usage = conv::map_buffer_usage(desc.usage);
if desc.mapped_at_creation {
if desc.size % wgt::COPY_BUFFER_ALIGNMENT != 0 {
return Err(resource::CreateBufferError::UnalignedSize);