Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metal: if new_texture returns NULL, create_texture returns an error #3554

Merged
merged 1 commit into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ By @teoxoy in [#3436](https://github.com/gfx-rs/wgpu/pull/3436)

- Treat `VK_SUBOPTIMAL_KHR` as `VK_SUCCESS` on Android. By @James2022-rgb in [#3525](https://github.com/gfx-rs/wgpu/pull/3525)

#### Metal
- `create_texture` returns an error if `new_texture` returns NULL. By @jinleili in [#3554](https://github.com/gfx-rs/wgpu/pull/3554)

## wgpu-0.15.0 (2023-01-25)

### Major Changes
Expand Down
5 changes: 5 additions & 0 deletions wgpu-hal/src/metal/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ impl crate::Device<super::Api> for super::Device {
&self,
desc: &crate::TextureDescriptor,
) -> DeviceResult<super::Texture> {
use foreign_types::ForeignTypeRef;

let mtl_format = self.shared.private_caps.map_format(desc.format);

objc::rc::autoreleasepool(|| {
Expand Down Expand Up @@ -321,6 +323,9 @@ impl crate::Device<super::Api> for super::Device {
descriptor.set_storage_mode(metal::MTLStorageMode::Private);

let raw = self.shared.device.lock().new_texture(&descriptor);
if raw.as_ptr().is_null() {
return Err(crate::DeviceError::OutOfMemory);
}
if let Some(label) = desc.label {
raw.set_label(label);
}
Expand Down