From f6988d4a8e8fabbad613a523c754d14300c0a3c4 Mon Sep 17 00:00:00 2001 From: GPUCode Date: Thu, 5 May 2022 14:56:34 +0300 Subject: [PATCH] vulkan: Add Vulkan memory allocator --- .gitmodules | 3 +++ CMakeLists.txt | 9 +++++++++ externals/vma | 1 + src/video_core/CMakeLists.txt | 8 +------- 4 files changed, 14 insertions(+), 7 deletions(-) create mode 160000 externals/vma diff --git a/.gitmodules b/.gitmodules index 126b75c01..17e8ab649 100644 --- a/.gitmodules +++ b/.gitmodules @@ -55,3 +55,6 @@ [submodule "libyuv"] path = externals/libyuv url = https://github.com/lemenkov/libyuv.git +[submodule "externals/vma"] + path = externals/vma + url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator diff --git a/CMakeLists.txt b/CMakeLists.txt index a61b65745..74e4b6764 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -264,6 +264,15 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU|SunOS)$") set(PLATFORM_LIBRARIES rt) endif() +if (ENABLE_VULKAN) + # Find the VulkanSDK + find_package(Vulkan REQUIRED) + find_library(SHADERC_LIB shaderc shaderc_shared) + + # Include Vulkan Memory Allocator + add_subdirectory(externals/vma) +endif() + # Setup a custom clang-format target (if clang-format can be found) that will run # against all the src files. This should be used before making a pull request. # ======================================================================= diff --git a/externals/vma b/externals/vma new file mode 160000 index 000000000..5ab8c1752 --- /dev/null +++ b/externals/vma @@ -0,0 +1 @@ +Subproject commit 5ab8c1752ab9720b7a38a3bc72ebcf17ef3ce6f1 diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 9c3536a70..4623ce4a9 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt @@ -166,12 +166,6 @@ if(ARCHITECTURE_x86_64) ) endif() -if (ENABLE_VULKAN) - # Find the VulkanSDK - find_package(Vulkan REQUIRED) - find_library(SHADERC_LIB shaderc shaderc_shared) -endif() - create_target_directory_groups(video_core) target_link_libraries(video_core PUBLIC common core) @@ -183,5 +177,5 @@ endif() if (ENABLE_VULKAN) target_include_directories(video_core PRIVATE ${Vulkan_INCLUDE_DIRS}) - target_link_libraries(video_core PRIVATE ${Vulkan_LIBRARIES} ${SHADERC_LIB}) + target_link_libraries(video_core PRIVATE ${Vulkan_LIBRARIES} ${SHADERC_LIB} vma) endif()