Don't panic when gl.create_buffer() fails on webgl (#3396)

This commit is contained in:
Nathan Adams 2023-01-18 22:31:16 +01:00 committed by GitHub
parent 81569dd6c3
commit cecf0633a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -255,6 +255,7 @@ let texture = device.create_texture(&wgpu::TextureDescriptor {
- Fix disallowing multisampling for float textures if otherwise supported. By @Wumpf in [#3183](https://github.com/gfx-rs/wgpu/pull/3183)
- Fix a panic when creating a pipeline with opaque types other than samplers (images and atomic counters). By @James2022-rgb in [#3361](https://github.com/gfx-rs/wgpu/pull/3361)
- Fix uniform buffers being empty on some vendors. By @Dinnerbone in [#3391](https://github.com/gfx-rs/wgpu/pull/3391)
- Fix a panic allocating a new buffer on webgl. By @Dinnerbone in [#3396](https://github.com/gfx-rs/wgpu/pull/3396)
#### Vulkan

View File

@ -472,7 +472,7 @@ impl crate::Device<super::Api> for super::Device {
map_flags |= glow::MAP_WRITE_BIT;
}
let raw = Some(unsafe { gl.create_buffer() }.unwrap());
let raw = Some(unsafe { gl.create_buffer() }.map_err(|_| crate::DeviceError::OutOfMemory)?);
unsafe { gl.bind_buffer(target, raw) };
let raw_size = desc
.size