8#include <vulkan/vulkan_core.h>
14std::unordered_map<uint64_t, std::string> VulkanHelper::objectNames;
34 std::lock_guard<std::mutex> lock(
s_mutex );
37 PLOGW <<
"Vulkan functions already initialized. Ignoring redundant call.";
54 "vkGetPhysicalDeviceCalibrateableTimeDomainsEXT",
55 s_functions.vkGetPhysicalDeviceCalibrateableTimeDomainsEXT
62 PLOGI <<
"Vulkan extension functions initialized successfully.";
69 throw std::runtime_error(
70 "Vulkan functions have not been initialized! Call VulkanHelper::initializeFunctions() first."
78 VkPhysicalDevice physicalDevice,
80 VkBufferUsageFlags usage,
81 VkMemoryPropertyFlags properties,
83 VkDeviceMemory & bufferMemory
89 VkBufferCreateInfo bufferInfo{};
90 bufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
91 bufferInfo.size = size;
92 bufferInfo.usage = usage;
93 bufferInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
98 if ( vkCreateBuffer( device, &bufferInfo,
nullptr, &buffer ) != VK_SUCCESS )
100 throw std::runtime_error(
"failed to create buffer!" );
105 VkMemoryRequirements memoryRequirements;
108 vkGetBufferMemoryRequirements( device, buffer, &memoryRequirements );
112 VkMemoryAllocateInfo allocInfo{};
113 allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
114 allocInfo.allocationSize = memoryRequirements.size;
115 allocInfo.memoryTypeIndex =
116 findMemoryType( physicalDevice, memoryRequirements.memoryTypeBits, properties );
120 if ( vkAllocateMemory( device, &allocInfo,
nullptr, &bufferMemory ) != VK_SUCCESS )
123 std::stringstream ss;
124 ss <<
"failed to allocate buffer memory for buffer ";
126 throw std::runtime_error(ss.str().c_str());
128 throw std::runtime_error(
"failed to allocate vertex buffer memory!" );
133 vkBindBufferMemory( device, buffer, bufferMemory, 0 );
138 VkPhysicalDevice physicalDevice,
139 VkCommandPool commandPool,
142 const void * dataPtr,
143 VkBuffer targetBuffer
147 VkBuffer stagingBuffer;
148 VkDeviceMemory stagingBufferMemory;
153 VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
154 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
161 vkMapMemory( device, stagingBufferMemory, 0, size, 0, &mappedData );
162 memcpy( mappedData, dataPtr,
static_cast<size_t>( size ) );
163 vkUnmapMemory( device, stagingBufferMemory );
169 vkDestroyBuffer( device, stagingBuffer,
nullptr );
170 vkFreeMemory( device, stagingBufferMemory,
nullptr );
175 return object != VK_NULL_HANDLE;
185 VkPhysicalDevice physicalDevice,
186 VkCommandPool commandPool,
189 VkBufferUsageFlags usage,
190 const void * dataPtr,
192 VkDeviceMemory & bufferMemory
195 VkBuffer stagingBuffer;
196 VkDeviceMemory stagingBufferMemory;
201 VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
202 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
208 vkMapMemory( device, stagingBufferMemory, 0, size, 0, &mappedData );
209 memcpy( mappedData, dataPtr,
static_cast<size_t>( size ) );
210 vkUnmapMemory( device, stagingBufferMemory );
216 VK_BUFFER_USAGE_TRANSFER_DST_BIT | usage,
217 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
224 vkDestroyBuffer( device, stagingBuffer,
nullptr );
225 vkFreeMemory( device, stagingBufferMemory,
nullptr );
230 VkPhysicalDevice physicalDevice,
231 VkCommandPool commandPool,
234 const void * dataPtr,
236 VkDeviceMemory bufferMemory
239 VkBuffer stagingBuffer;
240 VkDeviceMemory stagingBufferMemory;
246 VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
247 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
253 vkMapMemory( device, stagingBufferMemory, 0, size, 0, &mappedData );
254 memcpy( mappedData, dataPtr,
static_cast<size_t>( size ) );
255 vkUnmapMemory( device, stagingBufferMemory );
259 vkDestroyBuffer( device, stagingBuffer,
nullptr );
260 vkFreeMemory( device, stagingBufferMemory,
nullptr );
264 VkPhysicalDevice physicalDevice,
266 VkMemoryPropertyFlags properties
269 VkPhysicalDeviceMemoryProperties memoryProperties;
270 vkGetPhysicalDeviceMemoryProperties( physicalDevice, &memoryProperties );
272 for ( uint32_t i = 0; i < memoryProperties.memoryTypeCount; i++ )
274 if ( typeFilter & ( 1 << i ) &&
275 ( memoryProperties.memoryTypes[i].propertyFlags & properties ) == properties )
281 throw std::runtime_error(
"failed to find suitable memory type!" );
285 VkPhysicalDevice physicalDevice,
286 VkMemoryRequirements2 requirements,
287 VkMemoryPropertyFlags properties,
288 uint32_t & out_typeIndex
291 VkPhysicalDeviceMemoryProperties supportedMemoryProperties;
292 vkGetPhysicalDeviceMemoryProperties( physicalDevice, &supportedMemoryProperties );
294 const VkMemoryPropertyFlags typeFilter = requirements.memoryRequirements.memoryTypeBits;
295 for ( uint32_t memoryTypeIndex = 0u; memoryTypeIndex < supportedMemoryProperties.memoryTypeCount;
298 const VkMemoryPropertyFlags propertyFlags =
299 supportedMemoryProperties.memoryTypes[memoryTypeIndex].propertyFlags;
300 if ( typeFilter & ( 1u << memoryTypeIndex ) && ( propertyFlags & properties ) == properties )
302 out_typeIndex = memoryTypeIndex;
316 return ( value + alignment - 1u ) & ~( alignment - 1u );
321 VkCommandPool commandPool,
322 VkQueue graphicsQueue,
323 VkBuffer sourceBuffer,
324 VkBuffer destinationBuffer,
333 VkBufferCopy copyRegion{};
334 copyRegion.size = size;
335 vkCmdCopyBuffer( commandBuffer, sourceBuffer, destinationBuffer, 1, ©Region );
342 VkCommandPool commandPool,
343 VkQueue graphicsQueue,
344 const std::vector<BufferCopyObject> & bufferCopyObjects
354 VkBufferCopy copyRegion{};
355 copyRegion.size = copyObject.size;
357 commandBuffer, copyObject.sourceBuffer, copyObject.destinationBuffer, 1, ©Region
366 VkCommandBuffer commandBuffer,
367 const std::vector<BufferCopyObject> & bufferCopyObjects
377 bool familiesDiffer = ( transferFamilyIndex != graphicsFamilyIndex );
381 VkBufferCopy copyRegion{};
382 copyRegion.size = copyObject.size;
383 copyRegion.srcOffset = 0;
384 copyRegion.dstOffset = 0;
386 commandBuffer, copyObject.sourceBuffer, copyObject.destinationBuffer, 1, ©Region
392 VkBufferMemoryBarrier bufferMemoryBarrier{};
393 bufferMemoryBarrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
394 bufferMemoryBarrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
395 bufferMemoryBarrier.buffer = copyObject.destinationBuffer;
396 bufferMemoryBarrier.offset = 0;
397 bufferMemoryBarrier.size = VK_WHOLE_SIZE;
399 if ( familiesDiffer )
404 bufferMemoryBarrier.dstAccessMask = 0;
405 bufferMemoryBarrier.srcQueueFamilyIndex = transferFamilyIndex;
406 bufferMemoryBarrier.dstQueueFamilyIndex = graphicsFamilyIndex;
408 vkCmdPipelineBarrier(
410 VK_PIPELINE_STAGE_TRANSFER_BIT,
411 VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT,
417 &bufferMemoryBarrier,
456 VkCommandBufferAllocateInfo allocInfo{};
457 allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
458 allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
459 allocInfo.commandPool = commandPool;
460 allocInfo.commandBufferCount = 1;
462 VkCommandBuffer commandBuffer;
463 vkAllocateCommandBuffers( device, &allocInfo, &commandBuffer );
466 VkCommandBufferBeginInfo beginInfo{};
467 beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
468 beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
470 vkBeginCommandBuffer( commandBuffer, &beginInfo );
472 return commandBuffer;
477 VkQueue graphicsQueue,
478 VkCommandPool commandPool,
479 VkCommandBuffer commandBuffer
482 vkEndCommandBuffer( commandBuffer );
484 VkSubmitInfo submitInfo{};
485 submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
486 submitInfo.commandBufferCount = 1;
487 submitInfo.pCommandBuffers = &commandBuffer;
489 vkQueueSubmit( graphicsQueue, 1, &submitInfo, VK_NULL_HANDLE );
490 vkQueueWaitIdle( graphicsQueue );
492 vkFreeCommandBuffers( device, commandPool, 1, &commandBuffer );
497 if ( buffer != VK_NULL_HANDLE )
498 vkDestroyBuffer( device, buffer,
nullptr );
499 if ( bufferMemory != VK_NULL_HANDLE )
500 vkFreeMemory( device, bufferMemory,
nullptr );
505 VkPhysicalDevice physicalDevice,
509 VkImageTiling tiling,
510 VkImageUsageFlags usage,
511 VkMemoryPropertyFlags properties,
513 VkDeviceMemory & imageMemory
516 VkImageCreateInfo imageInfo{};
517 imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
518 imageInfo.imageType = VK_IMAGE_TYPE_2D;
519 imageInfo.extent.width = width;
520 imageInfo.extent.height = height;
521 imageInfo.extent.depth = 1;
522 imageInfo.mipLevels = 1;
523 imageInfo.arrayLayers = 1;
524 imageInfo.format = format;
525 imageInfo.tiling = tiling;
526 imageInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
527 imageInfo.usage = usage;
528 imageInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
529 imageInfo.samples = VK_SAMPLE_COUNT_1_BIT;
532 if ( vkCreateImage( device, &imageInfo,
nullptr, &image ) != VK_SUCCESS )
534 throw std::runtime_error(
"failed to create image!" );
537 VkMemoryRequirements memoryRequirements;
538 vkGetImageMemoryRequirements( device, image, &memoryRequirements );
540 VkMemoryAllocateInfo allocInfo{};
541 allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
542 allocInfo.allocationSize = memoryRequirements.size;
543 allocInfo.memoryTypeIndex =
545 assert(memoryRequirements.size > 0);
546 if ( vkAllocateMemory( device, &allocInfo,
nullptr, &imageMemory ) != VK_SUCCESS )
548 throw std::runtime_error(
"failed to allocate image memory!" );
551 vkBindImageMemory( device, image, imageMemory, 0 );
555 VkCommandBuffer commandBuffer,
557 VkQueue graphicsQueue,
558 VkCommandPool commandPool,
561 VkImageLayout oldLayout,
562 VkImageLayout newLayout,
566 VkImageMemoryBarrier barrier{};
567 barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
568 barrier.oldLayout = oldLayout;
569 barrier.newLayout = newLayout;
570 barrier.image = image;
571 barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
572 barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
574 if ( newLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL )
576 barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT;
580 barrier.subresourceRange.aspectMask |= VK_IMAGE_ASPECT_STENCIL_BIT;
585 barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
587 barrier.subresourceRange.baseMipLevel = 0;
588 barrier.subresourceRange.levelCount = 1;
589 barrier.subresourceRange.baseArrayLayer = 0;
590 barrier.subresourceRange.layerCount = layerCount;
594 barrier.srcAccessMask = 0;
595 barrier.dstAccessMask = 0;
597 VkPipelineStageFlags sourceStage;
598 VkPipelineStageFlags destinationStage;
600 if ( oldLayout == VK_IMAGE_LAYOUT_UNDEFINED && newLayout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL )
602 barrier.srcAccessMask = 0;
603 barrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
604 sourceStage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
605 destinationStage = VK_PIPELINE_STAGE_TRANSFER_BIT;
607 else if ( oldLayout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL && newLayout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL )
609 barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
610 barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
611 sourceStage = VK_PIPELINE_STAGE_TRANSFER_BIT;
612 destinationStage = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
614 else if ( oldLayout == VK_IMAGE_LAYOUT_UNDEFINED && newLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL )
616 barrier.srcAccessMask = 0;
617 barrier.dstAccessMask =
618 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
619 sourceStage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
620 destinationStage = VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT;
623 else if ( oldLayout == VK_IMAGE_LAYOUT_UNDEFINED && newLayout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL )
625 barrier.srcAccessMask = 0;
626 barrier.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
627 sourceStage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
628 destinationStage = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
632 throw std::invalid_argument(
"unsupported layout transition!" );
635 vkCmdPipelineBarrier(
636 commandBuffer, sourceStage, destinationStage, 0, 0,
nullptr, 0,
nullptr, 1, &barrier
642 return format == VK_FORMAT_D32_SFLOAT_S8_UINT || format == VK_FORMAT_D24_UNORM_S8_UINT;
647 VkCommandPool commandPool,
648 VkQueue graphicsQueue,
657 VkBufferImageCopy region{};
658 region.bufferOffset = 0;
659 region.bufferRowLength = 0;
660 region.bufferImageHeight = 0;
662 region.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
663 region.imageSubresource.mipLevel = 0;
664 region.imageSubresource.baseArrayLayer = 0;
665 region.imageSubresource.layerCount = 1;
667 region.imageOffset = { 0, 0, 0 };
668 region.imageExtent = { width, height, 1 };
670 vkCmdCopyBufferToImage( commandBuffer, buffer, image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, ®ion );
679 VkImageAspectFlags aspectFlags
682 assert( image != VK_NULL_HANDLE );
684 VkImageViewCreateInfo viewInfo{};
685 viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
686 viewInfo.image = image;
687 viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
688 viewInfo.format = format;
690 viewInfo.subresourceRange.aspectMask = aspectFlags;
691 viewInfo.subresourceRange.baseMipLevel = 0;
692 viewInfo.subresourceRange.levelCount = 1;
693 viewInfo.subresourceRange.baseArrayLayer = 0;
694 viewInfo.subresourceRange.layerCount = 1;
696 viewInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
697 viewInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
698 viewInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;
699 viewInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY;
701 VkImageView imageView =
nullptr;
702 if ( vkCreateImageView( device, &viewInfo,
nullptr, &imageView ) != VK_SUCCESS )
704 throw std::runtime_error(
"failed to create texture image view!" );
715 VkDescriptorBufferInfo bufferInfo{
718 .range = VK_WHOLE_SIZE
725 const VkDescriptorSetAllocateInfo * pAllocateInfo,
726 VkDescriptorSet * pDescriptorSets,
727 const std::string & name
730 PLOG_FN_VK_RETURN( vkAllocateDescriptorSets( device, pAllocateInfo, pDescriptorSets ) );
737 const VkSemaphoreCreateInfo * pCreateInfo,
738 const VkAllocationCallbacks * pAllocator,
739 VkSemaphore * pSemaphore,
740 const std::string & name
743 assert( pCreateInfo );
744 PLOG_THROW_FN_VK_RETURN( vkCreateSemaphore( device, pCreateInfo, pAllocator, pSemaphore ) );
751 const VkCommandBufferAllocateInfo * pAllocateInfo,
752 VkCommandBuffer * pCommandBuffers,
753 const std::string & name
756 PLOG_THROW_FN_VK_RETURN( vkAllocateCommandBuffers( device, pAllocateInfo, pCommandBuffers ) );
763 const VkDescriptorSetLayoutCreateInfo * pCreateInfo,
764 const VkAllocationCallbacks * pAllocator,
765 VkDescriptorSetLayout * pSetLayout,
766 const std::string & name
769 PLOG_THROW_FN_VK_RETURN( vkCreateDescriptorSetLayout( device, pCreateInfo, pAllocator, pSetLayout ) );
776 const VkPipelineLayoutCreateInfo * pCreateInfo,
777 const VkAllocationCallbacks * pAllocator,
778 VkPipelineLayout * pPipelineLayout,
779 const std::string & name
782 assert(pCreateInfo !=
nullptr);
783 PLOG_THROW_FN_VK_RETURN( vkCreatePipelineLayout( device, pCreateInfo, pAllocator, pPipelineLayout ) );
790 const VkFenceCreateInfo * pCreateInfo,
791 const VkAllocationCallbacks * pAllocator,
793 const std::string & name
796 PLOG_THROW_FN_VK_RETURN( vkCreateFence( device, pCreateInfo, pAllocator, pFence ) );
802 const VkDescriptorPoolCreateInfo * pCreateInfo,
803 const VkAllocationCallbacks * pAllocator,
804 VkDescriptorPool * pDescriptorPool,
805 const std::string & name
808 PLOG_FN_VK_RETURN( vkCreateDescriptorPool( device, pCreateInfo, pAllocator, pDescriptorPool ) )
815 std::stringstream ss;
830 VkDebugUtilsLabelEXT labelInfo{};
831 labelInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT;
832 labelInfo.pLabelName = pLabelName;
837 labelInfo.color[0] = color[0];
838 labelInfo.color[1] = color[1];
839 labelInfo.color[2] = color[2];
840 labelInfo.color[3] = color[3];
843 s_functions.vkCmdBeginDebugUtilsLabelEXT( commandBuffer, &labelInfo );
854 s_functions.vkCmdEndDebugUtilsLabelEXT( commandBuffer );
constexpr const char * CHECK_STR
constexpr const char * CROSS_STR
#define TRACY_ZONE_SCOPED_FUNCTION
#define TRACY_ZONE_SCOPED_NAMED(name)
@ DEBUG_FUNCTIONS_INITIALIZED
The application context is the core class which stores the basic openxr and vulkan objects.
uint32_t getVkTransferQueueFamilyIndex() const
gets the transfer queue family index
uint32_t getVkGraphicsQueueFamilyIndex() const
Gets the zero-based index of the vulkan draw queue family.
static VkResult createPipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkPipelineLayout *pPipelineLayout, const std::string &name)
static void createBufferWithStaging(VkDevice device, VkPhysicalDevice physicalDevice, VkCommandPool commandPool, VkQueue queue, VkDeviceSize size, VkBufferUsageFlags usage, const void *dataPtr, VkBuffer &buffer, VkDeviceMemory &bufferMemory)
static void endSingleTimeCommands(VkDevice device, VkQueue graphicsQueue, VkCommandPool commandPool, VkCommandBuffer commandBuffer)
static void initializeDebugFunctions(VkInstance instance)
static VkImageView createImageView(VkDevice device, VkImage image, VkFormat format, VkImageAspectFlags aspectFlags)
static void copyDataToBufferViaStaging(VkDevice device, VkPhysicalDevice physicalDevice, VkCommandPool commandPool, VkQueue queue, VkDeviceSize size, const void *dataPtr, VkBuffer buffer, VkDeviceMemory bufferMemory)
static VkDeviceSize align(VkDeviceSize value, VkDeviceSize alignment)
static bool findSuitableMemoryType(VkPhysicalDevice physicalDevice, VkMemoryRequirements2 requirements, VkMemoryPropertyFlags properties, uint32_t &out_typeIndex)
static void loadVkDeviceFunction(VkDevice device, const std::string &name, T &functionPointer)
static std::string strIsValid(void *object)
static std::string getDebugName(VulkanObjectType objectHandle)
static void copyBufferToImage(VkDevice device, VkCommandPool commandPool, VkQueue graphicsQueue, VkBuffer buffer, VkImage image, uint32_t width, uint32_t height)
static void recordBufferCopyMultiple(EngineCore::ApplicationContext *context, VkCommandBuffer commandBuffer, const std::vector< BufferCopyObject > &bufferCopyObjects)
static DynamicFunctionInitState s_functionInitializationState
static void copyBuffer(VkDevice device, VkCommandPool commandPool, VkQueue graphicsQueue, VkBuffer sourceBuffer, VkBuffer destinationBuffer, VkDeviceSize size)
static VulkanFunctions s_functions
static void endLabel(VkCommandBuffer)
static void createFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkFence *pFence, const std::string &name)
static VkResult allocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, VkCommandBuffer *pCommandBuffers, const std::string &name)
static VkResult createSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSemaphore *pSemaphore, const std::string &name)
static void uploadDataToExistingBuffer(VkDevice device, VkPhysicalDevice physicalDevice, VkCommandPool commandPool, VkQueue queue, VkDeviceSize size, const void *dataPtr, VkBuffer targetBuffer)
static bool isValid(void *object)
static void transitionImageLayout(VkCommandBuffer commandBuffer, VkDevice device, VkQueue graphicsQueue, VkCommandPool commandPool, VkImage image, VkFormat format, VkImageLayout oldLayout, VkImageLayout newLayout, uint32_t layerCount=1)
static void setObjectName(VkDevice device, VulkanObjectType objectHandle, const std::string &name)
static void loadVkFunction(VkInstance instance, const std::string &name, T &functionPointer)
static uint32_t findMemoryType(VkPhysicalDevice physicalDevice, uint32_t typeFilter, VkMemoryPropertyFlags properties)
static void cleanupBuffer(VkDevice device, VkBuffer buffer, VkDeviceMemory bufferMemory)
static bool hasStencilComponent(VkFormat format)
static VkResult allocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAllocateInfo, VkDescriptorSet *pDescriptorSets, const std::string &name)
static VkDescriptorBufferInfo fullBufferInfo(VkBuffer buffer)
static VkResult createDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorPool *pDescriptorPool, const std::string &name)
static std::string getName(const std::string &name, const std::string &suffix)
static void initializeFunctions(VkInstance instance, VkDevice device)
static const VulkanFunctions & getFunctions()
static void createBuffer(VkDevice device, VkPhysicalDevice physicalDevice, VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties, VkBuffer &buffer, VkDeviceMemory &bufferMemory)
static void beginLabel(VkCommandBuffer, const char *, const float *)
static std::mutex s_mutex
static VkResult createDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorSetLayout *pSetLayout, const std::string &name)
static void createImage(VkDevice device, VkPhysicalDevice physicalDevice, uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties, VkImage &image, VkDeviceMemory &imageMemory)
static void copyBufferMultiple(VkDevice device, VkCommandPool commandPool, VkQueue graphicsQueue, const std::vector< BufferCopyObject > &bufferCopyObjects)
static VkCommandBuffer beginSingleTimeCommands(VkDevice device, VkCommandPool commandPool)
PFN_vkCmdBeginDebugUtilsLabelEXT vkCmdBeginDebugUtilsLabelEXT