#include <VkContext.h>
|
| VkContext (VkPhysicalDevice physicalDevice) |
|
| ~VkContext () |
|
VkResult | createLogicalDevice (VkPhysicalDeviceFeatures enabledFeatures, std::vector< const char * > enabledExtensions, void *pNextChain, bool useSwapChain=true, VkQueueFlags requestedQueueTypes=VK_QUEUE_GRAPHICS_BIT|VK_QUEUE_COMPUTE_BIT) |
|
void | createPipelineCache () |
|
VkDevice | deviceHandle () |
|
VkQueue | graphicsQueueHandle () |
|
VkQueue | computeQueueHandle () |
|
VkQueue | transferQueueHandle () |
|
VkPhysicalDevice | physicalDeviceHandle () |
|
VkPipelineCache | pipelineCacheHandle () |
|
bool | isComputeQueueSpecial () |
|
uint32_t | getMemoryType (uint32_t typeBits, VkMemoryPropertyFlags properties, VkBool32 *memTypeFound=nullptr) const |
|
uint32_t | getQueueFamilyIndex (VkQueueFlagBits queueFlags) const |
|
VkResult | createBuffer (VkBufferUsageFlags usageFlags, VkMemoryPropertyFlags memoryPropertyFlags, VkDeviceSize size, VkBuffer *buffer, VkDeviceMemory *memory, void *data=nullptr) |
|
VkResult | createBuffer (VkBufferUsageFlags usageFlags, VkMemoryPropertyFlags memoryPropertyFlags, std::shared_ptr< vks::Buffer > &buffer, VkDeviceSize size, const void *data=nullptr) |
|
VkResult | createBuffer (uint32_t poolType, std::shared_ptr< vks::Buffer > &buffer, const void *data=nullptr) |
|
VkResult | createMemoryPool (VkInstance instance, uint32_t apiVerion) |
|
void | copyBuffer (vks::Buffer *src, vks::Buffer *dst, VkQueue queue, VkBufferCopy *copyRegion=nullptr) |
|
VkCommandPool | createCommandPool (uint32_t queueFamilyIndex, VkCommandPoolCreateFlags createFlags=VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT) |
|
VkCommandBuffer | createCommandBuffer (VkCommandBufferLevel level, VkCommandPool pool, bool begin=false) |
|
VkCommandBuffer | createCommandBuffer (VkCommandBufferLevel level, bool begin=false) |
|
void | flushCommandBuffer (VkCommandBuffer commandBuffer, VkQueue queue, VkCommandPool pool, bool free=true) |
|
void | flushCommandBuffer (VkCommandBuffer commandBuffer, VkQueue queue, bool free=true) |
|
bool | extensionSupported (std::string extension) |
|
VkFormat | getSupportedDepthFormat (bool checkSamplingSupport) |
|
| operator VkDevice () const |
|
Definition at line 16 of file VkContext.h.
◆ MemPoolType
Enumerator |
---|
DevicePool | |
HostPool | |
UniformPool | |
EndType | |
Definition at line 94 of file VkContext.h.
◆ VkContext()
dyno::VkContext::VkContext |
( |
VkPhysicalDevice | physicalDevice | ) |
|
|
explicit |
Default constructor
- Parameters
-
physicalDevice | Physical device that is to be used |
Definition at line 12 of file VkContext.cpp.
◆ ~VkContext()
dyno::VkContext::~VkContext |
( |
| ) |
|
Default destructor
- Note
- Frees the logical device
Definition at line 52 of file VkContext.cpp.
◆ computeQueueHandle()
VkQueue dyno::VkContext::computeQueueHandle |
( |
| ) |
|
|
inline |
◆ copyBuffer()
void dyno::VkContext::copyBuffer |
( |
vks::Buffer * | src, |
|
|
vks::Buffer * | dst, |
|
|
VkQueue | queue, |
|
|
VkBufferCopy * | copyRegion = nullptr ) |
Copy buffer data from src to dst using VkCmdCopyBuffer
- Parameters
-
src | Pointer to the source buffer to copy from |
dst | Pointer to the destination buffer to copy to |
queue | Pointer |
copyRegion | (Optional) Pointer to a copy region, if NULL, the whole buffer is copied |
- Note
- Source and destination pointers must have the appropriate transfer usage flags set (TRANSFER_SRC / TRANSFER_DST)
Definition at line 576 of file VkContext.cpp.
◆ createBuffer() [1/3]
VkResult dyno::VkContext::createBuffer |
( |
uint32_t | poolType, |
|
|
std::shared_ptr< vks::Buffer > & | buffer, |
|
|
const void * | data = nullptr ) |
Create a buffer on the device wth memory allocated from memory pool
- Parameters
-
poolType | memory type |
buffer | Pointer to a vk::Vulkan buffer object |
data | Pointer to the data that should be copied to the buffer after creation (optional, if not set, no data is copied over) |
- Returns
- VK_SUCCESS if buffer handle and memory have been created and (optionally passed) data has been copied
Definition at line 461 of file VkContext.cpp.
◆ createBuffer() [2/3]
VkResult dyno::VkContext::createBuffer |
( |
VkBufferUsageFlags | usageFlags, |
|
|
VkMemoryPropertyFlags | memoryPropertyFlags, |
|
|
std::shared_ptr< vks::Buffer > & | buffer, |
|
|
VkDeviceSize | size, |
|
|
const void * | data = nullptr ) |
Create a buffer on the device
- Parameters
-
usageFlags | Usage flag bit mask for the buffer (i.e. index, vertex, uniform buffer) |
memoryPropertyFlags | Memory properties for this buffer (i.e. device local, host visible, coherent) |
buffer | Pointer to a vk::Vulkan buffer object |
size | Size of the buffer in bytes |
data | Pointer to the data that should be copied to the buffer after creation (optional, if not set, no data is copied over) |
- Returns
- VK_SUCCESS if buffer handle and memory have been created and (optionally passed) data has been copied
Definition at line 404 of file VkContext.cpp.
◆ createBuffer() [3/3]
VkResult dyno::VkContext::createBuffer |
( |
VkBufferUsageFlags | usageFlags, |
|
|
VkMemoryPropertyFlags | memoryPropertyFlags, |
|
|
VkDeviceSize | size, |
|
|
VkBuffer * | buffer, |
|
|
VkDeviceMemory * | memory, |
|
|
void * | data = nullptr ) |
Create a buffer on the device
- Parameters
-
usageFlags | Usage flag bit mask for the buffer (i.e. index, vertex, uniform buffer) |
memoryPropertyFlags | Memory properties for this buffer (i.e. device local, host visible, coherent) |
size | Size of the buffer in byes |
buffer | Pointer to the buffer handle acquired by the function |
memory | Pointer to the memory handle acquired by the function |
data | Pointer to the data that should be copied to the buffer after creation (optional, if not set, no data is copied over) |
- Returns
- VK_SUCCESS if buffer handle and memory have been created and (optionally passed) data has been copied
Definition at line 346 of file VkContext.cpp.
◆ createCommandBuffer() [1/2]
VkCommandBuffer dyno::VkContext::createCommandBuffer |
( |
VkCommandBufferLevel | level, |
|
|
bool | begin = false ) |
◆ createCommandBuffer() [2/2]
VkCommandBuffer dyno::VkContext::createCommandBuffer |
( |
VkCommandBufferLevel | level, |
|
|
VkCommandPool | pool, |
|
|
bool | begin = false ) |
Allocate a command buffer from the command pool
- Parameters
-
level | Level of the new command buffer (primary or secondary) |
pool | Command pool from which the command buffer will be allocated |
(Optional) | begin If true, recording on the new command buffer will be started (vkBeginCommandBuffer) (Defaults to false) |
- Returns
- A handle to the allocated command buffer
Definition at line 626 of file VkContext.cpp.
◆ createCommandPool()
VkCommandPool dyno::VkContext::createCommandPool |
( |
uint32_t | queueFamilyIndex, |
|
|
VkCommandPoolCreateFlags | createFlags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT ) |
Create a command pool for allocation command buffers from
- Parameters
-
queueFamilyIndex | Family index of the queue to create the command pool for |
createFlags | (Optional) Command pool creation flags (Defaults to VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT) |
- Note
- Command buffers allocated from the created pool can only be submitted to a queue with the same family index
- Returns
- A handle to the created command buffer
Definition at line 606 of file VkContext.cpp.
◆ createLogicalDevice()
VkResult dyno::VkContext::createLogicalDevice |
( |
VkPhysicalDeviceFeatures | enabledFeatures, |
|
|
std::vector< const char * > | enabledExtensions, |
|
|
void * | pNextChain, |
|
|
bool | useSwapChain = true, |
|
|
VkQueueFlags | requestedQueueTypes = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT ) |
Create the logical device based on the assigned physical device, also gets default queue family indices
- Parameters
-
enabledFeatures | Can be used to enable certain features upon device creation |
pNextChain | Optional chain of pointer to extension structures |
useSwapChain | Set to false for headless rendering to omit the swapchain device extensions |
requestedQueueTypes | Bit flags specifying the queue types to be requested from the device |
- Returns
- VkResult of the device creation call
Definition at line 175 of file VkContext.cpp.
◆ createMemoryPool()
VkResult dyno::VkContext::createMemoryPool |
( |
VkInstance | instance, |
|
|
uint32_t | apiVerion ) |
Create memory pool from all type
- Parameters
-
instance | Vulkan instance |
apiVersion | Vulkan api version |
- Returns
- VK_SUCCESS if memory pool has been created.
Definition at line 504 of file VkContext.cpp.
◆ createPipelineCache()
void dyno::VkContext::createPipelineCache |
( |
| ) |
|
◆ deviceHandle()
VkDevice dyno::VkContext::deviceHandle |
( |
| ) |
|
|
inline |
◆ extensionSupported()
bool dyno::VkContext::extensionSupported |
( |
std::string | extension | ) |
|
Check if an extension is supported by the (physical device)
- Parameters
-
extension | Name of the extension to check |
- Returns
- True if the extension is supported (present in the list read at device creation time)
Definition at line 695 of file VkContext.cpp.
◆ flushCommandBuffer() [1/2]
void dyno::VkContext::flushCommandBuffer |
( |
VkCommandBuffer | commandBuffer, |
|
|
VkQueue | queue, |
|
|
bool | free = true ) |
◆ flushCommandBuffer() [2/2]
void dyno::VkContext::flushCommandBuffer |
( |
VkCommandBuffer | commandBuffer, |
|
|
VkQueue | queue, |
|
|
VkCommandPool | pool, |
|
|
bool | free = true ) |
Finish command buffer recording and submit it to a queue
- Parameters
-
commandBuffer | Command buffer to flush |
queue | Queue to submit the command buffer to |
pool | Command pool on which the command buffer has been created |
free | (Optional) Free the command buffer once it has been submitted (Defaults to true) |
- Note
- The queue that the command buffer is submitted to must be from the same family index as the pool it was allocated from
-
Uses a fence to ensure command buffer has finished executing
Definition at line 656 of file VkContext.cpp.
◆ getMemoryType()
uint32_t dyno::VkContext::getMemoryType |
( |
uint32_t | typeBits, |
|
|
VkMemoryPropertyFlags | properties, |
|
|
VkBool32 * | memTypeFound = nullptr ) const |
Get the index of a memory type that has all the requested property bits set
- Parameters
-
typeBits | Bit mask with bits set for each memory type supported by the resource to request for (from VkMemoryRequirements) |
properties | Bit mask of properties for the memory type to request |
(Optional) | memTypeFound Pointer to a bool that is set to true if a matching memory type has been found |
- Returns
- Index of the requested memory type
- Exceptions
-
Throws | an exception if memTypeFound is null and no memory type could be found that supports the requested properties |
Definition at line 87 of file VkContext.cpp.
◆ getQueueFamilyIndex()
uint32_t dyno::VkContext::getQueueFamilyIndex |
( |
VkQueueFlagBits | queueFlags | ) |
const |
Get the index of a queue family that supports the requested queue flags
- Parameters
-
queueFlags | Queue flags to find a queue family index for |
- Returns
- Index of the queue family index that matches the flags
- Exceptions
-
Throws | an exception if no queue family index could be found that supports the requested flags |
Definition at line 125 of file VkContext.cpp.
◆ getSupportedDepthFormat()
VkFormat dyno::VkContext::getSupportedDepthFormat |
( |
bool | checkSamplingSupport | ) |
|
Select the best-fit depth format for this device from a list of possible depth (and stencil) formats
- Parameters
-
checkSamplingSupport | Check if the format can be sampled from (e.g. for shader reads) |
- Returns
- The depth format that best fits for the current device
- Exceptions
-
Throws | an exception if no depth format fits the requirements |
Definition at line 709 of file VkContext.cpp.
◆ graphicsQueueHandle()
VkQueue dyno::VkContext::graphicsQueueHandle |
( |
| ) |
|
|
inline |
◆ isComputeQueueSpecial()
bool dyno::VkContext::isComputeQueueSpecial |
( |
| ) |
|
◆ operator VkDevice()
dyno::VkContext::operator VkDevice |
( |
| ) |
const |
|
inline |
◆ physicalDeviceHandle()
VkPhysicalDevice dyno::VkContext::physicalDeviceHandle |
( |
| ) |
|
|
inline |
◆ pipelineCacheHandle()
VkPipelineCache dyno::VkContext::pipelineCacheHandle |
( |
| ) |
|
|
inline |
◆ transferQueueHandle()
VkQueue dyno::VkContext::transferQueueHandle |
( |
| ) |
|
|
inline |
◆ commandPool
VkCommandPool dyno::VkContext::commandPool = VK_NULL_HANDLE |
Default command pool for the graphics queue family index.
Definition at line 71 of file VkContext.h.
◆ compute
uint32_t dyno::VkContext::compute |
◆ computeQueue
VkQueue dyno::VkContext::computeQueue |
◆ enableDebugMarkers
bool dyno::VkContext::enableDebugMarkers = false |
Set to true when the debug marker extension is detected.
Definition at line 77 of file VkContext.h.
◆ enabledFeatures
VkPhysicalDeviceFeatures dyno::VkContext::enabledFeatures |
Features that have been enabled for use on the physical device.
Definition at line 63 of file VkContext.h.
◆ features
VkPhysicalDeviceFeatures dyno::VkContext::features |
Features of the physical device that an application can use to check if a feature is supported.
Definition at line 61 of file VkContext.h.
◆ g_Allocator
VmaAllocator dyno::VkContext::g_Allocator |
◆ graphics
uint32_t dyno::VkContext::graphics |
◆ graphicsQueue
VkQueue dyno::VkContext::graphicsQueue |
◆ logicalDevice
VkDevice dyno::VkContext::logicalDevice |
Logical device representation (application's view of the device)
Definition at line 57 of file VkContext.h.
◆ memoryProperties
VkPhysicalDeviceMemoryProperties dyno::VkContext::memoryProperties |
Memory types and heaps of the physical device.
Definition at line 65 of file VkContext.h.
◆ physicalDevice
VkPhysicalDevice dyno::VkContext::physicalDevice |
Physical device representation.
Definition at line 55 of file VkContext.h.
◆ pipelineCache
VkPipelineCache dyno::VkContext::pipelineCache |
Contains queue family indices.
Definition at line 81 of file VkContext.h.
◆ poolMap
◆ properties
VkPhysicalDeviceProperties dyno::VkContext::properties |
Properties of the physical device including limits that the application can check against.
Definition at line 59 of file VkContext.h.
◆ [struct]
struct { ... } dyno::VkContext::queueFamilyIndices |
◆ queueFamilyProperties
std::vector<VkQueueFamilyProperties> dyno::VkContext::queueFamilyProperties |
Queue family properties of the physical device.
Definition at line 67 of file VkContext.h.
◆ supportedExtensions
std::vector<std::string> dyno::VkContext::supportedExtensions |
List of extensions supported by the device.
Definition at line 69 of file VkContext.h.
◆ transfer
uint32_t dyno::VkContext::transfer |
◆ transferQueue
VkQueue dyno::VkContext::transferQueue |
◆ useMemoryPool
bool dyno::VkContext::useMemoryPool = false |
The documentation for this class was generated from the following files: