gfx_hal/external_memory/
errors.rs

1//! Structures and enums related to external memory errors.
2
3use crate::device::OutOfMemory;
4
5#[derive(Clone, Debug, PartialEq, thiserror::Error)]
6/// Error while enumerating external image properties. Returned from [PhysicalDevice::external_image_properties][crate::adapter::PhysicalDevice::external_image_properties].
7pub enum ExternalImagePropertiesError {
8    /// Out of either host or device memory.
9    #[error(transparent)]
10    OutOfMemory(#[from] OutOfMemory),
11
12    /// Requested image format not supported in combination with other parameters.
13    #[error("Format not supported")]
14    FormatNotSupported,
15}
16
17#[derive(Clone, Debug, PartialEq, thiserror::Error)]
18/// Error while creating and allocating or importing an external buffer.
19pub enum ExternalResourceError {
20    /// Out of either host or device memory.
21    #[error(transparent)]
22    OutOfMemory(#[from] OutOfMemory),
23
24    /// Cannot create any more objects.
25    #[error("Too many objects")]
26    TooManyObjects,
27
28    /// All the desired memory type ids are invalid for the implementation..
29    #[error("No valid memory type id among the desired ones")]
30    NoValidMemoryTypeId,
31
32    /// Invalid external handle.
33    #[error("The used external handle or the combination of them is invalid")]
34    InvalidExternalHandle,
35}
36
37#[derive(Clone, Debug, PartialEq, thiserror::Error)]
38/// Error while exporting a memory. Returned from [Device::export_memory][crate::device::Device::export_memory].
39pub enum ExternalMemoryExportError {
40    /// Too many objects.
41    #[error("Too many objects")]
42    TooManyObjects,
43
44    /// Out of host memory.
45    #[error("Out of host memory")]
46    OutOfHostMemory,
47
48    /// Invalid external handle.
49    #[error("Invalid external handle")]
50    InvalidExternalHandle,
51}