Depends on [`wgpu#2673`]. WebGPU requires `GPUBufferDescriptor` validation failure to: 1) generate an error on the Device timeline, and 2) mark the new buffer as invalid. Satisfy 1) by moving most validation to the compositor process. Requirement 2) is harder. `wgpu_core::Global::device_create_buffer` already takes care of some validation for us, and marks the provided buffer id invalid when there's a problem. However, there are certain errors the spec requires us to detect which `device_create_buffer` cannot even see, because they are caught by standard Rust validation steps in the process of creating the `wgpu_types::BufferDescriptor` that one would *pass to* that function. For example, if there are bogus bits set in the `usage` property, we can't even construct a Rust `BufferUsages` value from that to include in the `BufferDescriptor` that we must pass to `device_create_buffer`. This means that we need to do some validation ourselves, in the process of constructing that `BufferDescriptor`, and use the `Global::create_buffer_error` method added in [`wgpu#2673`] to mark the new buffer as invalid. [`wgpu#2673`]: https://github.com/gfx-rs/wgpu/pull/2673 Depends on D146767
Bug 1752188 Comment 10 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Depends on [`wgpu#2673`]. WebGPU requires `GPUBufferDescriptor` validation failure to: 1) generate an error on the Device timeline, and 2) mark the new buffer as invalid. Satisfy 1) by moving most validation to the compositor process. Requirement 2) is harder. `wgpu_core::Global::device_create_buffer` already takes care of some validation for us, and marks the provided buffer id invalid when there's a problem. However, there are certain errors the spec requires us to detect which `device_create_buffer` cannot even see, because they are caught by standard Rust validation steps in the process of creating the `wgpu_types::BufferDescriptor` that one would *pass to* that function. For example, if there are bogus bits set in the `usage` property, we can't even construct a Rust `BufferUsages` value from that to include in the `BufferDescriptor` that we must pass to `device_create_buffer`. This means that we need to do some validation ourselves, in the process of constructing that `BufferDescriptor`, and use the `Global::create_buffer_error` method added in [`wgpu#2673`] to mark the new buffer as invalid. [`wgpu#2673`]: https://github.com/gfx-rs/wgpu/pull/2673 Depends on D146767