Struct vulkano::image::immutable::ImmutableImage
source · pub struct ImmutableImage<F, A = PotentialDedicatedAllocation<StdMemoryPoolAlloc>> { /* private fields */ }
Expand description
Image whose purpose is to be used for read-only purposes. You can write to the image once, but then you must only ever read from it.
Implementations
sourceimpl<F> ImmutableImage<F>
impl<F> ImmutableImage<F>
pub fn new<'a, I>(
device: Arc<Device>,
dimensions: Dimensions,
format: F,
queue_families: I
) -> Result<Arc<ImmutableImage<F>>, ImageCreationError>where
F: FormatDesc,
I: IntoIterator<Item = QueueFamily<'a>>,
👎Deprecated: use ImmutableImage::uninitialized instead
pub fn with_mipmaps<'a, I, M>(
device: Arc<Device>,
dimensions: Dimensions,
format: F,
mipmaps: M,
queue_families: I
) -> Result<Arc<ImmutableImage<F>>, ImageCreationError>where
F: FormatDesc,
I: IntoIterator<Item = QueueFamily<'a>>,
M: Into<MipmapsCount>,
👎Deprecated: use ImmutableImage::uninitialized instead
sourcepub fn uninitialized<'a, I, M>(
device: Arc<Device>,
dimensions: Dimensions,
format: F,
mipmaps: M,
usage: ImageUsage,
layout: ImageLayout,
queue_families: I
) -> Result<(Arc<ImmutableImage<F>>, ImmutableImageInitialization<F>), ImageCreationError>where
F: FormatDesc,
I: IntoIterator<Item = QueueFamily<'a>>,
M: Into<MipmapsCount>,
pub fn uninitialized<'a, I, M>(
device: Arc<Device>,
dimensions: Dimensions,
format: F,
mipmaps: M,
usage: ImageUsage,
layout: ImageLayout,
queue_families: I
) -> Result<(Arc<ImmutableImage<F>>, ImmutableImageInitialization<F>), ImageCreationError>where
F: FormatDesc,
I: IntoIterator<Item = QueueFamily<'a>>,
M: Into<MipmapsCount>,
Builds an uninitialized immutable image.
Returns two things: the image, and a special access that should be used for the initial upload to the image.
sourcepub fn from_iter<P, I>(
iter: I,
dimensions: Dimensions,
format: F,
queue: Arc<Queue>
) -> Result<(Arc<Self>, CommandBufferExecFuture<NowFuture, AutoCommandBuffer>), ImageCreationError>where
P: Send + Sync + Clone + 'static,
F: FormatDesc + AcceptsPixels<P> + 'static + Send + Sync,
I: ExactSizeIterator<Item = P>,
Format: AcceptsPixels<P>,
pub fn from_iter<P, I>(
iter: I,
dimensions: Dimensions,
format: F,
queue: Arc<Queue>
) -> Result<(Arc<Self>, CommandBufferExecFuture<NowFuture, AutoCommandBuffer>), ImageCreationError>where
P: Send + Sync + Clone + 'static,
F: FormatDesc + AcceptsPixels<P> + 'static + Send + Sync,
I: ExactSizeIterator<Item = P>,
Format: AcceptsPixels<P>,
Construct an ImmutableImage from the contents of iter
.
TODO: Support mipmaps
sourcepub fn from_buffer<B, P>(
source: B,
dimensions: Dimensions,
format: F,
queue: Arc<Queue>
) -> Result<(Arc<Self>, CommandBufferExecFuture<NowFuture, AutoCommandBuffer>), ImageCreationError>where
B: BufferAccess + TypedBufferAccess<Content = [P]> + 'static + Clone + Send + Sync,
P: Send + Sync + Clone + 'static,
F: FormatDesc + AcceptsPixels<P> + 'static + Send + Sync,
Format: AcceptsPixels<P>,
pub fn from_buffer<B, P>(
source: B,
dimensions: Dimensions,
format: F,
queue: Arc<Queue>
) -> Result<(Arc<Self>, CommandBufferExecFuture<NowFuture, AutoCommandBuffer>), ImageCreationError>where
B: BufferAccess + TypedBufferAccess<Content = [P]> + 'static + Clone + Send + Sync,
P: Send + Sync + Clone + 'static,
F: FormatDesc + AcceptsPixels<P> + 'static + Send + Sync,
Format: AcceptsPixels<P>,
Construct an ImmutableImage containing a copy of the data in source
.
TODO: Support mipmaps
sourceimpl<F, A> ImmutableImage<F, A>
impl<F, A> ImmutableImage<F, A>
sourcepub fn dimensions(&self) -> Dimensions
pub fn dimensions(&self) -> Dimensions
Returns the dimensions of the image.
sourcepub fn mipmap_levels(&self) -> u32
pub fn mipmap_levels(&self) -> u32
Returns the number of mipmap levels of the image.
Trait Implementations
sourceimpl<F: Debug, A: Debug> Debug for ImmutableImage<F, A>
impl<F: Debug, A: Debug> Debug for ImmutableImage<F, A>
sourceimpl<F, A> ImageAccess for ImmutableImage<F, A>where
F: 'static + Send + Sync,
impl<F, A> ImageAccess for ImmutableImage<F, A>where
F: 'static + Send + Sync,
sourcefn inner(&self) -> ImageInner<'_>
fn inner(&self) -> ImageInner<'_>
Returns the inner unsafe image object used by this image.
sourcefn initial_layout_requirement(&self) -> ImageLayout
fn initial_layout_requirement(&self) -> ImageLayout
Returns the layout that the image has when it is first used in a primary command buffer. Read more
sourcefn final_layout_requirement(&self) -> ImageLayout
fn final_layout_requirement(&self) -> ImageLayout
Returns the layout that the image must be returned to before the end of the command buffer. Read more
sourcefn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool
fn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool
Returns true if an access to
self
potentially overlaps the same memory as an
access to other
. Read moresourcefn conflicts_image(&self, other: &dyn ImageAccess) -> bool
fn conflicts_image(&self, other: &dyn ImageAccess) -> bool
Returns true if an access to
self
potentially overlaps the same memory as an
access to other
. Read moresourcefn conflict_key(&self) -> u64
fn conflict_key(&self) -> u64
Returns a key that uniquely identifies the memory content of the image.
Two ranges that potentially overlap in memory must return the same key. Read more
sourcefn try_gpu_lock(
&self,
exclusive_access: bool,
expected_layout: ImageLayout
) -> Result<(), AccessError>
fn try_gpu_lock(
&self,
exclusive_access: bool,
expected_layout: ImageLayout
) -> Result<(), AccessError>
Locks the resource for usage on the GPU. Returns an error if the lock can’t be acquired. Read more
sourceunsafe fn increase_gpu_lock(&self)
unsafe fn increase_gpu_lock(&self)
Locks the resource for usage on the GPU. Supposes that the resource is already locked, and
simply increases the lock by one. Read more
sourceunsafe fn unlock(&self, new_layout: Option<ImageLayout>)
unsafe fn unlock(&self, new_layout: Option<ImageLayout>)
sourcefn has_depth(&self) -> bool
fn has_depth(&self) -> bool
Returns true if the image has a depth component. In other words, if it is a depth or a
depth-stencil format. Read more
sourcefn has_stencil(&self) -> bool
fn has_stencil(&self) -> bool
Returns true if the image has a stencil component. In other words, if it is a stencil or a
depth-stencil format. Read more
sourcefn mipmap_levels(&self) -> u32
fn mipmap_levels(&self) -> u32
Returns the number of mipmap levels of this image.
sourcefn dimensions(&self) -> ImageDimensions
fn dimensions(&self) -> ImageDimensions
Returns the dimensions of the image.
sourcefn supports_blit_source(&self) -> bool
fn supports_blit_source(&self) -> bool
Returns true if the image can be used as a source for blits.
sourcefn supports_blit_destination(&self) -> bool
fn supports_blit_destination(&self) -> bool
Returns true if the image can be used as a destination for blits.
sourceunsafe fn forced_undefined_initial_layout(
self,
preinitialized: bool
) -> ImageAccessFromUndefinedLayout<Self>where
Self: Sized,
unsafe fn forced_undefined_initial_layout(
self,
preinitialized: bool
) -> ImageAccessFromUndefinedLayout<Self>where
Self: Sized,
Wraps around this
ImageAccess
and returns an identical ImageAccess
but whose initial
layout requirement is either Undefined
or Preinitialized
. Read moresourceimpl<P, F, A> ImageContent<P> for ImmutableImage<F, A>where
F: 'static + Send + Sync,
impl<P, F, A> ImageContent<P> for ImmutableImage<F, A>where
F: 'static + Send + Sync,
sourcefn matches_format(&self) -> bool
fn matches_format(&self) -> bool
Checks whether pixels of type
P
match the format of the image.sourceimpl<F: 'static, A> ImageViewAccess for ImmutableImage<F, A>where
F: 'static + Send + Sync,
impl<F: 'static, A> ImageViewAccess for ImmutableImage<F, A>where
F: 'static + Send + Sync,
fn parent(&self) -> &dyn ImageAccess
sourcefn dimensions(&self) -> Dimensions
fn dimensions(&self) -> Dimensions
Returns the dimensions of the image view.
sourcefn inner(&self) -> &UnsafeImageView
fn inner(&self) -> &UnsafeImageView
Returns the inner unsafe image view object used by this image view.
sourcefn descriptor_set_storage_image_layout(&self) -> ImageLayout
fn descriptor_set_storage_image_layout(&self) -> ImageLayout
Returns the image layout to use in a descriptor with the given subresource.
sourcefn descriptor_set_combined_image_sampler_layout(&self) -> ImageLayout
fn descriptor_set_combined_image_sampler_layout(&self) -> ImageLayout
Returns the image layout to use in a descriptor with the given subresource.
sourcefn descriptor_set_sampled_image_layout(&self) -> ImageLayout
fn descriptor_set_sampled_image_layout(&self) -> ImageLayout
Returns the image layout to use in a descriptor with the given subresource.
sourcefn descriptor_set_input_attachment_layout(&self) -> ImageLayout
fn descriptor_set_input_attachment_layout(&self) -> ImageLayout
Returns the image layout to use in a descriptor with the given subresource.
sourcefn identity_swizzle(&self) -> bool
fn identity_swizzle(&self) -> bool
Returns true if the view doesn’t use components swizzling. Read more
sourcefn format(&self) -> Format
fn format(&self) -> Format
Returns the format of this view. This can be different from the parent’s format.
fn samples(&self) -> u32
sourcefn can_be_sampled(&self, _sampler: &Sampler) -> bool
fn can_be_sampled(&self, _sampler: &Sampler) -> bool
Returns true if the given sampler can be used with this image view. Read more
Auto Trait Implementations
impl<F, A> RefUnwindSafe for ImmutableImage<F, A>where
A: RefUnwindSafe,
F: RefUnwindSafe,
impl<F, A> Send for ImmutableImage<F, A>where
A: Send,
F: Send,
impl<F, A> Sync for ImmutableImage<F, A>where
A: Sync,
F: Sync,
impl<F, A> Unpin for ImmutableImage<F, A>where
A: Unpin,
F: Unpin,
impl<F, A> UnwindSafe for ImmutableImage<F, A>where
A: UnwindSafe,
F: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Content for T
impl<T> Content for T
sourcefn ref_from_ptr<'a>(ptr: *mut c_void, size: usize) -> Option<*mut T>
fn ref_from_ptr<'a>(ptr: *mut c_void, size: usize) -> Option<*mut T>
Builds a pointer to this type from a raw pointer.
sourcefn is_size_suitable(size: usize) -> bool
fn is_size_suitable(size: usize) -> bool
Returns true if the size is suitable to store a type like this.
sourcefn indiv_size() -> usize
fn indiv_size() -> usize
Returns the size of an individual element.