pub struct D3D12Resource { /* private fields */ }Expand description
ID3D12Resource* keyed-mutex / shared-handle resource (Texture2D
dimension).
Implementations§
Source§impl D3D12Resource
impl D3D12Resource
Sourcepub unsafe fn try_from_raw(
resource: *mut c_void,
luid: Option<(i32, u32)>,
row_pitch: u32,
keep_alive: Option<KeepAlive>,
) -> Result<Self, InvalidHandleError>
pub unsafe fn try_from_raw( resource: *mut c_void, luid: Option<(i32, u32)>, row_pitch: u32, keep_alive: Option<KeepAlive>, ) -> Result<Self, InvalidHandleError>
Wrap a raw Texture2D-dimension ID3D12Resource*. Borrowing: the
handle is stored non-owningly, this type has no Drop, and every
obligation below extends to each Clone.
§Safety
resourcemust point to a liveID3D12ResourceofD3D12_RESOURCE_DIMENSION_TEXTURE2D. It is stored verbatim and the importer calls COM methods through the vtable at that address. Null is rejected asInvalidHandleError::NullPointerand is not a caller obligation.- Refcount: no
AddRefis taken and there is noDropthat wouldRelease. The caller’s reference must outlive this value and everyCloneof it; pass akeep_aliveanchor to discharge that, or carry it directly whenNone. - Cross-thread: unlike D3D11 this needs no opt-in — D3D12
objects are free-threaded by specification, which is what makes
the
unsafe impl Send + Syncbelow sound. The caller is still responsible for the usual D3D12 rules the importer cannot see: the resource must be in a state compatible with what the importer will transition from, and must not be evicted. luid, whenSome, must be theLUIDof the adapter the resource lives on; importers use it to refuse cross-adapter opens.row_pitchmust be the resource’s footprint row pitch in bytes, or0when unknown.
pub fn resource(&self) -> *mut c_void
pub fn luid(&self) -> Option<(i32, u32)>
pub fn row_pitch(&self) -> u32
pub fn keep_alive(&self) -> Option<&KeepAlive>
Trait Implementations§
Source§impl Clone for D3D12Resource
impl Clone for D3D12Resource
Source§impl Debug for D3D12Resource
impl Debug for D3D12Resource
impl Send for D3D12Resource
impl Sync for D3D12Resource
Auto Trait Implementations§
impl !RefUnwindSafe for D3D12Resource
impl !UnwindSafe for D3D12Resource
impl Freeze for D3D12Resource
impl Unpin for D3D12Resource
impl UnsafeUnpin for D3D12Resource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more