[−][src]Struct nobs_vkmem::Image
Builder pattern for creating image resources
A new builder will be initialized with the default configuration.
After the image has been configured, it can be created and bound to an allocator with bind.
One can create multiple buffers/images in bulk by calling next_buffer or next_image. This has the benefit, that then they are more likely to share a commen momory block.
see Allocator for more details on creating and binding images.
Methods
impl<'a> Image<'a>
[src]
pub fn new(handle: &'a mut u64) -> Self
[src]
Creates a new builder.
Initializes with defaults
After bind is called, the created image will be copied into the specified handle
pub fn defaults(self) -> Self
[src]
Sets the default image configuration
By default the builder will be initialized with
- memory properties:
vk::MEMORY_PROPERTY_DEVICE_LOCAL_BIT
- imageType:
vk::IMAGE_TYPE_2D
- format:
vk::FORMAT_R8G8B8A8_UNORM
- extent: width = height = depth = 0
- mipLevels: 1
- arrayLayers: 1
- samples:
vk::SAMPLE_COUNT_1_BIT
- tiling:
vk::IMAGE_TILING_OPTIMAL
- usage: 0,
- initialLayout:
vk::IMAGE_LAYOUT_UNDEFINED
- sharingMode: `vk::SHARING_MODE_EXCLUSIVE (no queue indices)
pub fn texture2d(self, w: u32, h: u32, format: Format) -> Self
[src]
Sets the configuration to be used as a sampled 2D texture
Basically sets the defaults with:
- width:
w
- height:
h
- format:
format
. - usage:
vk::IMAGE_USAGE_TRANSFER_SRC_BIT | vk::IMAGE_USAGE_TRANSFER_DST_BIT | vk::IMAGE_USAGE_SAMPLED_BIT
pub fn color_attachment(self, w: u32, h: u32, format: Format) -> Self
[src]
Sets the configuration to be used as a color attachment
This is basically a texture2D with additional usage vk::IMAGE_USAGE_COLOR_ATTACHMENT_BIT
pub fn depth_attachment(self, w: u32, h: u32, format: Format) -> Self
[src]
Sets the configuration to be used as a depth attachment
This is basically a texture2D with usage vk::IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
pub fn image_type(self, ty: ImageType) -> Self
[src]
Set the image type
pub fn format(self, format: Format) -> Self
[src]
Set the image format
pub fn width(self, w: u32) -> Self
[src]
Set the width in pixels
pub fn height(self, h: u32) -> Self
[src]
Set the height in pixels
pub fn depth(self, d: u32) -> Self
[src]
Set the depth in pixels
pub fn size(self, w: u32, h: u32, d: u32) -> Self
[src]
Set the width, height and depth in pixel
pub fn extent(self, extent: Extent3D) -> Self
[src]
Set the width, height and depth in pixel
pub fn mip_levels(self, levels: u32) -> Self
[src]
Set the number of mip level
pub fn array_layers(self, layers: u32) -> Self
[src]
Set the number of array layers
pub fn samples(self, samples: SampleCountFlags) -> Self
[src]
Seth the multisampling properties
pub fn tiling(self, tiling: ImageTiling) -> Self
[src]
Set the image tiling
pub fn usage(self, usage: BufferUsageFlags) -> Self
[src]
set the usage of the image
pub fn sharing(self, sharing: SharingMode) -> Self
[src]
Sets the image's sharing mode
pub fn queues(self, queue_family_indices: &[u32]) -> Self
[src]
Sets the images queue indices for sharing
This will be ignored if the sharing mode is vk::SHARING_MODE_EXCLUSIVE
pub fn layout(self, layout: ImageLayout) -> Self
[src]
Sets the initial layout of the image
pub fn mem_properties(self, properties: MemoryPropertyFlags) -> Self
[src]
Sets the memory properties of the buffer
pub fn devicelocal(self, local: bool) -> Self
[src]
Setst the memory properties of the image
Sets the properties to vk::MEMORY_PROPERTY_DEVICE_LOCAL_BIT
if local
is true.
Other wise sets properties to vk::MEMORY_PROPERTY_HOST_VISIBLE_BIT | vk::MEMORY_PROPERTY_HOST_COHERENT_BIT
.
pub fn submit(self) -> Resource<'a>
[src]
Finishes configuration of this image
Returns
A Resource so that we can continue configuring new buffers/images.
pub fn new_buffer(self, handle: &'a mut u64) -> Buffer
[src]
Short hand for submit()
.new_buffer(handle)
pub fn new_image(self, handle: &'a mut u64) -> Self
[src]
Short hand for submit()
.new_image(handle)
pub fn bind(
self,
allocator: &mut Allocator,
bindtype: BindType
) -> Result<(), Error>
[src]
self,
allocator: &mut Allocator,
bindtype: BindType
) -> Result<(), Error>
Short hand for submit()
.bind(handle)
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,