Enum wgpu::SurfaceTargetUnsafe
source · #[non_exhaustive]pub enum SurfaceTargetUnsafe {
RawHandle {
raw_display_handle: RawDisplayHandle,
raw_window_handle: RawWindowHandle,
},
CompositionVisual(*mut c_void),
SurfaceHandle(*mut c_void),
SwapChainPanel(*mut c_void),
}
Expand description
The window/canvas/surface/swap-chain/etc. a surface is attached to, for use with unsafe surface creation.
This is either a window or an actual web canvas depending on the platform and enabled features. Refer to the individual variants for more information.
See also SurfaceTarget
for safe variants.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
RawHandle
Raw window & display handle.
If the specified display and window handle are not supported by any of the backends, then the surface will not be supported by any adapters.
§Safety
raw_window_handle
&raw_display_handle
must be valid objects to create a surface upon.raw_window_handle
&raw_display_handle
must remain valid until after the returnedSurface
is dropped.
Fields
raw_display_handle: RawDisplayHandle
Raw display handle, underlying display must outlive the surface created from this.
raw_window_handle: RawWindowHandle
Raw display handle, underlying window must outlive the surface created from this.
CompositionVisual(*mut c_void)
dx12
only.Surface from IDCompositionVisual
.
§Safety
- visual must be a valid IDCompositionVisual to create a surface upon.
SurfaceHandle(*mut c_void)
dx12
only.Surface from DX12 SurfaceHandle
.
§Safety
- surface_handle must be a valid SurfaceHandle to create a surface upon.
SwapChainPanel(*mut c_void)
dx12
only.Surface from DX12 SwapChainPanel
.
§Safety
- visual must be a valid SwapChainPanel to create a surface upon.
Implementations§
source§impl SurfaceTargetUnsafe
impl SurfaceTargetUnsafe
sourcepub unsafe fn from_window<T>(window: &T) -> Result<Self, HandleError>where
T: HasDisplayHandle + HasWindowHandle,
pub unsafe fn from_window<T>(window: &T) -> Result<Self, HandleError>where
T: HasDisplayHandle + HasWindowHandle,
Creates a SurfaceTargetUnsafe::RawHandle
from a window.
§Safety
window
must outlive the resulting surface target (and subsequently the surface created for this target).