diff --git a/engine/src/device.cpp b/engine/src/device.cpp index 61f1257..e909b26 100644 --- a/engine/src/device.cpp +++ b/engine/src/device.cpp @@ -86,38 +86,6 @@ Device::~Device() { } } -Device::Builder& Device::Builder::withWindow(Window& window) { - this->window = &window; - this->headlessRequested = false; - this->modeSet = true; - return *this; -} - -Device::Builder& Device::Builder::headless() { - this->window = nullptr; - this->headlessRequested = true; - this->modeSet = true; - return *this; -} - -std::unique_ptr Device::Builder::build() const { - if (!this->modeSet) { - log::fatal( - "failed to build device: neither withWindow() nor headless() was " - "called"); - throw std::runtime_error( - "failed to build device: no window/headless mode specified"); - } - - if (this->headlessRequested) { - log::verbose("building headless Device"); - return std::unique_ptr(new Device(nullptr)); - } else { - log::verbose("building windowed Device"); - return std::unique_ptr(new Device(this->window)); - } -} - u32 Device::findMemoryType(u32 typeFilter, vk::MemoryPropertyFlags properties) { vk::PhysicalDeviceMemoryProperties memoryProperties = this->physicalDevice.getMemoryProperties(); diff --git a/engine/src/device.hpp b/engine/src/device.hpp index 5eeeede..3d5a5fb 100644 --- a/engine/src/device.hpp +++ b/engine/src/device.hpp @@ -32,13 +32,12 @@ 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 { @@ -87,8 +86,6 @@ class Device { vk::PhysicalDeviceProperties properties; private: - Device(Window* window); - void setupDebugMessenger(); bool checkValidationLayerSupport(); @@ -130,19 +127,4 @@ class Device { const std::vector enabledExtensions; }; -class Device::Builder { - public: - Builder() = default; - - Builder& withWindow(Window& window); - Builder& headless(); - - std::unique_ptr build() const; - - private: - Window* window = nullptr; - bool headlessRequested = false; - bool modeSet = false; -}; - } // namespace sophia