[][src]Struct nobs_vkmem::AllocatorSizes

pub struct AllocatorSizes {
    pub pdevice: PhysicalDevice,
    pub image_requirements: MemoryRequirements,
    pub buffer_requirements: MemoryRequirements,
    pub pagesize_default: DeviceSize,
    pub pagesizes: HashMap<u32, DeviceSize>,
}

Defines meta information for the Allocator

Caches vk::MemoryRequirements for buffers and images. Defines a pagesize for memory types of all common combinations of resource types [buffer, image] and memory properties [device local, host accessible].

Fields

pdevice: PhysicalDevice

Handle to the physical device

Used to retrieve and check against device limits

image_requirements: MemoryRequirements

Cached memory requirements for image resourcses

Used to get the memory type index without having to create an image.

buffer_requirements: MemoryRequirements

Cached memory requirements for image resourcses

Used to get the memory type index without having to create a buffer.

pagesize_default: DeviceSize

Default page size in bytes

This is the fallback page size, that is returned in get_pagesize, if no mapping for the requested memory type index exists.

The default page size is initialized with 64MiB.

pagesizes: HashMap<u32, DeviceSize>

Page size mapped by memory type index

Methods

impl AllocatorSizes[src]

pub fn new(pdevice: PhysicalDevice, device: Device) -> Self[src]

Creates an AllocatorSizes object with default pagesizes

Initializes pagesizes for the allocator with

  • 128MiB for device local resources
  • 8MiB for host accessible resources
  • 64MiB fallback pagesize

Arguments

  • pdevice - physical device handle
  • device - device handle

pub fn get_image_memtype(&self, properties: MemoryPropertyFlags) -> Option<u32>[src]

Get the memtype of an image with the specified memory properties

Returns

  • An option with the memory type index.
  • None, if there is no memory type that supports images with the specified properties

pub fn get_buffer_memtype(&self, properties: MemoryPropertyFlags) -> Option<u32>[src]

Get the memtype of a buffer with the specified memory properties

Returns

  • An option with the memory type index.
  • None, if there is no memory type that supports buffers with the specified properties

pub fn get_pagesize(&self, memtype: u32) -> DeviceSize[src]

Get the pagesize for the memory type

Returns

  • The pagesize of the memory type, if one has been set in the AllocatorSizes.
  • Otherwise the default pagesize is returned.

pub fn set_pagesize(
    &mut self,
    memtype: u32,
    size: DeviceSize
) -> Result<(), Error>
[src]

Set the pagesize for the specifid memory type

The page size must be at least of size bufferImageGranularity. If not the result returns InvalidPageSize.

Trait Implementations

impl Debug for AllocatorSizes[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.