Skip to content

Commit

Permalink
Validate that BufferDescriptor::usage is not zero.
Browse files Browse the repository at this point in the history
  • Loading branch information
nical committed Jul 14, 2023
1 parent fe9aa68 commit ab0f0f5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions wgpu-core/src/device/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
Ok(device) => device,
Err(_) => break DeviceError::Invalid.into(),
};

if desc.usage.is_empty() {
// Per spec, `usage` must not be zero.
break resource::CreateBufferError::InvalidUsage(desc.usage);
}

#[cfg(feature = "trace")]
if let Some(ref trace) = device.trace {
let mut desc = desc.clone();
Expand Down

0 comments on commit ab0f0f5

Please sign in to comment.