use instance::MemoryType;
use memory::DeviceMemory;
use memory::MappedDeviceMemory;
use OomError;
pub use self::pool::StdMemoryPool;
pub use self::pool::StdMemoryPoolAlloc;
pub use self::host_visible::StdHostVisibleMemoryTypePool;
pub use self::host_visible::StdHostVisibleMemoryTypePoolAlloc;
pub use self::non_host_visible::StdNonHostVisibleMemoryTypePool;
pub use self::non_host_visible::StdNonHostVisibleMemoryTypePoolAlloc;
mod host_visible;
mod non_host_visible;
mod pool;
pub unsafe trait MemoryPool {
type Alloc: MemoryPoolAlloc;
fn alloc(&self, ty: MemoryType, size: usize, alignment: usize, layout: AllocLayout)
-> Result<Self::Alloc, OomError>;
}
pub unsafe trait MemoryPoolAlloc {
fn mapped_memory(&self) -> Option<&MappedDeviceMemory>;
fn memory(&self) -> &DeviceMemory;
fn offset(&self) -> usize;
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum AllocLayout {
Linear,
Optimal,
}