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_surface.hpp"
|
||||||
#include "yave_vulkan_instance.hpp"
|
#include "yave_vulkan_instance.hpp"
|
||||||
#include <iostream>
|
|
||||||
#include <ostream>
|
|
||||||
|
|
||||||
#define GLFW_INCLUDE_VULKAN
|
#define GLFW_INCLUDE_VULKAN
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
@ -10,12 +8,15 @@ namespace yave {
|
||||||
|
|
||||||
YaveVulkanSurface::YaveVulkanSurface(YaveVulkanInstance &yaveVulkanInstance,
|
YaveVulkanSurface::YaveVulkanSurface(YaveVulkanInstance &yaveVulkanInstance,
|
||||||
YaveWindow &window) {
|
YaveWindow &window) {
|
||||||
if (glfwCreateWindowSurface(*yaveVulkanInstance.getVkInstance(), window.getGLFWWindow(), nullptr,
|
this->instance = yaveVulkanInstance.getVkInstance();
|
||||||
|
if (glfwCreateWindowSurface(*instance, window.getGLFWWindow(), nullptr,
|
||||||
&surface)) {
|
&surface)) {
|
||||||
throw std::runtime_error("failed to create window surface!");
|
throw std::runtime_error("failed to create window surface!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
YaveVulkanSurface::~YaveVulkanSurface() {}
|
YaveVulkanSurface::~YaveVulkanSurface() {
|
||||||
|
vkDestroySurfaceKHR(*instance, surface, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace yave
|
} // namespace yave
|
||||||
|
|
|
||||||
|
|
@ -4,19 +4,17 @@
|
||||||
#include "yave_window.hpp"
|
#include "yave_window.hpp"
|
||||||
#include <vulkan/vulkan_core.h>
|
#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
|
#define GLFW_INCLUDE_VULKAN
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
#define GLFW_EXPOSE_NATIVE_WAYLAND
|
|
||||||
#include <GLFW/glfw3native.h>
|
|
||||||
|
|
||||||
namespace yave {
|
namespace yave {
|
||||||
|
|
||||||
class YaveVulkanSurface {
|
class YaveVulkanSurface {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Keep reference to instance this surface is attached to
|
||||||
|
VkInstance *instance;
|
||||||
|
|
||||||
VkSurfaceKHR surface;
|
VkSurfaceKHR surface;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue