From 69747a2bdb4fff3ca1a801712822b8b73cad034a Mon Sep 17 00:00:00 2001 From: Johannes Date: Tue, 25 May 2021 17:49:48 +0200 Subject: [PATCH 01/26] Add CMake support --- CMakeLists.txt | 12 ++++ src/CMakeLists.txt | 112 +++++++++++++++++++++++++++++++++++ src/Shaders/CMakeLists.txt | 30 ++++++++++ src/VmaReplay/CMakeLists.txt | 19 ++++++ 4 files changed, 173 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 src/CMakeLists.txt create mode 100644 src/Shaders/CMakeLists.txt create mode 100644 src/VmaReplay/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..4537e13 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.9) + +project(VulkanMemoryAllocator) + +set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) + +find_package(Vulkan REQUIRED) + +# Put binaries into bin folder +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin) + +add_subdirectory(src) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..aea26cf --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,112 @@ +add_subdirectory(Shaders) +add_subdirectory(VmaReplay) + +set(VMA_LIBRARY_SOURCE_FILES + VmaUsage.cpp +) + +# Use folder structure as filters in project map +foreach(FILE ${VMA_LIBRARY_SOURCE_FILES}) + get_filename_component(PARENT_DIR "${FILE}" PATH) + + string(REPLACE "/" "\\" GROUP "${PARENT_DIR}") + + if("${FILE}" MATCHES ".*\\.cpp") + set(GROUP "Source Files\\${GROUP}") + elseif("${FILE}" MATCHES ".*\\.hpp") + set(GROUP "Header Files\\${GROUP}") + endif() + + source_group("${GROUP}" FILES "${FILE}") +endforeach() + +add_library(VmaLibrary ${VMA_LIBRARY_SOURCE_FILES}) + +set_target_properties( + VmaLibrary PROPERTIES + + CXX_EXTENSIONS OFF + # Use C++14 + CXX_STANDARD 14 + CXX_STANDARD_REQUIRED ON +) + +target_include_directories( + VmaLibrary + + PUBLIC + ${PROJECT_SOURCE_DIR}/include +) + +target_link_libraries( + VmaLibrary + + PUBLIC + Vulkan::Vulkan +) + +set(VMA_EXAMPLE_SOURCE_FILES + Common.cpp + SparseBindingTest.cpp + Tests.cpp + VulkanSample.cpp +) + +# Use folder structure as filters in project map +foreach(FILE ${VMA_EXAMPLE_SOURCE_FILES}) + get_filename_component(PARENT_DIR "${FILE}" PATH) + + string(REPLACE "/" "\\" GROUP "${PARENT_DIR}") + + if("${FILE}" MATCHES ".*\\.cpp") + set(GROUP "Source Files\\${GROUP}") + elseif("${FILE}" MATCHES ".*\\.hpp") + set(GROUP "Header Files\\${GROUP}") + endif() + + source_group("${GROUP}" FILES "${FILE}") +endforeach() + +IF (WIN32) + add_executable(VmaExample ${VMA_EXAMPLE_SOURCE_FILES}) + + # Make sure to compile shaders when compiling the example + add_dependencies(VmaExample VmaShaders) + + # Visual Studio specific settings + if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*") + # Use Unicode instead of multibyte set + add_definitions(-DUNICODE -D_UNICODE) + + # Set VmaExample as startup project + set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT "VmaExample") + + # Enable multithreaded compiling + target_compile_options(VmaExample PRIVATE "/MP") + + # Set working directory for Visual Studio debugger + set_target_properties( + VmaExample + PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/bin" + ) + endif() + + set_target_properties( + VmaExample PROPERTIES + + CXX_EXTENSIONS OFF + # Use C++14 + CXX_STANDARD 14 + CXX_STANDARD_REQUIRED ON + ) + + target_link_libraries( + VmaExample + + PRIVATE + VmaLibrary + ) + +ELSE() + message(STATUS "VmaExample application is not supported to Linux") +ENDIF() diff --git a/src/Shaders/CMakeLists.txt b/src/Shaders/CMakeLists.txt new file mode 100644 index 0000000..dfc2483 --- /dev/null +++ b/src/Shaders/CMakeLists.txt @@ -0,0 +1,30 @@ +find_program(GLSL_VALIDATOR glslangValidator REQUIRED) + +if(NOT GLSL_VALIDATOR) + message(FATAL_ERROR "glslangValidator not found!") +endif() + +set(SHADERS + Shader.vert + Shader.frag + SparseBindingTest.comp +) + +# Compile each shader using glslangValidator +foreach(SHADER ${SHADERS}) + get_filename_component(FILE_NAME ${SHADER} NAME) + + # Put the .spv files into the bin folder + set(SPIRV ${PROJECT_SOURCE_DIR}/bin/${FILE_NAME}.spv) + + add_custom_command( + OUTPUT ${SPIRV} + # Use the same file name and append .spv to the compiled shader + COMMAND ${GLSL_VALIDATOR} -V ${CMAKE_CURRENT_SOURCE_DIR}/${SHADER} -o ${SPIRV} + DEPENDS ${SHADER} + ) + + list(APPEND SPIRV_FILES ${SPIRV}) +endforeach() + +add_custom_target(VmaShaders DEPENDS ${SPIRV_FILES}) diff --git a/src/VmaReplay/CMakeLists.txt b/src/VmaReplay/CMakeLists.txt new file mode 100644 index 0000000..a4d41d5 --- /dev/null +++ b/src/VmaReplay/CMakeLists.txt @@ -0,0 +1,19 @@ +IF (WIN32) + set(VMA_REPLAY_SOURCE_FILES + Common.cpp + Constants.cpp + VmaReplay.cpp + VmaUsage.cpp + ) + + add_executable(VmaReplay ${VMA_REPLAY_SOURCE_FILES}) + + target_link_libraries( + VmaReplay + + PRIVATE + Vulkan::Vulkan + ) +ELSE() + message(STATUS "VmaReplay is not supported on Linux") +ENDIF() From e32721df9e2318c919d8160ffff0da7999f5c31d Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Fri, 28 May 2021 01:43:56 +0200 Subject: [PATCH 02/26] Make building shaders, VMA example application and VMA replay app optional --- CMakeLists.txt | 5 ++ src/CMakeLists.txt | 89 +++++++++++++++++++----------------- src/Shaders/CMakeLists.txt | 2 + src/VmaReplay/CMakeLists.txt | 8 ++-- 4 files changed, 58 insertions(+), 46 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4537e13..da7e883 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,4 +9,9 @@ find_package(Vulkan REQUIRED) # Put binaries into bin folder set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin) +# VulkanMemoryAllocator contains an example application and VmaReplay which are not build by default +option(VMA_BUILD_EXAMPLE_APP "Build VulkanMemoryAllocator example application" OFF) +option(VMA_BUILD_EXAMPLE_APP_SHADERS "Build VulkanMemoryAllocator example application's shaders" OFF) +option(VMA_BUILD_REPLAY_APP "Build VulkanMemoryAllocator replay application" OFF) + add_subdirectory(src) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index aea26cf..228d86e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,10 @@ -add_subdirectory(Shaders) -add_subdirectory(VmaReplay) +if(VMA_BUILD_EXAMPLE_APP_SHADERS) + add_subdirectory(Shaders) +endif() + +if(VMA_BUILD_REPLAY_APP) + add_subdirectory(VmaReplay) +endif() set(VMA_LIBRARY_SOURCE_FILES VmaUsage.cpp @@ -20,10 +25,10 @@ foreach(FILE ${VMA_LIBRARY_SOURCE_FILES}) source_group("${GROUP}" FILES "${FILE}") endforeach() -add_library(VmaLibrary ${VMA_LIBRARY_SOURCE_FILES}) +add_library(VulkanMemoryAllocator ${VMA_LIBRARY_SOURCE_FILES}) set_target_properties( - VmaLibrary PROPERTIES + VulkanMemoryAllocator PROPERTIES CXX_EXTENSIONS OFF # Use C++14 @@ -32,14 +37,14 @@ set_target_properties( ) target_include_directories( - VmaLibrary + VulkanMemoryAllocator PUBLIC ${PROJECT_SOURCE_DIR}/include ) target_link_libraries( - VmaLibrary + VulkanMemoryAllocator PUBLIC Vulkan::Vulkan @@ -67,46 +72,44 @@ foreach(FILE ${VMA_EXAMPLE_SOURCE_FILES}) source_group("${GROUP}" FILES "${FILE}") endforeach() -IF (WIN32) - add_executable(VmaExample ${VMA_EXAMPLE_SOURCE_FILES}) +if (VMA_BUILD_EXAMPLE_APP) + if(WIN32) + add_executable(VmaExample ${VMA_EXAMPLE_SOURCE_FILES}) - # Make sure to compile shaders when compiling the example - add_dependencies(VmaExample VmaShaders) + # Visual Studio specific settings + if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*") + # Use Unicode instead of multibyte set + add_definitions(-DUNICODE -D_UNICODE) + + # Set VmaExample as startup project + set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT "VmaExample") + + # Enable multithreaded compiling + target_compile_options(VmaExample PRIVATE "/MP") - # Visual Studio specific settings - if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*") - # Use Unicode instead of multibyte set - add_definitions(-DUNICODE -D_UNICODE) - - # Set VmaExample as startup project - set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT "VmaExample") - - # Enable multithreaded compiling - target_compile_options(VmaExample PRIVATE "/MP") + # Set working directory for Visual Studio debugger + set_target_properties( + VmaExample + PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/bin" + ) + endif() - # Set working directory for Visual Studio debugger set_target_properties( - VmaExample - PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/bin" + VmaExample PROPERTIES + + CXX_EXTENSIONS OFF + # Use C++14 + CXX_STANDARD 14 + CXX_STANDARD_REQUIRED ON ) + + target_link_libraries( + VmaExample + + PRIVATE + VmaLibrary + ) + else() + message(STATUS "VmaExample application is not supported to Linux") endif() - - set_target_properties( - VmaExample PROPERTIES - - CXX_EXTENSIONS OFF - # Use C++14 - CXX_STANDARD 14 - CXX_STANDARD_REQUIRED ON - ) - - target_link_libraries( - VmaExample - - PRIVATE - VmaLibrary - ) - -ELSE() - message(STATUS "VmaExample application is not supported to Linux") -ENDIF() +endif() diff --git a/src/Shaders/CMakeLists.txt b/src/Shaders/CMakeLists.txt index dfc2483..15bb0be 100644 --- a/src/Shaders/CMakeLists.txt +++ b/src/Shaders/CMakeLists.txt @@ -1,3 +1,5 @@ +# This file will only be executed if VMA_BUILD_EXAMPLE_APP_SHADERS is set to ON + find_program(GLSL_VALIDATOR glslangValidator REQUIRED) if(NOT GLSL_VALIDATOR) diff --git a/src/VmaReplay/CMakeLists.txt b/src/VmaReplay/CMakeLists.txt index a4d41d5..b848002 100644 --- a/src/VmaReplay/CMakeLists.txt +++ b/src/VmaReplay/CMakeLists.txt @@ -1,4 +1,6 @@ -IF (WIN32) +# This file will only be executed if VMA_BUILD_REPLAY_APP is set to ON + +if (WIN32) set(VMA_REPLAY_SOURCE_FILES Common.cpp Constants.cpp @@ -14,6 +16,6 @@ IF (WIN32) PRIVATE Vulkan::Vulkan ) -ELSE() +else() message(STATUS "VmaReplay is not supported on Linux") -ENDIF() +endif() From d475fbb9998fcd987ff4ecbe76dc036a867a6ff0 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Fri, 28 May 2021 02:12:29 +0200 Subject: [PATCH 03/26] Do not set CMAKE_RUNTIME_OUTPUT_DIRECTORY --- CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index da7e883..c84ce9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,9 +6,6 @@ set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) find_package(Vulkan REQUIRED) -# Put binaries into bin folder -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin) - # VulkanMemoryAllocator contains an example application and VmaReplay which are not build by default option(VMA_BUILD_EXAMPLE_APP "Build VulkanMemoryAllocator example application" OFF) option(VMA_BUILD_EXAMPLE_APP_SHADERS "Build VulkanMemoryAllocator example application's shaders" OFF) From 6b733a5ba23c0a2f8f0f84ebf4634bdd61857a45 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Fri, 28 May 2021 11:56:59 +0200 Subject: [PATCH 04/26] Fix missing Vulkan dependency of VmaExample --- src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 228d86e..faad73f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -108,6 +108,7 @@ if (VMA_BUILD_EXAMPLE_APP) PRIVATE VmaLibrary + Vulkan::Vulkan ) else() message(STATUS "VmaExample application is not supported to Linux") From 3f2238ac9d4d7837b750700cccb1d8c021cfc1f0 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Fri, 28 May 2021 12:45:58 +0200 Subject: [PATCH 05/26] Fix VMA_BUILD_EXAMPLE_APP_SHADERS being ignored on Linux --- src/Shaders/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Shaders/CMakeLists.txt b/src/Shaders/CMakeLists.txt index 15bb0be..a98c969 100644 --- a/src/Shaders/CMakeLists.txt +++ b/src/Shaders/CMakeLists.txt @@ -29,4 +29,4 @@ foreach(SHADER ${SHADERS}) list(APPEND SPIRV_FILES ${SPIRV}) endforeach() -add_custom_target(VmaShaders DEPENDS ${SPIRV_FILES}) +add_custom_target(VmaShaders ALL DEPENDS ${SPIRV_FILES}) From acba487a766371ef1bd938644971211203dc4a08 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Fri, 28 May 2021 12:57:01 +0200 Subject: [PATCH 06/26] Add CMake build instructions --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index e980e3c..0c83dcd 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,22 @@ With this one function call: `VmaAllocation` is an object that represents memory assigned to this buffer. It can be queried for parameters like Vulkan memory handle and offset. +# How to build + +On Windows it is recommended to use [CMake UI](https://cmake.org/runningcmake/). Alternatively you can generate a Visual Studio project map using CMake in command line: `cmake -B./build/ -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 16 2019" -A x64 ./` + +On Linux, use CMake with [Ninja](https://ninja-build.org/) and run `cmake -GNinja -Bbuild -DCMAKE_BUILD_TYPE=Debug` + +The following CMake options are available + +| Target | Description | CMake option | +| ------------- | ------------- | ------------- | +| VmaExample | VMA example application | `VMA_BUILD_EXAMPLE_APP` | +| VmaShaders | Shaders for VmaExample | `VMA_BUILD_EXAMPLE_APP_SHADERS` | +| VmaReplay | Replay tool for VMA .csv trace files | `VMA_BUILD_REPLAY_APP` | + +Please note that while VulkanMemoryAllocator library is supported on other platforms besides Windows, VmaExample and VmaReplay are not. + # Binaries The release comes with precompiled binary executables for "VulkanSample" application which contains test suite and "VmaReplay" tool. They are compiled using Visual Studio 2019, so they require appropriate libraries to work, including "MSVCP140.dll", "VCRUNTIME140.dll", "VCRUNTIME140_1.dll". If their launch fails with error message telling about those files missing, please download and install [Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads), "x64" version. From a7f6b7e1f161a03cf8740eff3d5ef883126e9be5 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Fri, 28 May 2021 14:53:31 +0200 Subject: [PATCH 07/26] Fix VmaReplay build --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index faad73f..26be85d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -107,7 +107,7 @@ if (VMA_BUILD_EXAMPLE_APP) VmaExample PRIVATE - VmaLibrary + VulkanMemoryAllocator Vulkan::Vulkan ) else() From 8f62aa27c2afcab7a9996374a67bda2bd0430b64 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Fri, 28 May 2021 15:13:13 +0200 Subject: [PATCH 08/26] Rename replay app target and shaders target --- src/Shaders/CMakeLists.txt | 2 +- src/VmaReplay/CMakeLists.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Shaders/CMakeLists.txt b/src/Shaders/CMakeLists.txt index a98c969..990b05a 100644 --- a/src/Shaders/CMakeLists.txt +++ b/src/Shaders/CMakeLists.txt @@ -29,4 +29,4 @@ foreach(SHADER ${SHADERS}) list(APPEND SPIRV_FILES ${SPIRV}) endforeach() -add_custom_target(VmaShaders ALL DEPENDS ${SPIRV_FILES}) +add_custom_target(VmaExampleAppShaders ALL DEPENDS ${SPIRV_FILES}) diff --git a/src/VmaReplay/CMakeLists.txt b/src/VmaReplay/CMakeLists.txt index b848002..0af9f99 100644 --- a/src/VmaReplay/CMakeLists.txt +++ b/src/VmaReplay/CMakeLists.txt @@ -8,10 +8,10 @@ if (WIN32) VmaUsage.cpp ) - add_executable(VmaReplay ${VMA_REPLAY_SOURCE_FILES}) + add_executable(VmaReplayApp ${VMA_REPLAY_SOURCE_FILES}) target_link_libraries( - VmaReplay + VmaReplayApp PRIVATE Vulkan::Vulkan From 8f14179a725d01637836cfce67489d3f3ed35e80 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Mon, 31 May 2021 23:52:06 +0200 Subject: [PATCH 09/26] Replace Ninja with Make as default build instruction on Linux --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0c83dcd..8e0bb37 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,14 @@ With this one function call: On Windows it is recommended to use [CMake UI](https://cmake.org/runningcmake/). Alternatively you can generate a Visual Studio project map using CMake in command line: `cmake -B./build/ -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 16 2019" -A x64 ./` -On Linux, use CMake with [Ninja](https://ninja-build.org/) and run `cmake -GNinja -Bbuild -DCMAKE_BUILD_TYPE=Debug` +On Linux: + +``` +mkdir build +cd build +cmake .. +make +``` The following CMake options are available From dadd8f635a6c6466e50a2e528791f0501d16e87d Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Mon, 31 May 2021 22:57:06 +0200 Subject: [PATCH 10/26] Show default values for CMake options in README's table --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8e0bb37..d6cdd34 100644 --- a/README.md +++ b/README.md @@ -109,11 +109,11 @@ make The following CMake options are available -| Target | Description | CMake option | -| ------------- | ------------- | ------------- | -| VmaExample | VMA example application | `VMA_BUILD_EXAMPLE_APP` | -| VmaShaders | Shaders for VmaExample | `VMA_BUILD_EXAMPLE_APP_SHADERS` | -| VmaReplay | Replay tool for VMA .csv trace files | `VMA_BUILD_REPLAY_APP` | +| Target | Description | CMake option | Default setting | +| ------------- | ------------- | ------------- | ------------- | +| VmaExample | VMA example application | `VMA_BUILD_EXAMPLE_APP` | `OFF` | +| VmaShaders | Shaders for VmaExample | `VMA_BUILD_EXAMPLE_APP_SHADERS` | `OFF` | +| VmaReplay | Replay tool for VMA .csv trace files | `VMA_BUILD_REPLAY_APP` | `OFF` | Please note that while VulkanMemoryAllocator library is supported on other platforms besides Windows, VmaExample and VmaReplay are not. From 853f713db1b51f9c030143798c434878b52bf536 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Mon, 31 May 2021 23:03:48 +0200 Subject: [PATCH 11/26] Remove source_group instructions --- src/CMakeLists.txt | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 26be85d..c3a1704 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,21 +10,6 @@ set(VMA_LIBRARY_SOURCE_FILES VmaUsage.cpp ) -# Use folder structure as filters in project map -foreach(FILE ${VMA_LIBRARY_SOURCE_FILES}) - get_filename_component(PARENT_DIR "${FILE}" PATH) - - string(REPLACE "/" "\\" GROUP "${PARENT_DIR}") - - if("${FILE}" MATCHES ".*\\.cpp") - set(GROUP "Source Files\\${GROUP}") - elseif("${FILE}" MATCHES ".*\\.hpp") - set(GROUP "Header Files\\${GROUP}") - endif() - - source_group("${GROUP}" FILES "${FILE}") -endforeach() - add_library(VulkanMemoryAllocator ${VMA_LIBRARY_SOURCE_FILES}) set_target_properties( @@ -57,21 +42,6 @@ set(VMA_EXAMPLE_SOURCE_FILES VulkanSample.cpp ) -# Use folder structure as filters in project map -foreach(FILE ${VMA_EXAMPLE_SOURCE_FILES}) - get_filename_component(PARENT_DIR "${FILE}" PATH) - - string(REPLACE "/" "\\" GROUP "${PARENT_DIR}") - - if("${FILE}" MATCHES ".*\\.cpp") - set(GROUP "Source Files\\${GROUP}") - elseif("${FILE}" MATCHES ".*\\.hpp") - set(GROUP "Header Files\\${GROUP}") - endif() - - source_group("${GROUP}" FILES "${FILE}") -endforeach() - if (VMA_BUILD_EXAMPLE_APP) if(WIN32) add_executable(VmaExample ${VMA_EXAMPLE_SOURCE_FILES}) From 08b190ff7ed11744def7951a7b4d8c5dc5aac564 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Mon, 31 May 2021 23:04:14 +0200 Subject: [PATCH 12/26] Rename VmaShaders to VmaBuildExampleShaders --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d6cdd34..4bf99dc 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ The following CMake options are available | Target | Description | CMake option | Default setting | | ------------- | ------------- | ------------- | ------------- | | VmaExample | VMA example application | `VMA_BUILD_EXAMPLE_APP` | `OFF` | -| VmaShaders | Shaders for VmaExample | `VMA_BUILD_EXAMPLE_APP_SHADERS` | `OFF` | +| VmaBuildExampleShaders | Shaders for VmaExample | `VMA_BUILD_EXAMPLE_APP_SHADERS` | `OFF` | | VmaReplay | Replay tool for VMA .csv trace files | `VMA_BUILD_REPLAY_APP` | `OFF` | Please note that while VulkanMemoryAllocator library is supported on other platforms besides Windows, VmaExample and VmaReplay are not. From 7dc310ad8561c3b2670089d9382a886ab19fc24f Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Mon, 31 May 2021 23:07:59 +0200 Subject: [PATCH 13/26] Remove CMAKE_DISABLE_IN_SOURCE_BUILD --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c84ce9d..c668e34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 3.9) project(VulkanMemoryAllocator) -set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) - find_package(Vulkan REQUIRED) # VulkanMemoryAllocator contains an example application and VmaReplay which are not build by default From 1a25921427aa64766871ccf9e7c53253a3582629 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Mon, 31 May 2021 23:14:58 +0200 Subject: [PATCH 14/26] Make target_include_directories a one line instruction --- src/CMakeLists.txt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c3a1704..179dddf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -21,12 +21,7 @@ set_target_properties( CXX_STANDARD_REQUIRED ON ) -target_include_directories( - VulkanMemoryAllocator - - PUBLIC - ${PROJECT_SOURCE_DIR}/include -) +target_include_directories(VulkanMemoryAllocator PUBLIC ${PROJECT_SOURCE_DIR}/include) target_link_libraries( VulkanMemoryAllocator From 61a2844a4fbc3d9b97216f222e5b47ca2f014830 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Mon, 31 May 2021 23:19:17 +0200 Subject: [PATCH 15/26] Only set VMA_EXAMPLE_SOURCE_FILES when building sample app --- src/CMakeLists.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 179dddf..387c26d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,15 +30,15 @@ target_link_libraries( Vulkan::Vulkan ) -set(VMA_EXAMPLE_SOURCE_FILES - Common.cpp - SparseBindingTest.cpp - Tests.cpp - VulkanSample.cpp -) - if (VMA_BUILD_EXAMPLE_APP) if(WIN32) + set(VMA_EXAMPLE_SOURCE_FILES + Common.cpp + SparseBindingTest.cpp + Tests.cpp + VulkanSample.cpp + ) + add_executable(VmaExample ${VMA_EXAMPLE_SOURCE_FILES}) # Visual Studio specific settings From a3078999ea83bc15c1c1fe0fe86e795efa4cdfcf Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Mon, 31 May 2021 23:23:46 +0200 Subject: [PATCH 16/26] Move add_subdirectory for shaders and VmaReplay to the end of the file --- src/CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 387c26d..1a56ddd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,11 +1,3 @@ -if(VMA_BUILD_EXAMPLE_APP_SHADERS) - add_subdirectory(Shaders) -endif() - -if(VMA_BUILD_REPLAY_APP) - add_subdirectory(VmaReplay) -endif() - set(VMA_LIBRARY_SOURCE_FILES VmaUsage.cpp ) @@ -79,3 +71,11 @@ if (VMA_BUILD_EXAMPLE_APP) message(STATUS "VmaExample application is not supported to Linux") endif() endif() + +if(VMA_BUILD_EXAMPLE_APP_SHADERS) + add_subdirectory(Shaders) +endif() + +if(VMA_BUILD_REPLAY_APP) + add_subdirectory(VmaReplay) +endif() From 696ecd674d575deb1c9b798c2029efcaa2b076c6 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Mon, 31 May 2021 23:36:57 +0200 Subject: [PATCH 17/26] Replace add_definitions with add_compile_definitions --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1a56ddd..d23bddf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -36,7 +36,7 @@ if (VMA_BUILD_EXAMPLE_APP) # Visual Studio specific settings if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*") # Use Unicode instead of multibyte set - add_definitions(-DUNICODE -D_UNICODE) + add_compile_definitions(UNICODE _UNICODE) # Set VmaExample as startup project set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT "VmaExample") From e65c1469d9fa19e5cd8e0eb99935c5f27787d47a Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Mon, 31 May 2021 23:43:54 +0200 Subject: [PATCH 18/26] Improve consistency in naming of targets and options --- CMakeLists.txt | 8 ++++---- README.md | 6 +++--- src/CMakeLists.txt | 24 ++++++++++++------------ src/Shaders/CMakeLists.txt | 4 ++-- src/VmaReplay/CMakeLists.txt | 6 +++--- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c668e34..29e0260 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,9 +4,9 @@ project(VulkanMemoryAllocator) find_package(Vulkan REQUIRED) -# VulkanMemoryAllocator contains an example application and VmaReplay which are not build by default -option(VMA_BUILD_EXAMPLE_APP "Build VulkanMemoryAllocator example application" OFF) -option(VMA_BUILD_EXAMPLE_APP_SHADERS "Build VulkanMemoryAllocator example application's shaders" OFF) -option(VMA_BUILD_REPLAY_APP "Build VulkanMemoryAllocator replay application" OFF) +# VulkanMemoryAllocator contains an sample application and VmaReplay which are not build by default +option(VMA_BUILD_SAMPLE "Build VulkanMemoryAllocator sample application" OFF) +option(VMA_BUILD_SAMPLE_SHADERS "Build VulkanMemoryAllocator sample application's shaders" OFF) +option(VMA_BUILD_REPLAY "Build VulkanMemoryAllocator replay application" OFF) add_subdirectory(src) diff --git a/README.md b/README.md index 4bf99dc..58bc1c3 100644 --- a/README.md +++ b/README.md @@ -111,9 +111,9 @@ The following CMake options are available | Target | Description | CMake option | Default setting | | ------------- | ------------- | ------------- | ------------- | -| VmaExample | VMA example application | `VMA_BUILD_EXAMPLE_APP` | `OFF` | -| VmaBuildExampleShaders | Shaders for VmaExample | `VMA_BUILD_EXAMPLE_APP_SHADERS` | `OFF` | -| VmaReplay | Replay tool for VMA .csv trace files | `VMA_BUILD_REPLAY_APP` | `OFF` | +| VmaExample | VMA example application | `VMA_BUILD_SAMPLE` | `OFF` | +| VmaBuildExampleShaders | Shaders for VmaExample | `VMA_BUILD_SAMPLE_SHADERS` | `OFF` | +| VmaReplay | Replay tool for VMA .csv trace files | `VMA_BUILD_REPLAY` | `OFF` | Please note that while VulkanMemoryAllocator library is supported on other platforms besides Windows, VmaExample and VmaReplay are not. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d23bddf..ac465b9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,37 +22,37 @@ target_link_libraries( Vulkan::Vulkan ) -if (VMA_BUILD_EXAMPLE_APP) +if (VMA_BUILD_SAMPLE) if(WIN32) - set(VMA_EXAMPLE_SOURCE_FILES + set(VMA_SAMPLE_SOURCE_FILES Common.cpp SparseBindingTest.cpp Tests.cpp VulkanSample.cpp ) - add_executable(VmaExample ${VMA_EXAMPLE_SOURCE_FILES}) + add_executable(VmaSample ${VMA_SAMPLE_SOURCE_FILES}) # Visual Studio specific settings if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*") # Use Unicode instead of multibyte set add_compile_definitions(UNICODE _UNICODE) - # Set VmaExample as startup project - set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT "VmaExample") + # Set VmaSample as startup project + set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT "VmaSample") # Enable multithreaded compiling - target_compile_options(VmaExample PRIVATE "/MP") + target_compile_options(VmaSample PRIVATE "/MP") # Set working directory for Visual Studio debugger set_target_properties( - VmaExample + VmaSample PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/bin" ) endif() set_target_properties( - VmaExample PROPERTIES + VmaSample PROPERTIES CXX_EXTENSIONS OFF # Use C++14 @@ -61,21 +61,21 @@ if (VMA_BUILD_EXAMPLE_APP) ) target_link_libraries( - VmaExample + VmaSample PRIVATE VulkanMemoryAllocator Vulkan::Vulkan ) else() - message(STATUS "VmaExample application is not supported to Linux") + message(STATUS "VmaSample application is not supported to Linux") endif() endif() -if(VMA_BUILD_EXAMPLE_APP_SHADERS) +if(VMA_BUILD_SAMPLE_SHADERS) add_subdirectory(Shaders) endif() -if(VMA_BUILD_REPLAY_APP) +if(VMA_BUILD_REPLAY) add_subdirectory(VmaReplay) endif() diff --git a/src/Shaders/CMakeLists.txt b/src/Shaders/CMakeLists.txt index 990b05a..f85ab78 100644 --- a/src/Shaders/CMakeLists.txt +++ b/src/Shaders/CMakeLists.txt @@ -1,4 +1,4 @@ -# This file will only be executed if VMA_BUILD_EXAMPLE_APP_SHADERS is set to ON +# This file will only be executed if VMA_BUILD_SAMPLE_SHADERS is set to ON find_program(GLSL_VALIDATOR glslangValidator REQUIRED) @@ -29,4 +29,4 @@ foreach(SHADER ${SHADERS}) list(APPEND SPIRV_FILES ${SPIRV}) endforeach() -add_custom_target(VmaExampleAppShaders ALL DEPENDS ${SPIRV_FILES}) +add_custom_target(VmaSampleShaders ALL DEPENDS ${SPIRV_FILES}) diff --git a/src/VmaReplay/CMakeLists.txt b/src/VmaReplay/CMakeLists.txt index 0af9f99..1583b23 100644 --- a/src/VmaReplay/CMakeLists.txt +++ b/src/VmaReplay/CMakeLists.txt @@ -1,4 +1,4 @@ -# This file will only be executed if VMA_BUILD_REPLAY_APP is set to ON +# This file will only be executed if VMA_BUILD_REPLAY is set to ON if (WIN32) set(VMA_REPLAY_SOURCE_FILES @@ -8,10 +8,10 @@ if (WIN32) VmaUsage.cpp ) - add_executable(VmaReplayApp ${VMA_REPLAY_SOURCE_FILES}) + add_executable(VmaReplay ${VMA_REPLAY_SOURCE_FILES}) target_link_libraries( - VmaReplayApp + VmaReplay PRIVATE Vulkan::Vulkan From 8111c12b36921858d501f5749403afdb792f2ea4 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Wed, 2 Jun 2021 00:22:18 +0200 Subject: [PATCH 19/26] Expose important VMA settings macros as CMake options --- CMakeLists.txt | 20 ++++++++++++++++++++ src/CMakeLists.txt | 13 +++++++++++++ 2 files changed, 33 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 29e0260..3ddc079 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,4 +9,24 @@ option(VMA_BUILD_SAMPLE "Build VulkanMemoryAllocator sample application" OFF) option(VMA_BUILD_SAMPLE_SHADERS "Build VulkanMemoryAllocator sample application's shaders" OFF) option(VMA_BUILD_REPLAY "Build VulkanMemoryAllocator replay application" OFF) +message(STATUS "VMA_BUILD_SAMPLE = ${VMA_BUILD_SAMPLE}") +message(STATUS "VMA_BUILD_SAMPLE_SHADERS = ${VMA_BUILD_SAMPLE_SHADERS}") +message(STATUS "VMA_BUILD_REPLAY = ${VMA_BUILD_REPLAY}") + +option(VMA_RECORDING_ENABLED "Enable VMA memory recording for debugging" OFF) +option(VMA_USE_STL_CONTAINERS "Use C++ STL containers instead of VMA's containers" OFF) +option(VMA_DYNAMIC_VULKAN_FUNCTIONS "Fetch pointers to Vulkan functions internally (no static linking)" OFF) +option(VMA_DEBUG_ALWAYS_DEDICATED_MEMORY "Every allocation will have its own memory block" OFF) +option(VMA_DEBUG_INITIALIZE_ALLOCATIONS "Automatically fill new allocations and destroyed allocations with some bit pattern" OFF) +option(VMA_DEBUG_GLOBAL_MUTEX "Enable single mutex protecting all entry calls to the library" OFF) +option(VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT "Never exceed VkPhysicalDeviceLimits::maxMemoryAllocationCount and return error" OFF) + +message(STATUS "VMA_RECORDING_ENABLED = ${VMA_RECORDING_ENABLED}") +message(STATUS "VMA_USE_STL_CONTAINERS = ${VMA_USE_STL_CONTAINERS}") +message(STATUS "VMA_DYNAMIC_VULKAN_FUNCTIONS = ${VMA_DYNAMIC_VULKAN_FUNCTIONS}") +message(STATUS "VMA_DEBUG_ALWAYS_DEDICATED_MEMORY = ${VMA_DEBUG_ALWAYS_DEDICATED_MEMORY}") +message(STATUS "VMA_DEBUG_INITIALIZE_ALLOCATIONS = ${VMA_DEBUG_INITIALIZE_ALLOCATIONS}") +message(STATUS "VMA_DEBUG_GLOBAL_MUTEX = ${VMA_DEBUG_GLOBAL_MUTEX}") +message(STATUS "VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT = ${VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT}") + add_subdirectory(src) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ac465b9..338d0c6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,6 +22,19 @@ target_link_libraries( Vulkan::Vulkan ) +target_compile_definitions( + VulkanMemoryAllocator + + PUBLIC + VMA_USE_STL_CONTAINERS=$ + VMA_DYNAMIC_VULKAN_FUNCTIONS=$ + VMA_DEBUG_ALWAYS_DEDICATED_MEMORY=$ + VMA_DEBUG_INITIALIZE_ALLOCATIONS=$ + VMA_DEBUG_GLOBAL_MUTEX=$ + VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT=$ + VMA_RECORDING_ENABLED=$ +) + if (VMA_BUILD_SAMPLE) if(WIN32) set(VMA_SAMPLE_SOURCE_FILES From 191c64c8eea3ce119744c5cb94cf466a7f41f717 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Wed, 2 Jun 2021 00:23:57 +0200 Subject: [PATCH 20/26] Link VulkanMemoryAllocator to Vulkan only if static linking is enabled --- src/CMakeLists.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 338d0c6..eccf82e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,12 +15,10 @@ set_target_properties( target_include_directories(VulkanMemoryAllocator PUBLIC ${PROJECT_SOURCE_DIR}/include) -target_link_libraries( - VulkanMemoryAllocator - - PUBLIC - Vulkan::Vulkan -) +# Only link to Vulkan if static linking is used +if (NOT ${VMA_DYNAMIC_VULKAN_FUNCTIONS}) + target_link_libraries(VulkanMemoryAllocator PUBLIC Vulkan::Vulkan) +endif() target_compile_definitions( VulkanMemoryAllocator From 6d3ef233ab9ba87dff41a867ea525ca57af876fa Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Wed, 2 Jun 2021 00:27:28 +0200 Subject: [PATCH 21/26] Correct README --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 58bc1c3..0bacb9e 100644 --- a/README.md +++ b/README.md @@ -107,15 +107,15 @@ cmake .. make ``` -The following CMake options are available +The following targets are available | Target | Description | CMake option | Default setting | | ------------- | ------------- | ------------- | ------------- | -| VmaExample | VMA example application | `VMA_BUILD_SAMPLE` | `OFF` | -| VmaBuildExampleShaders | Shaders for VmaExample | `VMA_BUILD_SAMPLE_SHADERS` | `OFF` | +| VmaSample | VMA sample application | `VMA_BUILD_SAMPLE` | `OFF` | +| VmaBuildSampleShaders | Shaders for VmaSample | `VMA_BUILD_SAMPLE_SHADERS` | `OFF` | | VmaReplay | Replay tool for VMA .csv trace files | `VMA_BUILD_REPLAY` | `OFF` | -Please note that while VulkanMemoryAllocator library is supported on other platforms besides Windows, VmaExample and VmaReplay are not. +Please note that while VulkanMemoryAllocator library is supported on other platforms besides Windows, VmaSample and VmaReplay are not. # Binaries From 12d8344ed0a492e3fb5ca4709d17670f134b50c1 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Wed, 2 Jun 2021 00:33:56 +0200 Subject: [PATCH 22/26] Add documentation of CMake options to README --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 0bacb9e..08883fd 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,18 @@ The following targets are available Please note that while VulkanMemoryAllocator library is supported on other platforms besides Windows, VmaSample and VmaReplay are not. +These CMake options are available + +| CMake option | Description | Default setting | +| ------------- | ------------- | ------------- | +| `VMA_RECORDING_ENABLED` | Enable VMA memory recording for debugging | `OFF` | +| `VMA_USE_STL_CONTAINERS` | Use C++ STL containers instead of VMA's containers | `OFF` | +| `VMA_DYNAMIC_VULKAN_FUNCTIONS` | Fetch pointers to Vulkan functions internally (no static linking) | `OFF` | +| `VMA_DEBUG_ALWAYS_DEDICATED_MEMORY` | Every allocation will have its own memory block | `OFF` | +| `VMA_DEBUG_INITIALIZE_ALLOCATIONS` | Automatically fill new allocations and destroyed allocations with some bit pattern | `OFF` | +| `VMA_DEBUG_GLOBAL_MUTEX` | Enable single mutex protecting all entry calls to the library | `OFF` | +| `VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT` | Never exceed [VkPhysicalDeviceLimits::maxMemoryAllocationCount](https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#limits-maxMemoryAllocationCount) and return error | `OFF` | + # Binaries The release comes with precompiled binary executables for "VulkanSample" application which contains test suite and "VmaReplay" tool. They are compiled using Visual Studio 2019, so they require appropriate libraries to work, including "MSVCP140.dll", "VCRUNTIME140.dll", "VCRUNTIME140_1.dll". If their launch fails with error message telling about those files missing, please download and install [Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads), "x64" version. From 948be7004851d7dce963b4e6e8d24dbe203d9d4d Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Wed, 2 Jun 2021 12:18:42 +0200 Subject: [PATCH 23/26] Enable compiling with multiple processes for VmaReplay --- src/VmaReplay/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/VmaReplay/CMakeLists.txt b/src/VmaReplay/CMakeLists.txt index 1583b23..a53f9c9 100644 --- a/src/VmaReplay/CMakeLists.txt +++ b/src/VmaReplay/CMakeLists.txt @@ -10,6 +10,9 @@ if (WIN32) add_executable(VmaReplay ${VMA_REPLAY_SOURCE_FILES}) + # Enable multithreaded compiling + target_compile_options(VmaReplay PRIVATE "/MP") + target_link_libraries( VmaReplay From c9777daabbc5a89a33ee629deb397931e97efb35 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Wed, 2 Jun 2021 23:15:57 +0200 Subject: [PATCH 24/26] Remove macros which can be configured through CMake from VmaUsage.h --- src/VmaUsage.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/VmaUsage.h b/src/VmaUsage.h index 9c778b0..52c0513 100644 --- a/src/VmaUsage.h +++ b/src/VmaUsage.h @@ -48,18 +48,12 @@ include all public interface declarations. Example: */ //#define VMA_HEAVY_ASSERT(expr) assert(expr) -//#define VMA_USE_STL_CONTAINERS 1 //#define VMA_DEDICATED_ALLOCATION 0 //#define VMA_DEBUG_MARGIN 16 //#define VMA_DEBUG_DETECT_CORRUPTION 1 -//#define VMA_DEBUG_INITIALIZE_ALLOCATIONS 1 -//#define VMA_RECORDING_ENABLED 1 //#define VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY 256 //#define VMA_USE_STL_SHARED_MUTEX 0 -//#define VMA_DEBUG_GLOBAL_MUTEX 1 //#define VMA_MEMORY_BUDGET 0 -#define VMA_STATIC_VULKAN_FUNCTIONS 0 -#define VMA_DYNAMIC_VULKAN_FUNCTIONS 1 #define VMA_VULKAN_VERSION 1002000 // Vulkan 1.2 //#define VMA_VULKAN_VERSION 1001000 // Vulkan 1.1 From f8daef898cac2de242399f4399a130f79d524e12 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Wed, 2 Jun 2021 23:17:35 +0200 Subject: [PATCH 25/26] Add VMA_STATIC_VULKAN_FUNCTIONS and set VMA_DYNAMIC_VULKAN_FUNCTIONS to ON by default --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ddc079..3c323ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,8 @@ message(STATUS "VMA_BUILD_REPLAY = ${VMA_BUILD_REPLAY}") option(VMA_RECORDING_ENABLED "Enable VMA memory recording for debugging" OFF) option(VMA_USE_STL_CONTAINERS "Use C++ STL containers instead of VMA's containers" OFF) -option(VMA_DYNAMIC_VULKAN_FUNCTIONS "Fetch pointers to Vulkan functions internally (no static linking)" OFF) +option(VMA_STATIC_VULKAN_FUNCTIONS "Link statically with Vulkan API" OFF) +option(VMA_DYNAMIC_VULKAN_FUNCTIONS "Fetch pointers to Vulkan functions internally (no static linking)" ON) option(VMA_DEBUG_ALWAYS_DEDICATED_MEMORY "Every allocation will have its own memory block" OFF) option(VMA_DEBUG_INITIALIZE_ALLOCATIONS "Automatically fill new allocations and destroyed allocations with some bit pattern" OFF) option(VMA_DEBUG_GLOBAL_MUTEX "Enable single mutex protecting all entry calls to the library" OFF) From 5c52b859046043b0d47c3a7bfd2d45f54385d219 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Wed, 2 Jun 2021 23:17:45 +0200 Subject: [PATCH 26/26] Update README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 08883fd..3170fc1 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,8 @@ These CMake options are available | ------------- | ------------- | ------------- | | `VMA_RECORDING_ENABLED` | Enable VMA memory recording for debugging | `OFF` | | `VMA_USE_STL_CONTAINERS` | Use C++ STL containers instead of VMA's containers | `OFF` | -| `VMA_DYNAMIC_VULKAN_FUNCTIONS` | Fetch pointers to Vulkan functions internally (no static linking) | `OFF` | +| `VMA_STATIC_VULKAN_FUNCTIONS` | Link statically with Vulkan API | `OFF` | +| `VMA_DYNAMIC_VULKAN_FUNCTIONS` | Fetch pointers to Vulkan functions internally (no static linking) | `ON` | | `VMA_DEBUG_ALWAYS_DEDICATED_MEMORY` | Every allocation will have its own memory block | `OFF` | | `VMA_DEBUG_INITIALIZE_ALLOCATIONS` | Automatically fill new allocations and destroyed allocations with some bit pattern | `OFF` | | `VMA_DEBUG_GLOBAL_MUTEX` | Enable single mutex protecting all entry calls to the library | `OFF` |