Struct draw2d::graphics::vulkan::texture::TextureImage [−][src]
pub struct TextureImage { /* fields omitted */ }
Expand description
The TextureImage maintains the image, view, and memory, which are required when rendering with a texture.
Implementations
The raw image handle used by this texture.
Unsafe because it is up to the caller to synchronize access to the image.
The raw image view used by this texture.
Unsafe because it is up to the caller to synchronize access to the view.
pub fn new(
device: Arc<Device>,
image_create_info: ImageCreateInfo,
memory_property_flags: MemoryPropertyFlags,
bytes_per_pixel: u64
) -> Result<Self>
pub fn new(
device: Arc<Device>,
image_create_info: ImageCreateInfo,
memory_property_flags: MemoryPropertyFlags,
bytes_per_pixel: u64
) -> Result<Self>
Create the image, allocate memory, create a view for the texture.
Bytes per pixel is used by the various upload_*
methods when copying
data from a buffer into the image. For example, if the image format
is R8G8B8A8_SRGB then the bytes per pixel is 4.
Upload a texture’s data from a buffer.
This method is just an alias to Self::upload_mipmaps_from_buffer which only updates the first mipmap. It’s particularly convenient for textures which only have a single mipmap level.
pub unsafe fn upload_mipmaps_from_buffer(
&mut self,
src: &impl Buffer,
mipmap_sizes: &[MipmapExtent]
) -> Result<()>
pub unsafe fn upload_mipmaps_from_buffer(
&mut self,
src: &impl Buffer,
mipmap_sizes: &[MipmapExtent]
) -> Result<()>
Upload a texture’s mipmaps from a buffer.
- This method assumes that each mipmap has the same
bytes_per_pixel
as the texture image. - Order is super important. The first entry in
mipmap_sizes
corresponds to the first region of memory in the src bufer. The mipmap extents are used to compute the byte offset and size of each mipmap region.
Transition the image memory layout such that it is an optimal transfer target.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for TextureImage
impl !Send for TextureImage
impl !Sync for TextureImage
impl Unpin for TextureImage
impl UnwindSafe for TextureImage
Blanket Implementations
Mutably borrows from an owned value. Read more
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
Checks if self
is actually part of its subset T
(and can be converted to it).
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
The inclusion map: converts self
to the equivalent element of its superset.