|
| 1 | +diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 2 | +index 6a7645a..bf336b9 100644 |
| 3 | +--- a/CMakeLists.txt |
| 4 | ++++ b/CMakeLists.txt |
| 5 | +@@ -8,10 +8,16 @@ if(APPLE) |
| 6 | + endif() |
| 7 | + |
| 8 | + string(COMPARE EQUAL ${CMAKE_SYSTEM_NAME} "Linux" IS_LINUX) |
| 9 | ++string(COMPARE EQUAL ${CMAKE_SYSTEM_NAME} "iOS" IS_IOS) |
| 10 | ++if(IS_LINUX OR IS_IOS) |
| 11 | ++ set(IS_SDL_VULKAN_PLATFORM ON) |
| 12 | ++else() |
| 13 | ++ set(IS_SDL_VULKAN_PLATFORM OFF) |
| 14 | ++endif() |
| 15 | + |
| 16 | + # Project options |
| 17 | + include(CMakeDependentOption) |
| 18 | +-cmake_dependent_option(SDL_VULKAN_ENABLED "Enable SDL Vulkan integration" OFF IS_LINUX OFF) |
| 19 | ++cmake_dependent_option(SDL_VULKAN_ENABLED "Enable SDL Vulkan integration" OFF IS_SDL_VULKAN_PLATFORM OFF) |
| 20 | + cmake_dependent_option(D3D12_AGILITY_SDK_ENABLED "Enable D3D12 Agility SDK" OFF WIN32 OFF) |
| 21 | + option(PLUME_BUILD_EXAMPLES "Build example applications" OFF) |
| 22 | + |
| 23 | +diff --git a/plume_vulkan.cpp b/plume_vulkan.cpp |
| 24 | +index 9103ca8..02c3591 100644 |
| 25 | +--- a/plume_vulkan.cpp |
| 26 | ++++ b/plume_vulkan.cpp |
| 27 | +@@ -2112,6 +2112,12 @@ namespace plume { |
| 28 | + fprintf(stderr, "vkCreateXlibSurfaceKHR failed with error code 0x%X.\n", res); |
| 29 | + return; |
| 30 | + } |
| 31 | ++# elif defined(__APPLE__) && defined(SDL_VULKAN_ENABLED) |
| 32 | ++ VulkanInterface *renderInterface = commandQueue->device->renderInterface; |
| 33 | ++ if (!SDL_Vulkan_CreateSurface(renderWindow, renderInterface->instance, &surface)) { |
| 34 | ++ fprintf(stderr, "SDL_Vulkan_CreateSurface failed: %s.\n", SDL_GetError()); |
| 35 | ++ return; |
| 36 | ++ } |
| 37 | + # elif defined(__APPLE__) |
| 38 | + assert(renderWindow.window != 0); |
| 39 | + assert(renderWindow.view != 0); |
| 40 | +@@ -2443,7 +2449,7 @@ namespace plume { |
| 41 | + // The attributes width and height members do not include the border. |
| 42 | + dstWidth = attributes.width; |
| 43 | + dstHeight = attributes.height; |
| 44 | +-# elif defined(__APPLE__) |
| 45 | ++# elif defined(__APPLE__) && !defined(SDL_VULKAN_ENABLED) |
| 46 | + CocoaWindowAttributes attributes; |
| 47 | + windowWrapper->getWindowAttributes(&attributes); |
| 48 | + dstWidth = attributes.width; |
| 49 | +diff --git a/plume_vulkan.h b/plume_vulkan.h |
| 50 | +index 73022bb..9d89adf 100644 |
| 51 | +--- a/plume_vulkan.h |
| 52 | ++++ b/plume_vulkan.h |
| 53 | +@@ -22,8 +22,10 @@ |
| 54 | + #define VK_USE_PLATFORM_XLIB_KHR |
| 55 | + #elif defined(__APPLE__) |
| 56 | + #define VK_USE_PLATFORM_METAL_EXT |
| 57 | ++#ifndef SDL_VULKAN_ENABLED |
| 58 | + #include "plume_apple.h" |
| 59 | + #endif |
| 60 | ++#endif |
| 61 | + |
| 62 | + // For VK_KHR_portability_subset |
| 63 | + #define VK_ENABLE_BETA_EXTENSIONS |
| 64 | +@@ -226,7 +228,7 @@ namespace plume { |
| 65 | + VulkanCommandQueue *commandQueue = nullptr; |
| 66 | + VkSurfaceKHR surface = VK_NULL_HANDLE; |
| 67 | + RenderWindow renderWindow = {}; |
| 68 | +-#if defined(__APPLE__) |
| 69 | ++#if defined(__APPLE__) && !defined(SDL_VULKAN_ENABLED) |
| 70 | + std::unique_ptr<CocoaWindow> windowWrapper; |
| 71 | + #endif |
| 72 | + uint32_t textureCount = 0; |
0 commit comments