[−][src]Struct nobs_vkmem::AllocatorSizes
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 handledevice
- 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]
&mut self,
memtype: u32,
size: DeviceSize
) -> Result<(), Error>
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
Auto Trait Implementations
impl Send for AllocatorSizes
impl Sync for AllocatorSizes
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>,