fixing SDL issue on windows

This commit is contained in:
Kbz-8
2023-12-31 01:08:41 +01:00
parent f3efb72a21
commit 4087fca980
10 changed files with 72 additions and 65 deletions

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/08 18:58:49 by maldavid #+# #+# */
/* Updated: 2023/11/18 17:22:38 by maldavid ### ########.fr */
/* Updated: 2023/12/30 23:14:54 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -15,6 +15,7 @@
#include <renderer/renderer.h>
#include <SDL2/SDL_vulkan.h>
#include <SDL2/SDL.h>
#include <algorithm>
namespace mlx
{
@@ -29,13 +30,12 @@ namespace mlx
VkSurfaceFormatKHR Surface::chooseSwapSurfaceFormat(const std::vector<VkSurfaceFormatKHR>& availableFormats)
{
for(const auto& availableFormat : availableFormats)
auto it = std::find_if(availableFormats.begin(), availableFormats.end(), [](VkSurfaceFormatKHR format)
{
if(availableFormat.format == VK_FORMAT_R8G8B8A8_SRGB && availableFormat.colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR)
return availableFormat;
}
return format.format == VK_FORMAT_R8G8B8A8_SRGB && format.colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
});
return availableFormats[0];
return (it == availableFormats.end() ? availableFormats[0] : *it);
}
void Surface::destroy() noexcept