2022-12-03 05:40:04 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "vulkaninstance.h"
|
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
#include <mutex>
|
|
|
|
#include <vector>
|
|
|
|
#include <algorithm>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
class VulkanSwapChain;
|
|
|
|
class VulkanSemaphore;
|
|
|
|
class VulkanFence;
|
|
|
|
class VulkanPhysicalDevice;
|
|
|
|
class VulkanSurface;
|
|
|
|
class VulkanCompatibleDevice;
|
|
|
|
|
|
|
|
class VulkanDevice
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
VulkanDevice(std::shared_ptr<VulkanInstance> instance, std::shared_ptr<VulkanSurface> surface, const VulkanCompatibleDevice& selectedDevice);
|
|
|
|
~VulkanDevice();
|
|
|
|
|
|
|
|
std::set<std::string> EnabledDeviceExtensions;
|
|
|
|
VulkanDeviceFeatures EnabledFeatures;
|
|
|
|
|
|
|
|
VulkanPhysicalDevice PhysicalDevice;
|
|
|
|
|
|
|
|
std::shared_ptr<VulkanInstance> Instance;
|
|
|
|
std::shared_ptr<VulkanSurface> Surface;
|
|
|
|
|
|
|
|
VkDevice device = VK_NULL_HANDLE;
|
|
|
|
VmaAllocator allocator = VK_NULL_HANDLE;
|
|
|
|
|
|
|
|
VkQueue GraphicsQueue = VK_NULL_HANDLE;
|
|
|
|
VkQueue PresentQueue = VK_NULL_HANDLE;
|
|
|
|
|
|
|
|
int GraphicsFamily = -1;
|
|
|
|
int PresentFamily = -1;
|
|
|
|
bool GraphicsTimeQueries = false;
|
|
|
|
|
2023-09-16 01:13:43 +00:00
|
|
|
bool SupportsExtension(const char* ext) const;
|
2022-12-03 05:40:04 +00:00
|
|
|
|
|
|
|
void SetObjectName(const char* name, uint64_t handle, VkObjectType type);
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool DebugLayerActive = false;
|
|
|
|
|
|
|
|
void CreateDevice();
|
|
|
|
void CreateAllocator();
|
|
|
|
void ReleaseResources();
|
|
|
|
};
|