summaryrefslogtreecommitdiffstats
path: root/third_party/rust/wgpu-hal/src/vulkan/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/wgpu-hal/src/vulkan/mod.rs')
-rw-r--r--third_party/rust/wgpu-hal/src/vulkan/mod.rs34
1 files changed, 27 insertions, 7 deletions
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<DebugUtilsMessengerUserData>,
}
+#[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<ValidationLayerProperties>,
/// 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<Api> for Queue {
impl From<vk::Result> 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
}
}