diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a63afa5b..52793e6c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -123,6 +123,7 @@ By @SupaMaggie70Incorporated in [#8206](https://github.com/gfx-rs/wgpu/pull/8206 - Validation errors from `CommandEncoder::finish()` will report the label of the invalid encoder. By @kpreid in [#8449](https://github.com/gfx-rs/wgpu/pull/8449). - Corrected documentation of the minimum alignment of the *end* of a mapped range of a buffer (it is 4, not 8). By @kpreid in [#8450](https://github.com/gfx-rs/wgpu/pull/8450). - `util::StagingBelt` now takes a `Device` when it is created instead of when it is used. By @kpreid in [#8462](https://github.com/gfx-rs/wgpu/pull/8462). +- `wgpu_hal::vulkan::Device::texture_from_raw` now takes an `external_memory` argument. By @s-ol in [#8512](https://github.com/gfx-rs/wgpu/pull/8512) ### Bug Fixes diff --git a/wgpu-hal/src/vulkan/device.rs b/wgpu-hal/src/vulkan/device.rs index d1288612b..5550dbfb9 100644 --- a/wgpu-hal/src/vulkan/device.rs +++ b/wgpu-hal/src/vulkan/device.rs @@ -488,11 +488,14 @@ impl super::Device { /// - If `drop_callback` is [`None`], wgpu-hal will take ownership of `vk_image`. If /// `drop_callback` is [`Some`], `vk_image` must be valid until the callback is called. /// - If the `ImageCreateFlags` does not contain `MUTABLE_FORMAT`, the `view_formats` of `desc` must be empty. + /// - If `external_memory` is [`Some`], wgpu-hal will take ownership of the memory (which is presumed to back + /// `vk_image`). If `external_memory` is [`None`], the memory must be valid until `drop_callback` is called. pub unsafe fn texture_from_raw( &self, vk_image: vk::Image, desc: &crate::TextureDescriptor, drop_callback: Option, + external_memory: Option, ) -> super::Texture { let mut raw_flags = vk::ImageCreateFlags::empty(); let mut view_formats = vec![]; @@ -518,7 +521,7 @@ impl super::Device { super::Texture { raw: vk_image, drop_guard, - external_memory: None, + external_memory, block: None, format: desc.format, copy_size: desc.copy_extent(),