Add get_surface_extension to X11SystenDriver
This commit is contained in:
@@ -12,5 +12,7 @@ namespace Nova {
|
|||||||
class NOVA_API SystemDriver {
|
class NOVA_API SystemDriver {
|
||||||
public:
|
public:
|
||||||
virtual ~SystemDriver() = default;
|
virtual ~SystemDriver() = default;
|
||||||
|
|
||||||
|
[[nodiscard]] virtual const char* get_surface_extension() const = 0;
|
||||||
};
|
};
|
||||||
} // namespace Nova
|
} // namespace Nova
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "drivers/linux/system_driver.h"
|
||||||
|
|
||||||
#ifdef NOVA_WAYLAND
|
#ifdef NOVA_WAYLAND
|
||||||
#include "drivers/linux/wayland/system_driver.h"
|
#include "drivers/linux/wayland/system_driver.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -13,8 +15,6 @@
|
|||||||
|
|
||||||
#include <nova/core/debug.h>
|
#include <nova/core/debug.h>
|
||||||
|
|
||||||
#include "drivers/linux/system_driver.h"
|
|
||||||
|
|
||||||
using namespace Nova;
|
using namespace Nova;
|
||||||
|
|
||||||
LinuxSystemDriver::LinuxSystemDriver() {
|
LinuxSystemDriver::LinuxSystemDriver() {
|
||||||
@@ -25,6 +25,11 @@ LinuxSystemDriver::~LinuxSystemDriver() {
|
|||||||
NOVA_AUTO_TRACE();
|
NOVA_AUTO_TRACE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* LinuxSystemDriver::get_surface_extension() const {
|
||||||
|
NOVA_WARN("System driver does not support surfaces");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<SystemDriver> LinuxSystemDriver::get_default_driver() {
|
std::unique_ptr<SystemDriver> LinuxSystemDriver::get_default_driver() {
|
||||||
NOVA_AUTO_TRACE();
|
NOVA_AUTO_TRACE();
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ namespace Nova {
|
|||||||
LinuxSystemDriver();
|
LinuxSystemDriver();
|
||||||
~LinuxSystemDriver() override;
|
~LinuxSystemDriver() override;
|
||||||
|
|
||||||
|
[[nodiscard]] const char* get_surface_extension() const override;
|
||||||
|
|
||||||
static std::unique_ptr<SystemDriver> get_default_driver();
|
static std::unique_ptr<SystemDriver> get_default_driver();
|
||||||
};
|
};
|
||||||
} // namespace Nova
|
} // namespace Nova
|
||||||
|
|||||||
@@ -6,6 +6,11 @@
|
|||||||
|
|
||||||
#include "drivers/linux/x11/system_driver.h"
|
#include "drivers/linux/x11/system_driver.h"
|
||||||
|
|
||||||
|
#ifdef NOVA_VULKAN
|
||||||
|
#include <vulkan/vulkan.h>
|
||||||
|
#include <vulkan/vulkan_xlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <nova/core/debug.h>
|
#include <nova/core/debug.h>
|
||||||
|
|
||||||
using namespace Nova;
|
using namespace Nova;
|
||||||
@@ -17,3 +22,11 @@ X11SystemDriver::X11SystemDriver() {
|
|||||||
X11SystemDriver::~X11SystemDriver() {
|
X11SystemDriver::~X11SystemDriver() {
|
||||||
NOVA_AUTO_TRACE();
|
NOVA_AUTO_TRACE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* X11SystemDriver::get_surface_extension() const {
|
||||||
|
#ifdef NOVA_VULKAN
|
||||||
|
return VK_KHR_XLIB_SURFACE_EXTENSION_NAME;
|
||||||
|
#else
|
||||||
|
return nullptr;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,10 +8,14 @@
|
|||||||
|
|
||||||
#include "drivers/linux/system_driver.h"
|
#include "drivers/linux/system_driver.h"
|
||||||
|
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
namespace Nova {
|
namespace Nova {
|
||||||
class X11SystemDriver final : public LinuxSystemDriver {
|
class X11SystemDriver final : public LinuxSystemDriver {
|
||||||
public:
|
public:
|
||||||
X11SystemDriver();
|
X11SystemDriver();
|
||||||
~X11SystemDriver() override;
|
~X11SystemDriver() override;
|
||||||
|
|
||||||
|
[[nodiscard]] const char* get_surface_extension() const override;
|
||||||
};
|
};
|
||||||
} // namespace Nova
|
} // namespace Nova
|
||||||
|
|||||||
@@ -6,9 +6,8 @@
|
|||||||
|
|
||||||
#include "drivers/vulkan/render_driver.h"
|
#include "drivers/vulkan/render_driver.h"
|
||||||
|
|
||||||
#include <SDL3/SDL.h>
|
|
||||||
#include <SDL3/SDL_vulkan.h>
|
|
||||||
#include <nova/core/debug.h>
|
#include <nova/core/debug.h>
|
||||||
|
#include <nova/platform/system.h>
|
||||||
#include <nova/version.h>
|
#include <nova/version.h>
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
|
|
||||||
@@ -117,12 +116,8 @@ void VulkanRenderDriver::_check_extensions() {
|
|||||||
u32 count;
|
u32 count;
|
||||||
std::unordered_map<std::string_view, bool> requested; // <extension, required>
|
std::unordered_map<std::string_view, bool> requested; // <extension, required>
|
||||||
|
|
||||||
// Find required extensions
|
requested[VK_KHR_SURFACE_EXTENSION_NAME] = true;
|
||||||
SDL_Init(SDL_INIT_VIDEO); // TODO: Move to SDL driver
|
requested[System::get_driver()->get_surface_extension()] = true;
|
||||||
const auto required = SDL_Vulkan_GetInstanceExtensions(&count);
|
|
||||||
for (u32 i = 0; i < count; ++i) {
|
|
||||||
requested[required[i]] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add optional extensions
|
// Add optional extensions
|
||||||
requested[VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME] = false;
|
requested[VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME] = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user