From 40a355a42d4a9444dc753c04c6608dade2f06a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:27 +0200 Subject: Adding upstream version 125.0.1. Signed-off-by: Daniel Baumann --- third_party/rust/wgpu-hal/src/vulkan/mod.rs | 34 +++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'third_party/rust/wgpu-hal/src/vulkan/mod.rs') diff --git a/third_party/rust/wgpu-hal/src/vulkan/mod.rs b/third_party/rust/wgpu-hal/src/vulkan/mod.rs index 787ebd7267..1f922e83da 100644 --- a/third_party/rust/wgpu-hal/src/vulkan/mod.rs +++ b/third_party/rust/wgpu-hal/src/vulkan/mod.rs @@ -101,17 +101,25 @@ pub struct DebugUtilsCreateInfo { callback_data: Box, } +#[derive(Debug)] +/// The properties related to the validation layer needed for the +/// DebugUtilsMessenger for their workarounds +struct ValidationLayerProperties { + /// Validation layer description, from `vk::LayerProperties`. + layer_description: std::ffi::CString, + + /// Validation layer specification version, from `vk::LayerProperties`. + layer_spec_version: u32, +} + /// User data needed by `instance::debug_utils_messenger_callback`. /// /// When we create the [`vk::DebugUtilsMessengerEXT`], the `pUserData` /// pointer refers to one of these values. #[derive(Debug)] pub struct DebugUtilsMessengerUserData { - /// Validation layer description, from `vk::LayerProperties`. - validation_layer_description: std::ffi::CString, - - /// Validation layer specification version, from `vk::LayerProperties`. - validation_layer_spec_version: u32, + /// The properties related to the validation layer, if present + validation_layer_properties: Option, /// If the OBS layer is present. OBS never increments the version of their layer, /// so there's no reason to have the version. @@ -724,13 +732,25 @@ impl crate::Queue for Queue { impl From for crate::DeviceError { fn from(result: vk::Result) -> Self { + #![allow(unreachable_code)] match result { vk::Result::ERROR_OUT_OF_HOST_MEMORY | vk::Result::ERROR_OUT_OF_DEVICE_MEMORY => { + #[cfg(feature = "oom_panic")] + panic!("Out of memory ({result:?})"); + Self::OutOfMemory } - vk::Result::ERROR_DEVICE_LOST => Self::Lost, + vk::Result::ERROR_DEVICE_LOST => { + #[cfg(feature = "device_lost_panic")] + panic!("Device lost"); + + Self::Lost + } _ => { - log::warn!("Unrecognized device error {:?}", result); + #[cfg(feature = "internal_error_panic")] + panic!("Internal error: {result:?}"); + + log::warn!("Unrecognized device error {result:?}"); Self::Lost } } -- cgit v1.2.3