[−][src]Struct rendy::memory::MappedRange
Represents range of the memory mapped to the host. Provides methods for safer host access to the memory.
Methods
impl<'a, B> MappedRange<'a, B, MaybeCoherent> where
B: Backend,
[src]
B: Backend,
pub unsafe fn from_raw(
memory: &'a Memory<B>,
ptr: NonNull<u8>,
range: Range<u64>
) -> MappedRange<'a, B, MaybeCoherent>
[src]
memory: &'a Memory<B>,
ptr: NonNull<u8>,
range: Range<u64>
) -> MappedRange<'a, B, MaybeCoherent>
Construct mapped range from raw mapping
Safety
memory
range
must be mapped to host memory region pointer by ptr
.
range
is in memory object space.
ptr
points to the range.start
offset from memory origin.
pub fn ptr(&self) -> NonNull<u8>
[src]
Get pointer to beginning of memory region.
i.e. to range().start
offset from memory origin.
pub fn range(&self) -> Range<u64>
[src]
Get mapped range.
pub unsafe fn read<'b, T>(
&'b mut self,
device: &<B as Backend>::Device,
range: Range<u64>
) -> Result<&'b [T], Error> where
'a: 'b,
T: Copy,
[src]
&'b mut self,
device: &<B as Backend>::Device,
range: Range<u64>
) -> Result<&'b [T], Error> where
'a: 'b,
T: Copy,
Fetch readable slice of sub-range to be read.
Invalidating range if memory is not coherent.
range.end - range.start
must be multiple of size_of::()
.
mapping offset + range.start
must be multiple of align_of::()
.
Safety
- Caller must ensure that device won't write to the memory region until the borrowing ends.
T
Must be plain-old-data type compatible with data in mapped region.
pub unsafe fn write<'b, T>(
&'b mut self,
device: &'b <B as Backend>::Device,
range: Range<u64>
) -> Result<impl Write<T> + 'b, Error> where
'a: 'b,
T: 'b + Copy,
[src]
&'b mut self,
device: &'b <B as Backend>::Device,
range: Range<u64>
) -> Result<impl Write<T> + 'b, Error> where
'a: 'b,
T: 'b + Copy,
Fetch writer to the sub-region. This writer will flush data on drop if written at least once.
Safety
- Caller must ensure that device won't write to or read from the memory region.
pub fn coherent(
self
) -> Result<MappedRange<'a, B, Coherent>, MappedRange<'a, B, NonCoherent>>
[src]
self
) -> Result<MappedRange<'a, B, Coherent>, MappedRange<'a, B, NonCoherent>>
Convert into mapped range with statically known coherency.
impl<'a, B> MappedRange<'a, B, Coherent> where
B: Backend,
[src]
B: Backend,
pub unsafe fn write<'b, U>(
&'b mut self,
range: Range<u64>
) -> Result<impl Write<U> + 'b, Error> where
U: 'b + Copy,
[src]
&'b mut self,
range: Range<u64>
) -> Result<impl Write<U> + 'b, Error> where
U: 'b + Copy,
Fetch writer to the sub-region.
Safety
- Caller must ensure that device won't write to or read from the memory region.
Trait Implementations
impl<'a, B, C> Debug for MappedRange<'a, B, C> where
B: Debug + Backend,
C: Debug,
[src]
B: Debug + Backend,
C: Debug,
impl<'a, B> From<MappedRange<'a, B, Coherent>> for MappedRange<'a, B, MaybeCoherent> where
B: Backend,
[src]
B: Backend,
fn from(
range: MappedRange<'a, B, Coherent>
) -> MappedRange<'a, B, MaybeCoherent>
[src]
range: MappedRange<'a, B, Coherent>
) -> MappedRange<'a, B, MaybeCoherent>
impl<'a, B> From<MappedRange<'a, B, NonCoherent>> for MappedRange<'a, B, MaybeCoherent> where
B: Backend,
[src]
B: Backend,
fn from(
range: MappedRange<'a, B, NonCoherent>
) -> MappedRange<'a, B, MaybeCoherent>
[src]
range: MappedRange<'a, B, NonCoherent>
) -> MappedRange<'a, B, MaybeCoherent>
Auto Trait Implementations
impl<'a, B, C> Unpin for MappedRange<'a, B, C> where
C: Unpin,
C: Unpin,
impl<'a, B, C = MaybeCoherent> !Sync for MappedRange<'a, B, C>
impl<'a, B, C = MaybeCoherent> !Send for MappedRange<'a, B, C>
impl<'a, B, C> UnwindSafe for MappedRange<'a, B, C> where
C: UnwindSafe,
<B as Backend>::Memory: RefUnwindSafe,
C: UnwindSafe,
<B as Backend>::Memory: RefUnwindSafe,
impl<'a, B, C> RefUnwindSafe for MappedRange<'a, B, C> where
C: RefUnwindSafe,
<B as Backend>::Memory: RefUnwindSafe,
C: RefUnwindSafe,
<B as Backend>::Memory: RefUnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Supports<T> for T
[src]
impl<T> SetParameter for T
[src]
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
[src]
T: Parameter<Self>,
Sets value
as a parameter of self
.
impl<T> Erased for T
[src]
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
[src]
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
[src]
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into(self) -> D
[src]
Convert the source color to the destination color using the bradford method by default Read more