Add get_surface_extension to WaylandSystemDriver

This commit is contained in:
2025-03-31 22:35:44 +10:00
parent 6a77722ff5
commit 595f8a26de
3 changed files with 21 additions and 1 deletions

View File

@@ -8,6 +8,11 @@
#include "drivers/linux/wayland/system_driver.h"
#ifdef NOVA_VULKAN
#include <vulkan/vulkan.h>
#include <vulkan/vulkan_wayland.h>
#endif
#include <nova/core/debug.h>
using namespace Nova;
@@ -20,4 +25,12 @@ WaylandSystemDriver::~WaylandSystemDriver() {
NOVA_AUTO_TRACE();
}
const char* WaylandSystemDriver::get_surface_extension() const {
#ifdef NOVA_VULKAN
return VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME;
#else
return nullptr;
#endif
}
#endif // NOVA_WAYLAND

View File

@@ -15,6 +15,8 @@ namespace Nova {
public:
WaylandSystemDriver();
~WaylandSystemDriver() override;
[[nodiscard]] const char* get_surface_extension() const override;
};
} // namespace Nova

View File

@@ -118,8 +118,13 @@ void VulkanRenderDriver::_check_extensions() {
u32 count;
std::unordered_map<std::string_view, bool> requested; // <extension, required>
const auto surface_extension = System::get_driver()->get_surface_extension();
if (!surface_extension) {
throw std::runtime_error("Could not determine required surface extension");
}
requested[VK_KHR_SURFACE_EXTENSION_NAME] = true;
requested[System::get_driver()->get_surface_extension()] = true;
requested[surface_extension] = true;
// Add optional extensions
requested[VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME] = false;