Trait vulkano::image::traits::Image [] [src]

pub unsafe trait Image: 'static + Send + Sync {
    fn inner(&self) -> &UnsafeImage;
    fn blocks(&self, mipmap_levels: Range<u32>, array_layers: Range<u32>) -> Vec<(u32, u32)>;
    fn block_mipmap_levels_range(&self, block: (u32, u32)) -> Range<u32>;
    fn block_array_layers_range(&self, block: (u32, u32)) -> Range<u32>;
    fn initial_layout(&self, block: (u32, u32), first_required_layout: Layout) -> (Layout, bool, bool);
    fn final_layout(&self, block: (u32, u32), last_required_layout: Layout) -> (Layout, bool, bool);
    fn needs_fence(&self, access: &mut Iterator<Item=AccessRange>) -> Option<bool>;
    unsafe fn gpu_access(&self, access: &mut Iterator<Item=AccessRange>, submission: &Arc<Submission>) -> GpuAccessResult;

    fn format(&self) -> Format { ... }
    fn samples(&self) -> u32 { ... }
    fn dimensions(&self) -> Dimensions { ... }
    fn supports_blit_source(&self) -> bool { ... }
    fn supports_blit_destination(&self) -> bool { ... }
}

Trait for types that represent images.

Required Methods

Returns the inner unsafe image object used by this image.

Given a range, returns the list of blocks which each range is contained in.

Each block must have a unique number. Hint: it can simply be the offset of the start of the mipmap and array layer. Calling this function multiple times with the same parameter must always return the same value. The return value must not be empty.

Called when a command buffer that uses this image is being built. Given a block, this function should return the layout that the block will have when the command buffer is submitted.

The first_required_layout is provided as a hint and corresponds to the first layout that the image will be used for. If this function returns a value different from first_required_layout, then a layout transition will be performed by the command buffer.

The two additional elements are:

  • Whether a pipeline barrier should be added in order to address a read or write from the host (VK_ACCESS_HOST_READ_BIT | VK_ACCESS_HOST_WRITE_BIT).
  • Whether a pipeline barrier should be added in order to address a read or write from memory (VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT).

Called when a command buffer that uses this image is being built. Given a block, this function should return the layout that the block must have when the command buffer is end.

The last_required_layout is provided as a hint and corresponds to the last layout that the image will be in at the end of the command buffer. If this function returns a value different from last_required_layout, then a layout transition will be performed by the command buffer.

The two additional elements are:

  • Whether a pipeline barrier should be added in order to address a read or write from the host (VK_ACCESS_HOST_READ_BIT | VK_ACCESS_HOST_WRITE_BIT).
  • Whether a pipeline barrier should be added in order to address a read or write from memory (VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT).

Returns whether accessing a subresource of that image should signal a fence.

The Submission object likely holds an Arc to self. Therefore you should store the Submission in the form of a Weak<Submission> and not of an Arc<Submission> to avoid cyclic references.

Provided Methods

Returns the format of this image.

Returns the number of samples of this image.

Returns the dimensions of the image.

Returns true if the image can be used as a source for blits.

Returns true if the image can be used as a destination for blits.

Implementors