diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt index b9fce3b8..98edc2b5 100644 --- a/neo/CMakeLists.txt +++ b/neo/CMakeLists.txt @@ -396,18 +396,23 @@ if(USE_VULKAN) if(NOT Vulkan_FOUND) message(FATAL_ERROR "Could not find Vulkan library!") else() - # SRS - Optionally use MoltenVK headers/library for runtime config functions on OSX - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND USE_MoltenVK) - add_definitions(-DUSE_MoltenVK) - include_directories($ENV{VULKAN_SDK}/../MoltenVK/include) - set(Vulkan_LIBRARY $ENV{VULKAN_SDK}/lib/libMoltenVK.dylib) + add_definitions(-DUSE_VULKAN) + include_directories($ENV{VULKAN_SDK}/include) + + # SRS - Locate this after Vulkan SDK include path, otherwise issues with precompiled headers + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + # SRS - Enable Beta extensions for VULKAN_SDK portability subset features on OSX + add_definitions(-DVK_ENABLE_BETA_EXTENSIONS) + # SRS - Optionally use MoltenVK headers/library for runtime config functions on OSX + if(USE_MoltenVK) + add_definitions(-DUSE_MoltenVK) + include_directories($ENV{VULKAN_SDK}/../MoltenVK/include) + set(Vulkan_LIBRARY $ENV{VULKAN_SDK}/lib/libMoltenVK.dylib) + endif() endif() message(STATUS "Using Vulkan: " ${Vulkan_LIBRARY}) endif() - add_definitions(-DUSE_VULKAN) - include_directories($ENV{VULKAN_SDK}/include) - # Eric: For use with SDL2/Vulkan if(UNIX) find_package(X11_XCB) diff --git a/neo/renderer/Vulkan/RenderBackend_VK.cpp b/neo/renderer/Vulkan/RenderBackend_VK.cpp index f9b5ddc4..cd9538d5 100644 --- a/neo/renderer/Vulkan/RenderBackend_VK.cpp +++ b/neo/renderer/Vulkan/RenderBackend_VK.cpp @@ -74,14 +74,9 @@ static const char* g_instanceExtensions[ g_numInstanceExtensions ] = }; #endif -// SRS - needed for MoltenVK portability implementation on OSX -#if defined(__APPLE__) - // required for VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME visibility (as of SDK 1.2.170.0) - #include - #if defined(USE_MoltenVK) - // optionally needed for runtime access to fullImageViewSwizzle (instead of env var MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE = 1) - #include - #endif +// SRS - optionally needed for runtime access to fullImageViewSwizzle (instead of env var MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE = 1) +#if defined(__APPLE__) && defined(USE_MoltenVK) +#include #endif static const int g_numDebugInstanceExtensions = 1; @@ -1508,7 +1503,7 @@ void idRenderBackend::Init() // DG: make sure SDL has setup video so getting supported modes in R_SetNewMode() works // SRS - Add OSX case -#if ( defined(__linux__) || defined(__APPLE__) ) && defined(USE_VULKAN) +#if defined(__linux__) || defined(__APPLE__) VKimp_PreInit(); #else GLimp_PreInit(); @@ -1704,7 +1699,7 @@ void idRenderBackend::Shutdown() // destroy main window // SRS - Add OSX case -#if ( defined(__linux__) || defined(__APPLE__) ) && defined(USE_VULKAN) +#if defined(__linux__) || defined(__APPLE__) VKimp_Shutdown(); #else GLimp_Shutdown();