fix(surface): not checking if surface component has initialized x11 native data

This commit is contained in:
light7734 2025-09-27 23:32:21 +03:30
parent 84d0026051
commit a77abe312b
Signed by: light7734
GPG key ID: 8C30176798F1A6BA

View file

@ -1,3 +1,4 @@
#include <lt_debug/assertions.hpp>
#include <renderer/vk/context/surface.hpp>
#include <surface/components.hpp>
@ -7,6 +8,9 @@ Surface::Surface(const ecs::Entity &surface_entity)
{
const auto &component = surface_entity.get<surface::SurfaceComponent>();
esnure(component.get_native_data().display, "Failed to initialize usrface: null x-display");
esnure(component.get_native_data().window, "Failed to initialize usrface: null x-window");
auto create_info = VkXlibSurfaceCreateInfoKHR {
.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR,
.dpy = component.get_native_data().display,
@ -14,7 +18,7 @@ Surface::Surface(const ecs::Entity &surface_entity)
};
auto *instance = Instance::get();
vkc(vk_create_xlib_surface_khr(instance, &create_info, nullptr, &m_surface));
auto result = vk_create_xlib_surface_khr(instance, &create_info, nullptr, &m_surface);
const auto &[width, height] = component.get_resolution();
m_framebuffer_size = {