Made Vulkan Surface
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
#include "GLFWManager.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace PB::Renderer
|
||||
{
|
||||
std::vector<GLFWwindow*> GLFWManager::s_Windows;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "GLFW/glfw3.h"
|
||||
|
||||
#include <vector>
|
||||
#include "../VulkanRenderer.h"
|
||||
|
||||
namespace PB::Renderer
|
||||
{
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
#include "VulkanManager.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "GLFW/glfw3.h"
|
||||
|
||||
namespace PB::Renderer
|
||||
{
|
||||
std::optional<VkInstance> VulkanManager::s_Instance = std::nullopt;
|
||||
std::optional<VkSurfaceKHR> VulkanManager::s_Surface = std::nullopt;
|
||||
|
||||
std::optional<VkInstance> VulkanManager::Init()
|
||||
{
|
||||
@@ -48,8 +45,23 @@ namespace PB::Renderer
|
||||
return instance;
|
||||
}
|
||||
|
||||
std::optional<VkSurfaceKHR> VulkanManager::CreateSurface(GLFWwindow* window)
|
||||
{
|
||||
VkSurfaceKHR surface;
|
||||
if (glfwCreateWindowSurface(s_Instance.value(), window, nullptr, &surface) != VK_SUCCESS)
|
||||
{
|
||||
std::cout << "PB::Renderer::VulkanManager::CreateSurface(): Failed to create Vulkan Surface" << std::endl;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
bool VulkanManager::Cleanup()
|
||||
{
|
||||
if (s_Surface != std::nullopt)
|
||||
vkDestroySurfaceKHR(s_Instance.value(), s_Surface.value(), nullptr);
|
||||
|
||||
if (s_Instance != std::nullopt)
|
||||
vkDestroyInstance(s_Instance.value(), nullptr);
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <vulkan/vulkan.h>
|
||||
#include "../VulkanRenderer.h"
|
||||
|
||||
namespace PB::Renderer
|
||||
{
|
||||
@@ -9,9 +8,12 @@ namespace PB::Renderer
|
||||
{
|
||||
private:
|
||||
static std::optional<VkInstance> s_Instance;
|
||||
static std::optional<VkSurfaceKHR> s_Surface;
|
||||
|
||||
public:
|
||||
static std::optional<VkInstance> Init();
|
||||
static bool Cleanup();
|
||||
|
||||
static std::optional<VkSurfaceKHR> CreateSurface(GLFWwindow* window);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user