RicardasSim

vulkan VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT flag

Dec 21st, 2018
567
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.61 KB | None | 0 0
  1.     VkMemoryAllocateInfo bufferAllocateInfo = {0};
  2.  
  3.     bufferAllocateInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
  4.     bufferAllocateInfo.pNext = NULL;
  5.     ...
  6.     ...
  7.  
  8.     VkPhysicalDeviceMemoryProperties memoryProperties;
  9.  
  10.     vkGetPhysicalDeviceMemoryProperties(physicalDevice, &memoryProperties);
  11.  
  12.     for(uint32_t i = 0; i < memoryProperties.memoryTypeCount; ++i)
  13.     {
  14.         VkMemoryType memoryType = memoryProperties.memoryTypes[i];
  15.  
  16.         if(memoryType.propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)
  17.         {
  18.             bufferAllocateInfo.memoryTypeIndex = i;
  19.         }
  20.  
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment