Added swapchain
This commit is contained in:
@@ -15,6 +15,13 @@ namespace PB::Renderer
|
||||
}
|
||||
};
|
||||
|
||||
struct SwapChainSupportDetails
|
||||
{
|
||||
VkSurfaceCapabilitiesKHR capabilities;
|
||||
std::vector<VkSurfaceFormatKHR> formats;
|
||||
std::vector<VkPresentModeKHR> presentModes;
|
||||
};
|
||||
|
||||
class VulkanManager
|
||||
{
|
||||
public:
|
||||
@@ -25,12 +32,18 @@ namespace PB::Renderer
|
||||
static std::optional<VkSurfaceKHR> CreateSurface(GLFWwindow* window);
|
||||
static bool PickPhysicalDevice();
|
||||
static bool CreateLogicalDevice();
|
||||
static bool CreateSwapChain(GLFWwindow* window);
|
||||
|
||||
private:
|
||||
static bool IsDeviceSuitable(VkPhysicalDevice device, VkSurfaceKHR surface);
|
||||
static QueueFamilyIndices FindQueueFamilies(VkPhysicalDevice device, VkSurfaceKHR surface);
|
||||
static bool CheckDeviceExtensionSupport(VkPhysicalDevice device);
|
||||
|
||||
static SwapChainSupportDetails QuerySwapChainSupport();
|
||||
static VkSurfaceFormatKHR ChooseSurfaceFormat(const std::vector<VkSurfaceFormatKHR>& availableFormats);
|
||||
static VkPresentModeKHR ChoosePresentMode(const std::vector<VkPresentModeKHR>& availablePresentModes);
|
||||
static VkExtent2D ChooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities, GLFWwindow* window);
|
||||
|
||||
static std::optional<VkInstance> s_Instance;
|
||||
static std::optional<VkSurfaceKHR> s_Surface;
|
||||
|
||||
@@ -41,5 +54,11 @@ namespace PB::Renderer
|
||||
|
||||
static VkQueue s_GraphicsQueue;
|
||||
static VkQueue s_PresentQueue;
|
||||
|
||||
static VkSwapchainKHR s_SwapChain;
|
||||
static std::vector<VkImage> s_SwapChainImages;
|
||||
static std::vector<VkImageView> s_SwapChainImageViews;
|
||||
static VkFormat s_SwapChainImageFormat;
|
||||
static VkExtent2D s_SwapChainExtent;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user