diff options
author | Juan Linietsky <reduzio@gmail.com> | 2019-06-24 16:13:06 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2020-02-11 11:53:27 +0100 |
commit | 1b4281b895f3046ea972256182b18696a25f8316 (patch) | |
tree | 5f6b9c1600a4354f17b29e430a447d08f93ecf25 /platform | |
parent | 42b44f43ee52eb664d3610d0fdae0eff14c00f0a (diff) |
basic 2D engine is more or less working with Vulkan, including editor.
Still a lot to do
Diffstat (limited to 'platform')
-rw-r--r-- | platform/x11/os_x11.cpp | 13 | ||||
-rw-r--r-- | platform/x11/vulkan_context_x11.cpp | 15 | ||||
-rw-r--r-- | platform/x11/vulkan_context_x11.h | 7 |
3 files changed, 22 insertions, 13 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 14bb8dbcb8..cfd3cea4ec 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -401,8 +401,10 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a XFree(visualInfo); - context_vulkan = memnew(VulkanContextX11(x11_window, x11_display)); - context_vulkan->initialize(OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height, false); + context_vulkan = memnew(VulkanContextX11); + context_vulkan->initialize(); + context_vulkan->window_create(x11_window, x11_display, get_video_mode().width, get_video_mode().height); + //temporary rendering_device = memnew(RenderingDeviceVulkan); rendering_device->initialize(context_vulkan); @@ -1161,6 +1163,12 @@ void OS_X11::finalize() { cursors_cache.clear(); visual_server->finish(); memdelete(visual_server); + + rendering_device->finalize(); + memdelete(rendering_device); + + memdelete(context_vulkan); + //memdelete(rasterizer); memdelete(power_manager); @@ -2415,6 +2423,7 @@ void OS_X11::_window_changed(XEvent *event) { current_videomode.width = event->xconfigure.width; current_videomode.height = event->xconfigure.height; + context_vulkan->window_resize(0, current_videomode.width, current_videomode.height); } void OS_X11::process_xevents() { diff --git a/platform/x11/vulkan_context_x11.cpp b/platform/x11/vulkan_context_x11.cpp index eab7c3935b..412cc2ddf8 100644 --- a/platform/x11/vulkan_context_x11.cpp +++ b/platform/x11/vulkan_context_x11.cpp @@ -4,19 +4,20 @@ const char *VulkanContextX11::_get_platform_surface_extension() const { return VK_KHR_XLIB_SURFACE_EXTENSION_NAME; } -VkResult VulkanContextX11::_create_surface(VkSurfaceKHR *surface, VkInstance p_instance) { +int VulkanContextX11::window_create(::Window p_window, Display *p_display, int p_width, int p_height) { VkXlibSurfaceCreateInfoKHR createInfo; createInfo.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR; createInfo.pNext = NULL; createInfo.flags = 0; - createInfo.dpy = display; - createInfo.window = window; + createInfo.dpy = p_display; + createInfo.window = p_window; - return vkCreateXlibSurfaceKHR(p_instance, &createInfo, NULL, surface); + VkSurfaceKHR surface; + VkResult err = vkCreateXlibSurfaceKHR(_get_instance(), &createInfo, NULL, &surface); + ERR_FAIL_COND_V(err, -1); + return _window_create(surface, p_width, p_height); } -VulkanContextX11::VulkanContextX11(Window p_window, Display *p_display) { - window = p_window; - display = p_display; +VulkanContextX11::VulkanContextX11() { } diff --git a/platform/x11/vulkan_context_x11.h b/platform/x11/vulkan_context_x11.h index b91f63bd27..6631d39e98 100644 --- a/platform/x11/vulkan_context_x11.h +++ b/platform/x11/vulkan_context_x11.h @@ -5,14 +5,13 @@ #include <X11/Xlib.h> class VulkanContextX11 : public VulkanContext { - Window window; - Display *display; virtual const char *_get_platform_surface_extension() const; - virtual VkResult _create_surface(VkSurfaceKHR *surface, VkInstance p_instance); public: - VulkanContextX11(Window p_window, Display *display); + int window_create(::Window p_window, Display *p_display, int p_width, int p_height); + + VulkanContextX11(); }; #endif // VULKAN_DEVICE_X11_H |