Added vk surface destructor and reduced includes in yave surfaces
This commit is contained in:
parent
5d672a8b0b
commit
a3dd1a461f
2 changed files with 8 additions and 9 deletions
|
|
@ -1,7 +1,5 @@
|
|||
#include "yave_vulkan_surface.hpp"
|
||||
#include "yave_vulkan_instance.hpp"
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
|
||||
#define GLFW_INCLUDE_VULKAN
|
||||
#include <GLFW/glfw3.h>
|
||||
|
|
@ -10,12 +8,15 @@ namespace yave {
|
|||
|
||||
YaveVulkanSurface::YaveVulkanSurface(YaveVulkanInstance &yaveVulkanInstance,
|
||||
YaveWindow &window) {
|
||||
if (glfwCreateWindowSurface(*yaveVulkanInstance.getVkInstance(), window.getGLFWWindow(), nullptr,
|
||||
this->instance = yaveVulkanInstance.getVkInstance();
|
||||
if (glfwCreateWindowSurface(*instance, window.getGLFWWindow(), nullptr,
|
||||
&surface)) {
|
||||
throw std::runtime_error("failed to create window surface!");
|
||||
}
|
||||
}
|
||||
|
||||
YaveVulkanSurface::~YaveVulkanSurface() {}
|
||||
YaveVulkanSurface::~YaveVulkanSurface() {
|
||||
vkDestroySurfaceKHR(*instance, surface, nullptr);
|
||||
}
|
||||
|
||||
} // namespace yave
|
||||
|
|
|
|||
|
|
@ -4,19 +4,17 @@
|
|||
#include "yave_window.hpp"
|
||||
#include <vulkan/vulkan_core.h>
|
||||
|
||||
// This engine is for now Wayland only!!!
|
||||
#define VK_USE_PLATFORM_WAYLAND_KHR
|
||||
#include <vulkan/vulkan_wayland.h>
|
||||
#define GLFW_INCLUDE_VULKAN
|
||||
#include <GLFW/glfw3.h>
|
||||
#define GLFW_EXPOSE_NATIVE_WAYLAND
|
||||
#include <GLFW/glfw3native.h>
|
||||
|
||||
namespace yave {
|
||||
|
||||
class YaveVulkanSurface {
|
||||
|
||||
private:
|
||||
// Keep reference to instance this surface is attached to
|
||||
VkInstance *instance;
|
||||
|
||||
VkSurfaceKHR surface;
|
||||
|
||||
public:
|
||||
|
|
|
|||
Loading…
Reference in a new issue