13 #include "VulkanTools.h"
14 #include "Allocation.h"
15 #include "vulkan/vulkan.h"
20 constexpr
int VULKAN_VENDOR_ID_AMD = 0x1002;
27 VkPhysicalDevice physicalDevice;
29 VkDevice logicalDevice;
31 VkPhysicalDeviceProperties properties;
33 VkPhysicalDeviceFeatures features;
35 VkPhysicalDeviceFeatures enabledFeatures;
37 VkPhysicalDeviceMemoryProperties memoryProperties;
39 std::vector<VkQueueFamilyProperties> queueFamilyProperties;
41 std::vector<std::string> supportedExtensions;
43 VkCommandPool graphicsCommandPool = VK_NULL_HANDLE;
44 VkCommandPool transferCommandPool = VK_NULL_HANDLE;
45 VkCommandPool computeCommandPool = VK_NULL_HANDLE;
49 uint32_t graphics{ VK_QUEUE_FAMILY_IGNORED };
50 uint32_t compute{ VK_QUEUE_FAMILY_IGNORED };
51 uint32_t transfer{ VK_QUEUE_FAMILY_IGNORED };
53 operator VkDevice()
const
57 explicit VulkanDevice(VkPhysicalDevice physicalDevice);
59 uint32_t getMemoryType(uint32_t typeBits, VkMemoryPropertyFlags properties, VkBool32 *memTypeFound =
nullptr)
const;
60 uint32_t getQueueFamilyIndex(VkQueueFlags queueFlags)
const;
61 VkResult createLogicalDevice(VkPhysicalDeviceFeatures enabledFeatures, std::vector<const char *> enabledExtensions,
void *pNextChain,
bool useSwapChain =
true, VkQueueFlags requestedQueueTypes = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT);
62 VkCommandPool createCommandPool(uint32_t queueFamilyIndex, VkCommandPoolCreateFlags createFlags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT);
63 VkCommandBuffer createCommandBuffer(VkCommandPool pool, VkCommandBufferLevel level,
bool begin =
false);
64 void flushCommandBuffer(VkCommandBuffer commandBuffer, VkQueue queue, VkCommandPool pool,
bool free =
true);
65 bool extensionSupported(std::string extension);