Kale
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Member Functions | List of all members
Kale::Vulkan::DeviceMemory Class Reference

#include <DeviceMemory.hpp>

+ Inheritance diagram for Kale::Vulkan::DeviceMemory:

Public Member Functions

 DeviceMemory ()
 
 DeviceMemory (Device &device, const vk::MemoryRequirements &requirements, vk::MemoryPropertyFlags properties)
 
void init (Device &device, const vk::MemoryRequirements &requirements, vk::MemoryPropertyFlags properties)
 
 DeviceMemory (Device &device, vk::MemoryRequirements &&requirements, vk::MemoryPropertyFlags properties)
 
void init (Device &device, vk::MemoryRequirements &&requirements, vk::MemoryPropertyFlags properties)
 
void freeResources (bool remove=true) override
 
- Public Member Functions inherited from Kale::Vulkan::ParentResource< DeviceMemory >
virtual ~ParentResource ()
 
void freeChildren ()
 

Public Attributes

vk::UniqueDeviceMemory deviceMemory
 
vk::MemoryRequirements memoryInfo
 
vk::MemoryPropertyFlags memoryProperties
 

Private Member Functions

void allocateMemory ()
 

Additional Inherited Members

- Protected Member Functions inherited from Kale::Vulkan::ChildResource< Device >
 ChildResource ()
 
 ChildResource (Device &parent)
 
virtual void init (Device &parent)
 
 ~ChildResource ()
 
- Protected Attributes inherited from Kale::Vulkan::ParentResource< DeviceMemory >
std::list< ChildResource< DeviceMemory > * > resources
 
- Protected Attributes inherited from Kale::Vulkan::ChildResource< Device >
DeviceparentPtr
 

Detailed Description

Handles physical device memory allocation and deletion automatically using RAII to avoid memory leaks TODO - Delete this class and create a device memory pool class See https://www.youtube.com/watch?v=rXSdDE7NWmA for more info - getting memory is expensive so a pool can help FPS a ton

Definition at line 38 of file DeviceMemory.hpp.

Constructor & Destructor Documentation

◆ DeviceMemory() [1/3]

DeviceMemory::DeviceMemory ( )

Creates an uninitialized object

Definition at line 29 of file DeviceMemory.cpp.

◆ DeviceMemory() [2/3]

DeviceMemory::DeviceMemory ( Device & device,
const vk::MemoryRequirements & requirements,
vk::MemoryPropertyFlags properties )

Creates and initializes the device memory object

Parameters
deviceThe device to allocate the memory on
requirementsThe requirements of the memory to allocate
propertiesProperties regarding the memory to allocate

Definition at line 39 of file DeviceMemory.cpp.

◆ DeviceMemory() [3/3]

DeviceMemory::DeviceMemory ( Device & device,
vk::MemoryRequirements && requirements,
vk::MemoryPropertyFlags properties )

Creates and initializes the device memory object

Parameters
deviceThe device to allocate the memory on
requirementsThe requirements of the memory to allocate
propertiesProperties regarding the memory to allocate

Definition at line 63 of file DeviceMemory.cpp.

Member Function Documentation

◆ allocateMemory()

void DeviceMemory::allocateMemory ( )
private

Allocates memory into the device memory

Definition at line 84 of file DeviceMemory.cpp.

◆ freeResources()

void DeviceMemory::freeResources ( bool remove = true)
overridevirtual

Frees the memory on the device

Reimplemented from Kale::Vulkan::ChildResource< Device >.

Definition at line 93 of file DeviceMemory.cpp.

◆ init() [1/2]

void DeviceMemory::init ( Device & device,
const vk::MemoryRequirements & requirements,
vk::MemoryPropertyFlags properties )

Initializes the device memory object

Parameters
deviceThe device to allocate the memory on
requirementsThe requirements of the memory to allocate
propertiesProperties regarding the memory to allocate

Definition at line 50 of file DeviceMemory.cpp.

◆ init() [2/2]

void DeviceMemory::init ( Device & device,
vk::MemoryRequirements && requirements,
vk::MemoryPropertyFlags properties )

Initializes the device memory object

Parameters
deviceThe device to allocate the memory on
requirementsThe requirements of the memory to allocate
propertiesProperties regarding the memory to allocate

Definition at line 74 of file DeviceMemory.cpp.

Member Data Documentation

◆ deviceMemory

vk::UniqueDeviceMemory Kale::Vulkan::DeviceMemory::deviceMemory

The device memory block

Definition at line 88 of file DeviceMemory.hpp.

◆ memoryInfo

vk::MemoryRequirements Kale::Vulkan::DeviceMemory::memoryInfo

The size of the memory block

Definition at line 93 of file DeviceMemory.hpp.

◆ memoryProperties

vk::MemoryPropertyFlags Kale::Vulkan::DeviceMemory::memoryProperties

The properties of the memory, ie vram or ram, etc

Definition at line 98 of file DeviceMemory.hpp.


The documentation for this class was generated from the following files: