mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-04-18 13:36:49 +02:00
swithing to manual surface management
This commit is contained in:
@@ -1,56 +0,0 @@
|
|||||||
#ifndef __MLX_SURFACE__
|
|
||||||
#define __MLX_SURFACE__
|
|
||||||
|
|
||||||
#include <Utils/NonOwningPtr.h>
|
|
||||||
#include <Renderer/Image.h>
|
|
||||||
|
|
||||||
namespace mlx
|
|
||||||
{
|
|
||||||
class Surface
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Surface() = default;
|
|
||||||
|
|
||||||
void Init(NonOwningPtr<class Window> window);
|
|
||||||
void Destroy();
|
|
||||||
|
|
||||||
[[nodiscard]] inline VkSurfaceKHR Get() const noexcept { return m_surface; }
|
|
||||||
|
|
||||||
~Surface() = default;
|
|
||||||
|
|
||||||
private:
|
|
||||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
|
||||||
// VK_KHR_android_surface
|
|
||||||
void Create(ANativeWindow* window, VkAndroidSurfaceCreateFlagsKHR flags = 0, const VkAllocationCallbacks* allocator = nullptr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
|
||||||
// VK_KHR_xcb_surface
|
|
||||||
void Create(xcb_connection_t* connection, xcb_window_t window, VkXcbSurfaceCreateFlagsKHR flags = 0, const VkAllocationCallbacks* allocator = nullptr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef VK_USE_PLATFORM_XLIB_KHR
|
|
||||||
// VK_KHR_xlib_surface
|
|
||||||
void Create(Display* display, ::Window window, VkXlibSurfaceCreateFlagsKHR flags = 0, const VkAllocationCallbacks* allocator = nullptr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
|
||||||
// VK_KHR_wayland_surface
|
|
||||||
void Create(wl_display* display, wl_surface* surface, VkWaylandSurfaceCreateFlagsKHR flags = 0, const VkAllocationCallbacks* allocator = nullptr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
|
||||||
// VK_KHR_win32_surface
|
|
||||||
void Create(HINSTANCE instance, HWND handle, VkWin32SurfaceCreateFlagsKHR flags = 0, const VkAllocationCallbacks* allocator = nullptr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef VK_USE_PLATFORM_METAL_EXT
|
|
||||||
void Create(id layer, const VkAllocationCallbacks* allocator = nullptr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
|
||||||
VkSurfaceKHR m_surface = VK_NULL_HANDLE;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -207,31 +207,31 @@ namespace mlx
|
|||||||
MLX_LOAD_FUNCTION(vkCreateAndroidSurfaceKHR);
|
MLX_LOAD_FUNCTION(vkCreateAndroidSurfaceKHR);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||||
#ifdef VK_KHR_xcb_surface
|
#ifdef VK_KHR_xcb_surface
|
||||||
MLX_LOAD_FUNCTION(vkCreateXcbSurfaceKHR);
|
MLX_LOAD_FUNCTION(vkCreateXcbSurfaceKHR);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef VK_USE_PLATFORM_XLIB_KHR
|
#ifdef VK_USE_PLATFORM_XLIB_KHR
|
||||||
#ifdef VK_KHR_xlib_surface
|
#ifdef VK_KHR_xlib_surface
|
||||||
MLX_LOAD_FUNCTION(vkCreateXlibSurfaceKHR);
|
MLX_LOAD_FUNCTION(vkCreateXlibSurfaceKHR);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||||
#ifdef VK_KHR_wayland_surface
|
#ifdef VK_KHR_wayland_surface
|
||||||
MLX_LOAD_FUNCTION(vkCreateWaylandSurfaceKHR);
|
MLX_LOAD_FUNCTION(vkCreateWaylandSurfaceKHR);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||||
#ifdef VK_KHR_win32_surface
|
#ifdef VK_KHR_win32_surface
|
||||||
MLX_LOAD_FUNCTION(vkCreateWin32SurfaceKHR);
|
MLX_LOAD_FUNCTION(vkCreateWin32SurfaceKHR);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef VK_USE_PLATFORM_METAL_EXT
|
#ifdef VK_USE_PLATFORM_METAL_EXT
|
||||||
#ifdef VK_EXT_metal_surface
|
#ifdef VK_EXT_metal_surface
|
||||||
MLX_LOAD_FUNCTION(vkCreateMetalSurfaceEXT);
|
MLX_LOAD_FUNCTION(vkCreateMetalSurfaceEXT);
|
||||||
|
|||||||
Reference in New Issue
Block a user