mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
synced 2024-11-05 04:10:06 +00:00
Merge branch 'master' into PoolCustomPnext
# Conflicts: # include/vk_mem_alloc.h
This commit is contained in:
commit
d780fe0263
13
.gitignore
vendored
13
.gitignore
vendored
@ -1,2 +1,13 @@
|
||||
build/
|
||||
/bin/*
|
||||
|
||||
/build/*
|
||||
!/build/src/
|
||||
/build/src/*
|
||||
!/build/src/Release/
|
||||
/build/src/Release/*
|
||||
!/build/src/Release/VmaSample.exe
|
||||
!/build/src/VmaReplay/
|
||||
/build/src/VmaReplay/*
|
||||
!/build/src/VmaReplay/Release/
|
||||
/build/src/VmaReplay/Release/*
|
||||
!/build/src/VmaReplay/Release/VmaReplay.exe
|
||||
|
18
.travis.yml
18
.travis.yml
@ -1,7 +1,7 @@
|
||||
language: cpp
|
||||
sudo: required
|
||||
os: linux
|
||||
dist: trusty
|
||||
dist: bionic
|
||||
|
||||
branches:
|
||||
only:
|
||||
@ -12,24 +12,22 @@ compiler:
|
||||
- gcc
|
||||
|
||||
before_script:
|
||||
- sudo apt-get install
|
||||
- sudo apt-get install
|
||||
- eval "${MATRIX_EVAL}"
|
||||
|
||||
install:
|
||||
- wget https://github.com/premake/premake-core/releases/download/v5.0.0-alpha11/premake-5.0.0-alpha11-linux.tar.gz?Human=true -O premake-5.0.0-alpha11-linux.tar.gz
|
||||
- tar -xzvf premake-5.0.0-alpha11-linux.tar.gz
|
||||
- sudo apt-get -qq update
|
||||
- sudo apt-get install -y libassimp-dev libglm-dev graphviz libxcb-dri3-0 libxcb-present0 libpciaccess0 cmake libpng-dev libxcb-dri3-dev libx11-dev libx11-xcb-dev libmirclient-dev libwayland-dev libxrandr-dev
|
||||
- export VK_VERSION=1.2.131.1
|
||||
- wget -O vulkansdk-linux-x86_64-$VK_VERSION.tar.gz https://sdk.lunarg.com/sdk/download/$VK_VERSION/linux/vulkansdk-linux-x86_64-$VK_VERSION.tar.gz
|
||||
- wget -O vulkansdk-linux-x86_64-$VK_VERSION.tar.gz https://sdk.lunarg.com/sdk/download/$VK_VERSION/linux/vulkansdk-linux-x86_64-$VK_VERSION.tar.gz?Human=true
|
||||
- tar zxf vulkansdk-linux-x86_64-$VK_VERSION.tar.gz
|
||||
- export VULKAN_SDK=$TRAVIS_BUILD_DIR/$VK_VERSION/x86_64
|
||||
|
||||
script:
|
||||
- cd premake
|
||||
- ../premake5 gmake
|
||||
- cd ../build
|
||||
- make config=debug_linux-x64
|
||||
- cd ..
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake ..
|
||||
- make
|
||||
|
||||
notifications:
|
||||
email:
|
||||
|
33
CMakeLists.txt
Normal file
33
CMakeLists.txt
Normal file
@ -0,0 +1,33 @@
|
||||
cmake_minimum_required(VERSION 3.9)
|
||||
|
||||
project(VulkanMemoryAllocator)
|
||||
|
||||
find_package(Vulkan REQUIRED)
|
||||
|
||||
# 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)
|
||||
|
||||
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_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)
|
||||
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)
|
@ -1,4 +1,4 @@
|
||||
# Doxyfile 1.8.16
|
||||
# Doxyfile 1.9.1
|
||||
|
||||
# This file describes the settings to be used by the documentation system
|
||||
# doxygen (www.doxygen.org) for a project.
|
||||
@ -58,7 +58,7 @@ PROJECT_LOGO =
|
||||
# entered, it will be relative to the location where doxygen was started. If
|
||||
# left blank the current directory will be used.
|
||||
|
||||
OUTPUT_DIRECTORY = ../docs
|
||||
OUTPUT_DIRECTORY = docs
|
||||
|
||||
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
|
||||
# directories (in 2 levels) under the output directory of each output format and
|
||||
@ -227,6 +227,14 @@ QT_AUTOBRIEF = NO
|
||||
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
|
||||
# By default Python docstrings are displayed as preformatted text and doxygen's
|
||||
# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the
|
||||
# doxygen's special commands can be used and the contents of the docstring
|
||||
# documentation blocks is shown as doxygen documentation.
|
||||
# The default value is: YES.
|
||||
|
||||
PYTHON_DOCSTRING = YES
|
||||
|
||||
# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
|
||||
# documentation from any documented member that it re-implements.
|
||||
# The default value is: YES.
|
||||
@ -263,12 +271,6 @@ TAB_SIZE = 4
|
||||
|
||||
ALIASES =
|
||||
|
||||
# This tag can be used to specify a number of word-keyword mappings (TCL only).
|
||||
# A mapping has the form "name=value". For example adding "class=itcl::class"
|
||||
# will allow you to use the command class in the itcl::class meaning.
|
||||
|
||||
TCL_SUBST =
|
||||
|
||||
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
|
||||
# only. Doxygen will then generate output that is more tailored for C. For
|
||||
# instance, some of the names that are used will be different. The list of all
|
||||
@ -309,19 +311,22 @@ OPTIMIZE_OUTPUT_SLICE = NO
|
||||
# parses. With this tag you can assign which parser to use for a given
|
||||
# extension. Doxygen has a built-in mapping, but you can override or extend it
|
||||
# using this tag. The format is ext=language, where ext is a file extension, and
|
||||
# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
|
||||
# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice,
|
||||
# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,
|
||||
# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL,
|
||||
# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
|
||||
# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser
|
||||
# tries to guess whether the code is fixed or free formatted code, this is the
|
||||
# default for Fortran type files), VHDL, tcl. For instance to make doxygen treat
|
||||
# .inc files as Fortran files (default is PHP), and .f files as C (default is
|
||||
# Fortran), use: inc=Fortran f=C.
|
||||
# default for Fortran type files). For instance to make doxygen treat .inc files
|
||||
# as Fortran files (default is PHP), and .f files as C (default is Fortran),
|
||||
# use: inc=Fortran f=C.
|
||||
#
|
||||
# Note: For files without extension you can use no_extension as a placeholder.
|
||||
#
|
||||
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
|
||||
# the files are not read by doxygen.
|
||||
# the files are not read by doxygen. When specifying no_extension you should add
|
||||
# * to the FILE_PATTERNS.
|
||||
#
|
||||
# Note see also the list of default file extension mappings.
|
||||
|
||||
EXTENSION_MAPPING =
|
||||
|
||||
@ -455,6 +460,19 @@ TYPEDEF_HIDES_STRUCT = NO
|
||||
|
||||
LOOKUP_CACHE_SIZE = 0
|
||||
|
||||
# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use
|
||||
# during processing. When set to 0 doxygen will based this on the number of
|
||||
# cores available in the system. You can set it explicitly to a value larger
|
||||
# than 0 to get more control over the balance between CPU load and processing
|
||||
# speed. At this moment only the input processing can be done using multiple
|
||||
# threads. Since this is still an experimental feature the default is set to 1,
|
||||
# which efficively disables parallel processing. Please report any issues you
|
||||
# encounter. Generating dot graphs in parallel is controlled by the
|
||||
# DOT_NUM_THREADS setting.
|
||||
# Minimum value: 0, maximum value: 32, default value: 1.
|
||||
|
||||
NUM_PROC_THREADS = 1
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
@ -518,6 +536,13 @@ EXTRACT_LOCAL_METHODS = NO
|
||||
|
||||
EXTRACT_ANON_NSPACES = NO
|
||||
|
||||
# If this flag is set to YES, the name of an unnamed parameter in a declaration
|
||||
# will be determined by the corresponding definition. By default unnamed
|
||||
# parameters remain unnamed in the output.
|
||||
# The default value is: YES.
|
||||
|
||||
RESOLVE_UNNAMED_PARAMS = YES
|
||||
|
||||
# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
|
||||
# undocumented members inside documented classes or files. If set to NO these
|
||||
# members will be included in the various overviews, but no documentation
|
||||
@ -535,8 +560,8 @@ HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
|
||||
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
|
||||
# (class|struct|union) declarations. If set to NO, these declarations will be
|
||||
# included in the documentation.
|
||||
# declarations. If set to NO, these declarations will be included in the
|
||||
# documentation.
|
||||
# The default value is: NO.
|
||||
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
@ -555,11 +580,18 @@ HIDE_IN_BODY_DOCS = NO
|
||||
|
||||
INTERNAL_DOCS = NO
|
||||
|
||||
# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
|
||||
# names in lower-case letters. If set to YES, upper-case letters are also
|
||||
# allowed. This is useful if you have classes or files whose names only differ
|
||||
# in case and if your file system supports case sensitive file names. Windows
|
||||
# (including Cygwin) ands Mac users are advised to set this option to NO.
|
||||
# With the correct setting of option CASE_SENSE_NAMES doxygen will better be
|
||||
# able to match the capabilities of the underlying filesystem. In case the
|
||||
# filesystem is case sensitive (i.e. it supports files in the same directory
|
||||
# whose names only differ in casing), the option must be set to YES to properly
|
||||
# deal with such files in case they appear in the input. For filesystems that
|
||||
# are not case sensitive the option should be be set to NO to properly deal with
|
||||
# output files written for symbols that only differ in casing, such as for two
|
||||
# classes, one named CLASS and the other named Class, and to also support
|
||||
# references to files without having to specify the exact matching casing. On
|
||||
# Windows (including Cygwin) and MacOS, users should typically set this option
|
||||
# to NO, whereas on Linux or other Unix flavors it should typically be set to
|
||||
# YES.
|
||||
# The default value is: system dependent.
|
||||
|
||||
CASE_SENSE_NAMES = NO
|
||||
@ -798,7 +830,10 @@ WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
|
||||
# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
|
||||
# a warning is encountered.
|
||||
# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS
|
||||
# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but
|
||||
# at the end of the doxygen process doxygen will return with a non-zero status.
|
||||
# Possible values are: NO, YES and FAIL_ON_WARNINGS.
|
||||
# The default value is: NO.
|
||||
|
||||
WARN_AS_ERROR = NO
|
||||
@ -829,13 +864,13 @@ WARN_LOGFILE =
|
||||
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
|
||||
# Note: If this tag is empty the current directory is searched.
|
||||
|
||||
INPUT = vk_mem_alloc.h
|
||||
INPUT = include/vk_mem_alloc.h
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||
# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
|
||||
# documentation (see: https://www.gnu.org/software/libiconv/) for the list of
|
||||
# possible encodings.
|
||||
# documentation (see:
|
||||
# https://www.gnu.org/software/libiconv/) for the list of possible encodings.
|
||||
# The default value is: UTF-8.
|
||||
|
||||
INPUT_ENCODING = UTF-8
|
||||
@ -848,11 +883,15 @@ INPUT_ENCODING = UTF-8
|
||||
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
|
||||
# read by doxygen.
|
||||
#
|
||||
# Note the list of default checked file patterns might differ from the list of
|
||||
# default file extension mappings.
|
||||
#
|
||||
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
|
||||
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
|
||||
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
|
||||
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
|
||||
# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice.
|
||||
# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment),
|
||||
# *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, *.vhdl,
|
||||
# *.ucf, *.qsf and *.ice.
|
||||
|
||||
FILE_PATTERNS = *.c \
|
||||
*.cc \
|
||||
@ -1110,16 +1149,22 @@ USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
|
||||
# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
|
||||
# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
|
||||
# cost of reduced performance. This can be particularly helpful with template
|
||||
# rich C++ code for which doxygen's built-in parser lacks the necessary type
|
||||
# information.
|
||||
# clang parser (see:
|
||||
# http://clang.llvm.org/) for more accurate parsing at the cost of reduced
|
||||
# performance. This can be particularly helpful with template rich C++ code for
|
||||
# which doxygen's built-in parser lacks the necessary type information.
|
||||
# Note: The availability of this option depends on whether or not doxygen was
|
||||
# generated with the -Duse_libclang=ON option for CMake.
|
||||
# The default value is: NO.
|
||||
|
||||
CLANG_ASSISTED_PARSING = NO
|
||||
|
||||
# If clang assisted parsing is enabled and the CLANG_ADD_INC_PATHS tag is set to
|
||||
# YES then doxygen will add the directory of each input to the include path.
|
||||
# The default value is: YES.
|
||||
|
||||
CLANG_ADD_INC_PATHS = YES
|
||||
|
||||
# If clang assisted parsing is enabled you can provide the compiler with command
|
||||
# line options that you would normally use when invoking the compiler. Note that
|
||||
# the include paths will already be set by doxygen for the files and directories
|
||||
@ -1129,10 +1174,13 @@ CLANG_ASSISTED_PARSING = NO
|
||||
CLANG_OPTIONS =
|
||||
|
||||
# If clang assisted parsing is enabled you can provide the clang parser with the
|
||||
# path to the compilation database (see:
|
||||
# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) used when the files
|
||||
# were built. This is equivalent to specifying the "-p" option to a clang tool,
|
||||
# such as clang-check. These options will then be passed to the parser.
|
||||
# path to the directory containing a file called compile_commands.json. This
|
||||
# file is the compilation database (see:
|
||||
# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the
|
||||
# options used when the source files were built. This is equivalent to
|
||||
# specifying the -p option to a clang tool, such as clang-check. These options
|
||||
# will then be passed to the parser. Any options specified with CLANG_OPTIONS
|
||||
# will be added as well.
|
||||
# Note: The availability of this option depends on whether or not doxygen was
|
||||
# generated with the -Duse_libclang=ON option for CMake.
|
||||
|
||||
@ -1149,13 +1197,6 @@ CLANG_DATABASE_PATH =
|
||||
|
||||
ALPHABETICAL_INDEX = YES
|
||||
|
||||
# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
|
||||
# which the alphabetical index list will be split.
|
||||
# Minimum value: 1, maximum value: 20, default value: 5.
|
||||
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
|
||||
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
|
||||
# In case all classes in a project start with a common prefix, all classes will
|
||||
# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
|
||||
# can be used to specify a prefix (or a list of prefixes) that should be ignored
|
||||
@ -1294,9 +1335,9 @@ HTML_TIMESTAMP = NO
|
||||
|
||||
# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
|
||||
# documentation will contain a main index with vertical navigation menus that
|
||||
# are dynamically created via Javascript. If disabled, the navigation index will
|
||||
# are dynamically created via JavaScript. If disabled, the navigation index will
|
||||
# consists of multiple levels of tabs that are statically embedded in every HTML
|
||||
# page. Disable this option to support browsers that do not have Javascript,
|
||||
# page. Disable this option to support browsers that do not have JavaScript,
|
||||
# like the Qt help browser.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
@ -1326,10 +1367,11 @@ HTML_INDEX_NUM_ENTRIES = 100
|
||||
|
||||
# If the GENERATE_DOCSET tag is set to YES, additional index files will be
|
||||
# generated that can be used as input for Apple's Xcode 3 integrated development
|
||||
# environment (see: https://developer.apple.com/xcode/), introduced with OSX
|
||||
# 10.5 (Leopard). To create a documentation set, doxygen will generate a
|
||||
# Makefile in the HTML output directory. Running make will produce the docset in
|
||||
# that directory and running make install will install the docset in
|
||||
# environment (see:
|
||||
# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To
|
||||
# create a documentation set, doxygen will generate a Makefile in the HTML
|
||||
# output directory. Running make will produce the docset in that directory and
|
||||
# running make install will install the docset in
|
||||
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
|
||||
# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy
|
||||
# genXcode/_index.html for more information.
|
||||
@ -1371,8 +1413,8 @@ DOCSET_PUBLISHER_NAME = Publisher
|
||||
# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
|
||||
# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
|
||||
# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
|
||||
# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on
|
||||
# Windows.
|
||||
# (see:
|
||||
# https://www.microsoft.com/en-us/download/details.aspx?id=21138) on Windows.
|
||||
#
|
||||
# The HTML Help Workshop contains a compiler that can convert all HTML output
|
||||
# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
|
||||
@ -1402,7 +1444,7 @@ CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
|
||||
# The GENERATE_CHI flag controls if a separate .chi index file is generated
|
||||
# (YES) or that it should be included in the master .chm file (NO).
|
||||
# (YES) or that it should be included in the main .chm file (NO).
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
||||
|
||||
@ -1447,7 +1489,8 @@ QCH_FILE =
|
||||
|
||||
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
|
||||
# Project output. For more information please see Qt Help Project / Namespace
|
||||
# (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
|
||||
# (see:
|
||||
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
|
||||
# The default value is: org.doxygen.Project.
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
@ -1455,8 +1498,8 @@ QHP_NAMESPACE = org.doxygen.Project
|
||||
|
||||
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
|
||||
# Help Project output. For more information please see Qt Help Project / Virtual
|
||||
# Folders (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-
|
||||
# folders).
|
||||
# Folders (see:
|
||||
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders).
|
||||
# The default value is: doc.
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
@ -1464,16 +1507,16 @@ QHP_VIRTUAL_FOLDER = doc
|
||||
|
||||
# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
|
||||
# filter to add. For more information please see Qt Help Project / Custom
|
||||
# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
|
||||
# filters).
|
||||
# Filters (see:
|
||||
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QHP_CUST_FILTER_NAME =
|
||||
|
||||
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
|
||||
# custom filter to add. For more information please see Qt Help Project / Custom
|
||||
# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
|
||||
# filters).
|
||||
# Filters (see:
|
||||
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QHP_CUST_FILTER_ATTRS =
|
||||
@ -1485,9 +1528,9 @@ QHP_CUST_FILTER_ATTRS =
|
||||
|
||||
QHP_SECT_FILTER_ATTRS =
|
||||
|
||||
# The QHG_LOCATION tag can be used to specify the location of Qt's
|
||||
# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
|
||||
# generated .qhp file.
|
||||
# The QHG_LOCATION tag can be used to specify the location (absolute path
|
||||
# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to
|
||||
# run qhelpgenerator on the generated .qhp file.
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QHG_LOCATION =
|
||||
@ -1564,6 +1607,17 @@ TREEVIEW_WIDTH = 250
|
||||
|
||||
EXT_LINKS_IN_WINDOW = NO
|
||||
|
||||
# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg
|
||||
# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see
|
||||
# https://inkscape.org) to generate formulas as SVG images instead of PNGs for
|
||||
# the HTML output. These images will generally look nicer at scaled resolutions.
|
||||
# Possible values are: png (the default) and svg (looks nicer but requires the
|
||||
# pdf2svg or inkscape tool).
|
||||
# The default value is: png.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_FORMULA_FORMAT = png
|
||||
|
||||
# Use this tag to change the font size of LaTeX formulas included as images in
|
||||
# the HTML documentation. When you change the font size after a successful
|
||||
# doxygen run you need to manually remove any form_*.png images from the HTML
|
||||
@ -1584,8 +1638,14 @@ FORMULA_FONTSIZE = 10
|
||||
|
||||
FORMULA_TRANSPARENT = YES
|
||||
|
||||
# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands
|
||||
# to create new LaTeX commands to be used in formulas as building blocks. See
|
||||
# the section "Including formulas" for details.
|
||||
|
||||
FORMULA_MACROFILE =
|
||||
|
||||
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
|
||||
# https://www.mathjax.org) which uses client side Javascript for the rendering
|
||||
# https://www.mathjax.org) which uses client side JavaScript for the rendering
|
||||
# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
|
||||
# installed or if you want to formulas look prettier in the HTML output. When
|
||||
# enabled you may also need to install MathJax separately and configure the path
|
||||
@ -1597,7 +1657,7 @@ USE_MATHJAX = NO
|
||||
|
||||
# When MathJax is enabled you can set the default output format to be used for
|
||||
# the MathJax output. See the MathJax site (see:
|
||||
# http://docs.mathjax.org/en/latest/output.html) for more details.
|
||||
# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details.
|
||||
# Possible values are: HTML-CSS (which is slower, but has the best
|
||||
# compatibility), NativeMML (i.e. MathML) and SVG.
|
||||
# The default value is: HTML-CSS.
|
||||
@ -1613,7 +1673,7 @@ MATHJAX_FORMAT = HTML-CSS
|
||||
# Content Delivery Network so you can quickly see the result without installing
|
||||
# MathJax. However, it is strongly recommended to install a local copy of
|
||||
# MathJax from https://www.mathjax.org before deployment.
|
||||
# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/.
|
||||
# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2.
|
||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
||||
|
||||
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
|
||||
@ -1627,7 +1687,8 @@ MATHJAX_EXTENSIONS =
|
||||
|
||||
# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
|
||||
# of code that will be used on startup of the MathJax code. See the MathJax site
|
||||
# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
|
||||
# (see:
|
||||
# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an
|
||||
# example see the documentation.
|
||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
||||
|
||||
@ -1655,7 +1716,7 @@ MATHJAX_CODEFILE =
|
||||
SEARCHENGINE = YES
|
||||
|
||||
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
|
||||
# implemented using a web server instead of a web client using Javascript. There
|
||||
# implemented using a web server instead of a web client using JavaScript. There
|
||||
# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
|
||||
# setting. When disabled, doxygen will generate a PHP script for searching and
|
||||
# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
|
||||
@ -1674,7 +1735,8 @@ SERVER_BASED_SEARCH = NO
|
||||
#
|
||||
# Doxygen ships with an example indexer (doxyindexer) and search engine
|
||||
# (doxysearch.cgi) which are based on the open source search engine library
|
||||
# Xapian (see: https://xapian.org/).
|
||||
# Xapian (see:
|
||||
# https://xapian.org/).
|
||||
#
|
||||
# See the section "External Indexing and Searching" for details.
|
||||
# The default value is: NO.
|
||||
@ -1687,8 +1749,9 @@ EXTERNAL_SEARCH = NO
|
||||
#
|
||||
# Doxygen ships with an example indexer (doxyindexer) and search engine
|
||||
# (doxysearch.cgi) which are based on the open source search engine library
|
||||
# Xapian (see: https://xapian.org/). See the section "External Indexing and
|
||||
# Searching" for details.
|
||||
# Xapian (see:
|
||||
# https://xapian.org/). See the section "External Indexing and Searching" for
|
||||
# details.
|
||||
# This tag requires that the tag SEARCHENGINE is set to YES.
|
||||
|
||||
SEARCHENGINE_URL =
|
||||
@ -1852,9 +1915,11 @@ LATEX_EXTRA_FILES =
|
||||
|
||||
PDF_HYPERLINKS = YES
|
||||
|
||||
# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
|
||||
# the PDF file directly from the LaTeX files. Set this option to YES, to get a
|
||||
# higher quality PDF documentation.
|
||||
# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as
|
||||
# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX
|
||||
# files. Set this option to YES, to get a higher quality PDF documentation.
|
||||
#
|
||||
# See also section LATEX_CMD_NAME for selecting the engine.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
@ -2188,7 +2253,13 @@ INCLUDE_FILE_PATTERNS =
|
||||
# recursively expanded use the := operator instead of the = operator.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
|
||||
PREDEFINED = VMA_CALL_PRE= VMA_CALL_POST= VMA_NOT_NULL= VMA_NULLABLE= VMA_LEN_IF_NOT_NULL(len)= VMA_NOT_NULL_NON_DISPATCHABLE= VMA_NULLABLE_NON_DISPATCHABLE=
|
||||
PREDEFINED = VMA_CALL_PRE= \
|
||||
VMA_CALL_POST= \
|
||||
VMA_NOT_NULL= \
|
||||
VMA_NULLABLE= \
|
||||
VMA_LEN_IF_NOT_NULL(len)= \
|
||||
VMA_NOT_NULL_NON_DISPATCHABLE= \
|
||||
VMA_NULLABLE_NON_DISPATCHABLE=
|
||||
|
||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
|
||||
# tag can be used to specify a list of macro names that should be expanded. The
|
||||
@ -2365,10 +2436,32 @@ UML_LOOK = NO
|
||||
# but if the number exceeds 15, the total amount of fields shown is limited to
|
||||
# 10.
|
||||
# Minimum value: 0, maximum value: 100, default value: 10.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
# This tag requires that the tag UML_LOOK is set to YES.
|
||||
|
||||
UML_LIMIT_NUM_FIELDS = 10
|
||||
|
||||
# If the DOT_UML_DETAILS tag is set to NO, doxygen will show attributes and
|
||||
# methods without types and arguments in the UML graphs. If the DOT_UML_DETAILS
|
||||
# tag is set to YES, doxygen will add type and arguments for attributes and
|
||||
# methods in the UML graphs. If the DOT_UML_DETAILS tag is set to NONE, doxygen
|
||||
# will not generate fields with class member information in the UML graphs. The
|
||||
# class diagrams will look similar to the default class diagrams but using UML
|
||||
# notation for the relationships.
|
||||
# Possible values are: NO, YES and NONE.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag UML_LOOK is set to YES.
|
||||
|
||||
DOT_UML_DETAILS = NO
|
||||
|
||||
# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters
|
||||
# to display on a single line. If the actual line length exceeds this threshold
|
||||
# significantly it will wrapped across multiple lines. Some heuristics are apply
|
||||
# to avoid ugly line breaks.
|
||||
# Minimum value: 0, maximum value: 1000, default value: 17.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
DOT_WRAP_THRESHOLD = 17
|
||||
|
||||
# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
|
||||
# collaboration graphs will show the relations between templates and their
|
||||
# instances.
|
||||
@ -2558,9 +2651,11 @@ DOT_MULTI_TARGETS = NO
|
||||
|
||||
GENERATE_LEGEND = YES
|
||||
|
||||
# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
|
||||
# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate
|
||||
# files that are used to generate the various graphs.
|
||||
#
|
||||
# Note: This setting is not only used for dot files but also for msc and
|
||||
# plantuml temporary files.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
DOT_CLEANUP = YES
|
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
45
README.md
45
README.md
@ -2,7 +2,7 @@
|
||||
|
||||
Easy to integrate Vulkan memory allocation library.
|
||||
|
||||
**Documentation:** See [Vulkan Memory Allocator](https://gpuopen-librariesandsdks.github.io/VulkanMemoryAllocator/html/) (generated from Doxygen-style comments in [src/vk_mem_alloc.h](src/vk_mem_alloc.h))
|
||||
**Documentation:** See [Vulkan Memory Allocator](https://gpuopen-librariesandsdks.github.io/VulkanMemoryAllocator/html/) (generated from Doxygen-style comments in [include/vk_mem_alloc.h](include/vk_mem_alloc.h))
|
||||
|
||||
**License:** MIT. See [LICENSE.txt](LICENSE.txt)
|
||||
|
||||
@ -13,7 +13,7 @@ Easy to integrate Vulkan memory allocation library.
|
||||
**Build status:**
|
||||
|
||||
- Windows: [![Build status](https://ci.appveyor.com/api/projects/status/4vlcrb0emkaio2pn/branch/master?svg=true)](https://ci.appveyor.com/project/adam-sawicki-amd/vulkanmemoryallocator/branch/master)
|
||||
- Linux: [![Build Status](https://travis-ci.org/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.svg?branch=master)](https://travis-ci.org/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator)
|
||||
- Linux: [![Build Status](https://travis-ci.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.svg?branch=master)](https://travis-ci.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator)
|
||||
|
||||
# Problem
|
||||
|
||||
@ -37,7 +37,7 @@ This library can help game developers to manage memory allocations and resource
|
||||
Additional features:
|
||||
|
||||
- Well-documented - description of all functions and structures provided, along with chapters that contain general description and example code.
|
||||
- Thread-safety: Library is designed to be used by multithreaded code.
|
||||
- Thread-safety: Library is designed to be used in multithreaded code. Access to a single device memory block referred by different buffers and textures (binding, mapping) is synchronized internally.
|
||||
- Configuration: Fill optional members of CreateInfo structure to provide custom CPU memory allocator, pointers to Vulkan functions and other parameters.
|
||||
- Customization: Predefine appropriate macros to provide your own implementation of all external facilities used by the library, from assert, mutex, and atomic, to vector and linked list.
|
||||
- Support for memory mapping, reference-counted internally. Support for persistently mapped memory: Just allocate with appropriate flag and you get access to mapped pointer.
|
||||
@ -94,9 +94,45 @@ 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:
|
||||
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
```
|
||||
|
||||
The following targets are available
|
||||
|
||||
| Target | Description | CMake option | Default setting |
|
||||
| ------------- | ------------- | ------------- | ------------- |
|
||||
| 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, 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_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` |
|
||||
| `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 2017, so they require appropriate libraries to work, including "vcruntime140.dll" and "msvcp140.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.
|
||||
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.
|
||||
|
||||
# Read more
|
||||
|
||||
@ -118,6 +154,7 @@ See **[Documentation](https://gpuopen-librariesandsdks.github.io/VulkanMemoryAll
|
||||
- **[vkDOOM3](https://github.com/DustinHLand/vkDOOM3)** - Vulkan port of GPL DOOM 3 BFG Edition. License: GNU GPL.
|
||||
- **[vkQuake2](https://github.com/kondrak/vkQuake2)** - vanilla Quake 2 with Vulkan support. License: GNU GPL.
|
||||
- **[Vulkan Best Practice for Mobile Developers](https://github.com/ARM-software/vulkan_best_practice_for_mobile_developers)** from ARM. License: MIT.
|
||||
- **[RPCS3](https://github.com/RPCS3/rpcs3)** - PlayStation 3 emulator/debugger. License: GNU GPLv2.
|
||||
|
||||
[Many other projects on GitHub](https://github.com/search?q=AMD_VULKAN_MEMORY_ALLOCATOR_H&type=Code) and some game development studios that use Vulkan in their games.
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
build/src/Release/VmaSample.exe
Normal file
BIN
build/src/Release/VmaSample.exe
Normal file
Binary file not shown.
BIN
build/src/VmaReplay/Release/VmaReplay.exe
Normal file
BIN
build/src/VmaReplay/Release/VmaReplay.exe
Normal file
Binary file not shown.
0
docs/.nojekyll
Normal file
0
docs/.nojekyll
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,27 +0,0 @@
|
||||
Copyright (c) 2003-2016 Jason Perkins and individual contributors.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Premake nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
Binary file not shown.
@ -1,99 +0,0 @@
|
||||
-- _ACTION is a premake global variable and for our usage will be vs2012, vs2013, etc.
|
||||
-- Strip "vs" from this string to make a suffix for solution and project files.
|
||||
_SUFFIX = _ACTION
|
||||
|
||||
workspace "VulkanSample"
|
||||
configurations { "Debug", "Release" }
|
||||
platforms { "x64", "Linux-x64" }
|
||||
location "../build"
|
||||
filename ("VulkanSample_" .. _SUFFIX)
|
||||
startproject "VulkanSample"
|
||||
|
||||
filter "platforms:x64"
|
||||
system "Windows"
|
||||
architecture "x64"
|
||||
includedirs { "$(VULKAN_SDK)/Include" }
|
||||
libdirs { "$(VULKAN_SDK)/Lib" }
|
||||
|
||||
filter "platforms:Linux-x64"
|
||||
system "Linux"
|
||||
architecture "x64"
|
||||
includedirs { "$(VULKAN_SDK)/include" }
|
||||
libdirs { "$(VULKAN_SDK)/lib" }
|
||||
|
||||
|
||||
project "VulkanSample"
|
||||
kind "ConsoleApp"
|
||||
language "C++"
|
||||
location "../build"
|
||||
filename ("VulkanSample_" .. _SUFFIX)
|
||||
targetdir "../bin"
|
||||
objdir "../build/Desktop_%{_SUFFIX}/%{cfg.platform}/%{cfg.buildcfg}"
|
||||
floatingpoint "Fast"
|
||||
files { "../src/*.h", "../src/*.cpp" }
|
||||
flags { "NoPCH", "FatalWarnings" }
|
||||
characterset "Unicode"
|
||||
|
||||
filter "configurations:Debug"
|
||||
defines { "_DEBUG", "DEBUG" }
|
||||
flags { }
|
||||
targetsuffix ("_Debug_" .. _SUFFIX)
|
||||
|
||||
filter "configurations:Release"
|
||||
defines { "NDEBUG" }
|
||||
optimize "On"
|
||||
flags { "LinkTimeOptimization" }
|
||||
targetsuffix ("_Release_" .. _SUFFIX)
|
||||
|
||||
filter { "platforms:x64" }
|
||||
defines { "WIN32", "_CONSOLE", "PROFILE", "_WINDOWS", "_WIN32_WINNT=0x0601" }
|
||||
links { "vulkan-1" }
|
||||
|
||||
filter { "platforms:Linux-x64" }
|
||||
buildoptions { "-std=c++0x" }
|
||||
links { "vulkan" }
|
||||
|
||||
filter { "configurations:Debug", "platforms:x64" }
|
||||
buildoptions { "/MDd" }
|
||||
|
||||
filter { "configurations:Release", "platforms:Windows-x64" }
|
||||
buildoptions { "/MD" }
|
||||
|
||||
|
||||
project "VmaReplay"
|
||||
removeplatforms { "Linux-x64" }
|
||||
kind "ConsoleApp"
|
||||
language "C++"
|
||||
location "../build"
|
||||
filename ("VmaReplay_" .. _SUFFIX)
|
||||
targetdir "../bin"
|
||||
objdir "../build/Desktop_%{_SUFFIX}/%{cfg.platform}/%{cfg.buildcfg}"
|
||||
floatingpoint "Fast"
|
||||
files { "../src/VmaReplay/*.h", "../src/VmaReplay/*.cpp" }
|
||||
flags { "NoPCH", "FatalWarnings" }
|
||||
characterset "Default"
|
||||
|
||||
filter "configurations:Debug"
|
||||
defines { "_DEBUG", "DEBUG" }
|
||||
flags { }
|
||||
targetsuffix ("_Debug_" .. _SUFFIX)
|
||||
|
||||
filter "configurations:Release"
|
||||
defines { "NDEBUG" }
|
||||
optimize "On"
|
||||
flags { "LinkTimeOptimization" }
|
||||
targetsuffix ("_Release_" .. _SUFFIX)
|
||||
|
||||
filter { "platforms:x64" }
|
||||
defines { "WIN32", "_CONSOLE", "PROFILE", "_WINDOWS", "_WIN32_WINNT=0x0601" }
|
||||
links { "vulkan-1" }
|
||||
|
||||
filter { "platforms:Linux-x64" }
|
||||
buildoptions { "-std=c++0x" }
|
||||
links { "vulkan" }
|
||||
|
||||
filter { "configurations:Debug", "platforms:x64" }
|
||||
buildoptions { "/MDd" }
|
||||
|
||||
filter { "configurations:Release", "platforms:Windows-x64" }
|
||||
buildoptions { "/MD" }
|
92
src/CMakeLists.txt
Normal file
92
src/CMakeLists.txt
Normal file
@ -0,0 +1,92 @@
|
||||
set(VMA_LIBRARY_SOURCE_FILES
|
||||
VmaUsage.cpp
|
||||
)
|
||||
|
||||
add_library(VulkanMemoryAllocator ${VMA_LIBRARY_SOURCE_FILES})
|
||||
|
||||
set_target_properties(
|
||||
VulkanMemoryAllocator PROPERTIES
|
||||
|
||||
CXX_EXTENSIONS OFF
|
||||
# Use C++14
|
||||
CXX_STANDARD 14
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
)
|
||||
|
||||
target_include_directories(VulkanMemoryAllocator PUBLIC ${PROJECT_SOURCE_DIR}/include)
|
||||
|
||||
# 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
|
||||
|
||||
PUBLIC
|
||||
VMA_USE_STL_CONTAINERS=$<BOOL:${VMA_USE_STL_CONTAINERS}>
|
||||
VMA_DYNAMIC_VULKAN_FUNCTIONS=$<BOOL:${VMA_DYNAMIC_VULKAN_FUNCTIONS}>
|
||||
VMA_DEBUG_ALWAYS_DEDICATED_MEMORY=$<BOOL:${VMA_DEBUG_ALWAYS_DEDICATED_MEMORY}>
|
||||
VMA_DEBUG_INITIALIZE_ALLOCATIONS=$<BOOL:${VMA_DEBUG_INITIALIZE_ALLOCATIONS}>
|
||||
VMA_DEBUG_GLOBAL_MUTEX=$<BOOL:${VMA_DEBUG_GLOBAL_MUTEX}>
|
||||
VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT=$<BOOL:${VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT}>
|
||||
VMA_RECORDING_ENABLED=$<BOOL:${VMA_RECORDING_ENABLED}>
|
||||
)
|
||||
|
||||
if (VMA_BUILD_SAMPLE)
|
||||
if(WIN32)
|
||||
set(VMA_SAMPLE_SOURCE_FILES
|
||||
Common.cpp
|
||||
SparseBindingTest.cpp
|
||||
Tests.cpp
|
||||
VulkanSample.cpp
|
||||
)
|
||||
|
||||
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 VmaSample as startup project
|
||||
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT "VmaSample")
|
||||
|
||||
# Enable multithreaded compiling
|
||||
target_compile_options(VmaSample PRIVATE "/MP")
|
||||
|
||||
# Set working directory for Visual Studio debugger
|
||||
set_target_properties(
|
||||
VmaSample
|
||||
PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/bin"
|
||||
)
|
||||
endif()
|
||||
|
||||
set_target_properties(
|
||||
VmaSample PROPERTIES
|
||||
|
||||
CXX_EXTENSIONS OFF
|
||||
# Use C++14
|
||||
CXX_STANDARD 14
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
VmaSample
|
||||
|
||||
PRIVATE
|
||||
VulkanMemoryAllocator
|
||||
Vulkan::Vulkan
|
||||
)
|
||||
else()
|
||||
message(STATUS "VmaSample application is not supported to Linux")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(VMA_BUILD_SAMPLE_SHADERS)
|
||||
add_subdirectory(Shaders)
|
||||
endif()
|
||||
|
||||
if(VMA_BUILD_REPLAY)
|
||||
add_subdirectory(VmaReplay)
|
||||
endif()
|
150
src/Common.cpp
150
src/Common.cpp
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
// Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@ -177,4 +177,152 @@ void SaveFile(const wchar_t* filePath, const void* data, size_t dataSize)
|
||||
assert(0);
|
||||
}
|
||||
|
||||
std::wstring SizeToStr(size_t size)
|
||||
{
|
||||
if(size == 0)
|
||||
return L"0";
|
||||
wchar_t result[32];
|
||||
double size2 = (double)size;
|
||||
if (size2 >= 1024.0*1024.0*1024.0*1024.0)
|
||||
{
|
||||
swprintf_s(result, L"%.2f TB", size2 / (1024.0*1024.0*1024.0*1024.0));
|
||||
}
|
||||
else if (size2 >= 1024.0*1024.0*1024.0)
|
||||
{
|
||||
swprintf_s(result, L"%.2f GB", size2 / (1024.0*1024.0*1024.0));
|
||||
}
|
||||
else if (size2 >= 1024.0*1024.0)
|
||||
{
|
||||
swprintf_s(result, L"%.2f MB", size2 / (1024.0*1024.0));
|
||||
}
|
||||
else if (size2 >= 1024.0)
|
||||
{
|
||||
swprintf_s(result, L"%.2f KB", size2 / 1024.0);
|
||||
}
|
||||
else
|
||||
swprintf_s(result, L"%llu B", size);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ConvertCharsToUnicode(std::wstring *outStr, const std::string &s, unsigned codePage)
|
||||
{
|
||||
if (s.empty())
|
||||
{
|
||||
outStr->clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Phase 1 - Get buffer size.
|
||||
const int size = MultiByteToWideChar(codePage, 0, s.data(), (int)s.length(), NULL, 0);
|
||||
if (size == 0)
|
||||
{
|
||||
outStr->clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Phase 2 - Do conversion.
|
||||
std::unique_ptr<wchar_t[]> buf(new wchar_t[(size_t)size]);
|
||||
int result = MultiByteToWideChar(codePage, 0, s.data(), (int)s.length(), buf.get(), size);
|
||||
if (result == 0)
|
||||
{
|
||||
outStr->clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
outStr->assign(buf.get(), (size_t)size);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConvertCharsToUnicode(std::wstring *outStr, const char *s, size_t sCharCount, unsigned codePage)
|
||||
{
|
||||
if (sCharCount == 0)
|
||||
{
|
||||
outStr->clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
assert(sCharCount <= (size_t)INT_MAX);
|
||||
|
||||
// Phase 1 - Get buffer size.
|
||||
int size = MultiByteToWideChar(codePage, 0, s, (int)sCharCount, NULL, 0);
|
||||
if (size == 0)
|
||||
{
|
||||
outStr->clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Phase 2 - Do conversion.
|
||||
std::unique_ptr<wchar_t[]> buf(new wchar_t[(size_t)size]);
|
||||
int result = MultiByteToWideChar(codePage, 0, s, (int)sCharCount, buf.get(), size);
|
||||
if (result == 0)
|
||||
{
|
||||
outStr->clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
outStr->assign(buf.get(), (size_t)size);
|
||||
return true;
|
||||
}
|
||||
|
||||
const wchar_t* PhysicalDeviceTypeToStr(VkPhysicalDeviceType type)
|
||||
{
|
||||
// Skipping common prefix VK_PHYSICAL_DEVICE_TYPE_
|
||||
static const wchar_t* const VALUES[] = {
|
||||
L"OTHER",
|
||||
L"INTEGRATED_GPU",
|
||||
L"DISCRETE_GPU",
|
||||
L"VIRTUAL_GPU",
|
||||
L"CPU",
|
||||
};
|
||||
return (uint32_t)type < _countof(VALUES) ? VALUES[(uint32_t)type] : L"";
|
||||
}
|
||||
|
||||
const wchar_t* VendorIDToStr(uint32_t vendorID)
|
||||
{
|
||||
switch(vendorID)
|
||||
{
|
||||
// Skipping common prefix VK_VENDOR_ID_ for these:
|
||||
case 0x10001: return L"VIV";
|
||||
case 0x10002: return L"VSI";
|
||||
case 0x10003: return L"KAZAN";
|
||||
case 0x10004: return L"CODEPLAY";
|
||||
case 0x10005: return L"MESA";
|
||||
case 0x10006: return L"POCL";
|
||||
// Others...
|
||||
case VENDOR_ID_AMD: return L"AMD";
|
||||
case VENDOR_ID_NVIDIA: return L"NVIDIA";
|
||||
case VENDOR_ID_INTEL: return L"Intel";
|
||||
case 0x1010: return L"ImgTec";
|
||||
case 0x13B5: return L"ARM";
|
||||
case 0x5143: return L"Qualcomm";
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
||||
#if VMA_VULKAN_VERSION >= 1002000
|
||||
const wchar_t* DriverIDToStr(VkDriverId driverID)
|
||||
{
|
||||
// Skipping common prefix VK_DRIVER_ID_
|
||||
static const wchar_t* const VALUES[] = {
|
||||
L"",
|
||||
L"AMD_PROPRIETARY",
|
||||
L"AMD_OPEN_SOURCE",
|
||||
L"MESA_RADV",
|
||||
L"NVIDIA_PROPRIETARY",
|
||||
L"INTEL_PROPRIETARY_WINDOWS",
|
||||
L"INTEL_OPEN_SOURCE_MESA",
|
||||
L"IMAGINATION_PROPRIETARY",
|
||||
L"QUALCOMM_PROPRIETARY",
|
||||
L"ARM_PROPRIETARY",
|
||||
L"GOOGLE_SWIFTSHADER",
|
||||
L"GGP_PROPRIETARY",
|
||||
L"BROADCOM_PROPRIETARY",
|
||||
L"MESA_LLVMPIPE",
|
||||
L"MOLTENVK",
|
||||
};
|
||||
return (uint32_t)driverID < _countof(VALUES) ? VALUES[(uint32_t)driverID] : L"";
|
||||
}
|
||||
#endif // #if VMA_VULKAN_VERSION >= 1002000
|
||||
|
||||
|
||||
#endif // #ifdef _WIN32
|
||||
|
42
src/Common.h
42
src/Common.h
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
// Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@ -48,21 +48,21 @@
|
||||
typedef std::chrono::high_resolution_clock::time_point time_point;
|
||||
typedef std::chrono::high_resolution_clock::duration duration;
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define TEST(expr) do { \
|
||||
if(!(expr)) { \
|
||||
assert(0 && #expr); \
|
||||
} \
|
||||
} while(0)
|
||||
#else
|
||||
#define TEST(expr) do { \
|
||||
if(!(expr)) { \
|
||||
throw std::runtime_error("TEST FAILED: " #expr); \
|
||||
} \
|
||||
} while(0)
|
||||
#endif
|
||||
#define STRINGIZE(x) STRINGIZE2(x)
|
||||
#define STRINGIZE2(x) #x
|
||||
#define LINE_STRING STRINGIZE(__LINE__)
|
||||
#define TEST(expr) do { if(!(expr)) { \
|
||||
assert(0 && #expr); \
|
||||
throw std::runtime_error(__FILE__ "(" LINE_STRING "): ( " #expr " ) == false"); \
|
||||
} } while(false)
|
||||
#define ERR_GUARD_VULKAN(expr) do { if((expr) < 0) { \
|
||||
assert(0 && #expr); \
|
||||
throw std::runtime_error(__FILE__ "(" LINE_STRING "): VkResult( " #expr " ) < 0"); \
|
||||
} } while(false)
|
||||
|
||||
#define ERR_GUARD_VULKAN(expr) TEST((expr) >= 0)
|
||||
static const uint32_t VENDOR_ID_AMD = 0x1002;
|
||||
static const uint32_t VENDOR_ID_NVIDIA = 0x10DE;
|
||||
static const uint32_t VENDOR_ID_INTEL = 0x8086;
|
||||
|
||||
extern VkInstance g_hVulkanInstance;
|
||||
extern VkPhysicalDevice g_hPhysicalDevice;
|
||||
@ -322,6 +322,18 @@ void PrintErrorF(const wchar_t* format, ...);
|
||||
|
||||
void SaveFile(const wchar_t* filePath, const void* data, size_t dataSize);
|
||||
|
||||
std::wstring SizeToStr(size_t size);
|
||||
// As codePage use e.g. CP_ACP for native Windows 1-byte codepage or CP_UTF8.
|
||||
bool ConvertCharsToUnicode(std::wstring *outStr, const std::string &s, unsigned codePage);
|
||||
bool ConvertCharsToUnicode(std::wstring *outStr, const char *s, size_t sCharCount, unsigned codePage);
|
||||
|
||||
const wchar_t* PhysicalDeviceTypeToStr(VkPhysicalDeviceType type);
|
||||
const wchar_t* VendorIDToStr(uint32_t vendorID);
|
||||
|
||||
#if VMA_VULKAN_VERSION >= 1002000
|
||||
const wchar_t* DriverIDToStr(VkDriverId driverID);
|
||||
#endif
|
||||
|
||||
#endif // #ifdef _WIN32
|
||||
|
||||
#endif
|
||||
|
32
src/Shaders/CMakeLists.txt
Normal file
32
src/Shaders/CMakeLists.txt
Normal file
@ -0,0 +1,32 @@
|
||||
# This file will only be executed if VMA_BUILD_SAMPLE_SHADERS is set to ON
|
||||
|
||||
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(VmaSampleShaders ALL DEPENDS ${SPIRV_FILES})
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
// Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
// Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2018-2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
// Copyright (c) 2018-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
// Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@ -532,6 +532,8 @@ SparseBindingImage::~SparseBindingImage()
|
||||
|
||||
void TestSparseBinding()
|
||||
{
|
||||
wprintf(L"TESTING SPARSE BINDING:\n");
|
||||
|
||||
struct ImageInfo
|
||||
{
|
||||
std::unique_ptr<BaseImage> image;
|
||||
@ -545,7 +547,7 @@ void TestSparseBinding()
|
||||
|
||||
RandomNumberGenerator rand(4652467);
|
||||
|
||||
for(uint32_t i = 0; i < frameCount; ++i)
|
||||
for(uint32_t frameIndex = 0; frameIndex < frameCount; ++frameIndex)
|
||||
{
|
||||
// Bump frame index.
|
||||
++g_FrameIndex;
|
||||
@ -560,11 +562,11 @@ void TestSparseBinding()
|
||||
images.push_back(std::move(imageInfo));
|
||||
|
||||
// Delete all images that expired.
|
||||
for(size_t i = images.size(); i--; )
|
||||
for(size_t imageIndex = images.size(); imageIndex--; )
|
||||
{
|
||||
if(g_FrameIndex >= images[i].endFrame)
|
||||
if(g_FrameIndex >= images[imageIndex].endFrame)
|
||||
{
|
||||
images.erase(images.begin() + i);
|
||||
images.erase(images.begin() + imageIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -588,6 +590,8 @@ void TestSparseBinding()
|
||||
|
||||
// Free remaining images.
|
||||
images.clear();
|
||||
|
||||
wprintf(L"Done.\n");
|
||||
}
|
||||
|
||||
#endif // #ifdef _WIN32
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
// Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
313
src/Tests.cpp
313
src/Tests.cpp
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
// Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@ -34,10 +34,12 @@ static const char* CODE_DESCRIPTION = "Foo";
|
||||
|
||||
extern VkCommandBuffer g_hTemporaryCommandBuffer;
|
||||
extern const VkAllocationCallbacks* g_Allocs;
|
||||
extern bool g_BufferDeviceAddressEnabled;
|
||||
extern PFN_vkGetBufferDeviceAddressEXT g_vkGetBufferDeviceAddressEXT;
|
||||
extern bool VK_KHR_buffer_device_address_enabled;
|
||||
extern bool VK_EXT_memory_priority_enabled;
|
||||
extern PFN_vkGetBufferDeviceAddressKHR g_vkGetBufferDeviceAddressKHR;
|
||||
void BeginSingleTimeCommands();
|
||||
void EndSingleTimeCommands();
|
||||
void SetDebugUtilsObjectName(VkObjectType type, uint64_t handle, const char* name);
|
||||
|
||||
#ifndef VMA_DEBUG_MARGIN
|
||||
#define VMA_DEBUG_MARGIN 0
|
||||
@ -2793,6 +2795,52 @@ static void TestPool_MinBlockCount()
|
||||
vmaDestroyPool(g_hAllocator, pool);
|
||||
}
|
||||
|
||||
static void TestPool_MinAllocationAlignment()
|
||||
{
|
||||
wprintf(L"Test Pool MinAllocationAlignment\n");
|
||||
VkResult res;
|
||||
|
||||
static const VkDeviceSize ALLOC_SIZE = 32;
|
||||
static const VkDeviceSize BLOCK_SIZE = 1024 * 1024;
|
||||
static const VkDeviceSize MIN_ALLOCATION_ALIGNMENT = 64 * 1024;
|
||||
|
||||
VmaAllocationCreateInfo allocCreateInfo = {};
|
||||
allocCreateInfo.usage = VMA_MEMORY_USAGE_CPU_COPY;
|
||||
|
||||
VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
|
||||
bufCreateInfo.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
|
||||
bufCreateInfo.size = ALLOC_SIZE;
|
||||
|
||||
VmaPoolCreateInfo poolCreateInfo = {};
|
||||
poolCreateInfo.blockSize = BLOCK_SIZE;
|
||||
poolCreateInfo.minAllocationAlignment = MIN_ALLOCATION_ALIGNMENT;
|
||||
res = vmaFindMemoryTypeIndexForBufferInfo(g_hAllocator, &bufCreateInfo, &allocCreateInfo, &poolCreateInfo.memoryTypeIndex);
|
||||
TEST(res == VK_SUCCESS);
|
||||
|
||||
VmaPool pool = VK_NULL_HANDLE;
|
||||
res = vmaCreatePool(g_hAllocator, &poolCreateInfo, &pool);
|
||||
TEST(res == VK_SUCCESS && pool != VK_NULL_HANDLE);
|
||||
|
||||
static const uint32_t BUF_COUNT = 4;
|
||||
allocCreateInfo = {};
|
||||
allocCreateInfo.pool = pool;
|
||||
std::vector<AllocInfo> allocs(BUF_COUNT);
|
||||
for(uint32_t i = 0; i < BUF_COUNT; ++i)
|
||||
{
|
||||
VmaAllocationInfo allocInfo = {};
|
||||
res = vmaCreateBuffer(g_hAllocator, &bufCreateInfo, &allocCreateInfo, &allocs[i].m_Buffer, &allocs[i].m_Allocation, &allocInfo);
|
||||
TEST(res == VK_SUCCESS && allocs[i].m_Buffer != VK_NULL_HANDLE && allocs[i].m_Allocation != VK_NULL_HANDLE);
|
||||
TEST(allocInfo.offset % MIN_ALLOCATION_ALIGNMENT == 0);
|
||||
}
|
||||
|
||||
// Cleanup.
|
||||
for(size_t i = allocs.size(); i--; )
|
||||
{
|
||||
allocs[i].Destroy();
|
||||
}
|
||||
vmaDestroyPool(g_hAllocator, pool);
|
||||
}
|
||||
|
||||
void TestHeapSizeLimit()
|
||||
{
|
||||
const VkDeviceSize HEAP_SIZE_LIMIT = 100ull * 1024 * 1024; // 100 MB
|
||||
@ -3800,7 +3848,7 @@ static void TestBufferDeviceAddress()
|
||||
{
|
||||
wprintf(L"Test buffer device address\n");
|
||||
|
||||
assert(g_BufferDeviceAddressEnabled);
|
||||
assert(VK_KHR_buffer_device_address_enabled);
|
||||
|
||||
VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
|
||||
bufCreateInfo.size = 0x10000;
|
||||
@ -3823,12 +3871,40 @@ static void TestBufferDeviceAddress()
|
||||
|
||||
VkBufferDeviceAddressInfoEXT bufferDeviceAddressInfo = { VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO_EXT };
|
||||
bufferDeviceAddressInfo.buffer = bufInfo.Buffer;
|
||||
//assert(g_vkGetBufferDeviceAddressEXT != nullptr);
|
||||
if(g_vkGetBufferDeviceAddressEXT != nullptr)
|
||||
{
|
||||
VkDeviceAddress addr = g_vkGetBufferDeviceAddressEXT(g_hDevice, &bufferDeviceAddressInfo);
|
||||
TEST(addr != 0);
|
||||
}
|
||||
TEST(g_vkGetBufferDeviceAddressKHR != nullptr);
|
||||
VkDeviceAddress addr = g_vkGetBufferDeviceAddressKHR(g_hDevice, &bufferDeviceAddressInfo);
|
||||
TEST(addr != 0);
|
||||
|
||||
vmaDestroyBuffer(g_hAllocator, bufInfo.Buffer, bufInfo.Allocation);
|
||||
}
|
||||
}
|
||||
|
||||
static void TestMemoryPriority()
|
||||
{
|
||||
wprintf(L"Test memory priority\n");
|
||||
|
||||
assert(VK_EXT_memory_priority_enabled);
|
||||
|
||||
VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
|
||||
bufCreateInfo.size = 0x10000;
|
||||
bufCreateInfo.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT;
|
||||
|
||||
VmaAllocationCreateInfo allocCreateInfo = {};
|
||||
allocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;
|
||||
allocCreateInfo.priority = 1.f;
|
||||
|
||||
for(uint32_t testIndex = 0; testIndex < 2; ++testIndex)
|
||||
{
|
||||
// 1st is placed, 2nd is dedicated.
|
||||
if(testIndex == 1)
|
||||
allocCreateInfo.flags |= VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT;
|
||||
|
||||
BufferInfo bufInfo = {};
|
||||
VkResult res = vmaCreateBuffer(g_hAllocator, &bufCreateInfo, &allocCreateInfo,
|
||||
&bufInfo.Buffer, &bufInfo.Allocation, nullptr);
|
||||
TEST(res == VK_SUCCESS);
|
||||
|
||||
// There is nothing we can do to validate the priority.
|
||||
|
||||
vmaDestroyBuffer(g_hAllocator, bufInfo.Buffer, bufInfo.Allocation);
|
||||
}
|
||||
@ -4315,27 +4391,27 @@ static void TestPool_Benchmark(
|
||||
return sum + allocSize.Probability;
|
||||
});
|
||||
|
||||
VkBufferCreateInfo bufferInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
|
||||
bufferInfo.size = 256; // Whatever.
|
||||
bufferInfo.usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
|
||||
VkBufferCreateInfo bufferTemplateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
|
||||
bufferTemplateInfo.size = 256; // Whatever.
|
||||
bufferTemplateInfo.usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
|
||||
|
||||
VkImageCreateInfo imageInfo = { VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO };
|
||||
imageInfo.imageType = VK_IMAGE_TYPE_2D;
|
||||
imageInfo.extent.width = 256; // Whatever.
|
||||
imageInfo.extent.height = 256; // Whatever.
|
||||
imageInfo.extent.depth = 1;
|
||||
imageInfo.mipLevels = 1;
|
||||
imageInfo.arrayLayers = 1;
|
||||
imageInfo.format = VK_FORMAT_R8G8B8A8_UNORM;
|
||||
imageInfo.tiling = VK_IMAGE_TILING_OPTIMAL; // LINEAR if CPU memory.
|
||||
imageInfo.initialLayout = VK_IMAGE_LAYOUT_PREINITIALIZED;
|
||||
imageInfo.usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT; // TRANSFER_SRC if CPU memory.
|
||||
imageInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
VkImageCreateInfo imageTemplateInfo = { VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO };
|
||||
imageTemplateInfo.imageType = VK_IMAGE_TYPE_2D;
|
||||
imageTemplateInfo.extent.width = 256; // Whatever.
|
||||
imageTemplateInfo.extent.height = 256; // Whatever.
|
||||
imageTemplateInfo.extent.depth = 1;
|
||||
imageTemplateInfo.mipLevels = 1;
|
||||
imageTemplateInfo.arrayLayers = 1;
|
||||
imageTemplateInfo.format = VK_FORMAT_R8G8B8A8_UNORM;
|
||||
imageTemplateInfo.tiling = VK_IMAGE_TILING_OPTIMAL; // LINEAR if CPU memory.
|
||||
imageTemplateInfo.initialLayout = VK_IMAGE_LAYOUT_PREINITIALIZED;
|
||||
imageTemplateInfo.usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT; // TRANSFER_SRC if CPU memory.
|
||||
imageTemplateInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
|
||||
uint32_t bufferMemoryTypeBits = UINT32_MAX;
|
||||
{
|
||||
VkBuffer dummyBuffer;
|
||||
VkResult res = vkCreateBuffer(g_hDevice, &bufferInfo, g_Allocs, &dummyBuffer);
|
||||
VkResult res = vkCreateBuffer(g_hDevice, &bufferTemplateInfo, g_Allocs, &dummyBuffer);
|
||||
TEST(res == VK_SUCCESS);
|
||||
|
||||
VkMemoryRequirements memReq;
|
||||
@ -4348,7 +4424,7 @@ static void TestPool_Benchmark(
|
||||
uint32_t imageMemoryTypeBits = UINT32_MAX;
|
||||
{
|
||||
VkImage dummyImage;
|
||||
VkResult res = vkCreateImage(g_hDevice, &imageInfo, g_Allocs, &dummyImage);
|
||||
VkResult res = vkCreateImage(g_hDevice, &imageTemplateInfo, g_Allocs, &dummyImage);
|
||||
TEST(res == VK_SUCCESS);
|
||||
|
||||
VkMemoryRequirements memReq;
|
||||
@ -4376,32 +4452,67 @@ static void TestPool_Benchmark(
|
||||
TEST(0);
|
||||
|
||||
VmaPoolCreateInfo poolCreateInfo = {};
|
||||
poolCreateInfo.memoryTypeIndex = 0;
|
||||
poolCreateInfo.minBlockCount = 1;
|
||||
poolCreateInfo.maxBlockCount = 1;
|
||||
poolCreateInfo.blockSize = config.PoolSize;
|
||||
poolCreateInfo.frameInUseCount = 1;
|
||||
|
||||
VmaAllocationCreateInfo dummyAllocCreateInfo = {};
|
||||
dummyAllocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;
|
||||
vmaFindMemoryTypeIndex(g_hAllocator, memoryTypeBits, &dummyAllocCreateInfo, &poolCreateInfo.memoryTypeIndex);
|
||||
const VkPhysicalDeviceMemoryProperties* memProps = nullptr;
|
||||
vmaGetMemoryProperties(g_hAllocator, &memProps);
|
||||
|
||||
VmaPool pool;
|
||||
VkResult res = vmaCreatePool(g_hAllocator, &poolCreateInfo, &pool);
|
||||
TEST(res == VK_SUCCESS);
|
||||
VmaPool pool = VK_NULL_HANDLE;
|
||||
VkResult res;
|
||||
// Loop over memory types because we sometimes allocate a big block here,
|
||||
// while the most eligible DEVICE_LOCAL heap may be only 256 MB on some GPUs.
|
||||
while(memoryTypeBits)
|
||||
{
|
||||
VmaAllocationCreateInfo dummyAllocCreateInfo = {};
|
||||
dummyAllocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;
|
||||
vmaFindMemoryTypeIndex(g_hAllocator, memoryTypeBits, &dummyAllocCreateInfo, &poolCreateInfo.memoryTypeIndex);
|
||||
|
||||
const uint32_t heapIndex = memProps->memoryTypes[poolCreateInfo.memoryTypeIndex].heapIndex;
|
||||
// Protection against validation layer error when trying to allocate a block larger than entire heap size,
|
||||
// which may be only 256 MB on some platforms.
|
||||
if(poolCreateInfo.blockSize * poolCreateInfo.minBlockCount < memProps->memoryHeaps[heapIndex].size)
|
||||
{
|
||||
res = vmaCreatePool(g_hAllocator, &poolCreateInfo, &pool);
|
||||
if(res == VK_SUCCESS)
|
||||
break;
|
||||
}
|
||||
memoryTypeBits &= ~(1u << poolCreateInfo.memoryTypeIndex);
|
||||
}
|
||||
TEST(pool);
|
||||
|
||||
// Start time measurement - after creating pool and initializing data structures.
|
||||
time_point timeBeg = std::chrono::high_resolution_clock::now();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ThreadProc
|
||||
auto ThreadProc = [&](
|
||||
auto ThreadProc = [&config, allocationSizeProbabilitySum, pool](
|
||||
PoolTestThreadResult* outThreadResult,
|
||||
uint32_t randSeed,
|
||||
HANDLE frameStartEvent,
|
||||
HANDLE frameEndEvent) -> void
|
||||
{
|
||||
RandomNumberGenerator threadRand{randSeed};
|
||||
VkResult res = VK_SUCCESS;
|
||||
|
||||
VkBufferCreateInfo bufferInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
|
||||
bufferInfo.size = 256; // Whatever.
|
||||
bufferInfo.usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
|
||||
|
||||
VkImageCreateInfo imageInfo = { VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO };
|
||||
imageInfo.imageType = VK_IMAGE_TYPE_2D;
|
||||
imageInfo.extent.width = 256; // Whatever.
|
||||
imageInfo.extent.height = 256; // Whatever.
|
||||
imageInfo.extent.depth = 1;
|
||||
imageInfo.mipLevels = 1;
|
||||
imageInfo.arrayLayers = 1;
|
||||
imageInfo.format = VK_FORMAT_R8G8B8A8_UNORM;
|
||||
imageInfo.tiling = VK_IMAGE_TILING_OPTIMAL; // LINEAR if CPU memory.
|
||||
imageInfo.initialLayout = VK_IMAGE_LAYOUT_PREINITIALIZED;
|
||||
imageInfo.usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT; // TRANSFER_SRC if CPU memory.
|
||||
imageInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
|
||||
outThreadResult->AllocationTimeMin = duration::max();
|
||||
outThreadResult->AllocationTimeSum = duration::zero();
|
||||
@ -4418,16 +4529,62 @@ static void TestPool_Benchmark(
|
||||
|
||||
struct Item
|
||||
{
|
||||
VkDeviceSize BufferSize;
|
||||
VkExtent2D ImageSize;
|
||||
VkBuffer Buf;
|
||||
VkImage Image;
|
||||
VmaAllocation Alloc;
|
||||
VkDeviceSize BufferSize = 0;
|
||||
VkExtent2D ImageSize = { 0, 0 };
|
||||
VkBuffer Buf = VK_NULL_HANDLE;
|
||||
VkImage Image = VK_NULL_HANDLE;
|
||||
VmaAllocation Alloc = VK_NULL_HANDLE;
|
||||
|
||||
Item() { }
|
||||
Item(Item&& src) :
|
||||
BufferSize(src.BufferSize), ImageSize(src.ImageSize), Buf(src.Buf), Image(src.Image), Alloc(src.Alloc)
|
||||
{
|
||||
src.BufferSize = 0;
|
||||
src.ImageSize = {0, 0};
|
||||
src.Buf = VK_NULL_HANDLE;
|
||||
src.Image = VK_NULL_HANDLE;
|
||||
src.Alloc = VK_NULL_HANDLE;
|
||||
}
|
||||
Item(const Item& src) = delete;
|
||||
~Item()
|
||||
{
|
||||
DestroyResources();
|
||||
}
|
||||
Item& operator=(Item&& src)
|
||||
{
|
||||
if(&src != this)
|
||||
{
|
||||
DestroyResources();
|
||||
BufferSize = src.BufferSize; ImageSize = src.ImageSize;
|
||||
Buf = src.Buf; Image = src.Image; Alloc = src.Alloc;
|
||||
src.BufferSize = 0;
|
||||
src.ImageSize = {0, 0};
|
||||
src.Buf = VK_NULL_HANDLE;
|
||||
src.Image = VK_NULL_HANDLE;
|
||||
src.Alloc = VK_NULL_HANDLE;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
Item& operator=(const Item& src) = delete;
|
||||
void DestroyResources()
|
||||
{
|
||||
if(Buf)
|
||||
{
|
||||
assert(Image == VK_NULL_HANDLE);
|
||||
vmaDestroyBuffer(g_hAllocator, Buf, Alloc);
|
||||
Buf = VK_NULL_HANDLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
vmaDestroyImage(g_hAllocator, Image, Alloc);
|
||||
Image = VK_NULL_HANDLE;
|
||||
}
|
||||
Alloc = VK_NULL_HANDLE;
|
||||
}
|
||||
VkDeviceSize CalcSizeBytes() const
|
||||
{
|
||||
return BufferSize +
|
||||
ImageSize.width * ImageSize.height * 4;
|
||||
4ull * ImageSize.width * ImageSize.height;
|
||||
}
|
||||
};
|
||||
std::vector<Item> unusedItems, usedItems;
|
||||
@ -4469,11 +4626,13 @@ static void TestPool_Benchmark(
|
||||
}
|
||||
}
|
||||
|
||||
unusedItems.push_back(item);
|
||||
unusedItems.push_back(std::move(item));
|
||||
}
|
||||
|
||||
auto Allocate = [&](Item& item) -> VkResult
|
||||
{
|
||||
assert(item.Buf == VK_NULL_HANDLE && item.Image == VK_NULL_HANDLE && item.Alloc == VK_NULL_HANDLE);
|
||||
|
||||
VmaAllocationCreateInfo allocCreateInfo = {};
|
||||
allocCreateInfo.pool = pool;
|
||||
allocCreateInfo.flags = VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT |
|
||||
@ -4482,8 +4641,14 @@ static void TestPool_Benchmark(
|
||||
if(item.BufferSize)
|
||||
{
|
||||
bufferInfo.size = item.BufferSize;
|
||||
PoolAllocationTimeRegisterObj timeRegisterObj(*outThreadResult);
|
||||
return vmaCreateBuffer(g_hAllocator, &bufferInfo, &allocCreateInfo, &item.Buf, &item.Alloc, nullptr);
|
||||
VkResult res = VK_SUCCESS;
|
||||
{
|
||||
PoolAllocationTimeRegisterObj timeRegisterObj(*outThreadResult);
|
||||
res = vmaCreateBuffer(g_hAllocator, &bufferInfo, &allocCreateInfo, &item.Buf, &item.Alloc, nullptr);
|
||||
}
|
||||
if(res == VK_SUCCESS)
|
||||
SetDebugUtilsObjectName(VK_OBJECT_TYPE_BUFFER, (uint64_t)item.Buf, "TestPool_Benchmark_Buffer");
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4491,8 +4656,14 @@ static void TestPool_Benchmark(
|
||||
|
||||
imageInfo.extent.width = item.ImageSize.width;
|
||||
imageInfo.extent.height = item.ImageSize.height;
|
||||
PoolAllocationTimeRegisterObj timeRegisterObj(*outThreadResult);
|
||||
return vmaCreateImage(g_hAllocator, &imageInfo, &allocCreateInfo, &item.Image, &item.Alloc, nullptr);
|
||||
VkResult res = VK_SUCCESS;
|
||||
{
|
||||
PoolAllocationTimeRegisterObj timeRegisterObj(*outThreadResult);
|
||||
res = vmaCreateImage(g_hAllocator, &imageInfo, &allocCreateInfo, &item.Image, &item.Alloc, nullptr);
|
||||
}
|
||||
if(res == VK_SUCCESS)
|
||||
SetDebugUtilsObjectName(VK_OBJECT_TYPE_IMAGE, (uint64_t)item.Image, "TestPool_Benchmark_Image");
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
@ -4507,8 +4678,10 @@ static void TestPool_Benchmark(
|
||||
for(size_t i = 0; i < bufsToMakeUnused; ++i)
|
||||
{
|
||||
size_t index = threadRand.Generate() % usedItems.size();
|
||||
unusedItems.push_back(usedItems[index]);
|
||||
usedItems.erase(usedItems.begin() + index);
|
||||
auto it = usedItems.begin() + index;
|
||||
Item item = std::move(*it);
|
||||
usedItems.erase(it);
|
||||
unusedItems.push_back(std::move(item));
|
||||
}
|
||||
|
||||
// Determine which bufs we want to use in this frame.
|
||||
@ -4519,15 +4692,19 @@ static void TestPool_Benchmark(
|
||||
while(usedBufCount < usedItems.size())
|
||||
{
|
||||
size_t index = threadRand.Generate() % usedItems.size();
|
||||
unusedItems.push_back(usedItems[index]);
|
||||
usedItems.erase(usedItems.begin() + index);
|
||||
auto it = usedItems.begin() + index;
|
||||
Item item = std::move(*it);
|
||||
usedItems.erase(it);
|
||||
unusedItems.push_back(std::move(item));
|
||||
}
|
||||
// Move some unused to used.
|
||||
while(usedBufCount > usedItems.size())
|
||||
{
|
||||
size_t index = threadRand.Generate() % unusedItems.size();
|
||||
usedItems.push_back(unusedItems[index]);
|
||||
unusedItems.erase(unusedItems.begin() + index);
|
||||
auto it = unusedItems.begin() + index;
|
||||
Item item = std::move(*it);
|
||||
unusedItems.erase(it);
|
||||
usedItems.push_back(std::move(item));
|
||||
}
|
||||
|
||||
uint32_t touchExistingCount = 0;
|
||||
@ -4546,8 +4723,7 @@ static void TestPool_Benchmark(
|
||||
++outThreadResult->AllocationCount;
|
||||
if(res != VK_SUCCESS)
|
||||
{
|
||||
item.Alloc = VK_NULL_HANDLE;
|
||||
item.Buf = VK_NULL_HANDLE;
|
||||
assert(item.Alloc == VK_NULL_HANDLE && item.Buf == VK_NULL_HANDLE && item.Image == VK_NULL_HANDLE);
|
||||
++outThreadResult->FailedAllocationCount;
|
||||
outThreadResult->FailedAllocationTotalSize += item.CalcSizeBytes();
|
||||
++createFailedCount;
|
||||
@ -4568,14 +4744,9 @@ static void TestPool_Benchmark(
|
||||
// Destroy.
|
||||
{
|
||||
PoolDeallocationTimeRegisterObj timeRegisterObj(*outThreadResult);
|
||||
if(item.Buf)
|
||||
vmaDestroyBuffer(g_hAllocator, item.Buf, item.Alloc);
|
||||
else
|
||||
vmaDestroyImage(g_hAllocator, item.Image, item.Alloc);
|
||||
item.DestroyResources();
|
||||
++outThreadResult->DeallocationCount;
|
||||
}
|
||||
item.Alloc = VK_NULL_HANDLE;
|
||||
item.Buf = VK_NULL_HANDLE;
|
||||
|
||||
++outThreadResult->LostAllocationCount;
|
||||
outThreadResult->LostAllocationTotalSize += item.CalcSizeBytes();
|
||||
@ -4586,6 +4757,7 @@ static void TestPool_Benchmark(
|
||||
// Creation failed.
|
||||
if(res != VK_SUCCESS)
|
||||
{
|
||||
TEST(item.Alloc == VK_NULL_HANDLE && item.Buf == VK_NULL_HANDLE && item.Image == VK_NULL_HANDLE);
|
||||
++outThreadResult->FailedAllocationCount;
|
||||
outThreadResult->FailedAllocationTotalSize += item.CalcSizeBytes();
|
||||
++createFailedCount;
|
||||
@ -4612,19 +4784,13 @@ static void TestPool_Benchmark(
|
||||
for(size_t i = usedItems.size(); i--; )
|
||||
{
|
||||
PoolDeallocationTimeRegisterObj timeRegisterObj(*outThreadResult);
|
||||
if(usedItems[i].Buf)
|
||||
vmaDestroyBuffer(g_hAllocator, usedItems[i].Buf, usedItems[i].Alloc);
|
||||
else
|
||||
vmaDestroyImage(g_hAllocator, usedItems[i].Image, usedItems[i].Alloc);
|
||||
usedItems[i].DestroyResources();
|
||||
++outThreadResult->DeallocationCount;
|
||||
}
|
||||
for(size_t i = unusedItems.size(); i--; )
|
||||
{
|
||||
PoolDeallocationTimeRegisterObj timeRegisterOb(*outThreadResult);
|
||||
if(unusedItems[i].Buf)
|
||||
vmaDestroyBuffer(g_hAllocator, unusedItems[i].Buf, unusedItems[i].Alloc);
|
||||
else
|
||||
vmaDestroyImage(g_hAllocator, unusedItems[i].Image, unusedItems[i].Alloc);
|
||||
unusedItems[i].DestroyResources();
|
||||
++outThreadResult->DeallocationCount;
|
||||
}
|
||||
};
|
||||
@ -5663,6 +5829,8 @@ static void PerformCustomPoolTest(FILE* file)
|
||||
|
||||
static void PerformMainTests(FILE* file)
|
||||
{
|
||||
wprintf(L"MAIN TESTS:\n");
|
||||
|
||||
uint32_t repeatCount = 1;
|
||||
if(ConfigType >= CONFIG_TYPE_MAXIMUM) repeatCount = 3;
|
||||
|
||||
@ -5928,6 +6096,8 @@ static void PerformMainTests(FILE* file)
|
||||
|
||||
static void PerformPoolTests(FILE* file)
|
||||
{
|
||||
wprintf(L"POOL TESTS:\n");
|
||||
|
||||
const size_t AVG_RESOURCES_PER_POOL = 300;
|
||||
|
||||
uint32_t repeatCount = 1;
|
||||
@ -6408,6 +6578,7 @@ void Test()
|
||||
#else
|
||||
TestPool_SameSize();
|
||||
TestPool_MinBlockCount();
|
||||
TestPool_MinAllocationAlignment();
|
||||
TestHeapSizeLimit();
|
||||
#endif
|
||||
#if VMA_DEBUG_INITIALIZE_ALLOCATIONS
|
||||
@ -6427,8 +6598,10 @@ void Test()
|
||||
BasicTestBuddyAllocator();
|
||||
BasicTestAllocatePages();
|
||||
|
||||
if(g_BufferDeviceAddressEnabled)
|
||||
if(VK_KHR_buffer_device_address_enabled)
|
||||
TestBufferDeviceAddress();
|
||||
if(VK_EXT_memory_priority_enabled)
|
||||
TestMemoryPriority();
|
||||
|
||||
{
|
||||
FILE* file;
|
||||
@ -6460,7 +6633,7 @@ void Test()
|
||||
|
||||
fclose(file);
|
||||
|
||||
wprintf(L"Done.\n");
|
||||
wprintf(L"Done, all PASSED.\n");
|
||||
}
|
||||
|
||||
#endif // #ifdef _WIN32
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
// Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
24
src/VmaReplay/CMakeLists.txt
Normal file
24
src/VmaReplay/CMakeLists.txt
Normal file
@ -0,0 +1,24 @@
|
||||
# This file will only be executed if VMA_BUILD_REPLAY is set to ON
|
||||
|
||||
if (WIN32)
|
||||
set(VMA_REPLAY_SOURCE_FILES
|
||||
Common.cpp
|
||||
Constants.cpp
|
||||
VmaReplay.cpp
|
||||
VmaUsage.cpp
|
||||
)
|
||||
|
||||
add_executable(VmaReplay ${VMA_REPLAY_SOURCE_FILES})
|
||||
|
||||
# Enable multithreaded compiling
|
||||
target_compile_options(VmaReplay PRIVATE "/MP")
|
||||
|
||||
target_link_libraries(
|
||||
VmaReplay
|
||||
|
||||
PRIVATE
|
||||
Vulkan::Vulkan
|
||||
)
|
||||
else()
|
||||
message(STATUS "VmaReplay is not supported on Linux")
|
||||
endif()
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
// Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
// Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
// Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
// Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2018-2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
// Copyright (c) 2018-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@ -1089,7 +1089,7 @@ private:
|
||||
Extension_VK_EXT_memory_budget,
|
||||
Extension_VK_AMD_device_coherent_memory,
|
||||
Macro_VMA_DEBUG_ALWAYS_DEDICATED_MEMORY,
|
||||
Macro_VMA_DEBUG_ALIGNMENT,
|
||||
Macro_VMA_MIN_ALIGNMENT,
|
||||
Macro_VMA_DEBUG_MARGIN,
|
||||
Macro_VMA_DEBUG_INITIALIZE_ALLOCATIONS,
|
||||
Macro_VMA_DEBUG_DETECT_CORRUPTION,
|
||||
@ -1237,8 +1237,8 @@ bool ConfigurationParser::Parse(LineSplit& lineSplit)
|
||||
const StrRange subOptionName = csvSplit.GetRange(1);
|
||||
if(StrRangeEq(subOptionName, "VMA_DEBUG_ALWAYS_DEDICATED_MEMORY"))
|
||||
SetOption(currLineNumber, OPTION::Macro_VMA_DEBUG_ALWAYS_DEDICATED_MEMORY, csvSplit.GetRange(2));
|
||||
else if(StrRangeEq(subOptionName, "VMA_DEBUG_ALIGNMENT"))
|
||||
SetOption(currLineNumber, OPTION::Macro_VMA_DEBUG_ALIGNMENT, csvSplit.GetRange(2));
|
||||
else if(StrRangeEq(subOptionName, "VMA_MIN_ALIGNMENT") || StrRangeEq(subOptionName, "VMA_DEBUG_ALIGNMENT"))
|
||||
SetOption(currLineNumber, OPTION::Macro_VMA_MIN_ALIGNMENT, csvSplit.GetRange(2));
|
||||
else if(StrRangeEq(subOptionName, "VMA_DEBUG_MARGIN"))
|
||||
SetOption(currLineNumber, OPTION::Macro_VMA_DEBUG_MARGIN, csvSplit.GetRange(2));
|
||||
else if(StrRangeEq(subOptionName, "VMA_DEBUG_INITIALIZE_ALLOCATIONS"))
|
||||
@ -3683,7 +3683,8 @@ void Player::ExecuteResizeAllocation(size_t lineNumber, const CsvSplit& csvSplit
|
||||
const auto it = m_Allocations.find(origPtr);
|
||||
if(it != m_Allocations.end())
|
||||
{
|
||||
vmaResizeAllocation(m_Allocator, it->second.allocation, newSize);
|
||||
// Do nothing - the function was deprecated and has been removed.
|
||||
//vmaResizeAllocation(m_Allocator, it->second.allocation, newSize);
|
||||
UpdateMemStats();
|
||||
}
|
||||
else
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
// Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
// Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@ -45,6 +45,6 @@
|
||||
#pragma warning(disable: 4189) // local variable is initialized but not referenced
|
||||
#pragma warning(disable: 4324) // structure was padded due to alignment specifier
|
||||
|
||||
#include "../vk_mem_alloc.h"
|
||||
#include "../../include/vk_mem_alloc.h"
|
||||
|
||||
#pragma warning(pop)
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
// Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
// Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@ -48,21 +48,15 @@ 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
|
||||
#define VMA_VULKAN_VERSION 1002000 // Vulkan 1.2
|
||||
//#define VMA_VULKAN_VERSION 1001000 // Vulkan 1.1
|
||||
//#define VMA_VULKAN_VERSION 1000000 // Vulkan 1.0
|
||||
|
||||
/*
|
||||
@ -89,7 +83,7 @@ include all public interface declarations. Example:
|
||||
#pragma clang diagnostic ignored "-Wnullability-completeness"
|
||||
#endif
|
||||
|
||||
#include "vk_mem_alloc.h"
|
||||
#include "../include/vk_mem_alloc.h"
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
|
1023
src/VulkanSample.cpp
1023
src/VulkanSample.cpp
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2018-2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
# Copyright (c) 2018-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
|
Loading…
Reference in New Issue
Block a user