mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 22:53:34 +00:00
fixing windows compilation issues, bumping version
This commit is contained in:
@@ -206,7 +206,7 @@
|
|||||||
|
|
||||||
typedef void (*mlx_function)(void);
|
typedef void (*mlx_function)(void);
|
||||||
|
|
||||||
#define MLX_VERSION MLX_MAKE_VERSION(2, 2, 3)
|
#define MLX_VERSION MLX_MAKE_VERSION(2, 2, 4)
|
||||||
#define MLX_TARGET_VULKAN_API_VERSION MLX_MAKE_VERSION(1, 0, 0)
|
#define MLX_TARGET_VULKAN_API_VERSION MLX_MAKE_VERSION(1, 0, 0)
|
||||||
|
|
||||||
// Checking common assumptions
|
// Checking common assumptions
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
project('MacroLibX',
|
project('MacroLibX',
|
||||||
['c', 'cpp'],
|
['c', 'cpp'],
|
||||||
version : '2.2.3',
|
version : '2.2.4',
|
||||||
license : 'MIT',
|
license : 'MIT',
|
||||||
meson_version : '>= 1.9.0',
|
meson_version : '>= 1.9.0',
|
||||||
default_options : ['warning_level=2', 'optimization=3', 'cpp_std=c++20'])
|
default_options : ['warning_level=2', 'optimization=3', 'cpp_std=c++20'])
|
||||||
|
|||||||
@@ -17,8 +17,21 @@
|
|||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
|
|
||||||
#include <SDL2/SDL.h>
|
#if __has_include(<SDL2/SDL.h>)
|
||||||
#include <SDL2/SDL_vulkan.h>
|
#include <SDL2/SDL.h>
|
||||||
|
#elif __has_include(<SDL.h>)
|
||||||
|
#include <SDL.h>
|
||||||
|
#else
|
||||||
|
#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>
|
||||||
|
#else
|
||||||
|
#error Failed to find SDL2 Vulkan headers
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|||||||
@@ -479,7 +479,7 @@ extern "C"
|
|||||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||||
if(!gs)
|
if(!gs)
|
||||||
return nullptr;
|
return VK_NULL_HANDLE;
|
||||||
return gs->GetRenderer().GetSwapchain().GetSurface();
|
return gs->GetRenderer().GetSwapchain().GetSurface();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -488,7 +488,7 @@ extern "C"
|
|||||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||||
if(!gs || index > gs->GetRenderer().GetSwapchain().GetImagesCount())
|
if(!gs || index > gs->GetRenderer().GetSwapchain().GetImagesCount())
|
||||||
return nullptr;
|
return VK_NULL_HANDLE;
|
||||||
return gs->GetRenderer().GetSwapchain().GetSwapchainImages()[index].Get();
|
return gs->GetRenderer().GetSwapchain().GetSwapchainImages()[index].Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -506,7 +506,7 @@ extern "C"
|
|||||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||||
if(!gs || index > gs->GetRenderer().GetSwapchain().GetImagesCount())
|
if(!gs || index > gs->GetRenderer().GetSwapchain().GetImagesCount())
|
||||||
return nullptr;
|
return VK_NULL_HANDLE;
|
||||||
return gs->GetRenderer().GetSwapchain().GetSwapchainImages()[index].GetImageView();
|
return gs->GetRenderer().GetSwapchain().GetSwapchainImages()[index].GetImageView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace mlx
|
|||||||
|
|
||||||
void* MemManager::AlignedMalloc(std::size_t alignment, std::size_t size)
|
void* MemManager::AlignedMalloc(std::size_t alignment, std::size_t size)
|
||||||
{
|
{
|
||||||
#ifdef MLX_COMPILER_MSVC
|
#ifdef MLX_PLAT_WINDOWS
|
||||||
void* ptr = _aligned_malloc(size, alignment);
|
void* ptr = _aligned_malloc(size, alignment);
|
||||||
#else
|
#else
|
||||||
if(alignment < sizeof(void*))
|
if(alignment < sizeof(void*))
|
||||||
@@ -66,7 +66,7 @@ namespace mlx
|
|||||||
{
|
{
|
||||||
auto it = std::find_if(s_blocks.begin(), s_blocks.end(), [=](const Descriptor& rhs){ return ptr == rhs.ptr; });
|
auto it = std::find_if(s_blocks.begin(), s_blocks.end(), [=](const Descriptor& rhs){ return ptr == rhs.ptr; });
|
||||||
|
|
||||||
#ifdef MLX_COMPILER_MSVC
|
#ifdef MLX_PLAT_WINDOWS
|
||||||
void* ptr2 = _aligned_realloc(ptr, size, alignment);
|
void* ptr2 = _aligned_realloc(ptr, size, alignment);
|
||||||
if(it != s_blocks.end())
|
if(it != s_blocks.end())
|
||||||
s_blocks.erase(it);
|
s_blocks.erase(it);
|
||||||
@@ -90,7 +90,7 @@ namespace mlx
|
|||||||
auto it = std::find_if(s_blocks.begin(), s_blocks.end(), [=](const Descriptor& rhs){ return ptr == rhs.ptr; });
|
auto it = std::find_if(s_blocks.begin(), s_blocks.end(), [=](const Descriptor& rhs){ return ptr == rhs.ptr; });
|
||||||
if(it == s_blocks.end())
|
if(it == s_blocks.end())
|
||||||
return;
|
return;
|
||||||
#ifdef MLX_COMPILER_MSVC
|
#ifdef MLX_PLAT_WINDOWS
|
||||||
if(it->aligned)
|
if(it->aligned)
|
||||||
_aligned_free(it->ptr);
|
_aligned_free(it->ptr);
|
||||||
else
|
else
|
||||||
@@ -105,7 +105,7 @@ namespace mlx
|
|||||||
{
|
{
|
||||||
for(const Descriptor& desc : s_blocks)
|
for(const Descriptor& desc : s_blocks)
|
||||||
{
|
{
|
||||||
#ifdef MLX_COMPILER_MSVC
|
#ifdef MLX_PLAT_WINDOWS
|
||||||
if(desc.aligned)
|
if(desc.aligned)
|
||||||
_aligned_free(desc.ptr);
|
_aligned_free(desc.ptr);
|
||||||
else
|
else
|
||||||
|
|||||||
4
third_party/kvf.h
vendored
4
third_party/kvf.h
vendored
@@ -526,7 +526,7 @@ int32_t kvfFindMemoryType(VkPhysicalDevice physical_device, uint32_t type_filter
|
|||||||
VkPhysicalDeviceMemoryProperties mem_properties;
|
VkPhysicalDeviceMemoryProperties mem_properties;
|
||||||
KVF_GET_INSTANCE_FUNCTION(vkGetPhysicalDeviceMemoryProperties)(physical_device, &mem_properties);
|
KVF_GET_INSTANCE_FUNCTION(vkGetPhysicalDeviceMemoryProperties)(physical_device, &mem_properties);
|
||||||
|
|
||||||
for(int32_t i = 0; i < mem_properties.memoryTypeCount; i++)
|
for(int32_t i = 0; i < (int32_t)mem_properties.memoryTypeCount; i++)
|
||||||
{
|
{
|
||||||
if((type_filter & (1 << i)) && (mem_properties.memoryTypes[i].propertyFlags & properties) == properties)
|
if((type_filter & (1 << i)) && (mem_properties.memoryTypes[i].propertyFlags & properties) == properties)
|
||||||
return i;
|
return i;
|
||||||
@@ -1166,7 +1166,7 @@ const char* kvfVerbaliseVkResult(VkResult result)
|
|||||||
case VK_ERROR_OUT_OF_DATE_KHR: return "A surface has changed in such a way that it is no longer compatible with the swapchain";
|
case VK_ERROR_OUT_OF_DATE_KHR: return "A surface has changed in such a way that it is no longer compatible with the swapchain";
|
||||||
case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR: return "The display used by a swapchain does not use the same presentable image layout";
|
case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR: return "The display used by a swapchain does not use the same presentable image layout";
|
||||||
case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: return "The requested window is already connected to a VkSurfaceKHR, or to some other non-Vulkan API";
|
case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: return "The requested window is already connected to a VkSurfaceKHR, or to some other non-Vulkan API";
|
||||||
case VK_ERROR_VALIDATION_FAILED: return "A command failed because invalid usage was detected by the implementation or a validation layer.";
|
case VK_ERROR_VALIDATION_FAILED_EXT: return "A command failed because invalid usage was detected by the implementation or a validation layer.";
|
||||||
|
|
||||||
default: return "Unknown Vulkan error";
|
default: return "Unknown Vulkan error";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user