Declaration of AcceleratorBuffer.
More...
#include "AlignedAllocator.h"
#include "QueueManager.h"
#include <sys/mman.h>
#include <unistd.h>
#include <type_traits>
Go to the source code of this file.
|
typedef bool(* | MemoryPressureHandler) (MemoryPressureLevel level, MemoryPressureType type, size_t requestedSize) |
| Memory pressure handler type, called when free memory reaches a warning level or a Vulkan allocation fails.
|
|
|
uint32_t | g_vkPinnedMemoryType |
| Vulkan memory type for CPU-based memory that is also GPU-readable.
|
|
uint32_t | g_vkLocalMemoryType |
| Vulkan memory type for GPU-based memory (generally not CPU-readable, except on unified memory systems)
|
|
std::shared_ptr< vk::raii::Device > | g_vkComputeDevice |
| The Vulkan device selected for compute operations (may or may not be same device as rendering)
|
|
std::unique_ptr< vk::raii::CommandBuffer > | g_vkTransferCommandBuffer |
| Command buffer for AcceleratorBuffer transfers. More...
|
|
std::shared_ptr< QueueHandle > | g_vkTransferQueue |
| Queue for AcceleratorBuffer transfers. More...
|
|
std::mutex | g_vkTransferMutex |
| Mutex for interlocking access to g_vkTransferCommandBuffer and g_vkTransferCommandPool.
|
|
bool | g_hasDebugUtils |
| Indicates whether the VK_EXT_debug_utils extension is available.
|
|
bool | g_vulkanDeviceHasUnifiedMemory |
| Indicates whether the Vulkan device is unified memory. More...
|
|
std::set< MemoryPressureHandler > | g_memoryPressureHandlers |
| List of handlers for low memory registered by various subsystems.
|
|
Declaration of AcceleratorBuffer.
- Author
- Andrew D. Zonenberg
◆ MemoryPressureLevel
Levels of memory pressure.
Enumerator |
---|
Hard | A memory allocation has failed and we need to free memory immediately to continue execution.
|
Soft | Free memory has reached a warning threshold.
We should trim caches or otherwise try to make space but don't need to be too aggressive about it.
This level is only available if we have VK_EXT_memory_budget; without this extension we do not know about memory pressure until a hard allocation failure occurs.
|
◆ MemoryPressureType
Types of memory pressure.
Enumerator |
---|
Host | Pinned CPU-side memory.
|
Device | GPU-side memory.
|
◆ OnMemoryPressure()
Called when we run low on memory.
- Parameters
-
level | Indicates if this is a soft or hard memory exhaustion condition |
type | Indicates if we are low on CPU or GPU memory |
requestedSize | For hard memory exhaustion, the size of the failing allocation. For soft exhaustion, ignored and set to zero |
- Returns
- True if memory was freed, false if no space could be freed