mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-25 00:41:07 +01:00
expose VULKAN_EXTERNAL_MEMORY_WIN32 feature (#6825)
This commit is contained in:
1 parent
03ff99e2c3
commit
15a77b525c
4 files changed
+22
-8
No files matched your search
@@ -776,6 +776,11 @@ impl PhysicalDeviceFeatures {
|
||||
caps.supports_extension(google::display_timing::NAME),
|
||||
);
|
||||
|
||||
features.set(
|
||||
F::VULKAN_EXTERNAL_MEMORY_WIN32,
|
||||
caps.supports_extension(khr::external_memory_win32::NAME),
|
||||
);
|
||||
|
||||
(features, dl_flags)
|
||||
}
|
||||
|
||||
@@ -1554,9 +1559,6 @@ impl super::Instance {
|
||||
.is_some_and(|ext| ext.shader_zero_initialize_workgroup_memory == vk::TRUE),
|
||||
image_format_list: phd_capabilities.device_api_version >= vk::API_VERSION_1_2
|
||||
|| phd_capabilities.supports_extension(khr::image_format_list::NAME),
|
||||
#[cfg(windows)]
|
||||
external_memory_win32: phd_capabilities
|
||||
.supports_extension(khr::external_memory_win32::NAME),
|
||||
};
|
||||
let capabilities = crate::Capabilities {
|
||||
limits: phd_capabilities.to_wgpu_limits(),
|
||||
|
||||
@@ -786,7 +786,7 @@ impl super::Device {
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
/// - Vulkan 1.1+ (or VK_KHR_external_memory)
|
||||
/// - Vulkan (with VK_KHR_external_memory_win32)
|
||||
/// - The `d3d11_shared_handle` must be valid and respecting `desc`
|
||||
/// - `VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT` flag is used because we need to hold a reference to the handle
|
||||
#[cfg(windows)]
|
||||
@@ -795,8 +795,12 @@ impl super::Device {
|
||||
d3d11_shared_handle: windows::Win32::Foundation::HANDLE,
|
||||
desc: &crate::TextureDescriptor,
|
||||
) -> Result<super::Texture, crate::DeviceError> {
|
||||
if !self.shared.private_caps.external_memory_win32 {
|
||||
log::error!("VK_KHR_external_memory extension is required");
|
||||
if !self
|
||||
.shared
|
||||
.features
|
||||
.contains(wgt::Features::VULKAN_EXTERNAL_MEMORY_WIN32)
|
||||
{
|
||||
log::error!("Vulkan driver does not support VK_KHR_external_memory_win32");
|
||||
return Err(crate::DeviceError::ResourceCreationFailed);
|
||||
}
|
||||
|
||||
|
||||
@@ -532,8 +532,6 @@ struct PrivateCapabilities {
|
||||
robust_image_access2: bool,
|
||||
zero_initialize_workgroup_memory: bool,
|
||||
image_format_list: bool,
|
||||
#[cfg(windows)]
|
||||
external_memory_win32: bool,
|
||||
}
|
||||
|
||||
bitflags::bitflags!(
|
||||
|
||||
@@ -942,6 +942,16 @@ bitflags::bitflags! {
|
||||
/// [VK_GOOGLE_display_timing]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_GOOGLE_display_timing.html
|
||||
/// [`Surface::as_hal()`]: https://docs.rs/wgpu/latest/wgpu/struct.Surface.html#method.as_hal
|
||||
const VULKAN_GOOGLE_DISPLAY_TIMING = 1 << 62;
|
||||
|
||||
/// Allows using the [VK_KHR_external_memory_win32] Vulkan extension.
|
||||
///
|
||||
/// Supported platforms:
|
||||
/// - Vulkan (with [VK_KHR_external_memory_win32])
|
||||
///
|
||||
/// This is a native only feature.
|
||||
///
|
||||
/// [VK_KHR_external_memory_win32]: https://registry.khronos.org/vulkan/specs/latest/man/html/VK_KHR_external_memory_win32.html
|
||||
const VULKAN_EXTERNAL_MEMORY_WIN32 = 1 << 63;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user