mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-04-18 13:36:49 +02:00
fix
This commit is contained in:
@@ -47,7 +47,6 @@ namespace mlx
|
||||
|
||||
std::unordered_map<std::string, std::pair<std::size_t, ProfileResult>> m_profile_data;
|
||||
std::ofstream m_output_stream;
|
||||
std::mutex m_mutex;
|
||||
bool m_runtime_session_began = false;
|
||||
};
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ namespace mlx
|
||||
void SetInputBinding(std::function<void(SDL_Event*)> functor);
|
||||
|
||||
VkSurfaceKHR CreateVulkanSurface(Handle window, VkInstance instance) const noexcept;
|
||||
std::vector<const char*> GetRequiredVulkanInstanceExtentions(Handle window) const noexcept;
|
||||
Vec2ui GetVulkanDrawableSize(Handle window) const noexcept;
|
||||
void MoveMouseOnWindow(Handle window, int x, int y) const noexcept;
|
||||
void GetScreenSizeWindowIsOn(Handle window, int* x, int* y) const noexcept;
|
||||
|
||||
@@ -35,7 +35,6 @@ namespace mlx
|
||||
MLX_FORCEINLINE void GetSize(int* x, int* y) { *x = GetWidth(); *y = GetHeight(); }
|
||||
|
||||
MLX_FORCEINLINE VkSurfaceKHR CreateVulkanSurface(VkInstance instance) const noexcept { return SDLManager::Get().CreateVulkanSurface(p_window, instance); }
|
||||
MLX_FORCEINLINE std::vector<const char*> GetRequiredVulkanInstanceExtentions() const noexcept { return SDLManager::Get().GetRequiredVulkanInstanceExtentions(p_window); }
|
||||
MLX_FORCEINLINE Vec2ui GetVulkanDrawableSize() const noexcept { return SDLManager::Get().GetVulkanDrawableSize(p_window); }
|
||||
|
||||
[[nodiscard]] inline Handle GetRawHandle() const noexcept { return p_window; }
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
#error Failed to find SDL2 headers
|
||||
#endif
|
||||
|
||||
#if __has_include(<SDL2/SDL_vulkan.h>)
|
||||
#include <SDL2/SDL_vulkan.h>
|
||||
#elif __has_include(<SDL_vulkan.h>)
|
||||
#include <SDL_vulkan.h>
|
||||
#if __has_include(<SDL2/SDL_syswm.h>)
|
||||
#include <SDL2/SDL_syswm.h>
|
||||
#elif __has_include(<SDL_syswm.h>)
|
||||
#include <SDL_syswm.h>
|
||||
#else
|
||||
#error Failed to find SDL2 Vulkan headers
|
||||
#error Failed to find SDL2 SysWMinfo
|
||||
#endif
|
||||
|
||||
#include <functional>
|
||||
|
||||
56
runtime/Includes/Renderer/Surface.h
git.filemode.normal_file
56
runtime/Includes/Renderer/Surface.h
git.filemode.normal_file
@@ -0,0 +1,56 @@
|
||||
#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
|
||||
@@ -123,5 +123,41 @@
|
||||
MLX_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfaceFormatsKHR)
|
||||
MLX_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfacePresentModesKHR)
|
||||
MLX_VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfaceSupportKHR)
|
||||
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
#ifdef VK_KHR_android_surface
|
||||
MLX_VULKAN_INSTANCE_FUNCTION(vkCreateAndroidSurfaceKHR)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
#ifdef VK_KHR_xcb_surface
|
||||
MLX_VULKAN_INSTANCE_FUNCTION(vkCreateXcbSurfaceKHR)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XLIB_KHR
|
||||
#ifdef VK_KHR_xlib_surface
|
||||
MLX_VULKAN_INSTANCE_FUNCTION(vkCreateXlibSurfaceKHR)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
#ifdef VK_KHR_wayland_surface
|
||||
MLX_VULKAN_INSTANCE_FUNCTION(vkCreateWaylandSurfaceKHR)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
#ifdef VK_KHR_win32_surface
|
||||
MLX_VULKAN_INSTANCE_FUNCTION(vkCreateWin32SurfaceKHR)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VK_USE_PLATFORM_METAL_EXT
|
||||
#ifdef VK_EXT_metal_surface
|
||||
MLX_VULKAN_INSTANCE_FUNCTION(vkCreateMetalSurfaceEXT)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user