Big changes
This commit is contained in:
+22
-4
@@ -3,6 +3,7 @@
|
||||
#include <imgui_impl_vulkan.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <sophia/types.hpp>
|
||||
#include <vector>
|
||||
@@ -31,12 +32,13 @@ struct SwapchainSupportDetails {
|
||||
|
||||
class Device {
|
||||
public:
|
||||
class Builder;
|
||||
|
||||
Device(const Device&) = delete;
|
||||
Device& operator=(const Device&) = delete;
|
||||
Device(Device&&) = delete;
|
||||
Device& operator=(Device&&) = delete;
|
||||
|
||||
Device(Window& window);
|
||||
~Device();
|
||||
|
||||
const vk::Device* get() const {
|
||||
@@ -85,6 +87,8 @@ class Device {
|
||||
vk::PhysicalDeviceProperties properties;
|
||||
|
||||
private:
|
||||
Device(Window* window);
|
||||
|
||||
void setupDebugMessenger();
|
||||
|
||||
bool checkValidationLayerSupport();
|
||||
@@ -104,7 +108,7 @@ class Device {
|
||||
vk::UniqueInstance instance;
|
||||
VkDebugUtilsMessengerEXT debugMessenger;
|
||||
|
||||
Window& window;
|
||||
const bool headless;
|
||||
vk::SurfaceKHR surface;
|
||||
|
||||
vk::PhysicalDevice physicalDevice = VK_NULL_HANDLE;
|
||||
@@ -123,8 +127,22 @@ class Device {
|
||||
const std::vector<const char*> enabledLayers = {
|
||||
"VK_LAYER_KHRONOS_validation"};
|
||||
#endif
|
||||
const std::vector<const char*> enabledExtensions = {
|
||||
VK_KHR_SWAPCHAIN_EXTENSION_NAME};
|
||||
const std::vector<const char*> enabledExtensions;
|
||||
};
|
||||
|
||||
class Device::Builder {
|
||||
public:
|
||||
Builder() = default;
|
||||
|
||||
Builder& withWindow(Window& window);
|
||||
Builder& headless();
|
||||
|
||||
std::unique_ptr<Device> build() const;
|
||||
|
||||
private:
|
||||
Window* window = nullptr;
|
||||
bool headlessRequested = false;
|
||||
bool modeSet = false;
|
||||
};
|
||||
|
||||
} // namespace sophia
|
||||
|
||||
Reference in New Issue
Block a user