summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/VulkanMemoryAllocator/patches/0002-Make-it-compile-on-macOS-10.15.patch52
-rw-r--r--src/3rdparty/VulkanMemoryAllocator/patches/0002-Switch-back-to-the-old-VK_VERSION_-etc.-from-VK_API_.patch33
-rw-r--r--src/3rdparty/VulkanMemoryAllocator/patches/0003-Disable-some-warnings-for-gcc-and-clang.patch50
-rw-r--r--src/3rdparty/VulkanMemoryAllocator/patches/0003-Fix-gcc-8-warning.patch27
-rw-r--r--src/3rdparty/VulkanMemoryAllocator/patches/0004-Avoid-compiler-warnings.patch327
-rw-r--r--src/3rdparty/VulkanMemoryAllocator/patches/0004-Disable-nullability-warning-on-Apple-with-clang.patch27
-rw-r--r--src/3rdparty/VulkanMemoryAllocator/patches/0005-Disable-more-warnings.patch33
-rw-r--r--src/3rdparty/VulkanMemoryAllocator/patches/0005-More-MingW-8.1-warning-workarounds.patch150
-rw-r--r--src/3rdparty/VulkanMemoryAllocator/patches/0006-Silence-clang-warning-about-unused-member-var.patch40
-rw-r--r--src/3rdparty/VulkanMemoryAllocator/patches/0006-vma-Revise-disabled-warnings.patch28
-rw-r--r--src/3rdparty/VulkanMemoryAllocator/qt_attribution.json4
-rw-r--r--src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h23915
-rw-r--r--src/3rdparty/forkfd/forkfd_c11.h4
-rw-r--r--src/3rdparty/forkfd/forkfd_linux.c3
-rw-r--r--src/3rdparty/gradle/CMakeLists.txt39
-rw-r--r--src/3rdparty/gradle/gradle/wrapper/gradle-wrapper.properties2
-rw-r--r--src/3rdparty/gradle/qt_attribution.json4
-rw-r--r--src/3rdparty/harfbuzz-ng/CMakeLists.txt2
-rw-r--r--src/3rdparty/icc/qt_attribution.json2
-rw-r--r--src/3rdparty/libjpeg/qt_attribution.json2
-rw-r--r--src/3rdparty/libjpeg/src/ChangeLog.md35
-rw-r--r--src/3rdparty/libjpeg/src/jconfig.h4
-rw-r--r--src/3rdparty/libjpeg/src/jconfigint.h2
-rw-r--r--src/3rdparty/libjpeg/src/jdapistd.c13
-rw-r--r--src/3rdparty/libjpeg/src/jdcoefct.c6
-rw-r--r--src/3rdparty/libjpeg/src/jerror.c4
-rw-r--r--src/3rdparty/libjpeg/src/jinclude.h12
-rw-r--r--src/3rdparty/libjpeg/src/jmemmgr.c13
-rw-r--r--src/3rdparty/libpng/ANNOUNCE39
-rw-r--r--src/3rdparty/libpng/CHANGES32
-rw-r--r--src/3rdparty/libpng/CMakeLists.txt2
-rw-r--r--src/3rdparty/libpng/INSTALL85
-rw-r--r--src/3rdparty/libpng/LICENSE4
-rw-r--r--src/3rdparty/libpng/README143
-rw-r--r--src/3rdparty/libpng/libpng-manual.txt10
-rw-r--r--src/3rdparty/libpng/png.c16
-rw-r--r--src/3rdparty/libpng/png.h26
-rw-r--r--src/3rdparty/libpng/pngconf.h8
-rw-r--r--src/3rdparty/libpng/pngget.c14
-rw-r--r--src/3rdparty/libpng/pnglibconf.h4
-rw-r--r--src/3rdparty/libpng/pngpriv.h78
-rw-r--r--src/3rdparty/libpng/pngread.c7
-rw-r--r--src/3rdparty/libpng/pngrtran.c2
-rw-r--r--src/3rdparty/libpng/pngrutil.c32
-rw-r--r--src/3rdparty/libpng/pngset.c13
-rw-r--r--src/3rdparty/libpng/pngstruct.h12
-rw-r--r--src/3rdparty/libpng/pngwrite.c20
-rw-r--r--src/3rdparty/libpng/pngwutil.c6
-rw-r--r--src/3rdparty/libpng/qt_attribution.json13
-rw-r--r--src/3rdparty/libpng/qtpatches.diff62
-rw-r--r--src/3rdparty/libpsl/PSL-LICENSE.txt (renamed from src/network/kernel/PSL-LICENSE.txt)0
-rw-r--r--src/3rdparty/libpsl/README.txt (renamed from src/network/kernel/qurltlds_p.h.INFO)8
-rw-r--r--src/3rdparty/libpsl/psl_data.cpp (renamed from src/network/kernel/qurltlds_p.h)0
-rw-r--r--src/3rdparty/libpsl/qt_attribution.json30
-rw-r--r--src/3rdparty/md4/qt_attribution.json1
-rw-r--r--src/3rdparty/md5/qt_attribution.json1
-rw-r--r--src/3rdparty/sha1/qt_attribution.json1
-rw-r--r--src/3rdparty/sqlite/qt_attribution.json1
-rw-r--r--src/3rdparty/zlib/CMakeLists.txt2
-rw-r--r--src/3rdparty/zlib/qt_attribution.json6
-rw-r--r--src/3rdparty/zlib/qtpatches.diff26
-rw-r--r--src/3rdparty/zlib/src/ChangeLog26
-rw-r--r--src/3rdparty/zlib/src/README4
-rw-r--r--src/3rdparty/zlib/src/compress.c6
-rw-r--r--src/3rdparty/zlib/src/crc32.c33
-rw-r--r--src/3rdparty/zlib/src/deflate.c218
-rw-r--r--src/3rdparty/zlib/src/deflate.h4
-rw-r--r--src/3rdparty/zlib/src/gzlib.c2
-rw-r--r--src/3rdparty/zlib/src/gzread.c8
-rw-r--r--src/3rdparty/zlib/src/gzwrite.c2
-rw-r--r--src/3rdparty/zlib/src/infback.c17
-rw-r--r--src/3rdparty/zlib/src/inflate.c7
-rw-r--r--src/3rdparty/zlib/src/inftrees.c4
-rw-r--r--src/3rdparty/zlib/src/inftrees.h2
-rw-r--r--src/3rdparty/zlib/src/trees.c123
-rw-r--r--src/3rdparty/zlib/src/uncompr.c4
-rw-r--r--src/3rdparty/zlib/src/zconf.h19
-rw-r--r--src/3rdparty/zlib/src/zlib.h20
-rw-r--r--src/3rdparty/zlib/src/zutil.c16
-rw-r--r--src/3rdparty/zlib/src/zutil.h1
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/android/CMakeLists.txt2
-rw-r--r--src/android/jar/CMakeLists.txt2
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/CursorHandle.java3
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/ExtractStyle.java37
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtActivityDelegate.java39
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtInputConnection.java16
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtLayout.java142
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtNative.java74
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/accessibility/QtAccessibilityDelegate.java33
-rw-r--r--src/android/java/CMakeLists.txt46
-rw-r--r--src/android/java/src/org/qtproject/qt/android/bindings/QtActivity.java48
-rw-r--r--src/android/java/src/org/qtproject/qt/android/bindings/QtActivityLoader.java38
-rw-r--r--src/android/java/src/org/qtproject/qt/android/bindings/QtApplication.java38
-rw-r--r--src/android/java/src/org/qtproject/qt/android/bindings/QtLoader.java41
-rw-r--r--src/android/java/src/org/qtproject/qt/android/bindings/QtService.java38
-rw-r--r--src/android/java/src/org/qtproject/qt/android/bindings/QtServiceLoader.java38
-rw-r--r--src/android/templates/CMakeLists.txt15
-rw-r--r--src/android/templates/build.gradle2
-rw-r--r--src/android/templates/doc/src/android-manifest-file-configuration.qdoc2
-rw-r--r--src/concurrent/CMakeLists.txt2
-rw-r--r--src/concurrent/doc/snippets/CMakeLists.txt2
-rw-r--r--src/concurrent/qtaskbuilder.h6
-rw-r--r--src/concurrent/qtconcurrentfilter.h26
-rw-r--r--src/concurrent/qtconcurrentfilterkernel.h2
-rw-r--r--src/concurrent/qtconcurrentfunctionwrappers.h2
-rw-r--r--src/concurrent/qtconcurrentiteratekernel.cpp2
-rw-r--r--src/concurrent/qtconcurrentiteratekernel.h4
-rw-r--r--src/concurrent/qtconcurrentmap.h34
-rw-r--r--src/concurrent/qtconcurrentmapkernel.h2
-rw-r--r--src/concurrent/qtconcurrentmedian.h2
-rw-r--r--src/concurrent/qtconcurrentreducekernel.h6
-rw-r--r--src/concurrent/qtconcurrentrun.h6
-rw-r--r--src/concurrent/qtconcurrenttask.h4
-rw-r--r--src/concurrent/qtconcurrentthreadengine.cpp2
-rw-r--r--src/concurrent/qtconcurrentthreadengine.h2
-rw-r--r--src/corelib/CMakeLists.txt339
-rw-r--r--src/corelib/Qt6AndroidMacros.cmake113
-rw-r--r--src/corelib/Qt6CTestMacros.cmake68
-rw-r--r--src/corelib/Qt6CoreConfigExtras.cmake.in30
-rw-r--r--src/corelib/Qt6CoreDeploySupport.cmake374
-rw-r--r--src/corelib/Qt6CoreMacros.cmake995
-rw-r--r--src/corelib/Qt6WasmMacros.cmake83
-rw-r--r--src/corelib/QtCompressMimeDatabase.cmake156
-rw-r--r--src/corelib/QtInstallPaths.cmake.in16
-rw-r--r--src/corelib/animation/qabstractanimation.cpp10
-rw-r--r--src/corelib/animation/qabstractanimation_p.h2
-rw-r--r--src/corelib/animation/qanimationgroup.cpp4
-rw-r--r--src/corelib/animation/qpropertyanimation.cpp4
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.cpp6
-rw-r--r--src/corelib/animation/qvariantanimation.cpp12
-rw-r--r--src/corelib/compat/removed_api.cpp59
-rw-r--r--src/corelib/configure.cmake39
-rw-r--r--src/corelib/doc/include/QtCoreDoc1
-rw-r--r--src/corelib/doc/qtcore.qdocconf3
-rw-r--r--src/corelib/doc/snippets/cmake-macros/deployment.cmake27
-rw-r--r--src/corelib/doc/snippets/cmake-macros/examples.cmake2
-rw-r--r--src/corelib/doc/snippets/code/doc_src_containers.cpp71
-rw-r--r--src/corelib/doc/snippets/code/doc_src_qplugin.pro4
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_animation_qpropertyanimation.cpp94
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp13
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_kernel_qmetaobject.cpp33
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_kernel_qmetatype.cpp10
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_text_qbytearray.cpp11
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_text_qstring.cpp3
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp6
-rw-r--r--src/corelib/doc/snippets/code/src_gui_dialogs_qmessagebox.cpp4
-rw-r--r--src/corelib/doc/snippets/fileinfo/main.cpp8
-rw-r--r--src/corelib/doc/snippets/qmetatype/registerConverters.cpp8
-rw-r--r--src/corelib/doc/snippets/qsignalmapper/buttonwidget.cpp7
-rw-r--r--src/corelib/doc/snippets/qstringlist/main.cpp18
-rw-r--r--src/corelib/doc/snippets/resource-system/CMakeLists.txt2
-rw-r--r--src/corelib/doc/src/animation.qdoc338
-rw-r--r--src/corelib/doc/src/cbor.qdoc78
-rw-r--r--src/corelib/doc/src/cmake/cmake-commands.qdoc1
-rw-r--r--src/corelib/doc/src/cmake/cmake-configure-variables.qdoc109
-rw-r--r--src/corelib/doc/src/cmake/cmake-deploy-variables.qdoc82
-rw-r--r--src/corelib/doc/src/cmake/cmake-properties.qdoc82
-rw-r--r--src/corelib/doc/src/cmake/qt_add_big_resources.qdoc2
-rw-r--r--src/corelib/doc/src/cmake/qt_add_binary_resources.qdoc2
-rw-r--r--src/corelib/doc/src/cmake/qt_add_executable.qdoc33
-rw-r--r--src/corelib/doc/src/cmake/qt_add_library.qdoc3
-rw-r--r--src/corelib/doc/src/cmake/qt_add_plugin.qdoc16
-rw-r--r--src/corelib/doc/src/cmake/qt_add_resources.qdoc6
-rw-r--r--src/corelib/doc/src/cmake/qt_allow_non_utf8_sources.qdoc2
-rw-r--r--src/corelib/doc/src/cmake/qt_android_add_apk_target.qdoc2
-rw-r--r--src/corelib/doc/src/cmake/qt_android_apply_arch_suffix.qdoc2
-rw-r--r--src/corelib/doc/src/cmake/qt_android_generate_deployment_settings.qdoc2
-rw-r--r--src/corelib/doc/src/cmake/qt_deploy_qt_conf.qdoc9
-rw-r--r--src/corelib/doc/src/cmake/qt_deploy_runtime_dependencies.qdoc37
-rw-r--r--src/corelib/doc/src/cmake/qt_deploy_translations.qdoc76
-rw-r--r--src/corelib/doc/src/cmake/qt_disable_unicode_defines.qdoc2
-rw-r--r--src/corelib/doc/src/cmake/qt_extract_metatypes.qdoc2
-rw-r--r--src/corelib/doc/src/cmake/qt_finalize_project.qdoc24
-rw-r--r--src/corelib/doc/src/cmake/qt_finalize_target.qdoc4
-rw-r--r--src/corelib/doc/src/cmake/qt_generate_deploy_app_script.qdoc32
-rw-r--r--src/corelib/doc/src/cmake/qt_generate_deploy_script.qdoc66
-rw-r--r--src/corelib/doc/src/cmake/qt_generate_moc.qdoc2
-rw-r--r--src/corelib/doc/src/cmake/qt_import_plugins.qdoc2
-rw-r--r--src/corelib/doc/src/cmake/qt_set_finalizer_mode.qdoc2
-rw-r--r--src/corelib/doc/src/cmake/qt_standard_project_setup.qdoc2
-rw-r--r--src/corelib/doc/src/cmake/qt_wrap_cpp.qdoc2
-rw-r--r--src/corelib/doc/src/containers.qdoc74
-rw-r--r--src/corelib/doc/src/datastreamformat.qdoc3
-rw-r--r--src/corelib/doc/src/includes/cmake-android-qt-finalize-project-warning.qdocinc (renamed from src/corelib/doc/src/includes/cmake-android-qt-finalize-project-warning.cmake)4
-rw-r--r--src/corelib/doc/src/includes/cmake-deploy-runtime-dependencies.qdocinc12
-rw-r--r--src/corelib/doc/src/includes/permissions.qdocinc51
-rw-r--r--src/corelib/doc/src/objectmodel/bindableproperties.qdoc14
-rw-r--r--src/corelib/doc/src/qtcore-index.qdoc1
-rw-r--r--src/corelib/global/archdetect.cpp8
-rw-r--r--src/corelib/global/q20algorithm.h91
-rw-r--r--src/corelib/global/q20functional.h6
-rw-r--r--src/corelib/global/q20iterator.h6
-rw-r--r--src/corelib/global/q23functional.h6
-rw-r--r--src/corelib/global/qassert.cpp22
-rw-r--r--src/corelib/global/qassert.h9
-rw-r--r--src/corelib/global/qcompare.qdoc2
-rw-r--r--src/corelib/global/qcompilerdetection.h42
-rw-r--r--src/corelib/global/qcompilerdetection.qdoc394
-rw-r--r--src/corelib/global/qconfig-bootstrapped.h4
-rw-r--r--src/corelib/global/qconstructormacros.h38
-rw-r--r--src/corelib/global/qdarwinhelpers.h37
-rw-r--r--src/corelib/global/qdarwinhelpers.qdoc34
-rw-r--r--src/corelib/global/qendian.cpp16
-rw-r--r--src/corelib/global/qendian.h2
-rw-r--r--src/corelib/global/qflags.h14
-rw-r--r--src/corelib/global/qflags.qdoc459
-rw-r--r--src/corelib/global/qfloat16.cpp16
-rw-r--r--src/corelib/global/qfloat16.h184
-rw-r--r--src/corelib/global/qforeach.h30
-rw-r--r--src/corelib/global/qforeach.qdoc72
-rw-r--r--src/corelib/global/qfunctionpointer.h23
-rw-r--r--src/corelib/global/qfunctionpointer.qdoc9
-rw-r--r--src/corelib/global/qglobal.cpp3324
-rw-r--r--src/corelib/global/qglobal.h228
-rw-r--r--src/corelib/global/qlibraryinfo.cpp53
-rw-r--r--src/corelib/global/qlibraryinfo.h31
-rw-r--r--src/corelib/global/qlogging.cpp358
-rw-r--r--src/corelib/global/qlogging.h27
-rw-r--r--src/corelib/global/qmalloc.cpp1
-rw-r--r--src/corelib/global/qmalloc.h26
-rw-r--r--src/corelib/global/qnamespace.h14
-rw-r--r--src/corelib/global/qnamespace.qdoc53
-rw-r--r--src/corelib/global/qnumeric.cpp203
-rw-r--r--src/corelib/global/qnumeric.h2
-rw-r--r--src/corelib/global/qnumeric_p.h39
-rw-r--r--src/corelib/global/qoperatingsystemversion.cpp57
-rw-r--r--src/corelib/global/qoperatingsystemversion.h11
-rw-r--r--src/corelib/global/qprocessordetection.h35
-rw-r--r--src/corelib/global/qprocessordetection.qdoc448
-rw-r--r--src/corelib/global/qrandom.cpp4
-rw-r--r--src/corelib/global/qsimd.h2
-rw-r--r--src/corelib/global/qsimd_p.h21
-rw-r--r--src/corelib/global/qswap.h54
-rw-r--r--src/corelib/global/qswap.qdoc14
-rw-r--r--src/corelib/global/qsysinfo.cpp1054
-rw-r--r--src/corelib/global/qsystemdetection.h1
-rw-r--r--src/corelib/global/qsystemdetection.qdoc202
-rw-r--r--src/corelib/global/qt_windows.h2
-rw-r--r--src/corelib/global/qtclasshelpermacros.h25
-rw-r--r--src/corelib/global/qtclasshelpermacros.qdoc4
-rw-r--r--src/corelib/global/qtconfigmacros.h46
-rw-r--r--src/corelib/global/qtdeprecationmarkers.h27
-rw-r--r--src/corelib/global/qtdeprecationmarkers.qdoc64
-rw-r--r--src/corelib/global/qtenvironmentvariables.cpp (renamed from src/corelib/global/qenvironmentvariables.cpp)16
-rw-r--r--src/corelib/global/qtenvironmentvariables.h (renamed from src/corelib/global/qenvironmentvariables.h)12
-rw-r--r--src/corelib/global/qtnoop.h13
-rw-r--r--src/corelib/global/qtpreprocessorsupport.h26
-rw-r--r--src/corelib/global/qtpreprocessorsupport.qdoc20
-rw-r--r--src/corelib/global/qtresource.h21
-rw-r--r--src/corelib/global/qtresource.qdoc54
-rw-r--r--src/corelib/global/qttranslation.h (renamed from src/corelib/global/qtranslation.h)13
-rw-r--r--src/corelib/global/qttranslation.qdoc (renamed from src/corelib/global/qtranslation.qdoc)18
-rw-r--r--src/corelib/global/qttypetraits.h50
-rw-r--r--src/corelib/global/qttypetraits.qdoc108
-rw-r--r--src/corelib/global/qtversionchecks.cpp2
-rw-r--r--src/corelib/global/qtversionchecks.h7
-rw-r--r--src/corelib/global/qtypeinfo.qdoc55
-rw-r--r--src/corelib/global/qtypes.cpp70
-rw-r--r--src/corelib/global/qversiontagging.h2
-rw-r--r--src/corelib/global/qxpfunctional.h6
-rw-r--r--src/corelib/global/qxptype_traits.h63
-rw-r--r--src/corelib/io/qbuffer.cpp15
-rw-r--r--src/corelib/io/qbuffer.h8
-rw-r--r--src/corelib/io/qdataurl.cpp4
-rw-r--r--src/corelib/io/qdebug.cpp95
-rw-r--r--src/corelib/io/qdebug.h41
-rw-r--r--src/corelib/io/qdebug_p.h2
-rw-r--r--src/corelib/io/qdir.cpp247
-rw-r--r--src/corelib/io/qdir.h16
-rw-r--r--src/corelib/io/qdir_p.h2
-rw-r--r--src/corelib/io/qdiriterator.cpp2
-rw-r--r--src/corelib/io/qfile.cpp11
-rw-r--r--src/corelib/io/qfile.h39
-rw-r--r--src/corelib/io/qfiledevice.cpp6
-rw-r--r--src/corelib/io/qfileinfo.h10
-rw-r--r--src/corelib/io/qfileselector.cpp2
-rw-r--r--src/corelib/io/qfilesystemengine.cpp6
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp70
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp29
-rw-r--r--src/corelib/io/qfilesystemmetadata_p.h14
-rw-r--r--src/corelib/io/qfilesystemwatcher_inotify.cpp2
-rw-r--r--src/corelib/io/qfilesystemwatcher_kqueue.cpp2
-rw-r--r--src/corelib/io/qfilesystemwatcher_win.cpp8
-rw-r--r--src/corelib/io/qfilesystemwatcher_win_p.h5
-rw-r--r--src/corelib/io/qfsfileengine.cpp2
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp20
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp4
-rw-r--r--src/corelib/io/qiodevice.cpp30
-rw-r--r--src/corelib/io/qipaddress.cpp32
-rw-r--r--src/corelib/io/qlockfile.h6
-rw-r--r--src/corelib/io/qloggingcategory.cpp3
-rw-r--r--src/corelib/io/qloggingcategory.h1
-rw-r--r--src/corelib/io/qprocess.cpp56
-rw-r--r--src/corelib/io/qprocess.h8
-rw-r--r--src/corelib/io/qresource.cpp2
-rw-r--r--src/corelib/io/qsettings.cpp34
-rw-r--r--src/corelib/io/qsettings.h8
-rw-r--r--src/corelib/io/qsettings_p.h6
-rw-r--r--src/corelib/io/qsettings_wasm.cpp286
-rw-r--r--src/corelib/io/qstandardpaths_android.cpp25
-rw-r--r--src/corelib/io/qstandardpaths_unix.cpp14
-rw-r--r--src/corelib/io/qstorageinfo_unix.cpp33
-rw-r--r--src/corelib/io/qtemporaryfile.cpp8
-rw-r--r--src/corelib/io/qurl.cpp61
-rw-r--r--src/corelib/io/qurlidna.cpp12
-rw-r--r--src/corelib/io/qurlquery.cpp4
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp40
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.h2
-rw-r--r--src/corelib/itemmodels/qabstractproxymodel.cpp2
-rw-r--r--src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp4
-rw-r--r--src/corelib/itemmodels/qidentityproxymodel.cpp6
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.cpp76
-rw-r--r--src/corelib/itemmodels/qsortfilterproxymodel.cpp72
-rw-r--r--src/corelib/itemmodels/qstringlistmodel.cpp8
-rw-r--r--src/corelib/itemmodels/qtransposeproxymodel.cpp4
-rw-r--r--src/corelib/kernel/qabstracteventdispatcher.cpp2
-rw-r--r--src/corelib/kernel/qabstracteventdispatcher.h3
-rw-r--r--src/corelib/kernel/qapplicationstatic.h2
-rw-r--r--src/corelib/kernel/qbasictimer.cpp12
-rw-r--r--src/corelib/kernel/qbasictimer.h7
-rw-r--r--src/corelib/kernel/qcfsocketnotifier.cpp2
-rw-r--r--src/corelib/kernel/qcore_mac.mm10
-rw-r--r--src/corelib/kernel/qcore_mac_p.h31
-rw-r--r--src/corelib/kernel/qcore_wasm.cpp45
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp178
-rw-r--r--src/corelib/kernel/qcoreapplication.h72
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h2
-rw-r--r--src/corelib/kernel/qcoreapplication_platform.h8
-rw-r--r--src/corelib/kernel/qcoreglobaldata.cpp23
-rw-r--r--src/corelib/kernel/qcoreglobaldata_p.h39
-rw-r--r--src/corelib/kernel/qdeadlinetimer.h8
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib.cpp8
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix.cpp7
-rw-r--r--src/corelib/kernel/qeventdispatcher_wasm.cpp39
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp4
-rw-r--r--src/corelib/kernel/qfunctions_win.cpp64
-rw-r--r--src/corelib/kernel/qfunctions_win_p.h50
-rw-r--r--src/corelib/kernel/qiterable.cpp24
-rw-r--r--src/corelib/kernel/qjnihelpers.cpp4
-rw-r--r--src/corelib/kernel/qjnitypes.h77
-rw-r--r--src/corelib/kernel/qmath.h4
-rw-r--r--src/corelib/kernel/qmetaobject.cpp501
-rw-r--r--src/corelib/kernel/qmetaobject.h82
-rw-r--r--src/corelib/kernel/qmetaobject_p.h6
-rw-r--r--src/corelib/kernel/qmetaobjectbuilder.cpp2
-rw-r--r--src/corelib/kernel/qmetatype.cpp109
-rw-r--r--src/corelib/kernel/qmetatype.h47
-rw-r--r--src/corelib/kernel/qmimedata.cpp4
-rw-r--r--src/corelib/kernel/qobject.cpp70
-rw-r--r--src/corelib/kernel/qobject.h18
-rw-r--r--src/corelib/kernel/qobject_p.h5
-rw-r--r--src/corelib/kernel/qobjectdefs.h186
-rw-r--r--src/corelib/kernel/qobjectdefs_impl.h1
-rw-r--r--src/corelib/kernel/qpermissions.cpp556
-rw-r--r--src/corelib/kernel/qpermissions.h156
-rw-r--r--src/corelib/kernel/qpermissions_android.cpp137
-rw-r--r--src/corelib/kernel/qpermissions_darwin.mm88
-rw-r--r--src/corelib/kernel/qpermissions_p.h55
-rw-r--r--src/corelib/kernel/qpermissions_wasm.cpp278
-rw-r--r--src/corelib/kernel/qpoll.cpp5
-rw-r--r--src/corelib/kernel/qproperty.cpp519
-rw-r--r--src/corelib/kernel/qproperty.h96
-rw-r--r--src/corelib/kernel/qproperty_p.h42
-rw-r--r--src/corelib/kernel/qpropertyprivate.h5
-rw-r--r--src/corelib/kernel/qsharedmemory.cpp181
-rw-r--r--src/corelib/kernel/qsharedmemory.h19
-rw-r--r--src/corelib/kernel/qsharedmemory_android.cpp9
-rw-r--r--src/corelib/kernel/qsharedmemory_p.h30
-rw-r--r--src/corelib/kernel/qsharedmemory_unix.cpp16
-rw-r--r--src/corelib/kernel/qsharedmemory_win.cpp9
-rw-r--r--src/corelib/kernel/qsystemerror.cpp12
-rw-r--r--src/corelib/kernel/qsystemerror_p.h2
-rw-r--r--src/corelib/kernel/qsystemsemaphore.cpp2
-rw-r--r--src/corelib/kernel/qsystemsemaphore.h2
-rw-r--r--src/corelib/kernel/qsystemsemaphore_android.cpp6
-rw-r--r--src/corelib/kernel/qsystemsemaphore_p.h18
-rw-r--r--src/corelib/kernel/qsystemsemaphore_unix.cpp10
-rw-r--r--src/corelib/kernel/qsystemsemaphore_win.cpp5
-rw-r--r--src/corelib/kernel/qtimer.cpp31
-rw-r--r--src/corelib/kernel/qtimer.h10
-rw-r--r--src/corelib/kernel/qtimer_p.h39
-rw-r--r--src/corelib/kernel/qtimerinfo_unix.cpp31
-rw-r--r--src/corelib/kernel/qtimerinfo_unix_p.h2
-rw-r--r--src/corelib/kernel/qtmetamacros.h4
-rw-r--r--src/corelib/kernel/qtmochelpers.h3
-rw-r--r--src/corelib/kernel/qtranslator.cpp8
-rw-r--r--src/corelib/kernel/qvariant.cpp392
-rw-r--r--src/corelib/kernel/qvariant.h2
-rw-r--r--src/corelib/kernel/qwineventnotifier.h2
-rw-r--r--src/corelib/kernel/qwinregistry.cpp130
-rw-r--r--src/corelib/kernel/qwinregistry_p.h27
-rw-r--r--src/corelib/mimetypes/mime/generate.bat48
-rw-r--r--src/corelib/mimetypes/mime/generate.pl93
-rw-r--r--src/corelib/mimetypes/mimetypes_resources.cmake2
-rw-r--r--src/corelib/mimetypes/qmimedatabase.cpp8
-rw-r--r--src/corelib/mimetypes/qmimeglobpattern.cpp18
-rw-r--r--src/corelib/mimetypes/qmimemagicrule.cpp32
-rw-r--r--src/corelib/mimetypes/qmimeprovider.cpp16
-rw-r--r--src/corelib/mimetypes/qmimetype.cpp6
-rw-r--r--src/corelib/platform/android/qandroidextras.cpp150
-rw-r--r--src/corelib/platform/android/qandroidextras_p.h22
-rw-r--r--src/corelib/platform/android/qandroidnativeinterface.cpp2
-rw-r--r--src/corelib/platform/darwin/qdarwinpermissionplugin.mm90
-rw-r--r--src/corelib/platform/darwin/qdarwinpermissionplugin_bluetooth.mm84
-rw-r--r--src/corelib/platform/darwin/qdarwinpermissionplugin_calendar.mm57
-rw-r--r--src/corelib/platform/darwin/qdarwinpermissionplugin_camera.mm42
-rw-r--r--src/corelib/platform/darwin/qdarwinpermissionplugin_contacts.mm58
-rw-r--r--src/corelib/platform/darwin/qdarwinpermissionplugin_location.mm230
-rw-r--r--src/corelib/platform/darwin/qdarwinpermissionplugin_microphone.mm42
-rw-r--r--src/corelib/platform/darwin/qdarwinpermissionplugin_p.h58
-rw-r--r--src/corelib/platform/darwin/qdarwinpermissionplugin_p_p.h102
-rw-r--r--src/corelib/platform/wasm/qstdweb.cpp60
-rw-r--r--src/corelib/platform/wasm/qstdweb_p.h9
-rw-r--r--src/corelib/platform/windows/qfactorycacheregistration.cpp53
-rw-r--r--src/corelib/platform/windows/qfactorycacheregistration_p.h52
-rw-r--r--src/corelib/plugin/qcoffpeparser.cpp2
-rw-r--r--src/corelib/plugin/qelfparser_p.cpp18
-rw-r--r--src/corelib/plugin/qfactoryinterface.h2
-rw-r--r--src/corelib/plugin/qfactoryloader.cpp4
-rw-r--r--src/corelib/plugin/qlibrary.cpp50
-rw-r--r--src/corelib/plugin/qlibrary_unix.cpp2
-rw-r--r--src/corelib/plugin/qlibrary_win.cpp2
-rw-r--r--src/corelib/plugin/qplugin.h6
-rw-r--r--src/corelib/plugin/qplugin.qdoc8
-rw-r--r--src/corelib/plugin/qpluginloader.cpp6
-rw-r--r--src/corelib/plugin/qsystemlibrary.cpp40
-rw-r--r--src/corelib/plugin/qsystemlibrary_p.h17
-rw-r--r--src/corelib/plugin/quuid.h8
-rw-r--r--src/corelib/qt_cmdline.cmake3
-rw-r--r--src/corelib/serialization/qcborarray.cpp19
-rw-r--r--src/corelib/serialization/qcborcommon.cpp3
-rw-r--r--src/corelib/serialization/qcbormap.cpp19
-rw-r--r--src/corelib/serialization/qcborstreamreader.cpp15
-rw-r--r--src/corelib/serialization/qcborstreamwriter.cpp7
-rw-r--r--src/corelib/serialization/qcborvalue.cpp5
-rw-r--r--src/corelib/serialization/qcborvalue.h6
-rw-r--r--src/corelib/serialization/qdatastream.h4
-rw-r--r--src/corelib/serialization/qjsonarray.cpp36
-rw-r--r--src/corelib/serialization/qjsoncbor.cpp3
-rw-r--r--src/corelib/serialization/qjsondocument.cpp4
-rw-r--r--src/corelib/serialization/qjsondocument.h2
-rw-r--r--src/corelib/serialization/qjsonobject.cpp42
-rw-r--r--src/corelib/serialization/qjsonparser.cpp2
-rw-r--r--src/corelib/serialization/qjsonvalue.cpp3
-rw-r--r--src/corelib/serialization/qjsonwriter.cpp6
-rw-r--r--src/corelib/serialization/qtextstream.cpp4
-rw-r--r--src/corelib/serialization/qtextstream.h1
-rw-r--r--src/corelib/serialization/qtextstream_p.h4
-rw-r--r--src/corelib/serialization/qxmlstream.cpp73
-rw-r--r--src/corelib/serialization/qxmlstream_p.h30
-rw-r--r--src/corelib/text/qanystringview.h103
-rw-r--r--src/corelib/text/qanystringview.qdoc83
-rw-r--r--src/corelib/text/qbytearray.cpp451
-rw-r--r--src/corelib/text/qbytearray.h29
-rw-r--r--src/corelib/text/qbytearraylist.h6
-rw-r--r--src/corelib/text/qbytearraymatcher.h29
-rw-r--r--src/corelib/text/qbytearrayview.h13
-rw-r--r--src/corelib/text/qbytearrayview.qdoc50
-rw-r--r--src/corelib/text/qbytedata_p.h6
-rw-r--r--src/corelib/text/qchar.cpp19
-rw-r--r--src/corelib/text/qchar.h9
-rw-r--r--src/corelib/text/qcollator.cpp2
-rw-r--r--src/corelib/text/qlocale.cpp492
-rw-r--r--src/corelib/text/qlocale.h4
-rw-r--r--src/corelib/text/qlocale_mac.mm4
-rw-r--r--src/corelib/text/qlocale_p.h14
-rw-r--r--src/corelib/text/qlocale_tools.cpp170
-rw-r--r--src/corelib/text/qlocale_tools_p.h19
-rw-r--r--src/corelib/text/qlocale_win.cpp35
-rw-r--r--src/corelib/text/qregularexpression.cpp10
-rw-r--r--src/corelib/text/qstring.cpp1310
-rw-r--r--src/corelib/text/qstring.h86
-rw-r--r--src/corelib/text/qstringalgorithms_p.h3
-rw-r--r--src/corelib/text/qstringbuilder.h9
-rw-r--r--src/corelib/text/qstringconverter.cpp106
-rw-r--r--src/corelib/text/qstringconverter_p.h9
-rw-r--r--src/corelib/text/qstringfwd.h6
-rw-r--r--src/corelib/text/qstringlist.cpp24
-rw-r--r--src/corelib/text/qstringlist.h2
-rw-r--r--src/corelib/text/qstringmatcher.cpp41
-rw-r--r--src/corelib/text/qstringview.cpp4
-rw-r--r--src/corelib/text/qstringview.h20
-rw-r--r--src/corelib/text/qt_attribution.json4
-rw-r--r--src/corelib/text/qtextboundaryfinder.cpp2
-rw-r--r--src/corelib/text/qunicodetables.cpp10872
-rw-r--r--src/corelib/text/qutf8stringview.h25
-rw-r--r--src/corelib/text/qutf8stringview.qdoc2
-rw-r--r--src/corelib/text/qvsnprintf.cpp2
-rw-r--r--src/corelib/thread/qatomic.cpp82
-rw-r--r--src/corelib/thread/qatomic.h39
-rw-r--r--src/corelib/thread/qatomic_bootstrap.h69
-rw-r--r--src/corelib/thread/qatomic_cxx11.h2
-rw-r--r--src/corelib/thread/qbasicatomic.h20
-rw-r--r--src/corelib/thread/qexception.cpp6
-rw-r--r--src/corelib/thread/qexception.h2
-rw-r--r--src/corelib/thread/qfutex_p.h2
-rw-r--r--src/corelib/thread/qfuture.h8
-rw-r--r--src/corelib/thread/qfuture.qdoc8
-rw-r--r--src/corelib/thread/qfuture_impl.h2
-rw-r--r--src/corelib/thread/qfutureinterface.cpp59
-rw-r--r--src/corelib/thread/qfutureinterface.h4
-rw-r--r--src/corelib/thread/qfutureinterface_p.h5
-rw-r--r--src/corelib/thread/qfuturesynchronizer.h4
-rw-r--r--src/corelib/thread/qlocking_p.h7
-rw-r--r--src/corelib/thread/qmutex.cpp4
-rw-r--r--src/corelib/thread/qmutex.h16
-rw-r--r--src/corelib/thread/qmutex_p.h9
-rw-r--r--src/corelib/thread/qmutex_win.cpp30
-rw-r--r--src/corelib/thread/qpromise.h3
-rw-r--r--src/corelib/thread/qresultstore.h10
-rw-r--r--src/corelib/thread/qsemaphore.h2
-rw-r--r--src/corelib/thread/qthread.cpp10
-rw-r--r--src/corelib/thread/qthread.h6
-rw-r--r--src/corelib/thread/qthread_unix.cpp19
-rw-r--r--src/corelib/thread/qthread_win.cpp4
-rw-r--r--src/corelib/thread/qthreadpool.cpp12
-rw-r--r--src/corelib/thread/qthreadstorage.cpp6
-rw-r--r--src/corelib/thread/qwaitcondition.qdoc6
-rw-r--r--src/corelib/thread/qwaitcondition_p.h7
-rw-r--r--src/corelib/thread/qwaitcondition_win.cpp4
-rw-r--r--src/corelib/time/qdatetime.cpp259
-rw-r--r--src/corelib/time/qdatetime.h25
-rw-r--r--src/corelib/time/qdatetime_p.h1
-rw-r--r--src/corelib/time/qdatetimeparser.cpp86
-rw-r--r--src/corelib/time/qdatetimeparser_p.h4
-rw-r--r--src/corelib/time/qlocaltime.cpp30
-rw-r--r--src/corelib/time/qtimezone.cpp4
-rw-r--r--src/corelib/time/qtimezone.h2
-rw-r--r--src/corelib/time/qtimezoneprivate.cpp69
-rw-r--r--src/corelib/time/qtimezoneprivate_android.cpp49
-rw-r--r--src/corelib/time/qtimezoneprivate_data_p.h11
-rw-r--r--src/corelib/time/qtimezoneprivate_tz.cpp43
-rw-r--r--src/corelib/tools/qalgorithms.qdoc12
-rw-r--r--src/corelib/tools/qarraydataops.h11
-rw-r--r--src/corelib/tools/qatomicscopedvaluerollback_p.h1
-rw-r--r--src/corelib/tools/qcommandlineparser.cpp18
-rw-r--r--src/corelib/tools/qcontainerfwd.h2
-rw-r--r--src/corelib/tools/qcontainertools_impl.h40
-rw-r--r--src/corelib/tools/qcontiguouscache.h4
-rw-r--r--src/corelib/tools/qcryptographichash.cpp205
-rw-r--r--src/corelib/tools/qcryptographichash.h5
-rw-r--r--src/corelib/tools/qduplicatetracker_p.h4
-rw-r--r--src/corelib/tools/qeasingcurve.cpp24
-rw-r--r--src/corelib/tools/qflatmap_p.h36
-rw-r--r--src/corelib/tools/qfreelist_p.h3
-rw-r--r--src/corelib/tools/qhash.cpp45
-rw-r--r--src/corelib/tools/qhash.h18
-rw-r--r--src/corelib/tools/qhashfunctions.h32
-rw-r--r--src/corelib/tools/qiterator.qdoc8
-rw-r--r--src/corelib/tools/qlist.h6
-rw-r--r--src/corelib/tools/qlist.qdoc33
-rw-r--r--src/corelib/tools/qmap.h8
-rw-r--r--src/corelib/tools/qmap.qdoc33
-rw-r--r--src/corelib/tools/qmultimap.qdoc24
-rw-r--r--src/corelib/tools/qoffsetstringarray_p.h27
-rw-r--r--src/corelib/tools/qrect.h10
-rw-r--r--src/corelib/tools/qscopedpointer.cpp10
-rw-r--r--src/corelib/tools/qscopedpointer.h8
-rw-r--r--src/corelib/tools/qscopeguard.h2
-rw-r--r--src/corelib/tools/qset.h6
-rw-r--r--src/corelib/tools/qshareddata.h12
-rw-r--r--src/corelib/tools/qshareddata_impl.h4
-rw-r--r--src/corelib/tools/qtaggedpointer.h29
-rw-r--r--src/corelib/tools/qversionnumber.cpp13
-rw-r--r--src/dbus/CMakeLists.txt2
-rw-r--r--src/dbus/Qt6DBusMacros.cmake58
-rw-r--r--src/dbus/dbus_minimal_p.h6
-rw-r--r--src/dbus/doc/snippets/CMakeLists.txt2
-rw-r--r--src/dbus/doc/snippets/cmake/examples.cmake2
-rw-r--r--src/dbus/doc/src/qtdbus-cmake.qdoc8
-rw-r--r--src/dbus/doc/src/qtdbus-module.qdoc2
-rw-r--r--src/dbus/qdbusabstractadaptor.cpp4
-rw-r--r--src/dbus/qdbusabstractinterface.cpp8
-rw-r--r--src/dbus/qdbusargument.cpp10
-rw-r--r--src/dbus/qdbusconnection.cpp4
-rw-r--r--src/dbus/qdbusconnection_p.h3
-rw-r--r--src/dbus/qdbusintegrator.cpp181
-rw-r--r--src/dbus/qdbusinternalfilters.cpp8
-rw-r--r--src/dbus/qdbusmarshaller.cpp7
-rw-r--r--src/dbus/qdbusmetaobject.cpp48
-rw-r--r--src/dbus/qdbusmetatype.cpp2
-rw-r--r--src/dbus/qdbusmisc.cpp4
-rw-r--r--src/dbus/qdbuspendingcall.cpp14
-rw-r--r--src/dbus/qdbuspendingcall.h2
-rw-r--r--src/dbus/qdbuspendingreply.h2
-rw-r--r--src/dbus/qdbusreply.cpp4
-rw-r--r--src/dbus/qdbusserver.cpp2
-rw-r--r--src/dbus/qdbusservicewatcher.cpp4
-rw-r--r--src/dbus/qdbusutil.cpp24
-rw-r--r--src/dbus/qdbusutil_p.h2
-rw-r--r--src/dbus/qdbusxmlgenerator.cpp4
-rw-r--r--src/dbus/qtdbusglobal.h4
-rw-r--r--src/entrypoint/CMakeLists.txt4
-rw-r--r--src/entrypoint/qtentrypoint_win.cpp12
-rw-r--r--src/gui/CMakeLists.txt36
-rw-r--r--src/gui/accessible/linux/atspiadaptor.cpp428
-rw-r--r--src/gui/accessible/linux/atspiadaptor_p.h7
-rw-r--r--src/gui/accessible/linux/qspiapplicationadaptor.cpp4
-rw-r--r--src/gui/accessible/qaccessible.cpp157
-rw-r--r--src/gui/accessible/qaccessible.h35
-rw-r--r--src/gui/accessible/qaccessible_base.h3
-rw-r--r--src/gui/accessible/qaccessiblecache.cpp12
-rw-r--r--src/gui/accessible/qaccessibleobject.cpp6
-rw-r--r--src/gui/accessible/qplatformaccessibility.cpp4
-rw-r--r--src/gui/configure.cmake16
-rw-r--r--src/gui/doc/includes/QtGuiDoc1
-rw-r--r--src/gui/doc/includes/windows.h2
-rw-r--r--src/gui/doc/qtgui.qdocconf1
-rw-r--r--src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp4
-rw-r--r--src/gui/doc/snippets/separations/finalwidget.cpp3
-rw-r--r--src/gui/doc/snippets/separations/screenwidget.cpp3
-rw-r--r--src/gui/doc/snippets/transform/main.cpp3
-rw-r--r--src/gui/doc/src/dnd.qdoc4
-rw-r--r--src/gui/doc/src/external-resources.qdoc2
-rw-r--r--src/gui/doc/src/includes/qt-colors.qdocinc21
-rw-r--r--src/gui/doc/src/includes/svg-colors.qdocinc148
-rw-r--r--src/gui/image/qabstractfileiconengine.cpp2
-rw-r--r--src/gui/image/qbmphandler.cpp76
-rw-r--r--src/gui/image/qicon.cpp8
-rw-r--r--src/gui/image/qicon.h2
-rw-r--r--src/gui/image/qiconloader.cpp4
-rw-r--r--src/gui/image/qimage.cpp16
-rw-r--r--src/gui/image/qimage.h2
-rw-r--r--src/gui/image/qimage_conversions.cpp3
-rw-r--r--src/gui/image/qimagereader.cpp2
-rw-r--r--src/gui/image/qpixmap.cpp4
-rw-r--r--src/gui/image/qpnghandler.cpp4
-rw-r--r--src/gui/image/qppmhandler.cpp6
-rw-r--r--src/gui/image/qxbmhandler.cpp2
-rw-r--r--src/gui/image/qxpmhandler.cpp10
-rw-r--r--src/gui/itemmodels/qfileinfogatherer.cpp20
-rw-r--r--src/gui/itemmodels/qfilesystemmodel.cpp36
-rw-r--r--src/gui/itemmodels/qfilesystemmodel_p.h13
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.cpp67
-rw-r--r--src/gui/itemmodels/qstandarditemmodel_p.h2
-rw-r--r--src/gui/kernel/qaction.cpp14
-rw-r--r--src/gui/kernel/qaction.h4
-rw-r--r--src/gui/kernel/qactiongroup.cpp4
-rw-r--r--src/gui/kernel/qclipboard.cpp7
-rw-r--r--src/gui/kernel/qcursor.h2
-rw-r--r--src/gui/kernel/qevent.cpp12
-rw-r--r--src/gui/kernel/qevent.h4
-rw-r--r--src/gui/kernel/qguiapplication.cpp192
-rw-r--r--src/gui/kernel/qguiapplication.h2
-rw-r--r--src/gui/kernel/qguiapplication_p.h18
-rw-r--r--src/gui/kernel/qguiapplication_platform.h26
-rw-r--r--src/gui/kernel/qhighdpiscaling.cpp41
-rw-r--r--src/gui/kernel/qhighdpiscaling_p.h7
-rw-r--r--src/gui/kernel/qkeymapper_p.h2
-rw-r--r--src/gui/kernel/qkeysequence.cpp46
-rw-r--r--src/gui/kernel/qkeysequence.h6
-rw-r--r--src/gui/kernel/qoffscreensurface_platform.h2
-rw-r--r--src/gui/kernel/qopenglcontext.cpp2
-rw-r--r--src/gui/kernel/qopenglcontext_platform.h10
-rw-r--r--src/gui/kernel/qpalette.cpp64
-rw-r--r--src/gui/kernel/qpalette.h2
-rw-r--r--src/gui/kernel/qplatformdialoghelper.cpp23
-rw-r--r--src/gui/kernel/qplatformdialoghelper.h7
-rw-r--r--src/gui/kernel/qplatformintegration.cpp24
-rw-r--r--src/gui/kernel/qplatformintegration.h8
-rw-r--r--src/gui/kernel/qplatformmenu_p.h4
-rw-r--r--src/gui/kernel/qplatformscreen.cpp7
-rw-r--r--src/gui/kernel/qplatformscreen.h3
-rw-r--r--src/gui/kernel/qplatformscreen_p.h20
-rw-r--r--src/gui/kernel/qplatformservices.cpp24
-rw-r--r--src/gui/kernel/qplatformservices.h20
-rw-r--r--src/gui/kernel/qplatformtheme.cpp94
-rw-r--r--src/gui/kernel/qplatformtheme.h26
-rw-r--r--src/gui/kernel/qplatformtheme_p.h2
-rw-r--r--src/gui/kernel/qplatformthemefactory.cpp7
-rw-r--r--src/gui/kernel/qplatformwindow_p.h39
-rw-r--r--src/gui/kernel/qpointingdevice.cpp45
-rw-r--r--src/gui/kernel/qpointingdevice.h7
-rw-r--r--src/gui/kernel/qpointingdevice_p.h2
-rw-r--r--src/gui/kernel/qscreen.cpp96
-rw-r--r--src/gui/kernel/qscreen_p.h35
-rw-r--r--src/gui/kernel/qshapedpixmapdndwindow.cpp2
-rw-r--r--src/gui/kernel/qshortcut.cpp8
-rw-r--r--src/gui/kernel/qshortcut.h4
-rw-r--r--src/gui/kernel/qshortcutmap.cpp17
-rw-r--r--src/gui/kernel/qsimpledrag.cpp4
-rw-r--r--src/gui/kernel/qstylehints.cpp66
-rw-r--r--src/gui/kernel/qstylehints.h10
-rw-r--r--src/gui/kernel/qstylehints_p.h53
-rw-r--r--src/gui/kernel/qtestsupport_gui.cpp28
-rw-r--r--src/gui/kernel/qtestsupport_gui.h6
-rw-r--r--src/gui/kernel/qwindow.cpp20
-rw-r--r--src/gui/kernel/qwindow.h4
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp48
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h6
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h2
-rw-r--r--src/gui/opengl/qopengl.cpp26
-rw-r--r--src/gui/opengl/qopenglfunctions.h2
-rw-r--r--src/gui/painting/qbackingstoredefaultcompositor.cpp135
-rw-r--r--src/gui/painting/qbackingstoredefaultcompositor_p.h11
-rw-r--r--src/gui/painting/qbackingstorerhisupport.cpp1
-rw-r--r--src/gui/painting/qcolor.h2
-rw-r--r--src/gui/painting/qcolorspace.cpp2
-rw-r--r--src/gui/painting/qcolorspace_p.h2
-rw-r--r--src/gui/painting/qcolortransfertable_p.h4
-rw-r--r--src/gui/painting/qcoregraphics.mm2
-rw-r--r--src/gui/painting/qdrawhelper.cpp68
-rw-r--r--src/gui/painting/qdrawhelper_p.h11
-rw-r--r--src/gui/painting/qoutlinemapper_p.h2
-rw-r--r--src/gui/painting/qpageranges.cpp4
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp62
-rw-r--r--src/gui/painting/qpaintengine_raster_p.h16
-rw-r--r--src/gui/painting/qpainter.cpp22
-rw-r--r--src/gui/painting/qpainterpath.cpp5
-rw-r--r--src/gui/painting/qpathsimplifier.cpp4
-rw-r--r--src/gui/painting/qpdf.cpp174
-rw-r--r--src/gui/painting/qpdf_p.h15
-rw-r--r--src/gui/painting/qpen.h2
-rw-r--r--src/gui/painting/qpixellayout.cpp3
-rw-r--r--src/gui/painting/qplatformbackingstore.cpp25
-rw-r--r--src/gui/painting/qplatformbackingstore.h21
-rw-r--r--src/gui/painting/qpolygon.cpp4
-rw-r--r--src/gui/painting/qregion.cpp4
-rw-r--r--src/gui/painting/qregion.h2
-rw-r--r--src/gui/painting/qt_attribution.json2
-rw-r--r--src/gui/painting/qt_mips_asm_dsp_p.h2
-rw-r--r--src/gui/painting/qtransform.cpp4
-rw-r--r--src/gui/painting/webgradients.cpp3
-rw-r--r--src/gui/platform/darwin/qapplekeymapper.mm2
-rw-r--r--src/gui/platform/darwin/qmacmime.mm1013
-rw-r--r--src/gui/platform/darwin/qmacmime_p.h63
-rw-r--r--src/gui/platform/darwin/qmacmimeregistry.mm133
-rw-r--r--src/gui/platform/darwin/qmacmimeregistry_p.h42
-rw-r--r--src/gui/platform/darwin/qutimimeconverter.h54
-rw-r--r--src/gui/platform/darwin/qutimimeconverter.mm806
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenuregistrarproxy_p.h2
-rw-r--r--src/gui/platform/unix/dbusmenu/qdbusmenutypes.cpp4
-rw-r--r--src/gui/platform/unix/dbustray/qdbustraytypes.cpp6
-rw-r--r--src/gui/platform/unix/dbustray/qstatusnotifieritemadaptor.cpp6
-rw-r--r--src/gui/platform/unix/dbustray/qstatusnotifieritemadaptor_p.h4
-rw-r--r--src/gui/platform/unix/dbustray/qxdgnotificationproxy_p.h2
-rw-r--r--src/gui/platform/unix/qgenericunixservices.cpp146
-rw-r--r--src/gui/platform/unix/qgenericunixservices_p.h5
-rw-r--r--src/gui/platform/unix/qgenericunixthemes.cpp313
-rw-r--r--src/gui/platform/unix/qgenericunixthemes_p.h2
-rw-r--r--src/gui/platform/unix/qunixnativeinterface.cpp71
-rw-r--r--src/gui/platform/unix/qxkbcommon.cpp4
-rw-r--r--src/gui/platform/wasm/qlocalfileapi.cpp10
-rw-r--r--src/gui/platform/windows/qwindowsmimeconverter.cpp152
-rw-r--r--src/gui/platform/windows/qwindowsmimeconverter.h (renamed from src/gui/platform/windows/qwindowsmime_p.h)40
-rw-r--r--src/gui/platform/windows/qwindowsnativeinterface.cpp9
-rw-r--r--src/gui/qt_cmdline.cmake2
-rw-r--r--src/gui/qtgui.tracepoints2
-rw-r--r--src/gui/rhi/cs_tdr_p.h2
-rw-r--r--src/gui/rhi/qrhi.cpp235
-rw-r--r--src/gui/rhi/qrhi_p.h16
-rw-r--r--src/gui/rhi/qrhi_p_p.h46
-rw-r--r--src/gui/rhi/qrhid3d11.cpp256
-rw-r--r--src/gui/rhi/qrhid3d11_p_p.h4
-rw-r--r--src/gui/rhi/qrhigles2.cpp346
-rw-r--r--src/gui/rhi/qrhigles2_p_p.h36
-rw-r--r--src/gui/rhi/qrhimetal.mm1743
-rw-r--r--src/gui/rhi/qrhimetal_p_p.h51
-rw-r--r--src/gui/rhi/qrhinull.cpp11
-rw-r--r--src/gui/rhi/qrhivulkan.cpp460
-rw-r--r--src/gui/rhi/qshader.cpp239
-rw-r--r--src/gui/rhi/qshader_p.h19
-rw-r--r--src/gui/rhi/qshader_p_p.h16
-rw-r--r--src/gui/rhi/qshaderdescription.cpp418
-rw-r--r--src/gui/rhi/qshaderdescription_p.h76
-rw-r--r--src/gui/rhi/qshaderdescription_p_p.h17
-rw-r--r--src/gui/rhi/vs_test_p.h2
-rw-r--r--src/gui/text/coretext/qcoretextfontdatabase.mm145
-rw-r--r--src/gui/text/coretext/qcoretextfontdatabase_p.h2
-rw-r--r--src/gui/text/coretext/qfontengine_coretext.mm22
-rw-r--r--src/gui/text/freetype/qfontengine_ft.cpp23
-rw-r--r--src/gui/text/freetype/qfreetypefontdatabase.cpp16
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.cpp2
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.h2
-rw-r--r--src/gui/text/qcssparser.cpp166
-rw-r--r--src/gui/text/qcssparser_p.h7
-rw-r--r--src/gui/text/qcssscanner.cpp2
-rw-r--r--src/gui/text/qdistancefield.cpp6
-rw-r--r--src/gui/text/qfont.cpp6
-rw-r--r--src/gui/text/qfontdatabase.cpp23
-rw-r--r--src/gui/text/qfontengine_p.h4
-rw-r--r--src/gui/text/qfontmetrics.cpp52
-rw-r--r--src/gui/text/qfontsubset.cpp4
-rw-r--r--src/gui/text/qglyphrun.cpp67
-rw-r--r--src/gui/text/qglyphrun.h6
-rw-r--r--src/gui/text/qglyphrun_p.h4
-rw-r--r--src/gui/text/qharfbuzzng.cpp8
-rw-r--r--src/gui/text/qinputcontrol.cpp2
-rw-r--r--src/gui/text/qsyntaxhighlighter.cpp18
-rw-r--r--src/gui/text/qtextcursor.cpp8
-rw-r--r--src/gui/text/qtextdocument.cpp41
-rw-r--r--src/gui/text/qtextdocument_p.cpp22
-rw-r--r--src/gui/text/qtextdocumentfragment.cpp16
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp30
-rw-r--r--src/gui/text/qtextengine.cpp146
-rw-r--r--src/gui/text/qtextengine_p.h5
-rw-r--r--src/gui/text/qtextformat.cpp24
-rw-r--r--src/gui/text/qtextformat_p.h2
-rw-r--r--src/gui/text/qtexthtmlparser.cpp62
-rw-r--r--src/gui/text/qtexthtmlparser_p.h4
-rw-r--r--src/gui/text/qtextlayout.cpp264
-rw-r--r--src/gui/text/qtextlayout.h28
-rw-r--r--src/gui/text/qtextlist.cpp6
-rw-r--r--src/gui/text/qtextmarkdownimporter.cpp16
-rw-r--r--src/gui/text/qtextmarkdownwriter.cpp44
-rw-r--r--src/gui/text/qtextobject.cpp6
-rw-r--r--src/gui/text/qtextodfwriter.cpp20
-rw-r--r--src/gui/text/qtextoption.cpp4
-rw-r--r--src/gui/text/qtexttable.cpp2
-rw-r--r--src/gui/text/qzip.cpp26
-rw-r--r--src/gui/text/unix/qfontconfigdatabase.cpp2
-rw-r--r--src/gui/text/unix/qfontenginemultifontconfig.cpp2
-rw-r--r--src/gui/text/windows/qwindowsfontdatabase.cpp2
-rw-r--r--src/gui/text/windows/qwindowsfontdatabasebase.cpp22
-rw-r--r--src/gui/text/windows/qwindowsfontdatabasebase_p.h2
-rw-r--r--src/gui/text/windows/qwindowsfontenginedirectwrite.cpp94
-rw-r--r--src/gui/text/windows/qwindowsfontenginedirectwrite_p.h3
-rw-r--r--src/gui/util/qastchandler.cpp2
-rw-r--r--src/gui/util/qedidparser.cpp2
-rw-r--r--src/gui/util/qgridlayoutengine.cpp28
-rw-r--r--src/gui/util/qktxhandler.cpp2
-rw-r--r--src/gui/util/qtexturefiledata.cpp4
-rw-r--r--src/gui/util/qundostack.cpp12
-rw-r--r--src/gui/vulkan/qbasicvulkanplatforminstance.cpp23
-rw-r--r--src/gui/vulkan/qplatformvulkaninstance.h10
-rw-r--r--src/gui/vulkan/qvulkandefaultinstance.cpp2
-rw-r--r--src/gui/vulkan/qvulkaninstance.cpp17
-rw-r--r--src/gui/vulkan/qvulkaninstance.h13
-rw-r--r--src/gui/vulkan/qvulkaninstance_p.h2
-rw-r--r--src/gui/vulkan/qvulkanwindow.cpp18
-rw-r--r--src/gui/vulkan/qvulkanwindow.h4
-rw-r--r--src/gui/vulkan/qvulkanwindow_p.h2
-rw-r--r--src/network/CMakeLists.txt5
-rw-r--r--src/network/access/http2/hpacktable.cpp3
-rw-r--r--src/network/access/http2/http2protocol_p.h3
-rw-r--r--src/network/access/qhstsstore.cpp2
-rw-r--r--src/network/access/qhttp2configuration.cpp2
-rw-r--r--src/network/access/qhttp2configuration.h2
-rw-r--r--src/network/access/qhttp2protocolhandler.cpp3
-rw-r--r--src/network/access/qhttpheaderparser.cpp2
-rw-r--r--src/network/access/qhttpmultipart.cpp36
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp30
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp26
-rw-r--r--src/network/access/qhttpnetworkreply.cpp8
-rw-r--r--src/network/access/qhttpnetworkrequest.cpp2
-rw-r--r--src/network/access/qhttpprotocolhandler.cpp6
-rw-r--r--src/network/access/qnetworkaccessbackend.cpp2
-rw-r--r--src/network/access/qnetworkaccessfilebackend.cpp2
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp108
-rw-r--r--src/network/access/qnetworkcookie.cpp18
-rw-r--r--src/network/access/qnetworkcookie_p.h4
-rw-r--r--src/network/access/qnetworkcookiejar.cpp6
-rw-r--r--src/network/access/qnetworkdiskcache.cpp4
-rw-r--r--src/network/access/qnetworkreply.cpp4
-rw-r--r--src/network/access/qnetworkreplyfileimpl.cpp3
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp38
-rw-r--r--src/network/access/qnetworkreplyhttpimpl_p.h4
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp2
-rw-r--r--src/network/access/qnetworkreplywasmimpl.cpp84
-rw-r--r--src/network/access/qnetworkreplywasmimpl_p.h1
-rw-r--r--src/network/access/qnetworkrequest.cpp32
-rw-r--r--src/network/access/qnetworkrequest.h9
-rw-r--r--src/network/android/jar/CMakeLists.txt2
-rw-r--r--src/network/configure.cmake86
-rw-r--r--src/network/doc/snippets/CMakeLists.txt2
-rw-r--r--src/network/doc/snippets/network/CMakeLists.txt2
-rw-r--r--src/network/doc/src/ssl.qdoc5
-rw-r--r--src/network/kernel/qauthenticator.cpp14
-rw-r--r--src/network/kernel/qhostaddress.cpp10
-rw-r--r--src/network/kernel/qhostaddress.h2
-rw-r--r--src/network/kernel/qhostinfo.cpp8
-rw-r--r--src/network/kernel/qhostinfo.h4
-rw-r--r--src/network/kernel/qnetconmonitor_win.cpp41
-rw-r--r--src/network/kernel/qnetworkdatagram.h2
-rw-r--r--src/network/kernel/qnetworkinformation.cpp4
-rw-r--r--src/network/kernel/qnetworkinterface.cpp2
-rw-r--r--src/network/kernel/qnetworkinterface_linux.cpp4
-rw-r--r--src/network/kernel/qnetworkproxy_win.cpp4
-rw-r--r--src/network/kernel/qt_attribution.json28
-rw-r--r--src/network/kernel/qtldurl.cpp2
-rw-r--r--src/network/qt_cmdline.cmake5
-rw-r--r--src/network/socket/qabstractsocket.cpp2
-rw-r--r--src/network/socket/qabstractsocket.h4
-rw-r--r--src/network/socket/qabstractsocketengine_p.h2
-rw-r--r--src/network/socket/qhttpsocketengine.cpp2
-rw-r--r--src/network/socket/qhttpsocketengine_p.h2
-rw-r--r--src/network/socket/qlocalsocket_unix.cpp4
-rw-r--r--src/network/socket/qnativesocketengine.cpp6
-rw-r--r--src/network/socket/qnativesocketengine_p.h4
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp10
-rw-r--r--src/network/socket/qnativesocketengine_win.cpp12
-rw-r--r--src/network/socket/qsctpserver.cpp2
-rw-r--r--src/network/socket/qsctpserver.h2
-rw-r--r--src/network/socket/qsctpsocket.cpp2
-rw-r--r--src/network/socket/qsctpsocket.h2
-rw-r--r--src/network/socket/qsocks5socketengine.cpp6
-rw-r--r--src/network/socket/qsocks5socketengine_p.h2
-rw-r--r--src/network/socket/qtcpserver.cpp4
-rw-r--r--src/network/socket/qtcpsocket.h2
-rw-r--r--src/network/socket/qudpsocket.h2
-rw-r--r--src/network/ssl/qdtls.h2
-rw-r--r--src/network/ssl/qocspresponse.h2
-rw-r--r--src/network/ssl/qpassworddigestor.cpp2
-rw-r--r--src/network/ssl/qsslconfiguration.cpp8
-rw-r--r--src/network/ssl/qsslconfiguration.h2
-rw-r--r--src/network/ssl/qssldiffiehellmanparameters.cpp3
-rw-r--r--src/network/ssl/qsslserver.cpp11
-rw-r--r--src/network/ssl/qsslsocket.cpp8
-rw-r--r--src/network/ssl/qtlsbackend.cpp6
-rw-r--r--src/opengl/CMakeLists.txt5
-rw-r--r--src/opengl/doc/snippets/CMakeLists.txt2
-rw-r--r--src/opengl/qopenglcompositor.cpp22
-rw-r--r--src/opengl/qopengldebug.cpp12
-rw-r--r--src/opengl/qopengldebug.h2
-rw-r--r--src/opengl/qopenglengineshadermanager.cpp2
-rw-r--r--src/opengl/qopenglframebufferobject.cpp15
-rw-r--r--src/opengl/qopenglframebufferobject.h2
-rw-r--r--src/opengl/qopenglpaintengine.cpp58
-rw-r--r--src/opengl/qopenglpaintengine_p.h59
-rw-r--r--src/opengl/qopenglshaderprogram.cpp8
-rw-r--r--src/opengl/qopengltexture.cpp15
-rw-r--r--src/opengl/qopengltextureblitter.cpp75
-rw-r--r--src/opengl/qopengltexturecache.cpp2
-rw-r--r--src/opengl/qopengltextureglyphcache.cpp7
-rw-r--r--src/opengl/qopenglversionfunctions.cpp2
-rw-r--r--src/opengl/qtopengl.tracepoints6
-rw-r--r--src/openglwidgets/CMakeLists.txt2
-rw-r--r--src/openglwidgets/qopenglwidget.cpp369
-rw-r--r--src/openglwidgets/qopenglwidget.h10
-rw-r--r--src/platformsupport/CMakeLists.txt2
-rw-r--r--src/platformsupport/devicediscovery/CMakeLists.txt2
-rw-r--r--src/platformsupport/fbconvenience/CMakeLists.txt2
-rw-r--r--src/platformsupport/fbconvenience/qfbscreen.cpp4
-rw-r--r--src/platformsupport/fbconvenience/qfbwindow.cpp2
-rw-r--r--src/platformsupport/input/CMakeLists.txt2
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp2
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp4
-rw-r--r--src/platformsupport/input/evdevtablet/qevdevtabletmanager.cpp2
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp6
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp2
-rw-r--r--src/platformsupport/input/libinput/qlibinputtouch.cpp6
-rw-r--r--src/platformsupport/input/shared/qevdevutil.cpp2
-rw-r--r--src/platformsupport/kmsconvenience/CMakeLists.txt2
-rw-r--r--src/platformsupport/kmsconvenience/qkmsdevice.cpp10
-rw-r--r--src/plugins/CMakeLists.txt2
-rw-r--r--src/plugins/generic/CMakeLists.txt2
-rw-r--r--src/plugins/generic/evdevkeyboard/CMakeLists.txt2
-rw-r--r--src/plugins/generic/evdevkeyboard/main.cpp3
-rw-r--r--src/plugins/generic/evdevmouse/CMakeLists.txt2
-rw-r--r--src/plugins/generic/evdevmouse/main.cpp3
-rw-r--r--src/plugins/generic/evdevtablet/CMakeLists.txt2
-rw-r--r--src/plugins/generic/evdevtablet/main.cpp2
-rw-r--r--src/plugins/generic/evdevtouch/CMakeLists.txt2
-rw-r--r--src/plugins/generic/evdevtouch/main.cpp2
-rw-r--r--src/plugins/generic/libinput/CMakeLists.txt2
-rw-r--r--src/plugins/generic/libinput/main.cpp2
-rw-r--r--src/plugins/generic/tslib/CMakeLists.txt2
-rw-r--r--src/plugins/generic/tslib/main.cpp2
-rw-r--r--src/plugins/generic/tuiotouch/CMakeLists.txt2
-rw-r--r--src/plugins/generic/tuiotouch/main.cpp2
-rw-r--r--src/plugins/generic/tuiotouch/qtuiohandler.cpp40
-rw-r--r--src/plugins/imageformats/CMakeLists.txt2
-rw-r--r--src/plugins/imageformats/gif/CMakeLists.txt2
-rw-r--r--src/plugins/imageformats/gif/qgifhandler.cpp6
-rw-r--r--src/plugins/imageformats/ico/CMakeLists.txt2
-rw-r--r--src/plugins/imageformats/ico/qicohandler.cpp4
-rw-r--r--src/plugins/imageformats/jpeg/CMakeLists.txt2
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler.cpp9
-rw-r--r--src/plugins/networkinformation/CMakeLists.txt2
-rw-r--r--src/plugins/networkinformation/android/CMakeLists.txt2
-rw-r--r--src/plugins/networkinformation/glib/CMakeLists.txt2
-rw-r--r--src/plugins/networkinformation/networklistmanager/CMakeLists.txt3
-rw-r--r--src/plugins/networkinformation/networklistmanager/qnetworklistmanagerevents.cpp88
-rw-r--r--src/plugins/networkinformation/networklistmanager/qnetworklistmanagerevents.h21
-rw-r--r--src/plugins/networkinformation/networklistmanager/qnetworklistmanagernetworkinformationbackend.cpp39
-rw-r--r--src/plugins/networkinformation/networkmanager/CMakeLists.txt2
-rw-r--r--src/plugins/networkinformation/networkmanager/qnetworkmanagernetworkinformationbackend.cpp3
-rw-r--r--src/plugins/networkinformation/networkmanager/qnetworkmanagerservice.h2
-rw-r--r--src/plugins/networkinformation/scnetworkreachability/CMakeLists.txt2
-rw-r--r--src/plugins/platforminputcontexts/CMakeLists.txt2
-rw-r--r--src/plugins/platforminputcontexts/compose/CMakeLists.txt2
-rw-r--r--src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp3
-rw-r--r--src/plugins/platforminputcontexts/ibus/CMakeLists.txt2
-rw-r--r--src/plugins/platforminputcontexts/ibus/main.cpp3
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp104
-rw-r--r--src/plugins/platforms/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/android/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/android/androidjniaccessibility.cpp33
-rw-r--r--src/plugins/platforms/android/androidjniaccessibility.h1
-rw-r--r--src/plugins/platforms/android/androidjniclipboard.cpp22
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp38
-rw-r--r--src/plugins/platforms/android/androidjnimain.h1
-rw-r--r--src/plugins/platforms/android/androidjnimenu.cpp8
-rw-r--r--src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp4
-rw-r--r--src/plugins/platforms/android/qandroideventdispatcher.cpp8
-rw-r--r--src/plugins/platforms/android/qandroidplatformaccessibility.cpp2
-rw-r--r--src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp3
-rw-r--r--src/plugins/platforms/android/qandroidplatformintegration.cpp56
-rw-r--r--src/plugins/platforms/android/qandroidplatformintegration.h5
-rw-r--r--src/plugins/platforms/android/qandroidplatformscreen.cpp108
-rw-r--r--src/plugins/platforms/android/qandroidplatformscreen.h5
-rw-r--r--src/plugins/platforms/android/qandroidplatformservices.cpp11
-rw-r--r--src/plugins/platforms/android/qandroidplatformtheme.cpp85
-rw-r--r--src/plugins/platforms/android/qandroidplatformtheme.h9
-rw-r--r--src/plugins/platforms/android/qandroidplatformwindow.cpp2
-rw-r--r--src/plugins/platforms/bsdfb/qbsdfbscreen.cpp2
-rw-r--r--src/plugins/platforms/cocoa/CMakeLists.txt6
-rw-r--r--src/plugins/platforms/cocoa/main.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibility.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm257
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm5
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm1
-rw-r--r--src/plugins/platforms/cocoa/qcocoaclipboard.mm6
-rw-r--r--src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm12
-rw-r--r--src/plugins/platforms/cocoa/qcocoadrag.mm18
-rw-r--r--src/plugins/platforms/cocoa/qcocoaeventdispatcher.h6
-rw-r--r--src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm88
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm1
-rw-r--r--src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm12
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.h3
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm1
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm11
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.mm12
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenubar.mm68
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.mm1
-rw-r--r--src/plugins/platforms/cocoa/qcocoamessagedialog.h37
-rw-r--r--src/plugins/platforms/cocoa/qcocoamessagedialog.mm319
-rw-r--r--src/plugins/platforms/cocoa/qcocoamimetypes.mm52
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.mm3
-rw-r--r--src/plugins/platforms/cocoa/qcocoascreen.mm5
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.mm28
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h9
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm142
-rw-r--r--src/plugins/platforms/cocoa/qmacclipboard.h36
-rw-r--r--src/plugins/platforms/cocoa/qmacclipboard.mm243
-rw-r--r--src/plugins/platforms/cocoa/qmultitouch_mac.mm8
-rw-r--r--src/plugins/platforms/cocoa/qnsview.h2
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm5
-rw-r--r--src/plugins/platforms/cocoa/qnsview_complextext.mm12
-rw-r--r--src/plugins/platforms/cocoa/qnsview_dragging.mm13
-rw-r--r--src/plugins/platforms/cocoa/qnsview_keys.mm24
-rw-r--r--src/plugins/platforms/cocoa/qnswindow.h3
-rw-r--r--src/plugins/platforms/cocoa/qnswindow.mm9
-rw-r--r--src/plugins/platforms/direct2d/CMakeLists.txt4
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp2
-rw-r--r--src/plugins/platforms/directfb/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/directfb/main.cpp2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbbackingstore.h8
-rw-r--r--src/plugins/platforms/directfb/qdirectfbblitter.cpp2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbblitter.h31
-rw-r--r--src/plugins/platforms/directfb/qdirectfbcursor.h2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbinput.cpp11
-rw-r--r--src/plugins/platforms/directfb/qdirectfbinput.h2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbintegration.h20
-rw-r--r--src/plugins/platforms/directfb/qdirectfbscreen.h10
-rw-r--r--src/plugins/platforms/directfb/qdirectfbwindow.h20
-rw-r--r--src/plugins/platforms/eglfs/CMakeLists.txt4
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsscreen.cpp4
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfswindow.cpp2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.cpp2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp17
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice_p.h6
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp163
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen_p.h7
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice_p.h6
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qvsp2blendingdevice.cpp4
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_openwfd/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp4
-rw-r--r--src/plugins/platforms/ios/CMakeLists.txt6
-rw-r--r--src/plugins/platforms/ios/optional/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/ios/optional/nsphotolibrarysupport/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileenginefactory.h2
-rw-r--r--src/plugins/platforms/ios/qiosclipboard.mm27
-rw-r--r--src/plugins/platforms/ios/qioscolordialog.h38
-rw-r--r--src/plugins/platforms/ios/qioscolordialog.mm159
-rw-r--r--src/plugins/platforms/ios/qiosdocumentpickercontroller.h1
-rw-r--r--src/plugins/platforms/ios/qiosdocumentpickercontroller.mm21
-rw-r--r--src/plugins/platforms/ios/qiosfiledialog.mm4
-rw-r--r--src/plugins/platforms/ios/qiosfontdialog.h41
-rw-r--r--src/plugins/platforms/ios/qiosfontdialog.mm190
-rw-r--r--src/plugins/platforms/ios/qiosinputcontext.mm4
-rw-r--r--src/plugins/platforms/ios/qiosintegration.h2
-rw-r--r--src/plugins/platforms/ios/qiosintegration.mm13
-rw-r--r--src/plugins/platforms/ios/qiosmenu.mm4
-rw-r--r--src/plugins/platforms/ios/qiosmessagedialog.mm23
-rw-r--r--src/plugins/platforms/ios/qiosscreen.mm13
-rw-r--r--src/plugins/platforms/ios/qiostextresponder.mm8
-rw-r--r--src/plugins/platforms/ios/qiostheme.h2
-rw-r--r--src/plugins/platforms/ios/qiostheme.mm26
-rw-r--r--src/plugins/platforms/ios/quiview.mm53
-rw-r--r--src/plugins/platforms/linuxfb/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/linuxfb/main.cpp2
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp9
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp4
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp10
-rw-r--r--src/plugins/platforms/minimal/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/minimal/main.cpp2
-rw-r--r--src/plugins/platforms/minimal/qminimalintegration.cpp2
-rw-r--r--src/plugins/platforms/minimalegl/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/minimalegl/main.cpp2
-rw-r--r--src/plugins/platforms/minimalegl/qminimaleglbackingstore.cpp2
-rw-r--r--src/plugins/platforms/minimalegl/qminimaleglscreen.cpp8
-rw-r--r--src/plugins/platforms/offscreen/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/offscreen/qoffscreencommon.cpp4
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenintegration.cpp6
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenwindow.cpp4
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenwindow.h2
-rw-r--r--src/plugins/platforms/qnx/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/qnx/qqnxintegration.cpp2
-rw-r--r--src/plugins/platforms/vkkhrdisplay/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/vkkhrdisplay/main.cpp2
-rw-r--r--src/plugins/platforms/vnc/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/vnc/qvnc.cpp11
-rw-r--r--src/plugins/platforms/vnc/qvncscreen.cpp7
-rw-r--r--src/plugins/platforms/wasm/CMakeLists.txt22
-rw-r--r--src/plugins/platforms/wasm/qtloader.js25
-rw-r--r--src/plugins/platforms/wasm/qtlogo.svg40
-rw-r--r--src/plugins/platforms/wasm/qwasmaccessibility.cpp27
-rw-r--r--src/plugins/platforms/wasm/qwasmaccessibility.h3
-rw-r--r--src/plugins/platforms/wasm/qwasmbackingstore.cpp110
-rw-r--r--src/plugins/platforms/wasm/qwasmbackingstore.h11
-rw-r--r--src/plugins/platforms/wasm/qwasmclipboard.cpp124
-rw-r--r--src/plugins/platforms/wasm/qwasmclipboard.h25
-rw-r--r--src/plugins/platforms/wasm/qwasmcompositor.cpp869
-rw-r--r--src/plugins/platforms/wasm/qwasmcompositor.h139
-rw-r--r--src/plugins/platforms/wasm/qwasmcssstyle.cpp181
-rw-r--r--src/plugins/platforms/wasm/qwasmcssstyle.h18
-rw-r--r--src/plugins/platforms/wasm/qwasmcursor.cpp5
-rw-r--r--src/plugins/platforms/wasm/qwasmevent.cpp2
-rw-r--r--src/plugins/platforms/wasm/qwasmeventtranslator.cpp24
-rw-r--r--src/plugins/platforms/wasm/qwasmeventtranslator.h2
-rw-r--r--src/plugins/platforms/wasm/qwasmfontdatabase.cpp136
-rw-r--r--src/plugins/platforms/wasm/qwasmfontdatabase.h3
-rw-r--r--src/plugins/platforms/wasm/qwasminputcontext.cpp16
-rw-r--r--src/plugins/platforms/wasm/qwasminputcontext.h3
-rw-r--r--src/plugins/platforms/wasm/qwasmintegration.cpp73
-rw-r--r--src/plugins/platforms/wasm/qwasmoffscreensurface.cpp8
-rw-r--r--src/plugins/platforms/wasm/qwasmoffscreensurface.h6
-rw-r--r--src/plugins/platforms/wasm/qwasmopenglcontext.cpp71
-rw-r--r--src/plugins/platforms/wasm/qwasmopenglcontext.h5
-rw-r--r--src/plugins/platforms/wasm/qwasmscreen.cpp215
-rw-r--r--src/plugins/platforms/wasm/qwasmscreen.h16
-rw-r--r--src/plugins/platforms/wasm/qwasmtheme.cpp1
-rw-r--r--src/plugins/platforms/wasm/qwasmwindow.cpp648
-rw-r--r--src/plugins/platforms/wasm/qwasmwindow.h86
-rw-r--r--src/plugins/platforms/wasm/qwasmwindowstack.cpp44
-rw-r--r--src/plugins/platforms/wasm/qwasmwindowstack.h8
-rw-r--r--src/plugins/platforms/wasm/resources/maximize.svg1
-rw-r--r--src/plugins/platforms/wasm/resources/qtlogo.svg1
-rw-r--r--src/plugins/platforms/wasm/resources/restore.svg1
-rw-r--r--src/plugins/platforms/wasm/resources/x.svg1
-rw-r--r--src/plugins/platforms/wasm/wasm_shell.html11
-rw-r--r--src/plugins/platforms/windows/CMakeLists.txt4
-rw-r--r--src/plugins/platforms/windows/qtwindowsglobal.h15
-rw-r--r--src/plugins/platforms/windows/qwindowsapplication.cpp14
-rw-r--r--src/plugins/platforms/windows/qwindowsapplication.h6
-rw-r--r--src/plugins/platforms/windows/qwindowsclipboard.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp139
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.h10
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp23
-rw-r--r--src/plugins/platforms/windows/qwindowsdrag.cpp80
-rw-r--r--src/plugins/platforms/windows/qwindowsdropdataobject.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp160
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.h8
-rw-r--r--src/plugins/platforms/windows/qwindowsinternalmimedata.cpp12
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp39
-rw-r--r--src/plugins/platforms/windows/qwindowsmimeregistry.cpp (renamed from src/plugins/platforms/windows/qwindowsmime.cpp)269
-rw-r--r--src/plugins/platforms/windows/qwindowsmimeregistry.h (renamed from src/plugins/platforms/windows/qwindowsmime.h)28
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsole.cpp8
-rw-r--r--src/plugins/platforms/windows/qwindowsopengltester.cpp1
-rw-r--r--src/plugins/platforms/windows/qwindowspointerhandler.cpp12
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp5
-rw-r--r--src/plugins/platforms/windows/qwindowsservices.cpp73
-rw-r--r--src/plugins/platforms/windows/qwindowssystemtrayicon.cpp9
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.cpp70
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.h2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp46
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.h1
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp39
-rw-r--r--src/plugins/platforms/xcb/CMakeLists.txt13
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_egl/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/CMakeLists.txt2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp4
-rw-r--r--src/plugins/platforms/xcb/nativepainting/qtessellator.cpp1
-rw-r--r--src/plugins/platforms/xcb/qt_xlib_wrapper.c7
-rw-r--r--src/plugins/platforms/xcb/qt_xlib_wrapper.h17
-rw-r--r--src/plugins/platforms/xcb/qxcbatom.cpp1
-rw-r--r--src/plugins/platforms/xcb/qxcbatom.h1
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp44
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h5
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_screens.cpp24
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp10
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.cpp145
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.h10
-rw-r--r--src/plugins/platforms/xcb/qxcbcursorfont.h88
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp43
-rw-r--r--src/plugins/platforms/xcb/qxcbmime.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp16
-rw-r--r--src/plugins/platforms/xcb/qxcbsessionmanager.cpp6
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp14
-rw-r--r--src/plugins/platforms/xcb/qxcbxsettings.cpp4
-rw-r--r--src/plugins/platformthemes/CMakeLists.txt2
-rw-r--r--src/plugins/platformthemes/gtk3/CMakeLists.txt5
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp2
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3interface.cpp539
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3interface_p.h171
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3json.cpp404
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3json_p.h102
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3menu.cpp6
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3storage.cpp470
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3storage_p.h234
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3theme.cpp86
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3theme.h10
-rw-r--r--src/plugins/platformthemes/xdgdesktopportal/CMakeLists.txt2
-rw-r--r--src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp9
-rw-r--r--src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp18
-rw-r--r--src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.h2
-rw-r--r--src/plugins/printsupport/CMakeLists.txt2
-rw-r--r--src/plugins/printsupport/cups/CMakeLists.txt2
-rw-r--r--src/plugins/printsupport/cups/qcupsprintersupport.cpp2
-rw-r--r--src/plugins/printsupport/cups/qppdprintdevice.cpp4
-rw-r--r--src/plugins/sqldrivers/CMakeLists.txt2
-rw-r--r--src/plugins/sqldrivers/configure.cmake2
-rw-r--r--src/plugins/sqldrivers/db2/CMakeLists.txt2
-rw-r--r--src/plugins/sqldrivers/ibase/CMakeLists.txt2
-rw-r--r--src/plugins/sqldrivers/mysql/CMakeLists.txt2
-rw-r--r--src/plugins/sqldrivers/mysql/qsql_mysql.cpp234
-rw-r--r--src/plugins/sqldrivers/oci/CMakeLists.txt2
-rw-r--r--src/plugins/sqldrivers/oci/main.cpp2
-rw-r--r--src/plugins/sqldrivers/oci/qsql_oci.cpp3
-rw-r--r--src/plugins/sqldrivers/oci/qsql_oci_p.h2
-rw-r--r--src/plugins/sqldrivers/odbc/CMakeLists.txt2
-rw-r--r--src/plugins/sqldrivers/odbc/qsql_odbc.cpp29
-rw-r--r--src/plugins/sqldrivers/psql/CMakeLists.txt2
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql.cpp2
-rw-r--r--src/plugins/sqldrivers/qt_cmdline.cmake2
-rw-r--r--src/plugins/sqldrivers/sqlite/CMakeLists.txt5
-rw-r--r--src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp26
-rw-r--r--src/plugins/sqldrivers/sqlite/smain.cpp3
-rw-r--r--src/plugins/styles/CMakeLists.txt2
-rw-r--r--src/plugins/styles/android/CMakeLists.txt2
-rw-r--r--src/plugins/styles/android/qandroidstyle.cpp6
-rw-r--r--src/plugins/styles/mac/CMakeLists.txt2
-rw-r--r--src/plugins/styles/mac/main.mm2
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm36
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac_p_p.h3
-rw-r--r--src/plugins/styles/windowsvista/CMakeLists.txt7
-rw-r--r--src/plugins/styles/windowsvista/qwindowsthemedata.cpp59
-rw-r--r--src/plugins/styles/windowsvista/qwindowsthemedata_p.h183
-rw-r--r--src/plugins/styles/windowsvista/qwindowsvistaanimation.cpp15
-rw-r--r--src/plugins/styles/windowsvista/qwindowsvistaanimation_p.h49
-rw-r--r--src/plugins/styles/windowsvista/qwindowsvistastyle.cpp4387
-rw-r--r--src/plugins/styles/windowsvista/qwindowsvistastyle_p.h4
-rw-r--r--src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h160
-rw-r--r--src/plugins/styles/windowsvista/qwindowsxpstyle.cpp3669
-rw-r--r--src/plugins/styles/windowsvista/qwindowsxpstyle_p.h69
-rw-r--r--src/plugins/styles/windowsvista/qwindowsxpstyle_p_p.h309
-rw-r--r--src/plugins/tls/CMakeLists.txt2
-rw-r--r--src/plugins/tls/certonly/CMakeLists.txt2
-rw-r--r--src/plugins/tls/openssl/CMakeLists.txt2
-rw-r--r--src/plugins/tls/openssl/qdtls_openssl.cpp8
-rw-r--r--src/plugins/tls/openssl/qsslcontext_openssl.cpp8
-rw-r--r--src/plugins/tls/openssl/qsslsocket_openssl_symbols.cpp694
-rw-r--r--src/plugins/tls/openssl/qtls_openssl.cpp10
-rw-r--r--src/plugins/tls/openssl/qtlsbackend_openssl.cpp39
-rw-r--r--src/plugins/tls/openssl/qtlsbackend_openssl_p.h5
-rw-r--r--src/plugins/tls/openssl/qtlskey_openssl.cpp10
-rw-r--r--src/plugins/tls/openssl/qx509_openssl.cpp6
-rw-r--r--src/plugins/tls/schannel/CMakeLists.txt2
-rw-r--r--src/plugins/tls/securetransport/CMakeLists.txt2
-rw-r--r--src/plugins/tls/securetransport/qtls_st.cpp4
-rw-r--r--src/plugins/tls/securetransport/qtls_st_p.h5
-rw-r--r--src/plugins/tls/shared/qsslsocket_mac_shared.cpp64
-rw-r--r--src/plugins/tls/shared/qx509_generic.cpp6
-rw-r--r--src/printsupport/CMakeLists.txt4
-rw-r--r--src/printsupport/configure.cmake2
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog_mac.mm2
-rw-r--r--src/printsupport/dialogs/qprintpreviewdialog.cpp4
-rw-r--r--src/printsupport/doc/snippets/CMakeLists.txt2
-rw-r--r--src/printsupport/kernel/qcups.cpp8
-rw-r--r--src/printsupport/kernel/qpaintengine_alpha.cpp6
-rw-r--r--src/printsupport/kernel/qplatformprintdevice.cpp10
-rw-r--r--src/printsupport/kernel/qprinter.cpp5
-rw-r--r--src/printsupport/kernel/qprinter.h2
-rw-r--r--src/printsupport/widgets/qprintpreviewwidget.cpp14
-rw-r--r--src/sql/CMakeLists.txt2
-rw-r--r--src/sql/configure.cmake2
-rw-r--r--src/sql/doc/snippets/CMakeLists.txt2
-rw-r--r--src/sql/doc/snippets/code/CMakeLists.txt2
-rw-r--r--src/sql/doc/snippets/sqldatabase/CMakeLists.txt2
-rw-r--r--src/sql/kernel/qsqldatabase.cpp17
-rw-r--r--src/sql/kernel/qsqldriver.cpp4
-rw-r--r--src/sql/kernel/qsqlrecord.cpp6
-rw-r--r--src/sql/kernel/qsqlresult.cpp20
-rw-r--r--src/sql/kernel/qtsqlglobal.h1
-rw-r--r--src/sql/models/qsqlquerymodel.cpp4
-rw-r--r--src/sql/models/qsqlrelationaltablemodel.cpp12
-rw-r--r--src/sql/models/qsqltablemodel.cpp4
-rw-r--r--src/testlib/3rdparty/linux_perf_event_p.h889
-rw-r--r--src/testlib/CMakeLists.txt36
-rw-r--r--src/testlib/configure.cmake9
-rw-r--r--src/testlib/doc/includes/building-examples.qdocinc3
-rw-r--r--src/testlib/doc/qttestlib.qdocconf2
-rw-r--r--src/testlib/doc/snippets/CMakeLists.txt2
-rw-r--r--src/testlib/doc/snippets/code/CMakeLists.txt2
-rw-r--r--src/testlib/doc/snippets/code/doc_src_qtestlib.qdoc14
-rw-r--r--src/testlib/doc/snippets/code/doc_src_qtqskip.cpp4
-rw-r--r--src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp8
-rw-r--r--src/testlib/doc/snippets/code/src_qtestlib_qtestcase_snippet.cpp13
-rw-r--r--src/testlib/doc/src/qt-webpages.qdoc5
-rw-r--r--src/testlib/doc/src/qttest-best-practices.qdoc28
-rw-r--r--src/testlib/doc/src/qttestlib-manual.qdoc18
-rw-r--r--src/testlib/qabstractitemmodeltester.cpp2
-rw-r--r--src/testlib/qabstracttestlogger.cpp10
-rw-r--r--src/testlib/qabstracttestlogger_p.h1
-rw-r--r--src/testlib/qbenchmark.cpp24
-rw-r--r--src/testlib/qbenchmark_p.h35
-rw-r--r--src/testlib/qbenchmarkevent.cpp16
-rw-r--r--src/testlib/qbenchmarkevent_p.h7
-rw-r--r--src/testlib/qbenchmarkmeasurement.cpp35
-rw-r--r--src/testlib/qbenchmarkmeasurement_p.h13
-rw-r--r--src/testlib/qbenchmarkperfevents.cpp213
-rw-r--r--src/testlib/qbenchmarkperfevents_p.h12
-rw-r--r--src/testlib/qbenchmarktimemeasurers_p.h12
-rw-r--r--src/testlib/qbenchmarkvalgrind.cpp16
-rw-r--r--src/testlib/qbenchmarkvalgrind_p.h6
-rw-r--r--src/testlib/qcsvbenchmarklogger.cpp5
-rw-r--r--src/testlib/qjunittestlogger.cpp4
-rw-r--r--src/testlib/qplaintestlogger.cpp268
-rw-r--r--src/testlib/qplaintestlogger_p.h7
-rw-r--r--src/testlib/qpropertytesthelper_p.h18
-rw-r--r--src/testlib/qsignaldumper.cpp2
-rw-r--r--src/testlib/qsignalspy.h12
-rw-r--r--src/testlib/qt_cmdline.cmake1
-rw-r--r--src/testlib/qtaptestlogger.cpp2
-rw-r--r--src/testlib/qteamcitylogger.cpp172
-rw-r--r--src/testlib/qteamcitylogger_p.h12
-rw-r--r--src/testlib/qtest.h40
-rw-r--r--src/testlib/qtest_gui.h6
-rw-r--r--src/testlib/qtestaccessible.h2
-rw-r--r--src/testlib/qtestblacklist.cpp7
-rw-r--r--src/testlib/qtestcase.cpp143
-rw-r--r--src/testlib/qtestcase.h20
-rw-r--r--src/testlib/qtestcase.qdoc22
-rw-r--r--src/testlib/qtestcase_p.h36
-rw-r--r--src/testlib/qtestevent.h4
-rw-r--r--src/testlib/qtesteventloop.h4
-rw-r--r--src/testlib/qtestkeyboard.h2
-rw-r--r--src/testlib/qtestlog.cpp16
-rw-r--r--src/testlib/qtestlog_p.h4
-rw-r--r--src/testlib/qtestmouse.h14
-rw-r--r--src/testlib/qtestregistry.cpp36
-rw-r--r--src/testlib/qtestregistry_p.h47
-rw-r--r--src/testlib/qtestresult.cpp6
-rw-r--r--src/testlib/qtesttouch.h2
-rw-r--r--src/testlib/qttestglobal.h4
-rw-r--r--src/testlib/qxmltestlogger.cpp4
-rw-r--r--src/testlib/selfcover.cmake2
-rw-r--r--src/tools/CMakeLists.txt2
-rw-r--r--src/tools/androiddeployqt/CMakeLists.txt4
-rw-r--r--src/tools/androiddeployqt/main.cpp163
-rw-r--r--src/tools/androidtestrunner/CMakeLists.txt2
-rw-r--r--src/tools/androidtestrunner/main.cpp3
-rw-r--r--src/tools/bootstrap/CMakeLists.txt10
-rw-r--r--src/tools/cmake_automoc_parser/CMakeLists.txt2
-rw-r--r--src/tools/configure.cmake2
-rw-r--r--src/tools/macdeployqt/CMakeLists.txt2
-rw-r--r--src/tools/macdeployqt/macdeployqt/CMakeLists.txt3
-rw-r--r--src/tools/macdeployqt/shared/shared.cpp26
-rw-r--r--src/tools/moc/CMakeLists.txt2
-rw-r--r--src/tools/moc/collectjson.cpp2
-rw-r--r--src/tools/moc/generator.cpp117
-rw-r--r--src/tools/moc/main.cpp2
-rw-r--r--src/tools/moc/moc.cpp49
-rw-r--r--src/tools/moc/moc.h4
-rw-r--r--src/tools/moc/preprocessor.cpp4
-rw-r--r--src/tools/qdbuscpp2xml/CMakeLists.txt2
-rw-r--r--src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp14
-rw-r--r--src/tools/qdbusxml2cpp/CMakeLists.txt2
-rw-r--r--src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp109
-rw-r--r--src/tools/qlalr/CMakeLists.txt2
-rw-r--r--src/tools/qlalr/compress.cpp6
-rw-r--r--src/tools/qlalr/cppgenerator.cpp4
-rw-r--r--src/tools/qlalr/lalr.cpp8
-rw-r--r--src/tools/qtpaths/CMakeLists.txt2
-rw-r--r--src/tools/qvkgen/CMakeLists.txt2
-rw-r--r--src/tools/qvkgen/qvkgen.cpp6
-rw-r--r--src/tools/rcc/CMakeLists.txt2
-rw-r--r--src/tools/rcc/main.cpp12
-rw-r--r--src/tools/rcc/rcc.cpp24
-rw-r--r--src/tools/shared/shellquote_shared.h8
-rw-r--r--src/tools/syncqt/CMakeLists.txt30
-rw-r--r--src/tools/syncqt/main.cpp1606
-rw-r--r--src/tools/tracegen/CMakeLists.txt2
-rw-r--r--src/tools/tracegen/etw.cpp4
-rw-r--r--src/tools/tracegen/lttng.cpp7
-rw-r--r--src/tools/tracegen/panic.cpp13
-rw-r--r--src/tools/tracegen/panic.h1
-rw-r--r--src/tools/tracegen/provider.cpp4
-rw-r--r--src/tools/tracegen/provider.h1
-rw-r--r--src/tools/uic/CMakeLists.txt2
-rw-r--r--src/tools/uic/cpp/cppwritedeclaration.cpp14
-rw-r--r--src/tools/uic/cpp/cppwriteincludes.cpp4
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp60
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.h2
-rw-r--r--src/tools/uic/customwidgetsinfo.cpp2
-rw-r--r--src/tools/uic/driver.cpp2
-rw-r--r--src/tools/uic/main.cpp10
-rw-r--r--src/tools/uic/option.h2
-rw-r--r--src/tools/uic/python/pythonwriteimports.cpp10
-rw-r--r--src/tools/uic/qclass_lib_map.h1
-rw-r--r--src/tools/uic/shared/language.cpp6
-rw-r--r--src/tools/uic/uic.cpp20
-rw-r--r--src/tools/uic/utils.h2
-rw-r--r--src/tools/windeployqt/CMakeLists.txt8
-rw-r--r--src/tools/windeployqt/main.cpp349
-rw-r--r--src/tools/windeployqt/utils.cpp38
-rw-r--r--src/widgets/CMakeLists.txt2
-rw-r--r--src/widgets/Qt6WidgetsMacros.cmake4
-rw-r--r--src/widgets/accessible/complexwidgets.cpp14
-rw-r--r--src/widgets/accessible/complexwidgets_p.h1
-rw-r--r--src/widgets/accessible/itemviews.cpp121
-rw-r--r--src/widgets/accessible/itemviews_p.h11
-rw-r--r--src/widgets/accessible/qaccessiblemenu.cpp6
-rw-r--r--src/widgets/accessible/qaccessiblewidget.cpp6
-rw-r--r--src/widgets/accessible/qaccessiblewidgets.cpp8
-rw-r--r--src/widgets/accessible/simplewidgets.cpp6
-rw-r--r--src/widgets/configure.cmake2
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp34
-rw-r--r--src/widgets/dialogs/qdialog.cpp11
-rw-r--r--src/widgets/dialogs/qdialog_p.h1
-rw-r--r--src/widgets/dialogs/qerrormessage.cpp101
-rw-r--r--src/widgets/dialogs/qerrormessage.h2
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp181
-rw-r--r--src/widgets/dialogs/qfiledialog_p.h2
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp5
-rw-r--r--src/widgets/dialogs/qinputdialog.cpp3
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp149
-rw-r--r--src/widgets/dialogs/qmessagebox.h4
-rw-r--r--src/widgets/dialogs/qsidebar.cpp10
-rw-r--r--src/widgets/dialogs/qwizard.cpp54
-rw-r--r--src/widgets/dialogs/qwizard.h2
-rw-r--r--src/widgets/doc/images/msgbox1.pngbin4529 -> 12001 bytes
-rw-r--r--src/widgets/doc/images/msgbox2.pngbin9175 -> 22021 bytes
-rw-r--r--src/widgets/doc/images/msgbox3.pngbin9589 -> 17975 bytes
-rw-r--r--src/widgets/doc/images/msgbox4.pngbin17520 -> 24600 bytes
-rw-r--r--src/widgets/doc/snippets/CMakeLists.txt2
-rw-r--r--src/widgets/doc/snippets/cmake-macros/examples.cmake2
-rw-r--r--src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc3
-rw-r--r--src/widgets/doc/snippets/code/src_gui_dialogs_qfiledialog.cpp4
-rw-r--r--src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsgridlayout.cpp9
-rw-r--r--src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicslinearlayout.cpp9
-rw-r--r--src/widgets/doc/snippets/code/src_gui_graphicsview_qgraphicsproxywidget.cpp3
-rw-r--r--src/widgets/doc/snippets/code/src_gui_kernel_qformlayout.cpp7
-rw-r--r--src/widgets/doc/snippets/code/src_gui_widgets_qmenu.cpp2
-rw-r--r--src/widgets/doc/snippets/customviewstyle/CMakeLists.txt2
-rw-r--r--src/widgets/doc/snippets/filedialogurls/CMakeLists.txt2
-rw-r--r--src/widgets/doc/snippets/graphicssceneadditem/CMakeLists.txt2
-rw-r--r--src/widgets/doc/snippets/graphicsview/CMakeLists.txt2
-rw-r--r--src/widgets/doc/snippets/mainwindowsnippet.cpp3
-rw-r--r--src/widgets/doc/snippets/mdiarea/CMakeLists.txt2
-rw-r--r--src/widgets/doc/snippets/myscrollarea/CMakeLists.txt2
-rw-r--r--src/widgets/doc/snippets/qlistview-dnd/model.cpp2
-rw-r--r--src/widgets/doc/snippets/updating-selections/window.cpp4
-rw-r--r--src/widgets/doc/src/cmake-macros.qdoc2
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc28
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp74
-rw-r--r--src/widgets/graphicsview/qgraphicsgridlayout.cpp9
-rw-r--r--src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp24
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.h2
-rw-r--r--src/widgets/graphicsview/qgraphicslayout.h2
-rw-r--r--src/widgets/graphicsview/qgraphicslayoutitem.h2
-rw-r--r--src/widgets/graphicsview/qgraphicslinearlayout.cpp10
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp82
-rw-r--r--src/widgets/graphicsview/qgraphicsscene_bsp.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsview.cpp314
-rw-r--r--src/widgets/graphicsview/qgraphicsview_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.cpp6
-rw-r--r--src/widgets/graphicsview/qsimplex_p.cpp2
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate.cpp5
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp14
-rw-r--r--src/widgets/itemviews/qbsptree.cpp4
-rw-r--r--src/widgets/itemviews/qbsptree_p.h2
-rw-r--r--src/widgets/itemviews/qcolumnview.cpp30
-rw-r--r--src/widgets/itemviews/qheaderview.cpp105
-rw-r--r--src/widgets/itemviews/qheaderview_p.h12
-rw-r--r--src/widgets/itemviews/qlistview.cpp98
-rw-r--r--src/widgets/itemviews/qlistview_p.h2
-rw-r--r--src/widgets/itemviews/qlistwidget.cpp52
-rw-r--r--src/widgets/itemviews/qtableview.cpp4
-rw-r--r--src/widgets/itemviews/qtablewidget.cpp80
-rw-r--r--src/widgets/itemviews/qtablewidget_p.h2
-rw-r--r--src/widgets/itemviews/qtreeview.cpp128
-rw-r--r--src/widgets/itemviews/qtreeview_p.h4
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp108
-rw-r--r--src/widgets/itemviews/qtreewidget.h4
-rw-r--r--src/widgets/itemviews/qtreewidgetitemiterator.cpp4
-rw-r--r--src/widgets/kernel/qapplication.cpp153
-rw-r--r--src/widgets/kernel/qapplication.h4
-rw-r--r--src/widgets/kernel/qapplication_p.h5
-rw-r--r--src/widgets/kernel/qboxlayout.cpp16
-rw-r--r--src/widgets/kernel/qformlayout.cpp2
-rw-r--r--src/widgets/kernel/qgridlayout.cpp10
-rw-r--r--src/widgets/kernel/qstackedlayout.cpp18
-rw-r--r--src/widgets/kernel/qtestsupport_widgets.cpp35
-rw-r--r--src/widgets/kernel/qtooltip.cpp2
-rw-r--r--src/widgets/kernel/qwidget.cpp101
-rw-r--r--src/widgets/kernel/qwidget_p.h13
-rw-r--r--src/widgets/kernel/qwidgetaction.cpp4
-rw-r--r--src/widgets/kernel/qwidgetrepaintmanager.cpp19
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp9
-rw-r--r--src/widgets/qt_cmdline.cmake2
-rw-r--r--src/widgets/styles/qcommonstyle.cpp52
-rw-r--r--src/widgets/styles/qdrawutil.cpp2
-rw-r--r--src/widgets/styles/qdrawutil.h4
-rw-r--r--src/widgets/styles/qfusionstyle.cpp1
-rw-r--r--src/widgets/styles/qstyle.cpp7
-rw-r--r--src/widgets/styles/qstyle.h1
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp71
-rw-r--r--src/widgets/util/qcompleter.cpp12
-rw-r--r--src/widgets/util/qcompleter_p.h4
-rw-r--r--src/widgets/util/qflickgesture.cpp6
-rw-r--r--src/widgets/util/qscroller.cpp4
-rw-r--r--src/widgets/util/qsystemtrayicon.cpp4
-rw-r--r--src/widgets/widgets/qabstractbutton.cpp11
-rw-r--r--src/widgets/widgets/qabstractscrollarea.cpp2
-rw-r--r--src/widgets/widgets/qabstractspinbox.cpp4
-rw-r--r--src/widgets/widgets/qabstractspinbox_p.h2
-rw-r--r--src/widgets/widgets/qbuttongroup.cpp4
-rw-r--r--src/widgets/widgets/qcalendarwidget.cpp4
-rw-r--r--src/widgets/widgets/qcombobox.cpp135
-rw-r--r--src/widgets/widgets/qcombobox_p.h3
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp10
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.cpp12
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp90
-rw-r--r--src/widgets/widgets/qdockwidget.cpp20
-rw-r--r--src/widgets/widgets/qfontcombobox.cpp8
-rw-r--r--src/widgets/widgets/qkeysequenceedit.cpp2
-rw-r--r--src/widgets/widgets/qlcdnumber.cpp10
-rw-r--r--src/widgets/widgets/qlineedit.cpp10
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp2
-rw-r--r--src/widgets/widgets/qmainwindow.cpp2
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp31
-rw-r--r--src/widgets/widgets/qmainwindowlayout_p.h2
-rw-r--r--src/widgets/widgets/qmdiarea.cpp16
-rw-r--r--src/widgets/widgets/qmenu.cpp52
-rw-r--r--src/widgets/widgets/qmenu.h8
-rw-r--r--src/widgets/widgets/qmenubar.cpp34
-rw-r--r--src/widgets/widgets/qmenubar.h2
-rw-r--r--src/widgets/widgets/qsplitter.cpp28
-rw-r--r--src/widgets/widgets/qstatusbar.cpp6
-rw-r--r--src/widgets/widgets/qtabbar.cpp63
-rw-r--r--src/widgets/widgets/qtabbar_p.h2
-rw-r--r--src/widgets/widgets/qtextbrowser.cpp24
-rw-r--r--src/widgets/widgets/qtextedit.cpp2
-rw-r--r--src/widgets/widgets/qtoolbararealayout.cpp128
-rw-r--r--src/widgets/widgets/qtoolbarlayout.cpp32
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp60
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol_p.h10
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp22
-rw-r--r--src/xml/CMakeLists.txt2
-rw-r--r--src/xml/configure.cmake2
-rw-r--r--src/xml/doc/snippets/CMakeLists.txt2
-rw-r--r--src/xml/dom/qdom.cpp30
1586 files changed, 62579 insertions, 42789 deletions
diff --git a/src/3rdparty/VulkanMemoryAllocator/patches/0002-Make-it-compile-on-macOS-10.15.patch b/src/3rdparty/VulkanMemoryAllocator/patches/0002-Make-it-compile-on-macOS-10.15.patch
deleted file mode 100644
index 9a9c5ce0c0..0000000000
--- a/src/3rdparty/VulkanMemoryAllocator/patches/0002-Make-it-compile-on-macOS-10.15.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 8dedd23c769e5b8b76bea9d322fc46a46a2bf76e Mon Sep 17 00:00:00 2001
-From: Laszlo Agocs <laszlo.agocs@qt.io>
-Date: Thu, 14 Jan 2021 11:25:27 +0100
-Subject: [PATCH 2/4] Make it compile on macOS 10.15
-
-Change-Id: I0c26c16ed65668fa90330571d3b741e730b439da
----
- .../VulkanMemoryAllocator/vk_mem_alloc.h | 21 ++++++++++++++++++-
- 1 file changed, 20 insertions(+), 1 deletion(-)
-
-diff --git a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
-index 8e579967d9..10369475c7 100644
---- a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
-+++ b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
-@@ -3560,7 +3560,24 @@ void *aligned_alloc(size_t alignment, size_t size)
-
- return memalign(alignment, size);
- }
--#elif defined(__APPLE__) || defined(__ANDROID__) || (defined(__linux__) && defined(__GLIBCXX__) && !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC))
-+#elif defined(__APPLE__)
-+#include <cstdlib>
-+// aligned_alloc() is marked as macOS 10.15 only in the 10.15 SDK,
-+// avoid the mess by using a different name
-+void *vma_aligned_alloc(size_t alignment, size_t size)
-+{
-+ // alignment must be >= sizeof(void*)
-+ if(alignment < sizeof(void*))
-+ {
-+ alignment = sizeof(void*);
-+ }
-+
-+ void *pointer;
-+ if(posix_memalign(&pointer, alignment, size) == 0)
-+ return pointer;
-+ return VMA_NULL;
-+}
-+#elif defined(__ANDROID__) || (defined(__linux__) && defined(__GLIBCXX__) && !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC))
- #include <cstdlib>
- void *aligned_alloc(size_t alignment, size_t size)
- {
-@@ -3608,6 +3625,8 @@ void *aligned_alloc(size_t alignment, size_t size)
- #ifndef VMA_SYSTEM_ALIGNED_MALLOC
- #if defined(_WIN32)
- #define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment) (_aligned_malloc((size), (alignment)))
-+ #elif defined(__APPLE__)
-+ #define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment) (vma_aligned_alloc((alignment), (size) ))
- #else
- #define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment) (aligned_alloc((alignment), (size) ))
- #endif
---
-2.23.0.windows.1
-
diff --git a/src/3rdparty/VulkanMemoryAllocator/patches/0002-Switch-back-to-the-old-VK_VERSION_-etc.-from-VK_API_.patch b/src/3rdparty/VulkanMemoryAllocator/patches/0002-Switch-back-to-the-old-VK_VERSION_-etc.-from-VK_API_.patch
new file mode 100644
index 0000000000..631976cd81
--- /dev/null
+++ b/src/3rdparty/VulkanMemoryAllocator/patches/0002-Switch-back-to-the-old-VK_VERSION_-etc.-from-VK_API_.patch
@@ -0,0 +1,33 @@
+From 81ec04850473efe01ffdc5bc9383272e77f8cc4e Mon Sep 17 00:00:00 2001
+From: Laszlo Agocs <laszlo.agocs@qt.io>
+Date: Mon, 17 Oct 2022 14:14:12 +0200
+Subject: [PATCH] Switch back to the old VK_VERSION_* etc. from
+ VK_API_VERSION_*
+
+Change-Id: I412ff542ddda895a837c34c4ca40fb4845eae2ba
+---
+ src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
+index 02de45fa1c..ef3ad65060 100644
+--- a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
++++ b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
+@@ -16114,11 +16114,11 @@ VMA_CALL_PRE void VMA_CALL_POST vmaBuildStatsString(
+
+ json.WriteString("apiVersion");
+ json.BeginString();
+- json.ContinueString(VK_API_VERSION_MAJOR(deviceProperties.apiVersion));
++ json.ContinueString(VK_VERSION_MAJOR(deviceProperties.apiVersion));
+ json.ContinueString(".");
+- json.ContinueString(VK_API_VERSION_MINOR(deviceProperties.apiVersion));
++ json.ContinueString(VK_VERSION_MINOR(deviceProperties.apiVersion));
+ json.ContinueString(".");
+- json.ContinueString(VK_API_VERSION_PATCH(deviceProperties.apiVersion));
++ json.ContinueString(VK_VERSION_PATCH(deviceProperties.apiVersion));
+ json.EndString();
+
+ json.WriteString("GPU");
+--
+2.36.1.windows.1
+
diff --git a/src/3rdparty/VulkanMemoryAllocator/patches/0003-Disable-some-warnings-for-gcc-and-clang.patch b/src/3rdparty/VulkanMemoryAllocator/patches/0003-Disable-some-warnings-for-gcc-and-clang.patch
new file mode 100644
index 0000000000..b1476a4032
--- /dev/null
+++ b/src/3rdparty/VulkanMemoryAllocator/patches/0003-Disable-some-warnings-for-gcc-and-clang.patch
@@ -0,0 +1,50 @@
+From aca24b15fbb6b47c35cbd7cd31a3db840df52ded Mon Sep 17 00:00:00 2001
+From: Laszlo Agocs <laszlo.agocs@qt.io>
+Date: Mon, 17 Oct 2022 16:33:50 +0200
+Subject: [PATCH] Disable some warnings for gcc and clang
+
+Change-Id: I81c6c5a2ce736846b6fd95c7f66b7946f7357cf2
+---
+ .../VulkanMemoryAllocator/vk_mem_alloc.h | 19 +++++++++++++++++++
+ 1 file changed, 19 insertions(+)
+
+diff --git a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
+index ef3ad65060..2a5b1e4b1a 100644
+--- a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
++++ b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
+@@ -2565,6 +2565,18 @@ VMA_CALL_PRE void VMA_CALL_POST vmaFreeStatsString(
+ #ifdef VMA_IMPLEMENTATION
+ #undef VMA_IMPLEMENTATION
+
++#if defined(__GNUC__) && !defined(__clang__)
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wunused-variable"
++#pragma GCC diagnostic ignored "-Wunused-parameter"
++#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
++#elif defined(__clang__)
++#pragma clang diagnostic push
++#pragma clang diagnostic ignored "-Wunused-variable"
++#pragma clang diagnostic ignored "-Wunused-parameter"
++#pragma clang diagnostic ignored "-Wmissing-field-initializers"
++#endif
++
+ #include <cstdint>
+ #include <cstdlib>
+ #include <cstring>
+@@ -17526,6 +17538,13 @@ VMA_CALL_PRE void VMA_CALL_POST vmaFreeVirtualBlockStatsString(VmaVirtualBlock V
+ }
+ #endif // VMA_STATS_STRING_ENABLED
+ #endif // _VMA_PUBLIC_INTERFACE
++
++#if defined(__GNUC__) && !defined(__clang__)
++#pragma GCC diagnostic pop
++#elif defined(__clang__)
++#pragma clang diagnostic pop
++#endif
++
+ #endif // VMA_IMPLEMENTATION
+
+ /**
+--
+2.36.1.windows.1
+
diff --git a/src/3rdparty/VulkanMemoryAllocator/patches/0003-Fix-gcc-8-warning.patch b/src/3rdparty/VulkanMemoryAllocator/patches/0003-Fix-gcc-8-warning.patch
deleted file mode 100644
index 87fa8e4cc3..0000000000
--- a/src/3rdparty/VulkanMemoryAllocator/patches/0003-Fix-gcc-8-warning.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 2c51f161e9730482b6ebcc4a73b525d5aa4e539a Mon Sep 17 00:00:00 2001
-From: Laszlo Agocs <laszlo.agocs@qt.io>
-Date: Thu, 14 Jan 2021 11:26:48 +0100
-Subject: [PATCH 3/4] Fix gcc 8 warning
-
-Change-Id: I150223178ecc1e177f669f7415b147f9779f019c
----
- src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
-index 10369475c7..79efc1f0da 100644
---- a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
-+++ b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
-@@ -12640,7 +12640,8 @@ void VmaBlockVector::ApplyDefragmentationMovesGpu(
- const size_t blockCount = m_Blocks.size();
-
- pDefragCtx->blockContexts.resize(blockCount);
-- memset(pDefragCtx->blockContexts.data(), 0, blockCount * sizeof(VmaBlockDefragmentationContext));
-+ for (size_t i = 0; i < blockCount; ++i)
-+ pDefragCtx->blockContexts[i] = VmaBlockDefragmentationContext();
-
- // Go over all moves. Mark blocks that are used with BLOCK_FLAG_USED.
- const size_t moveCount = moves.size();
---
-2.23.0.windows.1
-
diff --git a/src/3rdparty/VulkanMemoryAllocator/patches/0004-Avoid-compiler-warnings.patch b/src/3rdparty/VulkanMemoryAllocator/patches/0004-Avoid-compiler-warnings.patch
deleted file mode 100644
index c9c841eefd..0000000000
--- a/src/3rdparty/VulkanMemoryAllocator/patches/0004-Avoid-compiler-warnings.patch
+++ /dev/null
@@ -1,327 +0,0 @@
-From 6b27f49d0a2d2391654cd89f9a9ef77fad934f66 Mon Sep 17 00:00:00 2001
-From: Laszlo Agocs <laszlo.agocs@qt.io>
-Date: Thu, 14 Jan 2021 11:57:18 +0100
-Subject: [PATCH 4/4] Avoid compiler warnings
-
-Change-Id: I3c9bc051229b02efeae60e27a53c3c4d17c7f995
----
- .../VulkanMemoryAllocator/vk_mem_alloc.h | 84 ++++++++++++-------
- 1 file changed, 56 insertions(+), 28 deletions(-)
-
-diff --git a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
-index 79efc1f0da..ebaeb4bcff 100644
---- a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
-+++ b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
-@@ -4080,7 +4080,7 @@ static void VmaWriteMagicValue(void* pData, VkDeviceSize offset)
- #if VMA_DEBUG_MARGIN > 0 && VMA_DEBUG_DETECT_CORRUPTION
- uint32_t* pDst = (uint32_t*)((char*)pData + offset);
- const size_t numberCount = VMA_DEBUG_MARGIN / sizeof(uint32_t);
-- for(size_t i = 0; i < numberCount; ++i, ++pDst)
-+ for(size_t i = 0; i != numberCount; ++i, ++pDst)
- {
- *pDst = VMA_CORRUPTION_DETECTION_MAGIC_VALUE;
- }
-@@ -4094,7 +4094,7 @@ static bool VmaValidateMagicValue(const void* pData, VkDeviceSize offset)
- #if VMA_DEBUG_MARGIN > 0 && VMA_DEBUG_DETECT_CORRUPTION
- const uint32_t* pSrc = (const uint32_t*)((const char*)pData + offset);
- const size_t numberCount = VMA_DEBUG_MARGIN / sizeof(uint32_t);
-- for(size_t i = 0; i < numberCount; ++i, ++pSrc)
-+ for(size_t i = 0; i != numberCount; ++i, ++pSrc)
- {
- if(*pSrc != VMA_CORRUPTION_DETECTION_MAGIC_VALUE)
- {
-@@ -4339,7 +4339,7 @@ public:
- template<typename U> VmaStlAllocator(const VmaStlAllocator<U>& src) : m_pCallbacks(src.m_pCallbacks) { }
-
- T* allocate(size_t n) { return VmaAllocateArray<T>(m_pCallbacks, n); }
-- void deallocate(T* p, size_t n) { VmaFree(m_pCallbacks, p); }
-+ void deallocate(T* p, size_t /*n*/) { VmaFree(m_pCallbacks, p); }
-
- template<typename U>
- bool operator==(const VmaStlAllocator<U>& rhs) const
-@@ -6067,7 +6067,7 @@ public:
-
- virtual uint32_t MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount);
-
-- virtual VkResult CheckCorruption(const void* pBlockData) { return VK_ERROR_FEATURE_NOT_PRESENT; }
-+ virtual VkResult CheckCorruption(const void* /*pBlockData*/) { return VK_ERROR_FEATURE_NOT_PRESENT; }
-
- virtual void Alloc(
- const VmaAllocationRequest& request,
-@@ -6637,7 +6637,7 @@ public:
- bool overlappingMoveSupported);
- virtual ~VmaDefragmentationAlgorithm_Fast();
-
-- virtual void AddAllocation(VmaAllocation hAlloc, VkBool32* pChanged) { ++m_AllocationCount; }
-+ virtual void AddAllocation(VmaAllocation /*hAlloc*/, VkBool32* /*pChanged*/) { ++m_AllocationCount; }
- virtual void AddAll() { m_AllAllocations = true; }
-
- virtual VkResult Defragment(
-@@ -7699,6 +7699,7 @@ void VmaJsonWriter::BeginValue(bool isString)
- if(currItem.type == COLLECTION_TYPE_OBJECT &&
- currItem.valueCount % 2 == 0)
- {
-+ (void) isString;
- VMA_ASSERT(isString);
- }
-
-@@ -8251,7 +8252,9 @@ bool VmaBlockMetadata_Generic::Validate() const
- }
-
- // Margin required between allocations - every free space must be at least that large.
-+#if VMA_DEBUG_MARGIN
- VMA_VALIDATE(subAlloc.size >= VMA_DEBUG_MARGIN);
-+#endif
- }
- else
- {
-@@ -8397,6 +8400,7 @@ bool VmaBlockMetadata_Generic::CreateAllocationRequest(
- {
- VMA_ASSERT(allocSize > 0);
- VMA_ASSERT(!upperAddress);
-+ (void) upperAddress;
- VMA_ASSERT(allocType != VMA_SUBALLOCATION_TYPE_FREE);
- VMA_ASSERT(pAllocationRequest != VMA_NULL);
- VMA_HEAVY_ASSERT(Validate());
-@@ -10136,10 +10140,12 @@ bool VmaBlockMetadata_Linear::CreateAllocationRequest_UpperAddress(
- // Apply VMA_DEBUG_MARGIN at the end.
- if(VMA_DEBUG_MARGIN > 0)
- {
-+#if VMA_DEBUG_MARGIN
- if(resultOffset < VMA_DEBUG_MARGIN)
- {
- return false;
- }
-+#endif
- resultOffset -= VMA_DEBUG_MARGIN;
- }
-
-@@ -11079,18 +11085,19 @@ void VmaBlockMetadata_Buddy::PrintDetailedMap(class VmaJsonWriter& json) const
- #endif // #if VMA_STATS_STRING_ENABLED
-
- bool VmaBlockMetadata_Buddy::CreateAllocationRequest(
-- uint32_t currentFrameIndex,
-- uint32_t frameInUseCount,
-+ uint32_t /*currentFrameIndex*/,
-+ uint32_t /*frameInUseCount*/,
- VkDeviceSize bufferImageGranularity,
- VkDeviceSize allocSize,
- VkDeviceSize allocAlignment,
- bool upperAddress,
- VmaSuballocationType allocType,
-- bool canMakeOtherLost,
-- uint32_t strategy,
-+ bool /*canMakeOtherLost*/,
-+ uint32_t /*strategy*/,
- VmaAllocationRequest* pAllocationRequest)
- {
- VMA_ASSERT(!upperAddress && "VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT can be used only with linear algorithm.");
-+ (void) upperAddress;
-
- // Simple way to respect bufferImageGranularity. May be optimized some day.
- // Whenever it might be an OPTIMAL image...
-@@ -11131,8 +11138,8 @@ bool VmaBlockMetadata_Buddy::CreateAllocationRequest(
- }
-
- bool VmaBlockMetadata_Buddy::MakeRequestedAllocationsLost(
-- uint32_t currentFrameIndex,
-- uint32_t frameInUseCount,
-+ uint32_t /*currentFrameIndex*/,
-+ uint32_t /*frameInUseCount*/,
- VmaAllocationRequest* pAllocationRequest)
- {
- /*
-@@ -11142,7 +11149,7 @@ bool VmaBlockMetadata_Buddy::MakeRequestedAllocationsLost(
- return pAllocationRequest->itemsToMakeLostCount == 0;
- }
-
--uint32_t VmaBlockMetadata_Buddy::MakeAllocationsLost(uint32_t currentFrameIndex, uint32_t frameInUseCount)
-+uint32_t VmaBlockMetadata_Buddy::MakeAllocationsLost(uint32_t /*currentFrameIndex*/, uint32_t /*frameInUseCount*/)
- {
- /*
- Lost allocations are not supported in buddy allocator at the moment.
-@@ -11153,7 +11160,7 @@ uint32_t VmaBlockMetadata_Buddy::MakeAllocationsLost(uint32_t currentFrameIndex,
-
- void VmaBlockMetadata_Buddy::Alloc(
- const VmaAllocationRequest& request,
-- VmaSuballocationType type,
-+ VmaSuballocationType /*type*/,
- VkDeviceSize allocSize,
- VmaAllocation hAllocation)
- {
-@@ -11480,7 +11487,7 @@ void VmaBlockMetadata_Buddy::PrintDetailedMapNode(class VmaJsonWriter& json, con
- ////////////////////////////////////////////////////////////////////////////////
- // class VmaDeviceMemoryBlock
-
--VmaDeviceMemoryBlock::VmaDeviceMemoryBlock(VmaAllocator hAllocator) :
-+VmaDeviceMemoryBlock::VmaDeviceMemoryBlock(VmaAllocator /*hAllocator*/) :
- m_pMetadata(VMA_NULL),
- m_MemoryTypeIndex(UINT32_MAX),
- m_Id(0),
-@@ -12268,6 +12275,7 @@ VkResult VmaBlockVector::AllocatePage(
- if(IsCorruptionDetectionEnabled())
- {
- VkResult res = pBestRequestBlock->WriteMagicValueAroundAllocation(m_hAllocator, bestRequest.offset, size);
-+ (void) res;
- VMA_ASSERT(res == VK_SUCCESS && "Couldn't map block memory to write magic value.");
- }
- return VK_SUCCESS;
-@@ -12314,6 +12322,7 @@ void VmaBlockVector::Free(
- if(IsCorruptionDetectionEnabled())
- {
- VkResult res = pBlock->ValidateMagicValueAroundAllocation(m_hAllocator, hAllocation->GetOffset(), hAllocation->GetSize());
-+ (void) res;
- VMA_ASSERT(res == VK_SUCCESS && "Couldn't map block memory to validate magic value.");
- }
-
-@@ -12472,6 +12481,7 @@ VkResult VmaBlockVector::AllocateFromBlock(
- if(IsCorruptionDetectionEnabled())
- {
- VkResult res = pBlock->WriteMagicValueAroundAllocation(m_hAllocator, currRequest.offset, size);
-+ (void) res;
- VMA_ASSERT(res == VK_SUCCESS && "Couldn't map block memory to write magic value.");
- }
- return VK_SUCCESS;
-@@ -12481,7 +12491,8 @@ VkResult VmaBlockVector::AllocateFromBlock(
-
- VkResult VmaBlockVector::CreateBlock(VkDeviceSize blockSize, size_t* pNewBlockIndex)
- {
-- VkMemoryAllocateInfo allocInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO };
-+ VkMemoryAllocateInfo allocInfo = {};
-+ allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
- allocInfo.memoryTypeIndex = m_MemoryTypeIndex;
- allocInfo.allocationSize = blockSize;
- VkDeviceMemory mem = VK_NULL_HANDLE;
-@@ -12570,7 +12581,8 @@ void VmaBlockVector::ApplyDefragmentationMovesCpu(
- if(pDefragCtx->res == VK_SUCCESS)
- {
- const VkDeviceSize nonCoherentAtomSize = m_hAllocator->m_PhysicalDeviceProperties.limits.nonCoherentAtomSize;
-- VkMappedMemoryRange memRange = { VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE };
-+ VkMappedMemoryRange memRange = {};
-+ memRange.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;
-
- for(size_t moveIndex = 0; moveIndex < moveCount; ++moveIndex)
- {
-@@ -13032,7 +13044,7 @@ VmaDefragmentationAlgorithm_Generic::VmaDefragmentationAlgorithm_Generic(
- VmaAllocator hAllocator,
- VmaBlockVector* pBlockVector,
- uint32_t currentFrameIndex,
-- bool overlappingMoveSupported) :
-+ bool /*overlappingMoveSupported*/) :
- VmaDefragmentationAlgorithm(hAllocator, pBlockVector, currentFrameIndex),
- m_AllocationCount(0),
- m_AllAllocations(false),
-@@ -15032,8 +15044,13 @@ VkResult VmaAllocator_T::AllocateDedicatedMemory(
- bool map,
- bool isUserDataString,
- void* pUserData,
-+#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000
- VkBuffer dedicatedBuffer,
- VkImage dedicatedImage,
-+#else
-+ VkBuffer /*dedicatedBuffer*/,
-+ VkImage /*dedicatedImage*/,
-+#endif
- size_t allocationCount,
- VmaAllocation* pAllocations)
- {
-@@ -15050,12 +15067,14 @@ VkResult VmaAllocator_T::AllocateDedicatedMemory(
- }
- }
-
-- VkMemoryAllocateInfo allocInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO };
-+ VkMemoryAllocateInfo allocInfo = {};
-+ allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
- allocInfo.memoryTypeIndex = memTypeIndex;
- allocInfo.allocationSize = size;
-
- #if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000
-- VkMemoryDedicatedAllocateInfoKHR dedicatedAllocInfo = { VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR };
-+ VkMemoryDedicatedAllocateInfoKHR dedicatedAllocInfo = {};
-+ dedicatedAllocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR;
- if(m_UseKhrDedicatedAllocation || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))
- {
- if(dedicatedBuffer != VK_NULL_HANDLE)
-@@ -15195,12 +15214,15 @@ void VmaAllocator_T::GetBufferMemoryRequirements(
- #if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000
- if(m_UseKhrDedicatedAllocation || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))
- {
-- VkBufferMemoryRequirementsInfo2KHR memReqInfo = { VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR };
-+ VkBufferMemoryRequirementsInfo2KHR memReqInfo = {};
-+ memReqInfo.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR;
- memReqInfo.buffer = hBuffer;
-
-- VkMemoryDedicatedRequirementsKHR memDedicatedReq = { VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR };
-+ VkMemoryDedicatedRequirementsKHR memDedicatedReq = {};
-+ memDedicatedReq.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR;
-
-- VkMemoryRequirements2KHR memReq2 = { VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR };
-+ VkMemoryRequirements2KHR memReq2 = {};
-+ memReq2.sType = VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR;
- memReq2.pNext = &memDedicatedReq;
-
- (*m_VulkanFunctions.vkGetBufferMemoryRequirements2KHR)(m_hDevice, &memReqInfo, &memReq2);
-@@ -15227,12 +15249,15 @@ void VmaAllocator_T::GetImageMemoryRequirements(
- #if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000
- if(m_UseKhrDedicatedAllocation || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))
- {
-- VkImageMemoryRequirementsInfo2KHR memReqInfo = { VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR };
-+ VkImageMemoryRequirementsInfo2KHR memReqInfo = {};
-+ memReqInfo.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR;
- memReqInfo.image = hImage;
-
-- VkMemoryDedicatedRequirementsKHR memDedicatedReq = { VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR };
-+ VkMemoryDedicatedRequirementsKHR memDedicatedReq = {};
-+ memDedicatedReq.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR;
-
-- VkMemoryRequirements2KHR memReq2 = { VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR };
-+ VkMemoryRequirements2KHR memReq2 = {};
-+ memReq2.sType = VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR;
- memReq2.pNext = &memDedicatedReq;
-
- (*m_VulkanFunctions.vkGetImageMemoryRequirements2KHR)(m_hDevice, &memReqInfo, &memReq2);
-@@ -15461,13 +15486,13 @@ VkResult VmaAllocator_T::ResizeAllocation(
- // This function is deprecated and so it does nothing. It's left for backward compatibility.
- if(newSize == 0 || alloc->GetLastUseFrameIndex() == VMA_FRAME_INDEX_LOST)
- {
-- return VK_ERROR_VALIDATION_FAILED_EXT;
-+ return VkResult(-1000011001); // VK_ERROR_VALIDATION_FAILED_EXT
- }
- if(newSize == alloc->GetSize())
- {
- return VK_SUCCESS;
- }
-- return VK_ERROR_OUT_OF_POOL_MEMORY;
-+ return VkResult(-1000069000); // VK_ERROR_OUT_OF_POOL_MEMORY
- }
-
- void VmaAllocator_T::CalculateStats(VmaStats* pStats)
-@@ -15780,6 +15805,7 @@ void VmaAllocator_T::DestroyPool(VmaPool pool)
- {
- VmaMutexLockWrite lock(m_PoolsMutex, m_UseMutex);
- bool success = VmaVectorRemoveSorted<VmaPointerLess>(m_Pools, pool);
-+ (void) success;
- VMA_ASSERT(success && "Pool not found in Allocator.");
- }
-
-@@ -16111,7 +16137,8 @@ void VmaAllocator_T::FlushOrInvalidateAllocation(
-
- const VkDeviceSize nonCoherentAtomSize = m_PhysicalDeviceProperties.limits.nonCoherentAtomSize;
-
-- VkMappedMemoryRange memRange = { VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE };
-+ VkMappedMemoryRange memRange = {};
-+ memRange.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;
- memRange.memory = hAllocation->GetMemory();
-
- switch(hAllocation->GetType())
-@@ -16184,6 +16211,7 @@ void VmaAllocator_T::FreeDedicatedMemory(const VmaAllocation allocation)
- AllocationVectorType* const pDedicatedAllocations = m_pDedicatedAllocations[memTypeIndex];
- VMA_ASSERT(pDedicatedAllocations);
- bool success = VmaVectorRemoveSorted<VmaPointerLess>(*pDedicatedAllocations, allocation);
-+ (void) success;
- VMA_ASSERT(success);
- }
-
---
-2.23.0.windows.1
-
diff --git a/src/3rdparty/VulkanMemoryAllocator/patches/0004-Disable-nullability-warning-on-Apple-with-clang.patch b/src/3rdparty/VulkanMemoryAllocator/patches/0004-Disable-nullability-warning-on-Apple-with-clang.patch
new file mode 100644
index 0000000000..685764a65e
--- /dev/null
+++ b/src/3rdparty/VulkanMemoryAllocator/patches/0004-Disable-nullability-warning-on-Apple-with-clang.patch
@@ -0,0 +1,27 @@
+From 1d0c960caba0b5aa7e686deafd455d4a3c84db49 Mon Sep 17 00:00:00 2001
+From: Laszlo Agocs <laszlo.agocs@qt.io>
+Date: Tue, 18 Oct 2022 13:26:38 +0200
+Subject: [PATCH] Disable nullability warning on Apple with clang
+
+Change-Id: I6602d1cb695d6483177d3c3722b468a0c9df235a
+---
+ src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
+index 2a5b1e4b1a..18081839c0 100644
+--- a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
++++ b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
+@@ -2575,6 +2575,9 @@ VMA_CALL_PRE void VMA_CALL_POST vmaFreeStatsString(
+ #pragma clang diagnostic ignored "-Wunused-variable"
+ #pragma clang diagnostic ignored "-Wunused-parameter"
+ #pragma clang diagnostic ignored "-Wmissing-field-initializers"
++#if defined(__APPLE__)
++#pragma clang diagnostic ignored "-Wnullability-completeness"
++#endif
+ #endif
+
+ #include <cstdint>
+--
+2.37.0 (Apple Git-136)
+
diff --git a/src/3rdparty/VulkanMemoryAllocator/patches/0005-Disable-more-warnings.patch b/src/3rdparty/VulkanMemoryAllocator/patches/0005-Disable-more-warnings.patch
new file mode 100644
index 0000000000..f6ac509039
--- /dev/null
+++ b/src/3rdparty/VulkanMemoryAllocator/patches/0005-Disable-more-warnings.patch
@@ -0,0 +1,33 @@
+From 4a6d29420041e1f0a14450853887226ff838b917 Mon Sep 17 00:00:00 2001
+From: Laszlo Agocs <laszlo.agocs@qt.io>
+Date: Mon, 24 Oct 2022 15:11:30 +0200
+Subject: [PATCH] vkmemalloc: Disable more warnings
+
+Change-Id: Ifedd263cb39ebad6babdab7687a22ad23f2c9471
+---
+ src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
+index 18081839c0..1b27eeac16 100644
+--- a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
++++ b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
+@@ -2570,11 +2570,15 @@ VMA_CALL_PRE void VMA_CALL_POST vmaFreeStatsString(
+ #pragma GCC diagnostic ignored "-Wunused-variable"
+ #pragma GCC diagnostic ignored "-Wunused-parameter"
+ #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
++#pragma GCC diagnostic ignored "-Wparentheses"
++#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
+ #elif defined(__clang__)
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wunused-variable"
+ #pragma clang diagnostic ignored "-Wunused-parameter"
+ #pragma clang diagnostic ignored "-Wmissing-field-initializers"
++#pragma clang diagnostic ignored "-Wparentheses"
++#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
+ #if defined(__APPLE__)
+ #pragma clang diagnostic ignored "-Wnullability-completeness"
+ #endif
+--
+2.36.1.windows.1
+
diff --git a/src/3rdparty/VulkanMemoryAllocator/patches/0005-More-MingW-8.1-warning-workarounds.patch b/src/3rdparty/VulkanMemoryAllocator/patches/0005-More-MingW-8.1-warning-workarounds.patch
deleted file mode 100644
index 1549f22d18..0000000000
--- a/src/3rdparty/VulkanMemoryAllocator/patches/0005-More-MingW-8.1-warning-workarounds.patch
+++ /dev/null
@@ -1,150 +0,0 @@
-From e4cf9a73270f586ed15fcd899f3b8f7c0a3253b8 Mon Sep 17 00:00:00 2001
-From: Laszlo Agocs <laszlo.agocs@qt.io>
-Date: Thu, 14 Jan 2021 13:31:15 +0100
-Subject: [PATCH] More MingW 8.1 warning workarounds
-
-Change-Id: Ib1df65672c312abce4489f5175d9a69af157c206
----
- .../VulkanMemoryAllocator/vk_mem_alloc.h | 37 +++++++++++++------
- 1 file changed, 25 insertions(+), 12 deletions(-)
-
-diff --git a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
-index ebaeb4bcff..6b10e1eb94 100644
---- a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
-+++ b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
-@@ -4086,6 +4086,8 @@ static void VmaWriteMagicValue(void* pData, VkDeviceSize offset)
- }
- #else
- // no-op
-+ (void) pData;
-+ (void) offset;
- #endif
- }
-
-@@ -4101,6 +4103,9 @@ static bool VmaValidateMagicValue(const void* pData, VkDeviceSize offset)
- return false;
- }
- }
-+#else
-+ (void) pData;
-+ (void) offset;
- #endif
- return true;
- }
-@@ -4400,7 +4405,7 @@ public:
-
- // This version of the constructor is here for compatibility with pre-C++14 std::vector.
- // value is unused.
-- VmaVector(size_t count, const T& value, const AllocatorT& allocator)
-+ VmaVector(size_t count, const T& /*value*/, const AllocatorT& allocator)
- : VmaVector(count, allocator) {}
-
- VmaVector(const VmaVector<T, AllocatorT>& src) :
-@@ -6002,7 +6007,7 @@ private:
- VkDeviceSize allocAlignment,
- VmaSuballocationType allocType,
- bool canMakeOtherLost,
-- uint32_t strategy,
-+ uint32_t /*strategy*/,
- VmaAllocationRequest* pAllocationRequest);
- bool CreateAllocationRequest_UpperAddress(
- uint32_t currentFrameIndex,
-@@ -10098,14 +10103,14 @@ bool VmaBlockMetadata_Linear::CreateAllocationRequest(
- }
-
- bool VmaBlockMetadata_Linear::CreateAllocationRequest_UpperAddress(
-- uint32_t currentFrameIndex,
-- uint32_t frameInUseCount,
-+ uint32_t /*currentFrameIndex*/,
-+ uint32_t /*frameInUseCount*/,
- VkDeviceSize bufferImageGranularity,
- VkDeviceSize allocSize,
- VkDeviceSize allocAlignment,
- VmaSuballocationType allocType,
-- bool canMakeOtherLost,
-- uint32_t strategy,
-+ bool /*canMakeOtherLost*/,
-+ uint32_t /*strategy*/,
- VmaAllocationRequest* pAllocationRequest)
- {
- const VkDeviceSize size = GetSize();
-@@ -10227,7 +10232,7 @@ bool VmaBlockMetadata_Linear::CreateAllocationRequest_LowerAddress(
- VkDeviceSize allocAlignment,
- VmaSuballocationType allocType,
- bool canMakeOtherLost,
-- uint32_t strategy,
-+ uint32_t /*strategy*/,
- VmaAllocationRequest* pAllocationRequest)
- {
- const VkDeviceSize size = GetSize();
-@@ -10678,6 +10683,7 @@ void VmaBlockMetadata_Linear::Alloc(
- // New allocation at the end of 2-part ring buffer, so before first allocation from 1st vector.
- VMA_ASSERT(!suballocations1st.empty() &&
- request.offset + allocSize <= suballocations1st[m_1stNullItemsBeginCount].offset);
-+ (void) suballocations1st;
- SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();
-
- switch(m_2ndVectorMode)
-@@ -11932,7 +11938,7 @@ VkResult VmaBlockVector::AllocatePage(
- const bool mapped = (createInfo.flags & VMA_ALLOCATION_CREATE_MAPPED_BIT) != 0;
- const bool isUserDataString = (createInfo.flags & VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT) != 0;
-
-- const bool withinBudget = (createInfo.flags & VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT) != 0;
-+ //const bool withinBudget = (createInfo.flags & VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT) != 0;
- VkDeviceSize freeMemory;
- {
- const uint32_t heapIndex = m_hAllocator->MemoryTypeIndexToHeapIndex(m_MemoryTypeIndex);
-@@ -15976,7 +15982,8 @@ VkResult VmaAllocator_T::BindVulkanBuffer(
- if((m_UseKhrBindMemory2 || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0)) &&
- m_VulkanFunctions.vkBindBufferMemory2KHR != VMA_NULL)
- {
-- VkBindBufferMemoryInfoKHR bindBufferMemoryInfo = { VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR };
-+ VkBindBufferMemoryInfoKHR bindBufferMemoryInfo = {};
-+ bindBufferMemoryInfo.sType = VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR;
- bindBufferMemoryInfo.pNext = pNext;
- bindBufferMemoryInfo.buffer = buffer;
- bindBufferMemoryInfo.memory = memory;
-@@ -16007,7 +16014,8 @@ VkResult VmaAllocator_T::BindVulkanImage(
- if((m_UseKhrBindMemory2 || m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0)) &&
- m_VulkanFunctions.vkBindImageMemory2KHR != VMA_NULL)
- {
-- VkBindImageMemoryInfoKHR bindBufferMemoryInfo = { VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR };
-+ VkBindImageMemoryInfoKHR bindBufferMemoryInfo = {};
-+ bindBufferMemoryInfo.sType = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR;
- bindBufferMemoryInfo.pNext = pNext;
- bindBufferMemoryInfo.image = image;
- bindBufferMemoryInfo.memory = memory;
-@@ -16263,9 +16271,11 @@ void VmaAllocator_T::UpdateVulkanBudget()
- {
- VMA_ASSERT(m_UseExtMemoryBudget);
-
-- VkPhysicalDeviceMemoryProperties2KHR memProps = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR };
-+ VkPhysicalDeviceMemoryProperties2KHR memProps = {};
-+ memProps.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR;
-
-- VkPhysicalDeviceMemoryBudgetPropertiesEXT budgetProps = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT };
-+ VkPhysicalDeviceMemoryBudgetPropertiesEXT budgetProps = {};
-+ budgetProps.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT;
- memProps.pNext = &budgetProps;
-
- GetVulkanFunctions().vkGetPhysicalDeviceMemoryProperties2KHR(m_PhysicalDevice, &memProps);
-@@ -16883,6 +16893,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaGetPoolName(
- const char** ppName)
- {
- VMA_ASSERT(allocator && pool);
-+ (void) allocator;
-
- VMA_DEBUG_LOG("vmaGetPoolName");
-
-@@ -16909,6 +16920,8 @@ VMA_CALL_PRE void VMA_CALL_POST vmaSetPoolName(
- {
- allocator->GetRecorder()->RecordSetPoolName(allocator->GetCurrentFrameIndex(), pool, pName);
- }
-+#else
-+ (void) allocator;
- #endif
- }
-
---
-2.23.0.windows.1
-
diff --git a/src/3rdparty/VulkanMemoryAllocator/patches/0006-Silence-clang-warning-about-unused-member-var.patch b/src/3rdparty/VulkanMemoryAllocator/patches/0006-Silence-clang-warning-about-unused-member-var.patch
deleted file mode 100644
index 3589deff98..0000000000
--- a/src/3rdparty/VulkanMemoryAllocator/patches/0006-Silence-clang-warning-about-unused-member-var.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 60d151dfd9ffa2e133af50fde05c5eaae9186bee Mon Sep 17 00:00:00 2001
-From: Laszlo Agocs <laszlo.agocs@qt.io>
-Date: Mon, 18 Jan 2021 22:34:37 +0100
-Subject: [PATCH] Silence clang warning about unused member var
-
-Change-Id: Id968fd2302e3ff7b4d1a20cd8dd1f4d789588511
----
- src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
-index 6b10e1eb94..4f3fe1c451 100644
---- a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
-+++ b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
-@@ -6865,7 +6865,7 @@ public:
- private:
- const VmaAllocator m_hAllocator;
- const uint32_t m_CurrFrameIndex;
-- const uint32_t m_Flags;
-+ //const uint32_t m_Flags;
- VmaDefragmentationStats* const m_pStats;
- // Owner of these objects.
- VmaBlockVectorDefragmentationContext* m_DefaultPoolContexts[VK_MAX_MEMORY_TYPES];
-@@ -13782,11 +13782,11 @@ void VmaBlockVectorDefragmentationContext::Begin(bool overlappingMoveSupported)
- VmaDefragmentationContext_T::VmaDefragmentationContext_T(
- VmaAllocator hAllocator,
- uint32_t currFrameIndex,
-- uint32_t flags,
-+ uint32_t /*flags*/,
- VmaDefragmentationStats* pStats) :
- m_hAllocator(hAllocator),
- m_CurrFrameIndex(currFrameIndex),
-- m_Flags(flags),
-+ //m_Flags(flags),
- m_pStats(pStats),
- m_CustomPoolContexts(VmaStlAllocator<VmaBlockVectorDefragmentationContext*>(hAllocator->GetAllocationCallbacks()))
- {
---
-2.24.2 (Apple Git-127)
-
diff --git a/src/3rdparty/VulkanMemoryAllocator/patches/0006-vma-Revise-disabled-warnings.patch b/src/3rdparty/VulkanMemoryAllocator/patches/0006-vma-Revise-disabled-warnings.patch
new file mode 100644
index 0000000000..3ed9b31e9c
--- /dev/null
+++ b/src/3rdparty/VulkanMemoryAllocator/patches/0006-vma-Revise-disabled-warnings.patch
@@ -0,0 +1,28 @@
+From 48762c18eb8a1430540214a6c1cb4572cc108a05 Mon Sep 17 00:00:00 2001
+From: Laszlo Agocs <laszlo.agocs@qt.io>
+Date: Wed, 26 Oct 2022 10:46:48 +0200
+Subject: [PATCH] vma: Revise disabled warnings
+
+Change-Id: I92f62022329ded94778b1385e72336ef9376baee
+---
+ src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
+index 1b27eeac16..b8f9ab52aa 100644
+--- a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
++++ b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
+@@ -2579,10 +2579,8 @@ VMA_CALL_PRE void VMA_CALL_POST vmaFreeStatsString(
+ #pragma clang diagnostic ignored "-Wmissing-field-initializers"
+ #pragma clang diagnostic ignored "-Wparentheses"
+ #pragma clang diagnostic ignored "-Wimplicit-fallthrough"
+-#if defined(__APPLE__)
+ #pragma clang diagnostic ignored "-Wnullability-completeness"
+ #endif
+-#endif
+
+ #include <cstdint>
+ #include <cstdlib>
+--
+2.37.3
+
diff --git a/src/3rdparty/VulkanMemoryAllocator/qt_attribution.json b/src/3rdparty/VulkanMemoryAllocator/qt_attribution.json
index 7d20bc9e44..52581bbb7e 100644
--- a/src/3rdparty/VulkanMemoryAllocator/qt_attribution.json
+++ b/src/3rdparty/VulkanMemoryAllocator/qt_attribution.json
@@ -7,10 +7,10 @@
"QtUsage": "Memory management for the Vulkan backend of QRhi.",
"Homepage": "https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator",
- "Version": "2.3.0",
+ "Version": "3.0.1",
"License": "MIT License",
"LicenseId": "MIT",
"LicenseFile": "LICENSE.txt",
- "Copyright": "Copyright (c) 2017-2019 Advanced Micro Devices, Inc. All rights reserved."
+ "Copyright": "Copyright (c) 2017-2022 Advanced Micro Devices, Inc. All rights reserved."
}
]
diff --git a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
index 4f3fe1c451..b8f9ab52aa 100644
--- a/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
+++ b/src/3rdparty/VulkanMemoryAllocator/vk_mem_alloc.h
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2017-2019 Advanced Micro Devices, Inc. All rights reserved.
+// Copyright (c) 2017-2022 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
@@ -23,18 +23,14 @@
#ifndef AMD_VULKAN_MEMORY_ALLOCATOR_H
#define AMD_VULKAN_MEMORY_ALLOCATOR_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/** \mainpage Vulkan Memory Allocator
-<b>Version 2.3.0</b> (2019-12-04)
+<b>Version 3.0.1 (2022-05-26)</b>
-Copyright (c) 2017-2019 Advanced Micro Devices, Inc. All rights reserved. \n
+Copyright (c) 2017-2022 Advanced Micro Devices, Inc. All rights reserved. \n
License: MIT
-Documentation of all members: vk_mem_alloc.h
+<b>API documentation divided into groups:</b> [Modules](modules.html)
\section main_table_of_contents Table of contents
@@ -53,10 +49,10 @@ Documentation of all members: vk_mem_alloc.h
- [Mapping functions](@ref memory_mapping_mapping_functions)
- [Persistently mapped memory](@ref memory_mapping_persistently_mapped_memory)
- [Cache flush and invalidate](@ref memory_mapping_cache_control)
- - [Finding out if memory is mappable](@ref memory_mapping_finding_if_memory_mappable)
- \subpage staying_within_budget
- [Querying for budget](@ref staying_within_budget_querying_for_budget)
- [Controlling memory usage](@ref staying_within_budget_controlling_memory_usage)
+ - \subpage resource_aliasing
- \subpage custom_memory_pools
- [Choosing memory type index](@ref custom_memory_pools_MemTypeIndex)
- [Linear allocation algorithm](@ref linear_algorithm)
@@ -64,1790 +60,874 @@ Documentation of all members: vk_mem_alloc.h
- [Stack](@ref linear_algorithm_stack)
- [Double stack](@ref linear_algorithm_double_stack)
- [Ring buffer](@ref linear_algorithm_ring_buffer)
- - [Buddy allocation algorithm](@ref buddy_algorithm)
- \subpage defragmentation
- - [Defragmenting CPU memory](@ref defragmentation_cpu)
- - [Defragmenting GPU memory](@ref defragmentation_gpu)
- - [Additional notes](@ref defragmentation_additional_notes)
- - [Writing custom allocation algorithm](@ref defragmentation_custom_algorithm)
- - \subpage lost_allocations
- \subpage statistics
- [Numeric statistics](@ref statistics_numeric_statistics)
- [JSON dump](@ref statistics_json_dump)
- \subpage allocation_annotation
- [Allocation user data](@ref allocation_user_data)
- [Allocation names](@ref allocation_names)
+ - \subpage virtual_allocator
- \subpage debugging_memory_usage
- [Memory initialization](@ref debugging_memory_usage_initialization)
- [Margins](@ref debugging_memory_usage_margins)
- [Corruption detection](@ref debugging_memory_usage_corruption_detection)
- - \subpage record_and_replay
+ - \subpage opengl_interop
- \subpage usage_patterns
- - [Common mistakes](@ref usage_patterns_common_mistakes)
- - [Simple patterns](@ref usage_patterns_simple)
- - [Advanced patterns](@ref usage_patterns_advanced)
+ - [GPU-only resource](@ref usage_patterns_gpu_only)
+ - [Staging copy for upload](@ref usage_patterns_staging_copy_upload)
+ - [Readback](@ref usage_patterns_readback)
+ - [Advanced data uploading](@ref usage_patterns_advanced_data_uploading)
+ - [Other use cases](@ref usage_patterns_other_use_cases)
- \subpage configuration
- [Pointers to Vulkan functions](@ref config_Vulkan_functions)
- [Custom host memory allocator](@ref custom_memory_allocator)
- [Device memory allocation callbacks](@ref allocation_callbacks)
- [Device heap memory limit](@ref heap_memory_limit)
- - \subpage vk_khr_dedicated_allocation
+- <b>Extension support</b>
+ - \subpage vk_khr_dedicated_allocation
+ - \subpage enabling_buffer_device_address
+ - \subpage vk_ext_memory_priority
+ - \subpage vk_amd_device_coherent_memory
- \subpage general_considerations
- [Thread safety](@ref general_considerations_thread_safety)
+ - [Versioning and compatibility](@ref general_considerations_versioning_and_compatibility)
- [Validation layer warnings](@ref general_considerations_validation_layer_warnings)
- [Allocation algorithm](@ref general_considerations_allocation_algorithm)
- [Features not supported](@ref general_considerations_features_not_supported)
\section main_see_also See also
-- [Product page on GPUOpen](https://gpuopen.com/gaming-product/vulkan-memory-allocator/)
-- [Source repository on GitHub](https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator)
+- [**Product page on GPUOpen**](https://gpuopen.com/gaming-product/vulkan-memory-allocator/)
+- [**Source repository on GitHub**](https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator)
+\defgroup group_init Library initialization
+\brief API elements related to the initialization and management of the entire library, especially #VmaAllocator object.
+\defgroup group_alloc Memory allocation
-\page quick_start Quick start
+\brief API elements related to the allocation, deallocation, and management of Vulkan memory, buffers, images.
+Most basic ones being: vmaCreateBuffer(), vmaCreateImage().
-\section quick_start_project_setup Project setup
+\defgroup group_virtual Virtual allocator
-Vulkan Memory Allocator comes in form of a "stb-style" single header file.
-You don't need to build it as a separate library project.
-You can add this file directly to your project and submit it to code repository next to your other source files.
+\brief API elements related to the mechanism of \ref virtual_allocator - using the core allocation algorithm
+for user-defined purpose without allocating any real GPU memory.
-"Single header" doesn't mean that everything is contained in C/C++ declarations,
-like it tends to be in case of inline functions or C++ templates.
-It means that implementation is bundled with interface in a single file and needs to be extracted using preprocessor macro.
-If you don't do it properly, you will get linker errors.
-
-To do it properly:
+\defgroup group_stats Statistics
--# Include "vk_mem_alloc.h" file in each CPP file where you want to use the library.
- This includes declarations of all members of the library.
--# In exacly one CPP file define following macro before this include.
- It enables also internal definitions.
-
-\code
-#define VMA_IMPLEMENTATION
-#include "vk_mem_alloc.h"
-\endcode
-
-It may be a good idea to create dedicated CPP file just for this purpose.
-
-Note on language: This library is written in C++, but has C-compatible interface.
-Thus you can include and use vk_mem_alloc.h in C or C++ code, but full
-implementation with `VMA_IMPLEMENTATION` macro must be compiled as C++, NOT as C.
-
-Please note that this library includes header `<vulkan/vulkan.h>`, which in turn
-includes `<windows.h>` on Windows. If you need some specific macros defined
-before including these headers (like `WIN32_LEAN_AND_MEAN` or
-`WINVER` for Windows, `VK_USE_PLATFORM_WIN32_KHR` for Vulkan), you must define
-them before every `#include` of this library.
-
-
-\section quick_start_initialization Initialization
-
-At program startup:
-
--# Initialize Vulkan to have `VkPhysicalDevice` and `VkDevice` object.
--# Fill VmaAllocatorCreateInfo structure and create #VmaAllocator object by
- calling vmaCreateAllocator().
-
-\code
-VmaAllocatorCreateInfo allocatorInfo = {};
-allocatorInfo.physicalDevice = physicalDevice;
-allocatorInfo.device = device;
-
-VmaAllocator allocator;
-vmaCreateAllocator(&allocatorInfo, &allocator);
-\endcode
-
-\section quick_start_resource_allocation Resource allocation
-
-When you want to create a buffer or image:
-
--# Fill `VkBufferCreateInfo` / `VkImageCreateInfo` structure.
--# Fill VmaAllocationCreateInfo structure.
--# Call vmaCreateBuffer() / vmaCreateImage() to get `VkBuffer`/`VkImage` with memory
- already allocated and bound to it.
-
-\code
-VkBufferCreateInfo bufferInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
-bufferInfo.size = 65536;
-bufferInfo.usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
-
-VmaAllocationCreateInfo allocInfo = {};
-allocInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;
-
-VkBuffer buffer;
-VmaAllocation allocation;
-vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &buffer, &allocation, nullptr);
-\endcode
-
-Don't forget to destroy your objects when no longer needed:
-
-\code
-vmaDestroyBuffer(allocator, buffer, allocation);
-vmaDestroyAllocator(allocator);
-\endcode
-
-
-\page choosing_memory_type Choosing memory type
-
-Physical devices in Vulkan support various combinations of memory heaps and
-types. Help with choosing correct and optimal memory type for your specific
-resource is one of the key features of this library. You can use it by filling
-appropriate members of VmaAllocationCreateInfo structure, as described below.
-You can also combine multiple methods.
-
--# If you just want to find memory type index that meets your requirements, you
- can use function: vmaFindMemoryTypeIndex(), vmaFindMemoryTypeIndexForBufferInfo(),
- vmaFindMemoryTypeIndexForImageInfo().
--# If you want to allocate a region of device memory without association with any
- specific image or buffer, you can use function vmaAllocateMemory(). Usage of
- this function is not recommended and usually not needed.
- vmaAllocateMemoryPages() function is also provided for creating multiple allocations at once,
- which may be useful for sparse binding.
--# If you already have a buffer or an image created, you want to allocate memory
- for it and then you will bind it yourself, you can use function
- vmaAllocateMemoryForBuffer(), vmaAllocateMemoryForImage().
- For binding you should use functions: vmaBindBufferMemory(), vmaBindImageMemory()
- or their extended versions: vmaBindBufferMemory2(), vmaBindImageMemory2().
--# If you want to create a buffer or an image, allocate memory for it and bind
- them together, all in one call, you can use function vmaCreateBuffer(),
- vmaCreateImage(). This is the easiest and recommended way to use this library.
-
-When using 3. or 4., the library internally queries Vulkan for memory types
-supported for that buffer or image (function `vkGetBufferMemoryRequirements()`)
-and uses only one of these types.
-
-If no memory type can be found that meets all the requirements, these functions
-return `VK_ERROR_FEATURE_NOT_PRESENT`.
-
-You can leave VmaAllocationCreateInfo structure completely filled with zeros.
-It means no requirements are specified for memory type.
-It is valid, although not very useful.
-
-\section choosing_memory_type_usage Usage
-
-The easiest way to specify memory requirements is to fill member
-VmaAllocationCreateInfo::usage using one of the values of enum #VmaMemoryUsage.
-It defines high level, common usage types.
-For more details, see description of this enum.
-
-For example, if you want to create a uniform buffer that will be filled using
-transfer only once or infrequently and used for rendering every frame, you can
-do it using following code:
-
-\code
-VkBufferCreateInfo bufferInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
-bufferInfo.size = 65536;
-bufferInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
-
-VmaAllocationCreateInfo allocInfo = {};
-allocInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;
-
-VkBuffer buffer;
-VmaAllocation allocation;
-vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &buffer, &allocation, nullptr);
-\endcode
-
-\section choosing_memory_type_required_preferred_flags Required and preferred flags
-
-You can specify more detailed requirements by filling members
-VmaAllocationCreateInfo::requiredFlags and VmaAllocationCreateInfo::preferredFlags
-with a combination of bits from enum `VkMemoryPropertyFlags`. For example,
-if you want to create a buffer that will be persistently mapped on host (so it
-must be `HOST_VISIBLE`) and preferably will also be `HOST_COHERENT` and `HOST_CACHED`,
-use following code:
+\brief API elements that query current status of the allocator, from memory usage, budget, to full dump of the internal state in JSON format.
+See documentation chapter: \ref statistics.
+*/
-\code
-VmaAllocationCreateInfo allocInfo = {};
-allocInfo.requiredFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
-allocInfo.preferredFlags = VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
-allocInfo.flags = VMA_ALLOCATION_CREATE_MAPPED_BIT;
-VkBuffer buffer;
-VmaAllocation allocation;
-vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &buffer, &allocation, nullptr);
-\endcode
+#ifdef __cplusplus
+extern "C" {
+#endif
-A memory type is chosen that has all the required flags and as many preferred
-flags set as possible.
+#ifndef VULKAN_H_
+ #include <vulkan/vulkan.h>
+#endif
-If you use VmaAllocationCreateInfo::usage, it is just internally converted to
-a set of required and preferred flags.
+// Define this macro to declare maximum supported Vulkan version in format AAABBBCCC,
+// where AAA = major, BBB = minor, CCC = patch.
+// If you want to use version > 1.0, it still needs to be enabled via VmaAllocatorCreateInfo::vulkanApiVersion.
+#if !defined(VMA_VULKAN_VERSION)
+ #if defined(VK_VERSION_1_3)
+ #define VMA_VULKAN_VERSION 1003000
+ #elif defined(VK_VERSION_1_2)
+ #define VMA_VULKAN_VERSION 1002000
+ #elif defined(VK_VERSION_1_1)
+ #define VMA_VULKAN_VERSION 1001000
+ #else
+ #define VMA_VULKAN_VERSION 1000000
+ #endif
+#endif
-\section choosing_memory_type_explicit_memory_types Explicit memory types
+#if defined(__ANDROID__) && defined(VK_NO_PROTOTYPES) && VMA_STATIC_VULKAN_FUNCTIONS
+ extern PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
+ extern PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr;
+ extern PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties;
+ extern PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties;
+ extern PFN_vkAllocateMemory vkAllocateMemory;
+ extern PFN_vkFreeMemory vkFreeMemory;
+ extern PFN_vkMapMemory vkMapMemory;
+ extern PFN_vkUnmapMemory vkUnmapMemory;
+ extern PFN_vkFlushMappedMemoryRanges vkFlushMappedMemoryRanges;
+ extern PFN_vkInvalidateMappedMemoryRanges vkInvalidateMappedMemoryRanges;
+ extern PFN_vkBindBufferMemory vkBindBufferMemory;
+ extern PFN_vkBindImageMemory vkBindImageMemory;
+ extern PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements;
+ extern PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements;
+ extern PFN_vkCreateBuffer vkCreateBuffer;
+ extern PFN_vkDestroyBuffer vkDestroyBuffer;
+ extern PFN_vkCreateImage vkCreateImage;
+ extern PFN_vkDestroyImage vkDestroyImage;
+ extern PFN_vkCmdCopyBuffer vkCmdCopyBuffer;
+ #if VMA_VULKAN_VERSION >= 1001000
+ extern PFN_vkGetBufferMemoryRequirements2 vkGetBufferMemoryRequirements2;
+ extern PFN_vkGetImageMemoryRequirements2 vkGetImageMemoryRequirements2;
+ extern PFN_vkBindBufferMemory2 vkBindBufferMemory2;
+ extern PFN_vkBindImageMemory2 vkBindImageMemory2;
+ extern PFN_vkGetPhysicalDeviceMemoryProperties2 vkGetPhysicalDeviceMemoryProperties2;
+ #endif // #if VMA_VULKAN_VERSION >= 1001000
+#endif // #if defined(__ANDROID__) && VMA_STATIC_VULKAN_FUNCTIONS && VK_NO_PROTOTYPES
-If you inspected memory types available on the physical device and you have
-a preference for memory types that you want to use, you can fill member
-VmaAllocationCreateInfo::memoryTypeBits. It is a bit mask, where each bit set
-means that a memory type with that index is allowed to be used for the
-allocation. Special value 0, just like `UINT32_MAX`, means there are no
-restrictions to memory type index.
+#if !defined(VMA_DEDICATED_ALLOCATION)
+ #if VK_KHR_get_memory_requirements2 && VK_KHR_dedicated_allocation
+ #define VMA_DEDICATED_ALLOCATION 1
+ #else
+ #define VMA_DEDICATED_ALLOCATION 0
+ #endif
+#endif
-Please note that this member is NOT just a memory type index.
-Still you can use it to choose just one, specific memory type.
-For example, if you already determined that your buffer should be created in
-memory type 2, use following code:
+#if !defined(VMA_BIND_MEMORY2)
+ #if VK_KHR_bind_memory2
+ #define VMA_BIND_MEMORY2 1
+ #else
+ #define VMA_BIND_MEMORY2 0
+ #endif
+#endif
-\code
-uint32_t memoryTypeIndex = 2;
+#if !defined(VMA_MEMORY_BUDGET)
+ #if VK_EXT_memory_budget && (VK_KHR_get_physical_device_properties2 || VMA_VULKAN_VERSION >= 1001000)
+ #define VMA_MEMORY_BUDGET 1
+ #else
+ #define VMA_MEMORY_BUDGET 0
+ #endif
+#endif
-VmaAllocationCreateInfo allocInfo = {};
-allocInfo.memoryTypeBits = 1u << memoryTypeIndex;
+// Defined to 1 when VK_KHR_buffer_device_address device extension or equivalent core Vulkan 1.2 feature is defined in its headers.
+#if !defined(VMA_BUFFER_DEVICE_ADDRESS)
+ #if VK_KHR_buffer_device_address || VMA_VULKAN_VERSION >= 1002000
+ #define VMA_BUFFER_DEVICE_ADDRESS 1
+ #else
+ #define VMA_BUFFER_DEVICE_ADDRESS 0
+ #endif
+#endif
-VkBuffer buffer;
-VmaAllocation allocation;
-vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &buffer, &allocation, nullptr);
-\endcode
+// Defined to 1 when VK_EXT_memory_priority device extension is defined in Vulkan headers.
+#if !defined(VMA_MEMORY_PRIORITY)
+ #if VK_EXT_memory_priority
+ #define VMA_MEMORY_PRIORITY 1
+ #else
+ #define VMA_MEMORY_PRIORITY 0
+ #endif
+#endif
-\section choosing_memory_type_custom_memory_pools Custom memory pools
+// Defined to 1 when VK_KHR_external_memory device extension is defined in Vulkan headers.
+#if !defined(VMA_EXTERNAL_MEMORY)
+ #if VK_KHR_external_memory
+ #define VMA_EXTERNAL_MEMORY 1
+ #else
+ #define VMA_EXTERNAL_MEMORY 0
+ #endif
+#endif
-If you allocate from custom memory pool, all the ways of specifying memory
-requirements described above are not applicable and the aforementioned members
-of VmaAllocationCreateInfo structure are ignored. Memory type is selected
-explicitly when creating the pool and then used to make all the allocations from
-that pool. For further details, see \ref custom_memory_pools.
+// Define these macros to decorate all public functions with additional code,
+// before and after returned type, appropriately. This may be useful for
+// exporting the functions when compiling VMA as a separate library. Example:
+// #define VMA_CALL_PRE __declspec(dllexport)
+// #define VMA_CALL_POST __cdecl
+#ifndef VMA_CALL_PRE
+ #define VMA_CALL_PRE
+#endif
+#ifndef VMA_CALL_POST
+ #define VMA_CALL_POST
+#endif
-\section choosing_memory_type_dedicated_allocations Dedicated allocations
+// Define this macro to decorate pointers with an attribute specifying the
+// length of the array they point to if they are not null.
+//
+// The length may be one of
+// - The name of another parameter in the argument list where the pointer is declared
+// - The name of another member in the struct where the pointer is declared
+// - The name of a member of a struct type, meaning the value of that member in
+// the context of the call. For example
+// VMA_LEN_IF_NOT_NULL("VkPhysicalDeviceMemoryProperties::memoryHeapCount"),
+// this means the number of memory heaps available in the device associated
+// with the VmaAllocator being dealt with.
+#ifndef VMA_LEN_IF_NOT_NULL
+ #define VMA_LEN_IF_NOT_NULL(len)
+#endif
-Memory for allocations is reserved out of larger block of `VkDeviceMemory`
-allocated from Vulkan internally. That's the main feature of this whole library.
-You can still request a separate memory block to be created for an allocation,
-just like you would do in a trivial solution without using any allocator.
-In that case, a buffer or image is always bound to that memory at offset 0.
-This is called a "dedicated allocation".
-You can explicitly request it by using flag #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT.
-The library can also internally decide to use dedicated allocation in some cases, e.g.:
+// The VMA_NULLABLE macro is defined to be _Nullable when compiling with Clang.
+// see: https://clang.llvm.org/docs/AttributeReference.html#nullable
+#ifndef VMA_NULLABLE
+ #ifdef __clang__
+ #define VMA_NULLABLE _Nullable
+ #else
+ #define VMA_NULLABLE
+ #endif
+#endif
-- When the size of the allocation is large.
-- When [VK_KHR_dedicated_allocation](@ref vk_khr_dedicated_allocation) extension is enabled
- and it reports that dedicated allocation is required or recommended for the resource.
-- When allocation of next big memory block fails due to not enough device memory,
- but allocation with the exact requested size succeeds.
+// The VMA_NOT_NULL macro is defined to be _Nonnull when compiling with Clang.
+// see: https://clang.llvm.org/docs/AttributeReference.html#nonnull
+#ifndef VMA_NOT_NULL
+ #ifdef __clang__
+ #define VMA_NOT_NULL _Nonnull
+ #else
+ #define VMA_NOT_NULL
+ #endif
+#endif
+// If non-dispatchable handles are represented as pointers then we can give
+// then nullability annotations
+#ifndef VMA_NOT_NULL_NON_DISPATCHABLE
+ #if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
+ #define VMA_NOT_NULL_NON_DISPATCHABLE VMA_NOT_NULL
+ #else
+ #define VMA_NOT_NULL_NON_DISPATCHABLE
+ #endif
+#endif
-\page memory_mapping Memory mapping
+#ifndef VMA_NULLABLE_NON_DISPATCHABLE
+ #if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
+ #define VMA_NULLABLE_NON_DISPATCHABLE VMA_NULLABLE
+ #else
+ #define VMA_NULLABLE_NON_DISPATCHABLE
+ #endif
+#endif
-To "map memory" in Vulkan means to obtain a CPU pointer to `VkDeviceMemory`,
-to be able to read from it or write to it in CPU code.
-Mapping is possible only of memory allocated from a memory type that has
-`VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT` flag.
-Functions `vkMapMemory()`, `vkUnmapMemory()` are designed for this purpose.
-You can use them directly with memory allocated by this library,
-but it is not recommended because of following issue:
-Mapping the same `VkDeviceMemory` block multiple times is illegal - only one mapping at a time is allowed.
-This includes mapping disjoint regions. Mapping is not reference-counted internally by Vulkan.
-Because of this, Vulkan Memory Allocator provides following facilities:
+#ifndef VMA_STATS_STRING_ENABLED
+ #define VMA_STATS_STRING_ENABLED 1
+#endif
-\section memory_mapping_mapping_functions Mapping functions
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+//
+// INTERFACE
+//
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
-The library provides following functions for mapping of a specific #VmaAllocation: vmaMapMemory(), vmaUnmapMemory().
-They are safer and more convenient to use than standard Vulkan functions.
-You can map an allocation multiple times simultaneously - mapping is reference-counted internally.
-You can also map different allocations simultaneously regardless of whether they use the same `VkDeviceMemory` block.
-The way it's implemented is that the library always maps entire memory block, not just region of the allocation.
-For further details, see description of vmaMapMemory() function.
-Example:
+// Sections for managing code placement in file, only for development purposes e.g. for convenient folding inside an IDE.
+#ifndef _VMA_ENUM_DECLARATIONS
-\code
-// Having these objects initialized:
+/**
+\addtogroup group_init
+@{
+*/
-struct ConstantBuffer
+/// Flags for created #VmaAllocator.
+typedef enum VmaAllocatorCreateFlagBits
{
- ...
-};
-ConstantBuffer constantBufferData;
-
-VmaAllocator allocator;
-VkBuffer constantBuffer;
-VmaAllocation constantBufferAllocation;
-
-// You can map and fill your buffer using following code:
-
-void* mappedData;
-vmaMapMemory(allocator, constantBufferAllocation, &mappedData);
-memcpy(mappedData, &constantBufferData, sizeof(constantBufferData));
-vmaUnmapMemory(allocator, constantBufferAllocation);
-\endcode
+ /** \brief Allocator and all objects created from it will not be synchronized internally, so you must guarantee they are used from only one thread at a time or synchronized externally by you.
-When mapping, you may see a warning from Vulkan validation layer similar to this one:
+ Using this flag may increase performance because internal mutexes are not used.
+ */
+ VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT = 0x00000001,
+ /** \brief Enables usage of VK_KHR_dedicated_allocation extension.
-<i>Mapping an image with layout VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL can result in undefined behavior if this memory is used by the device. Only GENERAL or PREINITIALIZED should be used.</i>
+ The flag works only if VmaAllocatorCreateInfo::vulkanApiVersion `== VK_API_VERSION_1_0`.
+ When it is `VK_API_VERSION_1_1`, the flag is ignored because the extension has been promoted to Vulkan 1.1.
-It happens because the library maps entire `VkDeviceMemory` block, where different
-types of images and buffers may end up together, especially on GPUs with unified memory like Intel.
-You can safely ignore it if you are sure you access only memory of the intended
-object that you wanted to map.
+ Using this extension will automatically allocate dedicated blocks of memory for
+ some buffers and images instead of suballocating place for them out of bigger
+ memory blocks (as if you explicitly used #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT
+ flag) when it is recommended by the driver. It may improve performance on some
+ GPUs.
+ You may set this flag only if you found out that following device extensions are
+ supported, you enabled them while creating Vulkan device passed as
+ VmaAllocatorCreateInfo::device, and you want them to be used internally by this
+ library:
-\section memory_mapping_persistently_mapped_memory Persistently mapped memory
+ - VK_KHR_get_memory_requirements2 (device extension)
+ - VK_KHR_dedicated_allocation (device extension)
-Kepping your memory persistently mapped is generally OK in Vulkan.
-You don't need to unmap it before using its data on the GPU.
-The library provides a special feature designed for that:
-Allocations made with #VMA_ALLOCATION_CREATE_MAPPED_BIT flag set in
-VmaAllocationCreateInfo::flags stay mapped all the time,
-so you can just access CPU pointer to it any time
-without a need to call any "map" or "unmap" function.
-Example:
+ When this flag is set, you can experience following warnings reported by Vulkan
+ validation layer. You can ignore them.
-\code
-VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
-bufCreateInfo.size = sizeof(ConstantBuffer);
-bufCreateInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
+ > vkBindBufferMemory(): Binding memory to buffer 0x2d but vkGetBufferMemoryRequirements() has not been called on that buffer.
+ */
+ VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT = 0x00000002,
+ /**
+ Enables usage of VK_KHR_bind_memory2 extension.
-VmaAllocationCreateInfo allocCreateInfo = {};
-allocCreateInfo.usage = VMA_MEMORY_USAGE_CPU_ONLY;
-allocCreateInfo.flags = VMA_ALLOCATION_CREATE_MAPPED_BIT;
+ The flag works only if VmaAllocatorCreateInfo::vulkanApiVersion `== VK_API_VERSION_1_0`.
+ When it is `VK_API_VERSION_1_1`, the flag is ignored because the extension has been promoted to Vulkan 1.1.
-VkBuffer buf;
-VmaAllocation alloc;
-VmaAllocationInfo allocInfo;
-vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &buf, &alloc, &allocInfo);
+ You may set this flag only if you found out that this device extension is supported,
+ you enabled it while creating Vulkan device passed as VmaAllocatorCreateInfo::device,
+ and you want it to be used internally by this library.
-// Buffer is already mapped. You can access its memory.
-memcpy(allocInfo.pMappedData, &constantBufferData, sizeof(constantBufferData));
-\endcode
+ The extension provides functions `vkBindBufferMemory2KHR` and `vkBindImageMemory2KHR`,
+ which allow to pass a chain of `pNext` structures while binding.
+ This flag is required if you use `pNext` parameter in vmaBindBufferMemory2() or vmaBindImageMemory2().
+ */
+ VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT = 0x00000004,
+ /**
+ Enables usage of VK_EXT_memory_budget extension.
-There are some exceptions though, when you should consider mapping memory only for a short period of time:
-
-- When operating system is Windows 7 or 8.x (Windows 10 is not affected because it uses WDDM2),
- device is discrete AMD GPU,
- and memory type is the special 256 MiB pool of `DEVICE_LOCAL + HOST_VISIBLE` memory
- (selected when you use #VMA_MEMORY_USAGE_CPU_TO_GPU),
- then whenever a memory block allocated from this memory type stays mapped
- for the time of any call to `vkQueueSubmit()` or `vkQueuePresentKHR()`, this
- block is migrated by WDDM to system RAM, which degrades performance. It doesn't
- matter if that particular memory block is actually used by the command buffer
- being submitted.
-- On Mac/MoltenVK there is a known bug - [Issue #175](https://github.com/KhronosGroup/MoltenVK/issues/175)
- which requires unmapping before GPU can see updated texture.
-- Keeping many large memory blocks mapped may impact performance or stability of some debugging tools.
+ You may set this flag only if you found out that this device extension is supported,
+ you enabled it while creating Vulkan device passed as VmaAllocatorCreateInfo::device,
+ and you want it to be used internally by this library, along with another instance extension
+ VK_KHR_get_physical_device_properties2, which is required by it (or Vulkan 1.1, where this extension is promoted).
-\section memory_mapping_cache_control Cache flush and invalidate
-
-Memory in Vulkan doesn't need to be unmapped before using it on GPU,
-but unless a memory types has `VK_MEMORY_PROPERTY_HOST_COHERENT_BIT` flag set,
-you need to manually **invalidate** cache before reading of mapped pointer
-and **flush** cache after writing to mapped pointer.
-Map/unmap operations don't do that automatically.
-Vulkan provides following functions for this purpose `vkFlushMappedMemoryRanges()`,
-`vkInvalidateMappedMemoryRanges()`, but this library provides more convenient
-functions that refer to given allocation object: vmaFlushAllocation(),
-vmaInvalidateAllocation().
+ The extension provides query for current memory usage and budget, which will probably
+ be more accurate than an estimation used by the library otherwise.
+ */
+ VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT = 0x00000008,
+ /**
+ Enables usage of VK_AMD_device_coherent_memory extension.
-Regions of memory specified for flush/invalidate must be aligned to
-`VkPhysicalDeviceLimits::nonCoherentAtomSize`. This is automatically ensured by the library.
-In any memory type that is `HOST_VISIBLE` but not `HOST_COHERENT`, all allocations
-within blocks are aligned to this value, so their offsets are always multiply of
-`nonCoherentAtomSize` and two different allocations never share same "line" of this size.
+ You may set this flag only if you:
-Please note that memory allocated with #VMA_MEMORY_USAGE_CPU_ONLY is guaranteed to be `HOST_COHERENT`.
+ - found out that this device extension is supported and enabled it while creating Vulkan device passed as VmaAllocatorCreateInfo::device,
+ - checked that `VkPhysicalDeviceCoherentMemoryFeaturesAMD::deviceCoherentMemory` is true and set it while creating the Vulkan device,
+ - want it to be used internally by this library.
-Also, Windows drivers from all 3 **PC** GPU vendors (AMD, Intel, NVIDIA)
-currently provide `HOST_COHERENT` flag on all memory types that are
-`HOST_VISIBLE`, so on this platform you may not need to bother.
+ The extension and accompanying device feature provide access to memory types with
+ `VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD` and `VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD` flags.
+ They are useful mostly for writing breadcrumb markers - a common method for debugging GPU crash/hang/TDR.
-\section memory_mapping_finding_if_memory_mappable Finding out if memory is mappable
+ When the extension is not enabled, such memory types are still enumerated, but their usage is illegal.
+ To protect from this error, if you don't create the allocator with this flag, it will refuse to allocate any memory or create a custom pool in such memory type,
+ returning `VK_ERROR_FEATURE_NOT_PRESENT`.
+ */
+ VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT = 0x00000010,
+ /**
+ Enables usage of "buffer device address" feature, which allows you to use function
+ `vkGetBufferDeviceAddress*` to get raw GPU pointer to a buffer and pass it for usage inside a shader.
-It may happen that your allocation ends up in memory that is `HOST_VISIBLE` (available for mapping)
-despite it wasn't explicitly requested.
-For example, application may work on integrated graphics with unified memory (like Intel) or
-allocation from video memory might have failed, so the library chose system memory as fallback.
+ You may set this flag only if you:
-You can detect this case and map such allocation to access its memory on CPU directly,
-instead of launching a transfer operation.
-In order to do that: inspect `allocInfo.memoryType`, call vmaGetMemoryTypeProperties(),
-and look for `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT` flag in properties of that memory type.
+ 1. (For Vulkan version < 1.2) Found as available and enabled device extension
+ VK_KHR_buffer_device_address.
+ This extension is promoted to core Vulkan 1.2.
+ 2. Found as available and enabled device feature `VkPhysicalDeviceBufferDeviceAddressFeatures::bufferDeviceAddress`.
-\code
-VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
-bufCreateInfo.size = sizeof(ConstantBuffer);
-bufCreateInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
+ When this flag is set, you can create buffers with `VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT` using VMA.
+ The library automatically adds `VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT` to
+ allocated memory blocks wherever it might be needed.
-VmaAllocationCreateInfo allocCreateInfo = {};
-allocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;
-allocCreateInfo.preferredFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
+ For more information, see documentation chapter \ref enabling_buffer_device_address.
+ */
+ VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT = 0x00000020,
+ /**
+ Enables usage of VK_EXT_memory_priority extension in the library.
-VkBuffer buf;
-VmaAllocation alloc;
-VmaAllocationInfo allocInfo;
-vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &buf, &alloc, &allocInfo);
+ You may set this flag only if you found available and enabled this device extension,
+ along with `VkPhysicalDeviceMemoryPriorityFeaturesEXT::memoryPriority == VK_TRUE`,
+ while creating Vulkan device passed as VmaAllocatorCreateInfo::device.
-VkMemoryPropertyFlags memFlags;
-vmaGetMemoryTypeProperties(allocator, allocInfo.memoryType, &memFlags);
-if((memFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)
-{
- // Allocation ended up in mappable memory. You can map it and access it directly.
- void* mappedData;
- vmaMapMemory(allocator, alloc, &mappedData);
- memcpy(mappedData, &constantBufferData, sizeof(constantBufferData));
- vmaUnmapMemory(allocator, alloc);
-}
-else
-{
- // Allocation ended up in non-mappable memory.
- // You need to create CPU-side buffer in VMA_MEMORY_USAGE_CPU_ONLY and make a transfer.
-}
-\endcode
+ When this flag is used, VmaAllocationCreateInfo::priority and VmaPoolCreateInfo::priority
+ are used to set priorities of allocated Vulkan memory. Without it, these variables are ignored.
-You can even use #VMA_ALLOCATION_CREATE_MAPPED_BIT flag while creating allocations
-that are not necessarily `HOST_VISIBLE` (e.g. using #VMA_MEMORY_USAGE_GPU_ONLY).
-If the allocation ends up in memory type that is `HOST_VISIBLE`, it will be persistently mapped and you can use it directly.
-If not, the flag is just ignored.
-Example:
+ A priority must be a floating-point value between 0 and 1, indicating the priority of the allocation relative to other memory allocations.
+ Larger values are higher priority. The granularity of the priorities is implementation-dependent.
+ It is automatically passed to every call to `vkAllocateMemory` done by the library using structure `VkMemoryPriorityAllocateInfoEXT`.
+ The value to be used for default priority is 0.5.
+ For more details, see the documentation of the VK_EXT_memory_priority extension.
+ */
+ VMA_ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT = 0x00000040,
-\code
-VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
-bufCreateInfo.size = sizeof(ConstantBuffer);
-bufCreateInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
+ VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VmaAllocatorCreateFlagBits;
+/// See #VmaAllocatorCreateFlagBits.
+typedef VkFlags VmaAllocatorCreateFlags;
-VmaAllocationCreateInfo allocCreateInfo = {};
-allocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;
-allocCreateInfo.flags = VMA_ALLOCATION_CREATE_MAPPED_BIT;
+/** @} */
-VkBuffer buf;
-VmaAllocation alloc;
-VmaAllocationInfo allocInfo;
-vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &buf, &alloc, &allocInfo);
+/**
+\addtogroup group_alloc
+@{
+*/
-if(allocInfo.pUserData != nullptr)
-{
- // Allocation ended up in mappable memory.
- // It's persistently mapped. You can access it directly.
- memcpy(allocInfo.pMappedData, &constantBufferData, sizeof(constantBufferData));
-}
-else
+/// \brief Intended usage of the allocated memory.
+typedef enum VmaMemoryUsage
{
- // Allocation ended up in non-mappable memory.
- // You need to create CPU-side buffer in VMA_MEMORY_USAGE_CPU_ONLY and make a transfer.
-}
-\endcode
-
-
-\page staying_within_budget Staying within budget
-
-When developing a graphics-intensive game or program, it is important to avoid allocating
-more GPU memory than it's physically available. When the memory is over-committed,
-various bad things can happen, depending on the specific GPU, graphics driver, and
-operating system:
-
-- It may just work without any problems.
-- The application may slow down because some memory blocks are moved to system RAM
- and the GPU has to access them through PCI Express bus.
-- A new allocation may take very long time to complete, even few seconds, and possibly
- freeze entire system.
-- The new allocation may fail with `VK_ERROR_OUT_OF_DEVICE_MEMORY`.
-- It may even result in GPU crash (TDR), observed as `VK_ERROR_DEVICE_LOST`
- returned somewhere later.
-
-\section staying_within_budget_querying_for_budget Querying for budget
-
-To query for current memory usage and available budget, use function vmaGetBudget().
-Returned structure #VmaBudget contains quantities expressed in bytes, per Vulkan memory heap.
-
-Please note that this function returns different information and works faster than
-vmaCalculateStats(). vmaGetBudget() can be called every frame or even before every
-allocation, while vmaCalculateStats() is intended to be used rarely,
-only to obtain statistical information, e.g. for debugging purposes.
-
-It is recommended to use <b>VK_EXT_memory_budget</b> device extension to obtain information
-about the budget from Vulkan device. VMA is able to use this extension automatically.
-When not enabled, the allocator behaves same way, but then it estimates current usage
-and available budget based on its internal information and Vulkan memory heap sizes,
-which may be less precise. In order to use this extension:
-
-1. Make sure extensions VK_EXT_memory_budget and VK_KHR_get_physical_device_properties2
- required by it are available and enable them. Please note that the first is a device
- extension and the second is instance extension!
-2. Use flag #VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT when creating #VmaAllocator object.
-3. Make sure to call vmaSetCurrentFrameIndex() every frame. Budget is queried from
- Vulkan inside of it to avoid overhead of querying it with every allocation.
-
-\section staying_within_budget_controlling_memory_usage Controlling memory usage
-
-There are many ways in which you can try to stay within the budget.
-
-First, when making new allocation requires allocating a new memory block, the library
-tries not to exceed the budget automatically. If a block with default recommended size
-(e.g. 256 MB) would go over budget, a smaller block is allocated, possibly even
-dedicated memory for just this resource.
-
-If the size of the requested resource plus current memory usage is more than the
-budget, by default the library still tries to create it, leaving it to the Vulkan
-implementation whether the allocation succeeds or fails. You can change this behavior
-by using #VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT flag. With it, the allocation is
-not made if it would exceed the budget or if the budget is already exceeded.
-Some other allocations become lost instead to make room for it, if the mechanism of
-[lost allocations](@ref lost_allocations) is used.
-If that is not possible, the allocation fails with `VK_ERROR_OUT_OF_DEVICE_MEMORY`.
-Example usage pattern may be to pass the #VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT flag
-when creating resources that are not essential for the application (e.g. the texture
-of a specific object) and not to pass it when creating critically important resources
-(e.g. render targets).
-
-Finally, you can also use #VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT flag to make sure
-a new allocation is created only when it fits inside one of the existing memory blocks.
-If it would require to allocate a new block, if fails instead with `VK_ERROR_OUT_OF_DEVICE_MEMORY`.
-This also ensures that the function call is very fast because it never goes to Vulkan
-to obtain a new block.
-
-Please note that creating \ref custom_memory_pools with VmaPoolCreateInfo::minBlockCount
-set to more than 0 will try to allocate memory blocks without checking whether they
-fit within budget.
-
-
-\page custom_memory_pools Custom memory pools
-
-A memory pool contains a number of `VkDeviceMemory` blocks.
-The library automatically creates and manages default pool for each memory type available on the device.
-Default memory pool automatically grows in size.
-Size of allocated blocks is also variable and managed automatically.
-
-You can create custom pool and allocate memory out of it.
-It can be useful if you want to:
-
-- Keep certain kind of allocations separate from others.
-- Enforce particular, fixed size of Vulkan memory blocks.
-- Limit maximum amount of Vulkan memory allocated for that pool.
-- Reserve minimum or fixed amount of Vulkan memory always preallocated for that pool.
-
-To use custom memory pools:
-
--# Fill VmaPoolCreateInfo structure.
--# Call vmaCreatePool() to obtain #VmaPool handle.
--# When making an allocation, set VmaAllocationCreateInfo::pool to this handle.
- You don't need to specify any other parameters of this structure, like `usage`.
-
-Example:
-
-\code
-// Create a pool that can have at most 2 blocks, 128 MiB each.
-VmaPoolCreateInfo poolCreateInfo = {};
-poolCreateInfo.memoryTypeIndex = ...
-poolCreateInfo.blockSize = 128ull * 1024 * 1024;
-poolCreateInfo.maxBlockCount = 2;
-
-VmaPool pool;
-vmaCreatePool(allocator, &poolCreateInfo, &pool);
-
-// Allocate a buffer out of it.
-VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
-bufCreateInfo.size = 1024;
-bufCreateInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
-
-VmaAllocationCreateInfo allocCreateInfo = {};
-allocCreateInfo.pool = pool;
-
-VkBuffer buf;
-VmaAllocation alloc;
-VmaAllocationInfo allocInfo;
-vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &buf, &alloc, &allocInfo);
-\endcode
-
-You have to free all allocations made from this pool before destroying it.
-
-\code
-vmaDestroyBuffer(allocator, buf, alloc);
-vmaDestroyPool(allocator, pool);
-\endcode
-
-\section custom_memory_pools_MemTypeIndex Choosing memory type index
-
-When creating a pool, you must explicitly specify memory type index.
-To find the one suitable for your buffers or images, you can use helper functions
-vmaFindMemoryTypeIndexForBufferInfo(), vmaFindMemoryTypeIndexForImageInfo().
-You need to provide structures with example parameters of buffers or images
-that you are going to create in that pool.
-
-\code
-VkBufferCreateInfo exampleBufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
-exampleBufCreateInfo.size = 1024; // Whatever.
-exampleBufCreateInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT; // Change if needed.
-
-VmaAllocationCreateInfo allocCreateInfo = {};
-allocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY; // Change if needed.
-
-uint32_t memTypeIndex;
-vmaFindMemoryTypeIndexForBufferInfo(allocator, &exampleBufCreateInfo, &allocCreateInfo, &memTypeIndex);
-
-VmaPoolCreateInfo poolCreateInfo = {};
-poolCreateInfo.memoryTypeIndex = memTypeIndex;
-// ...
-\endcode
-
-When creating buffers/images allocated in that pool, provide following parameters:
-
-- `VkBufferCreateInfo`: Prefer to pass same parameters as above.
- Otherwise you risk creating resources in a memory type that is not suitable for them, which may result in undefined behavior.
- Using different `VK_BUFFER_USAGE_` flags may work, but you shouldn't create images in a pool intended for buffers
- or the other way around.
-- VmaAllocationCreateInfo: You don't need to pass same parameters. Fill only `pool` member.
- Other members are ignored anyway.
-
-\section linear_algorithm Linear allocation algorithm
-
-Each Vulkan memory block managed by this library has accompanying metadata that
-keeps track of used and unused regions. By default, the metadata structure and
-algorithm tries to find best place for new allocations among free regions to
-optimize memory usage. This way you can allocate and free objects in any order.
-
-![Default allocation algorithm](../gfx/Linear_allocator_1_algo_default.png)
-
-Sometimes there is a need to use simpler, linear allocation algorithm. You can
-create custom pool that uses such algorithm by adding flag
-#VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT to VmaPoolCreateInfo::flags while creating
-#VmaPool object. Then an alternative metadata management is used. It always
-creates new allocations after last one and doesn't reuse free regions after
-allocations freed in the middle. It results in better allocation performance and
-less memory consumed by metadata.
-
-![Linear allocation algorithm](../gfx/Linear_allocator_2_algo_linear.png)
-
-With this one flag, you can create a custom pool that can be used in many ways:
-free-at-once, stack, double stack, and ring buffer. See below for details.
-
-\subsection linear_algorithm_free_at_once Free-at-once
-
-In a pool that uses linear algorithm, you still need to free all the allocations
-individually, e.g. by using vmaFreeMemory() or vmaDestroyBuffer(). You can free
-them in any order. New allocations are always made after last one - free space
-in the middle is not reused. However, when you release all the allocation and
-the pool becomes empty, allocation starts from the beginning again. This way you
-can use linear algorithm to speed up creation of allocations that you are going
-to release all at once.
-
-![Free-at-once](../gfx/Linear_allocator_3_free_at_once.png)
-
-This mode is also available for pools created with VmaPoolCreateInfo::maxBlockCount
-value that allows multiple memory blocks.
-
-\subsection linear_algorithm_stack Stack
-
-When you free an allocation that was created last, its space can be reused.
-Thanks to this, if you always release allocations in the order opposite to their
-creation (LIFO - Last In First Out), you can achieve behavior of a stack.
-
-![Stack](../gfx/Linear_allocator_4_stack.png)
-
-This mode is also available for pools created with VmaPoolCreateInfo::maxBlockCount
-value that allows multiple memory blocks.
-
-\subsection linear_algorithm_double_stack Double stack
-
-The space reserved by a custom pool with linear algorithm may be used by two
-stacks:
-
-- First, default one, growing up from offset 0.
-- Second, "upper" one, growing down from the end towards lower offsets.
-
-To make allocation from upper stack, add flag #VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT
-to VmaAllocationCreateInfo::flags.
-
-![Double stack](../gfx/Linear_allocator_7_double_stack.png)
-
-Double stack is available only in pools with one memory block -
-VmaPoolCreateInfo::maxBlockCount must be 1. Otherwise behavior is undefined.
-
-When the two stacks' ends meet so there is not enough space between them for a
-new allocation, such allocation fails with usual
-`VK_ERROR_OUT_OF_DEVICE_MEMORY` error.
-
-\subsection linear_algorithm_ring_buffer Ring buffer
-
-When you free some allocations from the beginning and there is not enough free space
-for a new one at the end of a pool, allocator's "cursor" wraps around to the
-beginning and starts allocation there. Thanks to this, if you always release
-allocations in the same order as you created them (FIFO - First In First Out),
-you can achieve behavior of a ring buffer / queue.
-
-![Ring buffer](../gfx/Linear_allocator_5_ring_buffer.png)
-
-Pools with linear algorithm support [lost allocations](@ref lost_allocations) when used as ring buffer.
-If there is not enough free space for a new allocation, but existing allocations
-from the front of the queue can become lost, they become lost and the allocation
-succeeds.
-
-![Ring buffer with lost allocations](../gfx/Linear_allocator_6_ring_buffer_lost.png)
-
-Ring buffer is available only in pools with one memory block -
-VmaPoolCreateInfo::maxBlockCount must be 1. Otherwise behavior is undefined.
-
-\section buddy_algorithm Buddy allocation algorithm
-
-There is another allocation algorithm that can be used with custom pools, called
-"buddy". Its internal data structure is based on a tree of blocks, each having
-size that is a power of two and a half of its parent's size. When you want to
-allocate memory of certain size, a free node in the tree is located. If it's too
-large, it is recursively split into two halves (called "buddies"). However, if
-requested allocation size is not a power of two, the size of a tree node is
-aligned up to the nearest power of two and the remaining space is wasted. When
-two buddy nodes become free, they are merged back into one larger node.
-
-![Buddy allocator](../gfx/Buddy_allocator.png)
+ /** No intended memory usage specified.
+ Use other members of VmaAllocationCreateInfo to specify your requirements.
+ */
+ VMA_MEMORY_USAGE_UNKNOWN = 0,
+ /**
+ \deprecated Obsolete, preserved for backward compatibility.
+ Prefers `VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT`.
+ */
+ VMA_MEMORY_USAGE_GPU_ONLY = 1,
+ /**
+ \deprecated Obsolete, preserved for backward compatibility.
+ Guarantees `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT` and `VK_MEMORY_PROPERTY_HOST_COHERENT_BIT`.
+ */
+ VMA_MEMORY_USAGE_CPU_ONLY = 2,
+ /**
+ \deprecated Obsolete, preserved for backward compatibility.
+ Guarantees `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT`, prefers `VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT`.
+ */
+ VMA_MEMORY_USAGE_CPU_TO_GPU = 3,
+ /**
+ \deprecated Obsolete, preserved for backward compatibility.
+ Guarantees `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT`, prefers `VK_MEMORY_PROPERTY_HOST_CACHED_BIT`.
+ */
+ VMA_MEMORY_USAGE_GPU_TO_CPU = 4,
+ /**
+ \deprecated Obsolete, preserved for backward compatibility.
+ Prefers not `VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT`.
+ */
+ VMA_MEMORY_USAGE_CPU_COPY = 5,
+ /**
+ Lazily allocated GPU memory having `VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT`.
+ Exists mostly on mobile platforms. Using it on desktop PC or other GPUs with no such memory type present will fail the allocation.
-The advantage of buddy allocation algorithm over default algorithm is faster
-allocation and deallocation, as well as smaller external fragmentation. The
-disadvantage is more wasted space (internal fragmentation).
+ Usage: Memory for transient attachment images (color attachments, depth attachments etc.), created with `VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT`.
-For more information, please read ["Buddy memory allocation" on Wikipedia](https://en.wikipedia.org/wiki/Buddy_memory_allocation)
-or other sources that describe this concept in general.
+ Allocations with this usage are always created as dedicated - it implies #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT.
+ */
+ VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED = 6,
+ /**
+ Selects best memory type automatically.
+ This flag is recommended for most common use cases.
-To use buddy allocation algorithm with a custom pool, add flag
-#VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT to VmaPoolCreateInfo::flags while creating
-#VmaPool object.
+ When using this flag, if you want to map the allocation (using vmaMapMemory() or #VMA_ALLOCATION_CREATE_MAPPED_BIT),
+ you must pass one of the flags: #VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT or #VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT
+ in VmaAllocationCreateInfo::flags.
+
+ It can be used only with functions that let the library know `VkBufferCreateInfo` or `VkImageCreateInfo`, e.g.
+ vmaCreateBuffer(), vmaCreateImage(), vmaFindMemoryTypeIndexForBufferInfo(), vmaFindMemoryTypeIndexForImageInfo()
+ and not with generic memory allocation functions.
+ */
+ VMA_MEMORY_USAGE_AUTO = 7,
+ /**
+ Selects best memory type automatically with preference for GPU (device) memory.
-Several limitations apply to pools that use buddy algorithm:
+ When using this flag, if you want to map the allocation (using vmaMapMemory() or #VMA_ALLOCATION_CREATE_MAPPED_BIT),
+ you must pass one of the flags: #VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT or #VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT
+ in VmaAllocationCreateInfo::flags.
-- It is recommended to use VmaPoolCreateInfo::blockSize that is a power of two.
- Otherwise, only largest power of two smaller than the size is used for
- allocations. The remaining space always stays unused.
-- [Margins](@ref debugging_memory_usage_margins) and
- [corruption detection](@ref debugging_memory_usage_corruption_detection)
- don't work in such pools.
-- [Lost allocations](@ref lost_allocations) don't work in such pools. You can
- use them, but they never become lost. Support may be added in the future.
-- [Defragmentation](@ref defragmentation) doesn't work with allocations made from
- such pool.
+ It can be used only with functions that let the library know `VkBufferCreateInfo` or `VkImageCreateInfo`, e.g.
+ vmaCreateBuffer(), vmaCreateImage(), vmaFindMemoryTypeIndexForBufferInfo(), vmaFindMemoryTypeIndexForImageInfo()
+ and not with generic memory allocation functions.
+ */
+ VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE = 8,
+ /**
+ Selects best memory type automatically with preference for CPU (host) memory.
-\page defragmentation Defragmentation
+ When using this flag, if you want to map the allocation (using vmaMapMemory() or #VMA_ALLOCATION_CREATE_MAPPED_BIT),
+ you must pass one of the flags: #VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT or #VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT
+ in VmaAllocationCreateInfo::flags.
-Interleaved allocations and deallocations of many objects of varying size can
-cause fragmentation over time, which can lead to a situation where the library is unable
-to find a continuous range of free memory for a new allocation despite there is
-enough free space, just scattered across many small free ranges between existing
-allocations.
+ It can be used only with functions that let the library know `VkBufferCreateInfo` or `VkImageCreateInfo`, e.g.
+ vmaCreateBuffer(), vmaCreateImage(), vmaFindMemoryTypeIndexForBufferInfo(), vmaFindMemoryTypeIndexForImageInfo()
+ and not with generic memory allocation functions.
+ */
+ VMA_MEMORY_USAGE_AUTO_PREFER_HOST = 9,
-To mitigate this problem, you can use defragmentation feature:
-structure #VmaDefragmentationInfo2, function vmaDefragmentationBegin(), vmaDefragmentationEnd().
-Given set of allocations,
-this function can move them to compact used memory, ensure more continuous free
-space and possibly also free some `VkDeviceMemory` blocks.
+ VMA_MEMORY_USAGE_MAX_ENUM = 0x7FFFFFFF
+} VmaMemoryUsage;
-What the defragmentation does is:
+/// Flags to be passed as VmaAllocationCreateInfo::flags.
+typedef enum VmaAllocationCreateFlagBits
+{
+ /** \brief Set this flag if the allocation should have its own memory block.
-- Updates #VmaAllocation objects to point to new `VkDeviceMemory` and offset.
- After allocation has been moved, its VmaAllocationInfo::deviceMemory and/or
- VmaAllocationInfo::offset changes. You must query them again using
- vmaGetAllocationInfo() if you need them.
-- Moves actual data in memory.
+ Use it for special, big resources, like fullscreen images used as attachments.
+ */
+ VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT = 0x00000001,
-What it doesn't do, so you need to do it yourself:
+ /** \brief Set this flag to only try to allocate from existing `VkDeviceMemory` blocks and never create new such block.
-- Recreate buffers and images that were bound to allocations that were defragmented and
- bind them with their new places in memory.
- You must use `vkDestroyBuffer()`, `vkDestroyImage()`,
- `vkCreateBuffer()`, `vkCreateImage()`, vmaBindBufferMemory(), vmaBindImageMemory()
- for that purpose and NOT vmaDestroyBuffer(),
- vmaDestroyImage(), vmaCreateBuffer(), vmaCreateImage(), because you don't need to
- destroy or create allocation objects!
-- Recreate views and update descriptors that point to these buffers and images.
+ If new allocation cannot be placed in any of the existing blocks, allocation
+ fails with `VK_ERROR_OUT_OF_DEVICE_MEMORY` error.
-\section defragmentation_cpu Defragmenting CPU memory
+ You should not use #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT and
+ #VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT at the same time. It makes no sense.
+ */
+ VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT = 0x00000002,
+ /** \brief Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.
-Following example demonstrates how you can run defragmentation on CPU.
-Only allocations created in memory types that are `HOST_VISIBLE` can be defragmented.
-Others are ignored.
+ Pointer to mapped memory will be returned through VmaAllocationInfo::pMappedData.
-The way it works is:
+ It is valid to use this flag for allocation made from memory type that is not
+ `HOST_VISIBLE`. This flag is then ignored and memory is not mapped. This is
+ useful if you need an allocation that is efficient to use on GPU
+ (`DEVICE_LOCAL`) and still want to map it directly if possible on platforms that
+ support it (e.g. Intel GPU).
+ */
+ VMA_ALLOCATION_CREATE_MAPPED_BIT = 0x00000004,
+ /** \deprecated Preserved for backward compatibility. Consider using vmaSetAllocationName() instead.
+
+ Set this flag to treat VmaAllocationCreateInfo::pUserData as pointer to a
+ null-terminated string. Instead of copying pointer value, a local copy of the
+ string is made and stored in allocation's `pName`. The string is automatically
+ freed together with the allocation. It is also used in vmaBuildStatsString().
+ */
+ VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT = 0x00000020,
+ /** Allocation will be created from upper stack in a double stack pool.
-- It temporarily maps entire memory blocks when necessary.
-- It moves data using `memmove()` function.
+ This flag is only allowed for custom pools created with #VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT flag.
+ */
+ VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT = 0x00000040,
+ /** Create both buffer/image and allocation, but don't bind them together.
+ It is useful when you want to bind yourself to do some more advanced binding, e.g. using some extensions.
+ The flag is meaningful only with functions that bind by default: vmaCreateBuffer(), vmaCreateImage().
+ Otherwise it is ignored.
-\code
-// Given following variables already initialized:
-VkDevice device;
-VmaAllocator allocator;
-std::vector<VkBuffer> buffers;
-std::vector<VmaAllocation> allocations;
+ If you want to make sure the new buffer/image is not tied to the new memory allocation
+ through `VkMemoryDedicatedAllocateInfoKHR` structure in case the allocation ends up in its own memory block,
+ use also flag #VMA_ALLOCATION_CREATE_CAN_ALIAS_BIT.
+ */
+ VMA_ALLOCATION_CREATE_DONT_BIND_BIT = 0x00000080,
+ /** Create allocation only if additional device memory required for it, if any, won't exceed
+ memory budget. Otherwise return `VK_ERROR_OUT_OF_DEVICE_MEMORY`.
+ */
+ VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT = 0x00000100,
+ /** \brief Set this flag if the allocated memory will have aliasing resources.
+
+ Usage of this flag prevents supplying `VkMemoryDedicatedAllocateInfoKHR` when #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT is specified.
+ Otherwise created dedicated memory will not be suitable for aliasing resources, resulting in Vulkan Validation Layer errors.
+ */
+ VMA_ALLOCATION_CREATE_CAN_ALIAS_BIT = 0x00000200,
+ /**
+ Requests possibility to map the allocation (using vmaMapMemory() or #VMA_ALLOCATION_CREATE_MAPPED_BIT).
+
+ - If you use #VMA_MEMORY_USAGE_AUTO or other `VMA_MEMORY_USAGE_AUTO*` value,
+ you must use this flag to be able to map the allocation. Otherwise, mapping is incorrect.
+ - If you use other value of #VmaMemoryUsage, this flag is ignored and mapping is always possible in memory types that are `HOST_VISIBLE`.
+ This includes allocations created in \ref custom_memory_pools.
+ Declares that mapped memory will only be written sequentially, e.g. using `memcpy()` or a loop writing number-by-number,
+ never read or accessed randomly, so a memory type can be selected that is uncached and write-combined.
-const uint32_t allocCount = (uint32_t)allocations.size();
-std::vector<VkBool32> allocationsChanged(allocCount);
+ \warning Violating this declaration may work correctly, but will likely be very slow.
+ Watch out for implicit reads introduced by doing e.g. `pMappedData[i] += x;`
+ Better prepare your data in a local variable and `memcpy()` it to the mapped pointer all at once.
+ */
+ VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT = 0x00000400,
+ /**
+ Requests possibility to map the allocation (using vmaMapMemory() or #VMA_ALLOCATION_CREATE_MAPPED_BIT).
+
+ - If you use #VMA_MEMORY_USAGE_AUTO or other `VMA_MEMORY_USAGE_AUTO*` value,
+ you must use this flag to be able to map the allocation. Otherwise, mapping is incorrect.
+ - If you use other value of #VmaMemoryUsage, this flag is ignored and mapping is always possible in memory types that are `HOST_VISIBLE`.
+ This includes allocations created in \ref custom_memory_pools.
-VmaDefragmentationInfo2 defragInfo = {};
-defragInfo.allocationCount = allocCount;
-defragInfo.pAllocations = allocations.data();
-defragInfo.pAllocationsChanged = allocationsChanged.data();
-defragInfo.maxCpuBytesToMove = VK_WHOLE_SIZE; // No limit.
-defragInfo.maxCpuAllocationsToMove = UINT32_MAX; // No limit.
+ Declares that mapped memory can be read, written, and accessed in random order,
+ so a `HOST_CACHED` memory type is required.
+ */
+ VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT = 0x00000800,
+ /**
+ Together with #VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT or #VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT,
+ it says that despite request for host access, a not-`HOST_VISIBLE` memory type can be selected
+ if it may improve performance.
+
+ By using this flag, you declare that you will check if the allocation ended up in a `HOST_VISIBLE` memory type
+ (e.g. using vmaGetAllocationMemoryProperties()) and if not, you will create some "staging" buffer and
+ issue an explicit transfer to write/read your data.
+ To prepare for this possibility, don't forget to add appropriate flags like
+ `VK_BUFFER_USAGE_TRANSFER_DST_BIT`, `VK_BUFFER_USAGE_TRANSFER_SRC_BIT` to the parameters of created buffer or image.
+ */
+ VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT = 0x00001000,
+ /** Allocation strategy that chooses smallest possible free range for the allocation
+ to minimize memory usage and fragmentation, possibly at the expense of allocation time.
+ */
+ VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT = 0x00010000,
+ /** Allocation strategy that chooses first suitable free range for the allocation -
+ not necessarily in terms of the smallest offset but the one that is easiest and fastest to find
+ to minimize allocation time, possibly at the expense of allocation quality.
+ */
+ VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT = 0x00020000,
+ /** Allocation strategy that chooses always the lowest offset in available space.
+ This is not the most efficient strategy but achieves highly packed data.
+ Used internally by defragmentation, not recomended in typical usage.
+ */
+ VMA_ALLOCATION_CREATE_STRATEGY_MIN_OFFSET_BIT = 0x00040000,
+ /** Alias to #VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT.
+ */
+ VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT = VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT,
+ /** Alias to #VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT.
+ */
+ VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT = VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT,
+ /** A bit mask to extract only `STRATEGY` bits from entire set of flags.
+ */
+ VMA_ALLOCATION_CREATE_STRATEGY_MASK =
+ VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT |
+ VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT |
+ VMA_ALLOCATION_CREATE_STRATEGY_MIN_OFFSET_BIT,
-VmaDefragmentationContext defragCtx;
-vmaDefragmentationBegin(allocator, &defragInfo, nullptr, &defragCtx);
-vmaDefragmentationEnd(allocator, defragCtx);
+ VMA_ALLOCATION_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VmaAllocationCreateFlagBits;
+/// See #VmaAllocationCreateFlagBits.
+typedef VkFlags VmaAllocationCreateFlags;
-for(uint32_t i = 0; i < allocCount; ++i)
+/// Flags to be passed as VmaPoolCreateInfo::flags.
+typedef enum VmaPoolCreateFlagBits
{
- if(allocationsChanged[i])
- {
- // Destroy buffer that is immutably bound to memory region which is no longer valid.
- vkDestroyBuffer(device, buffers[i], nullptr);
-
- // Create new buffer with same parameters.
- VkBufferCreateInfo bufferInfo = ...;
- vkCreateBuffer(device, &bufferInfo, nullptr, &buffers[i]);
-
- // You can make dummy call to vkGetBufferMemoryRequirements here to silence validation layer warning.
-
- // Bind new buffer to new memory region. Data contained in it is already moved.
- VmaAllocationInfo allocInfo;
- vmaGetAllocationInfo(allocator, allocations[i], &allocInfo);
- vmaBindBufferMemory(allocator, allocations[i], buffers[i]);
- }
-}
-\endcode
-
-Setting VmaDefragmentationInfo2::pAllocationsChanged is optional.
-This output array tells whether particular allocation in VmaDefragmentationInfo2::pAllocations at the same index
-has been modified during defragmentation.
-You can pass null, but you then need to query every allocation passed to defragmentation
-for new parameters using vmaGetAllocationInfo() if you might need to recreate and rebind a buffer or image associated with it.
-
-If you use [Custom memory pools](@ref choosing_memory_type_custom_memory_pools),
-you can fill VmaDefragmentationInfo2::poolCount and VmaDefragmentationInfo2::pPools
-instead of VmaDefragmentationInfo2::allocationCount and VmaDefragmentationInfo2::pAllocations
-to defragment all allocations in given pools.
-You cannot use VmaDefragmentationInfo2::pAllocationsChanged in that case.
-You can also combine both methods.
-
-\section defragmentation_gpu Defragmenting GPU memory
-
-It is also possible to defragment allocations created in memory types that are not `HOST_VISIBLE`.
-To do that, you need to pass a command buffer that meets requirements as described in
-VmaDefragmentationInfo2::commandBuffer. The way it works is:
-
-- It creates temporary buffers and binds them to entire memory blocks when necessary.
-- It issues `vkCmdCopyBuffer()` to passed command buffer.
-
-Example:
-
-\code
-// Given following variables already initialized:
-VkDevice device;
-VmaAllocator allocator;
-VkCommandBuffer commandBuffer;
-std::vector<VkBuffer> buffers;
-std::vector<VmaAllocation> allocations;
+ /** \brief Use this flag if you always allocate only buffers and linear images or only optimal images out of this pool and so Buffer-Image Granularity can be ignored.
+ This is an optional optimization flag.
-const uint32_t allocCount = (uint32_t)allocations.size();
-std::vector<VkBool32> allocationsChanged(allocCount);
+ If you always allocate using vmaCreateBuffer(), vmaCreateImage(),
+ vmaAllocateMemoryForBuffer(), then you don't need to use it because allocator
+ knows exact type of your allocations so it can handle Buffer-Image Granularity
+ in the optimal way.
-VkCommandBufferBeginInfo cmdBufBeginInfo = ...;
-vkBeginCommandBuffer(commandBuffer, &cmdBufBeginInfo);
+ If you also allocate using vmaAllocateMemoryForImage() or vmaAllocateMemory(),
+ exact type of such allocations is not known, so allocator must be conservative
+ in handling Buffer-Image Granularity, which can lead to suboptimal allocation
+ (wasted memory). In that case, if you can make sure you always allocate only
+ buffers and linear images or only optimal images out of this pool, use this flag
+ to make allocator disregard Buffer-Image Granularity and so make allocations
+ faster and more optimal.
+ */
+ VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT = 0x00000002,
-VmaDefragmentationInfo2 defragInfo = {};
-defragInfo.allocationCount = allocCount;
-defragInfo.pAllocations = allocations.data();
-defragInfo.pAllocationsChanged = allocationsChanged.data();
-defragInfo.maxGpuBytesToMove = VK_WHOLE_SIZE; // Notice it's "GPU" this time.
-defragInfo.maxGpuAllocationsToMove = UINT32_MAX; // Notice it's "GPU" this time.
-defragInfo.commandBuffer = commandBuffer;
+ /** \brief Enables alternative, linear allocation algorithm in this pool.
-VmaDefragmentationContext defragCtx;
-vmaDefragmentationBegin(allocator, &defragInfo, nullptr, &defragCtx);
+ Specify this flag to enable linear allocation algorithm, which always creates
+ new allocations after last one and doesn't reuse space from allocations freed in
+ between. It trades memory consumption for simplified algorithm and data
+ structure, which has better performance and uses less memory for metadata.
-vkEndCommandBuffer(commandBuffer);
+ By using this flag, you can achieve behavior of free-at-once, stack,
+ ring buffer, and double stack.
+ For details, see documentation chapter \ref linear_algorithm.
+ */
+ VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT = 0x00000004,
-// Submit commandBuffer.
-// Wait for a fence that ensures commandBuffer execution finished.
+ /** Bit mask to extract only `ALGORITHM` bits from entire set of flags.
+ */
+ VMA_POOL_CREATE_ALGORITHM_MASK =
+ VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT,
-vmaDefragmentationEnd(allocator, defragCtx);
+ VMA_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VmaPoolCreateFlagBits;
+/// Flags to be passed as VmaPoolCreateInfo::flags. See #VmaPoolCreateFlagBits.
+typedef VkFlags VmaPoolCreateFlags;
-for(uint32_t i = 0; i < allocCount; ++i)
+/// Flags to be passed as VmaDefragmentationInfo::flags.
+typedef enum VmaDefragmentationFlagBits
{
- if(allocationsChanged[i])
- {
- // Destroy buffer that is immutably bound to memory region which is no longer valid.
- vkDestroyBuffer(device, buffers[i], nullptr);
-
- // Create new buffer with same parameters.
- VkBufferCreateInfo bufferInfo = ...;
- vkCreateBuffer(device, &bufferInfo, nullptr, &buffers[i]);
-
- // You can make dummy call to vkGetBufferMemoryRequirements here to silence validation layer warning.
-
- // Bind new buffer to new memory region. Data contained in it is already moved.
- VmaAllocationInfo allocInfo;
- vmaGetAllocationInfo(allocator, allocations[i], &allocInfo);
- vmaBindBufferMemory(allocator, allocations[i], buffers[i]);
- }
-}
-\endcode
-
-You can combine these two methods by specifying non-zero `maxGpu*` as well as `maxCpu*` parameters.
-The library automatically chooses best method to defragment each memory pool.
-
-You may try not to block your entire program to wait until defragmentation finishes,
-but do it in the background, as long as you carefully fullfill requirements described
-in function vmaDefragmentationBegin().
-
-\section defragmentation_additional_notes Additional notes
-
-It is only legal to defragment allocations bound to:
-
-- buffers
-- images created with `VK_IMAGE_CREATE_ALIAS_BIT`, `VK_IMAGE_TILING_LINEAR`, and
- being currently in `VK_IMAGE_LAYOUT_GENERAL` or `VK_IMAGE_LAYOUT_PREINITIALIZED`.
-
-Defragmentation of images created with `VK_IMAGE_TILING_OPTIMAL` or in any other
-layout may give undefined results.
-
-If you defragment allocations bound to images, new images to be bound to new
-memory region after defragmentation should be created with `VK_IMAGE_LAYOUT_PREINITIALIZED`
-and then transitioned to their original layout from before defragmentation if
-needed using an image memory barrier.
-
-While using defragmentation, you may experience validation layer warnings, which you just need to ignore.
-See [Validation layer warnings](@ref general_considerations_validation_layer_warnings).
-
-Please don't expect memory to be fully compacted after defragmentation.
-Algorithms inside are based on some heuristics that try to maximize number of Vulkan
-memory blocks to make totally empty to release them, as well as to maximimze continuous
-empty space inside remaining blocks, while minimizing the number and size of allocations that
-need to be moved. Some fragmentation may still remain - this is normal.
-
-\section defragmentation_custom_algorithm Writing custom defragmentation algorithm
-
-If you want to implement your own, custom defragmentation algorithm,
-there is infrastructure prepared for that,
-but it is not exposed through the library API - you need to hack its source code.
-Here are steps needed to do this:
-
--# Main thing you need to do is to define your own class derived from base abstract
- class `VmaDefragmentationAlgorithm` and implement your version of its pure virtual methods.
- See definition and comments of this class for details.
--# Your code needs to interact with device memory block metadata.
- If you need more access to its data than it's provided by its public interface,
- declare your new class as a friend class e.g. in class `VmaBlockMetadata_Generic`.
--# If you want to create a flag that would enable your algorithm or pass some additional
- flags to configure it, add them to `VmaDefragmentationFlagBits` and use them in
- VmaDefragmentationInfo2::flags.
--# Modify function `VmaBlockVectorDefragmentationContext::Begin` to create object
- of your new class whenever needed.
-
-
-\page lost_allocations Lost allocations
-
-If your game oversubscribes video memory, if may work OK in previous-generation
-graphics APIs (DirectX 9, 10, 11, OpenGL) because resources are automatically
-paged to system RAM. In Vulkan you can't do it because when you run out of
-memory, an allocation just fails. If you have more data (e.g. textures) that can
-fit into VRAM and you don't need it all at once, you may want to upload them to
-GPU on demand and "push out" ones that are not used for a long time to make room
-for the new ones, effectively using VRAM (or a cartain memory pool) as a form of
-cache. Vulkan Memory Allocator can help you with that by supporting a concept of
-"lost allocations".
-
-To create an allocation that can become lost, include #VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT
-flag in VmaAllocationCreateInfo::flags. Before using a buffer or image bound to
-such allocation in every new frame, you need to query it if it's not lost.
-To check it, call vmaTouchAllocation().
-If the allocation is lost, you should not use it or buffer/image bound to it.
-You mustn't forget to destroy this allocation and this buffer/image.
-vmaGetAllocationInfo() can also be used for checking status of the allocation.
-Allocation is lost when returned VmaAllocationInfo::deviceMemory == `VK_NULL_HANDLE`.
-
-To create an allocation that can make some other allocations lost to make room
-for it, use #VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT flag. You will
-usually use both flags #VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT and
-#VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT at the same time.
-
-Warning! Current implementation uses quite naive, brute force algorithm,
-which can make allocation calls that use #VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT
-flag quite slow. A new, more optimal algorithm and data structure to speed this
-up is planned for the future.
-
-<b>Q: When interleaving creation of new allocations with usage of existing ones,
-how do you make sure that an allocation won't become lost while it's used in the
-current frame?</b>
-
-It is ensured because vmaTouchAllocation() / vmaGetAllocationInfo() not only returns allocation
-status/parameters and checks whether it's not lost, but when it's not, it also
-atomically marks it as used in the current frame, which makes it impossible to
-become lost in that frame. It uses lockless algorithm, so it works fast and
-doesn't involve locking any internal mutex.
-
-<b>Q: What if my allocation may still be in use by the GPU when it's rendering a
-previous frame while I already submit new frame on the CPU?</b>
-
-You can make sure that allocations "touched" by vmaTouchAllocation() / vmaGetAllocationInfo() will not
-become lost for a number of additional frames back from the current one by
-specifying this number as VmaAllocatorCreateInfo::frameInUseCount (for default
-memory pool) and VmaPoolCreateInfo::frameInUseCount (for custom pool).
-
-<b>Q: How do you inform the library when new frame starts?</b>
-
-You need to call function vmaSetCurrentFrameIndex().
-
-Example code:
+ /* \brief Use simple but fast algorithm for defragmentation.
+ May not achieve best results but will require least time to compute and least allocations to copy.
+ */
+ VMA_DEFRAGMENTATION_FLAG_ALGORITHM_FAST_BIT = 0x1,
+ /* \brief Default defragmentation algorithm, applied also when no `ALGORITHM` flag is specified.
+ Offers a balance between defragmentation quality and the amount of allocations and bytes that need to be moved.
+ */
+ VMA_DEFRAGMENTATION_FLAG_ALGORITHM_BALANCED_BIT = 0x2,
+ /* \brief Perform full defragmentation of memory.
+ Can result in notably more time to compute and allocations to copy, but will achieve best memory packing.
+ */
+ VMA_DEFRAGMENTATION_FLAG_ALGORITHM_FULL_BIT = 0x4,
+ /** \brief Use the most roboust algorithm at the cost of time to compute and number of copies to make.
+ Only available when bufferImageGranularity is greater than 1, since it aims to reduce
+ alignment issues between different types of resources.
+ Otherwise falls back to same behavior as #VMA_DEFRAGMENTATION_FLAG_ALGORITHM_FULL_BIT.
+ */
+ VMA_DEFRAGMENTATION_FLAG_ALGORITHM_EXTENSIVE_BIT = 0x8,
-\code
-struct MyBuffer
-{
- VkBuffer m_Buf = nullptr;
- VmaAllocation m_Alloc = nullptr;
+ /// A bit mask to extract only `ALGORITHM` bits from entire set of flags.
+ VMA_DEFRAGMENTATION_FLAG_ALGORITHM_MASK =
+ VMA_DEFRAGMENTATION_FLAG_ALGORITHM_FAST_BIT |
+ VMA_DEFRAGMENTATION_FLAG_ALGORITHM_BALANCED_BIT |
+ VMA_DEFRAGMENTATION_FLAG_ALGORITHM_FULL_BIT |
+ VMA_DEFRAGMENTATION_FLAG_ALGORITHM_EXTENSIVE_BIT,
- // Called when the buffer is really needed in the current frame.
- void EnsureBuffer();
-};
+ VMA_DEFRAGMENTATION_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VmaDefragmentationFlagBits;
+/// See #VmaDefragmentationFlagBits.
+typedef VkFlags VmaDefragmentationFlags;
-void MyBuffer::EnsureBuffer()
+/// Operation performed on single defragmentation move. See structure #VmaDefragmentationMove.
+typedef enum VmaDefragmentationMoveOperation
{
- // Buffer has been created.
- if(m_Buf != VK_NULL_HANDLE)
- {
- // Check if its allocation is not lost + mark it as used in current frame.
- if(vmaTouchAllocation(allocator, m_Alloc))
- {
- // It's all OK - safe to use m_Buf.
- return;
- }
- }
-
- // Buffer not yet exists or lost - destroy and recreate it.
-
- vmaDestroyBuffer(allocator, m_Buf, m_Alloc);
-
- VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
- bufCreateInfo.size = 1024;
- bufCreateInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
-
- VmaAllocationCreateInfo allocCreateInfo = {};
- allocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;
- allocCreateInfo.flags = VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT |
- VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT;
-
- vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &m_Buf, &m_Alloc, nullptr);
-}
-\endcode
-
-When using lost allocations, you may see some Vulkan validation layer warnings
-about overlapping regions of memory bound to different kinds of buffers and
-images. This is still valid as long as you implement proper handling of lost
-allocations (like in the example above) and don't use them.
-
-You can create an allocation that is already in lost state from the beginning using function
-vmaCreateLostAllocation(). It may be useful if you need a "dummy" allocation that is not null.
-
-You can call function vmaMakePoolAllocationsLost() to set all eligible allocations
-in a specified custom pool to lost state.
-Allocations that have been "touched" in current frame or VmaPoolCreateInfo::frameInUseCount frames back
-cannot become lost.
-
-<b>Q: Can I touch allocation that cannot become lost?</b>
-
-Yes, although it has no visible effect.
-Calls to vmaGetAllocationInfo() and vmaTouchAllocation() update last use frame index
-also for allocations that cannot become lost, but the only way to observe it is to dump
-internal allocator state using vmaBuildStatsString().
-You can use this feature for debugging purposes to explicitly mark allocations that you use
-in current frame and then analyze JSON dump to see for how long each allocation stays unused.
-
-
-\page statistics Statistics
-
-This library contains functions that return information about its internal state,
-especially the amount of memory allocated from Vulkan.
-Please keep in mind that these functions need to traverse all internal data structures
-to gather these information, so they may be quite time-consuming.
-Don't call them too often.
-
-\section statistics_numeric_statistics Numeric statistics
-
-You can query for overall statistics of the allocator using function vmaCalculateStats().
-Information are returned using structure #VmaStats.
-It contains #VmaStatInfo - number of allocated blocks, number of allocations
-(occupied ranges in these blocks), number of unused (free) ranges in these blocks,
-number of bytes used and unused (but still allocated from Vulkan) and other information.
-They are summed across memory heaps, memory types and total for whole allocator.
-
-You can query for statistics of a custom pool using function vmaGetPoolStats().
-Information are returned using structure #VmaPoolStats.
-
-You can query for information about specific allocation using function vmaGetAllocationInfo().
-It fill structure #VmaAllocationInfo.
-
-\section statistics_json_dump JSON dump
-
-You can dump internal state of the allocator to a string in JSON format using function vmaBuildStatsString().
-The result is guaranteed to be correct JSON.
-It uses ANSI encoding.
-Any strings provided by user (see [Allocation names](@ref allocation_names))
-are copied as-is and properly escaped for JSON, so if they use UTF-8, ISO-8859-2 or any other encoding,
-this JSON string can be treated as using this encoding.
-It must be freed using function vmaFreeStatsString().
-
-The format of this JSON string is not part of official documentation of the library,
-but it will not change in backward-incompatible way without increasing library major version number
-and appropriate mention in changelog.
-
-The JSON string contains all the data that can be obtained using vmaCalculateStats().
-It can also contain detailed map of allocated memory blocks and their regions -
-free and occupied by allocations.
-This allows e.g. to visualize the memory or assess fragmentation.
-
-
-\page allocation_annotation Allocation names and user data
-
-\section allocation_user_data Allocation user data
-
-You can annotate allocations with your own information, e.g. for debugging purposes.
-To do that, fill VmaAllocationCreateInfo::pUserData field when creating
-an allocation. It's an opaque `void*` pointer. You can use it e.g. as a pointer,
-some handle, index, key, ordinal number or any other value that would associate
-the allocation with your custom metadata.
-
-\code
-VkBufferCreateInfo bufferInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
-// Fill bufferInfo...
-
-MyBufferMetadata* pMetadata = CreateBufferMetadata();
-
-VmaAllocationCreateInfo allocCreateInfo = {};
-allocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;
-allocCreateInfo.pUserData = pMetadata;
-
-VkBuffer buffer;
-VmaAllocation allocation;
-vmaCreateBuffer(allocator, &bufferInfo, &allocCreateInfo, &buffer, &allocation, nullptr);
-\endcode
-
-The pointer may be later retrieved as VmaAllocationInfo::pUserData:
-
-\code
-VmaAllocationInfo allocInfo;
-vmaGetAllocationInfo(allocator, allocation, &allocInfo);
-MyBufferMetadata* pMetadata = (MyBufferMetadata*)allocInfo.pUserData;
-\endcode
-
-It can also be changed using function vmaSetAllocationUserData().
-
-Values of (non-zero) allocations' `pUserData` are printed in JSON report created by
-vmaBuildStatsString(), in hexadecimal form.
-
-\section allocation_names Allocation names
-
-There is alternative mode available where `pUserData` pointer is used to point to
-a null-terminated string, giving a name to the allocation. To use this mode,
-set #VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT flag in VmaAllocationCreateInfo::flags.
-Then `pUserData` passed as VmaAllocationCreateInfo::pUserData or argument to
-vmaSetAllocationUserData() must be either null or pointer to a null-terminated string.
-The library creates internal copy of the string, so the pointer you pass doesn't need
-to be valid for whole lifetime of the allocation. You can free it after the call.
-
-\code
-VkImageCreateInfo imageInfo = { VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO };
-// Fill imageInfo...
-
-std::string imageName = "Texture: ";
-imageName += fileName;
-
-VmaAllocationCreateInfo allocCreateInfo = {};
-allocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;
-allocCreateInfo.flags = VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT;
-allocCreateInfo.pUserData = imageName.c_str();
-
-VkImage image;
-VmaAllocation allocation;
-vmaCreateImage(allocator, &imageInfo, &allocCreateInfo, &image, &allocation, nullptr);
-\endcode
-
-The value of `pUserData` pointer of the allocation will be different than the one
-you passed when setting allocation's name - pointing to a buffer managed
-internally that holds copy of the string.
-
-\code
-VmaAllocationInfo allocInfo;
-vmaGetAllocationInfo(allocator, allocation, &allocInfo);
-const char* imageName = (const char*)allocInfo.pUserData;
-printf("Image name: %s\n", imageName);
-\endcode
-
-That string is also printed in JSON report created by vmaBuildStatsString().
-
-
-\page debugging_memory_usage Debugging incorrect memory usage
-
-If you suspect a bug with memory usage, like usage of uninitialized memory or
-memory being overwritten out of bounds of an allocation,
-you can use debug features of this library to verify this.
-
-\section debugging_memory_usage_initialization Memory initialization
-
-If you experience a bug with incorrect and nondeterministic data in your program and you suspect uninitialized memory to be used,
-you can enable automatic memory initialization to verify this.
-To do it, define macro `VMA_DEBUG_INITIALIZE_ALLOCATIONS` to 1.
-
-\code
-#define VMA_DEBUG_INITIALIZE_ALLOCATIONS 1
-#include "vk_mem_alloc.h"
-\endcode
-
-It makes memory of all new allocations initialized to bit pattern `0xDCDCDCDC`.
-Before an allocation is destroyed, its memory is filled with bit pattern `0xEFEFEFEF`.
-Memory is automatically mapped and unmapped if necessary.
-
-If you find these values while debugging your program, good chances are that you incorrectly
-read Vulkan memory that is allocated but not initialized, or already freed, respectively.
-
-Memory initialization works only with memory types that are `HOST_VISIBLE`.
-It works also with dedicated allocations.
-It doesn't work with allocations created with #VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT flag,
-as they cannot be mapped.
-
-\section debugging_memory_usage_margins Margins
-
-By default, allocations are laid out in memory blocks next to each other if possible
-(considering required alignment, `bufferImageGranularity`, and `nonCoherentAtomSize`).
-
-![Allocations without margin](../gfx/Margins_1.png)
-
-Define macro `VMA_DEBUG_MARGIN` to some non-zero value (e.g. 16) to enforce specified
-number of bytes as a margin before and after every allocation.
-
-\code
-#define VMA_DEBUG_MARGIN 16
-#include "vk_mem_alloc.h"
-\endcode
-
-![Allocations with margin](../gfx/Margins_2.png)
-
-If your bug goes away after enabling margins, it means it may be caused by memory
-being overwritten outside of allocation boundaries. It is not 100% certain though.
-Change in application behavior may also be caused by different order and distribution
-of allocations across memory blocks after margins are applied.
-
-The margin is applied also before first and after last allocation in a block.
-It may occur only once between two adjacent allocations.
-
-Margins work with all types of memory.
-
-Margin is applied only to allocations made out of memory blocks and not to dedicated
-allocations, which have their own memory block of specific size.
-It is thus not applied to allocations made using #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT flag
-or those automatically decided to put into dedicated allocations, e.g. due to its
-large size or recommended by VK_KHR_dedicated_allocation extension.
-Margins are also not active in custom pools created with #VMA_POOL_CREATE_BUDDY_ALGORITHM_BIT flag.
-
-Margins appear in [JSON dump](@ref statistics_json_dump) as part of free space.
-
-Note that enabling margins increases memory usage and fragmentation.
-
-\section debugging_memory_usage_corruption_detection Corruption detection
-
-You can additionally define macro `VMA_DEBUG_DETECT_CORRUPTION` to 1 to enable validation
-of contents of the margins.
-
-\code
-#define VMA_DEBUG_MARGIN 16
-#define VMA_DEBUG_DETECT_CORRUPTION 1
-#include "vk_mem_alloc.h"
-\endcode
-
-When this feature is enabled, number of bytes specified as `VMA_DEBUG_MARGIN`
-(it must be multiply of 4) before and after every allocation is filled with a magic number.
-This idea is also know as "canary".
-Memory is automatically mapped and unmapped if necessary.
-
-This number is validated automatically when the allocation is destroyed.
-If it's not equal to the expected value, `VMA_ASSERT()` is executed.
-It clearly means that either CPU or GPU overwritten the memory outside of boundaries of the allocation,
-which indicates a serious bug.
-
-You can also explicitly request checking margins of all allocations in all memory blocks
-that belong to specified memory types by using function vmaCheckCorruption(),
-or in memory blocks that belong to specified custom pool, by using function
-vmaCheckPoolCorruption().
-
-Margin validation (corruption detection) works only for memory types that are
-`HOST_VISIBLE` and `HOST_COHERENT`.
-
-
-\page record_and_replay Record and replay
-
-\section record_and_replay_introduction Introduction
-
-While using the library, sequence of calls to its functions together with their
-parameters can be recorded to a file and later replayed using standalone player
-application. It can be useful to:
-
-- Test correctness - check if same sequence of calls will not cause crash or
- failures on a target platform.
-- Gather statistics - see number of allocations, peak memory usage, number of
- calls etc.
-- Benchmark performance - see how much time it takes to replay the whole
- sequence.
-
-\section record_and_replay_usage Usage
-
-Recording functionality is disabled by default.
-To enable it, define following macro before every include of this library:
-
-\code
-#define VMA_RECORDING_ENABLED 1
-\endcode
-
-<b>To record sequence of calls to a file:</b> Fill in
-VmaAllocatorCreateInfo::pRecordSettings member while creating #VmaAllocator
-object. File is opened and written during whole lifetime of the allocator.
-
-<b>To replay file:</b> Use VmaReplay - standalone command-line program.
-Precompiled binary can be found in "bin" directory.
-Its source can be found in "src/VmaReplay" directory.
-Its project is generated by Premake.
-Command line syntax is printed when the program is launched without parameters.
-Basic usage:
-
- VmaReplay.exe MyRecording.csv
-
-<b>Documentation of file format</b> can be found in file: "docs/Recording file format.md".
-It's a human-readable, text file in CSV format (Comma Separated Values).
-
-\section record_and_replay_additional_considerations Additional considerations
-
-- Replaying file that was recorded on a different GPU (with different parameters
- like `bufferImageGranularity`, `nonCoherentAtomSize`, and especially different
- set of memory heaps and types) may give different performance and memory usage
- results, as well as issue some warnings and errors.
-- Current implementation of recording in VMA, as well as VmaReplay application, is
- coded and tested only on Windows. Inclusion of recording code is driven by
- `VMA_RECORDING_ENABLED` macro. Support for other platforms should be easy to
- add. Contributions are welcomed.
-
-
-\page usage_patterns Recommended usage patterns
-
-See also slides from talk:
-[Sawicki, Adam. Advanced Graphics Techniques Tutorial: Memory management in Vulkan and DX12. Game Developers Conference, 2018](https://www.gdcvault.com/play/1025458/Advanced-Graphics-Techniques-Tutorial-New)
-
-
-\section usage_patterns_common_mistakes Common mistakes
-
-<b>Use of CPU_TO_GPU instead of CPU_ONLY memory</b>
-
-#VMA_MEMORY_USAGE_CPU_TO_GPU is recommended only for resources that will be
-mapped and written by the CPU, as well as read directly by the GPU - like some
-buffers or textures updated every frame (dynamic). If you create a staging copy
-of a resource to be written by CPU and then used as a source of transfer to
-another resource placed in the GPU memory, that staging resource should be
-created with #VMA_MEMORY_USAGE_CPU_ONLY. Please read the descriptions of these
-enums carefully for details.
-
-<b>Unnecessary use of custom pools</b>
-
-\ref custom_memory_pools may be useful for special purposes - when you want to
-keep certain type of resources separate e.g. to reserve minimum amount of memory
-for them, limit maximum amount of memory they can occupy, or make some of them
-push out the other through the mechanism of \ref lost_allocations. For most
-resources this is not needed and so it is not recommended to create #VmaPool
-objects and allocations out of them. Allocating from the default pool is sufficient.
-
-\section usage_patterns_simple Simple patterns
-
-\subsection usage_patterns_simple_render_targets Render targets
-
-<b>When:</b>
-Any resources that you frequently write and read on GPU,
-e.g. images used as color attachments (aka "render targets"), depth-stencil attachments,
-images/buffers used as storage image/buffer (aka "Unordered Access View (UAV)").
-
-<b>What to do:</b>
-Create them in video memory that is fastest to access from GPU using
-#VMA_MEMORY_USAGE_GPU_ONLY.
-
-Consider using [VK_KHR_dedicated_allocation](@ref vk_khr_dedicated_allocation) extension
-and/or manually creating them as dedicated allocations using #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT,
-especially if they are large or if you plan to destroy and recreate them e.g. when
-display resolution changes.
-Prefer to create such resources first and all other GPU resources (like textures and vertex buffers) later.
-
-\subsection usage_patterns_simple_immutable_resources Immutable resources
-
-<b>When:</b>
-Any resources that you fill on CPU only once (aka "immutable") or infrequently
-and then read frequently on GPU,
-e.g. textures, vertex and index buffers, constant buffers that don't change often.
-
-<b>What to do:</b>
-Create them in video memory that is fastest to access from GPU using
-#VMA_MEMORY_USAGE_GPU_ONLY.
-
-To initialize content of such resource, create a CPU-side (aka "staging") copy of it
-in system memory - #VMA_MEMORY_USAGE_CPU_ONLY, map it, fill it,
-and submit a transfer from it to the GPU resource.
-You can keep the staging copy if you need it for another upload transfer in the future.
-If you don't, you can destroy it or reuse this buffer for uploading different resource
-after the transfer finishes.
-
-Prefer to create just buffers in system memory rather than images, even for uploading textures.
-Use `vkCmdCopyBufferToImage()`.
-Dont use images with `VK_IMAGE_TILING_LINEAR`.
-
-\subsection usage_patterns_dynamic_resources Dynamic resources
-
-<b>When:</b>
-Any resources that change frequently (aka "dynamic"), e.g. every frame or every draw call,
-written on CPU, read on GPU.
-
-<b>What to do:</b>
-Create them using #VMA_MEMORY_USAGE_CPU_TO_GPU.
-You can map it and write to it directly on CPU, as well as read from it on GPU.
-
-This is a more complex situation. Different solutions are possible,
-and the best one depends on specific GPU type, but you can use this simple approach for the start.
-Prefer to write to such resource sequentially (e.g. using `memcpy`).
-Don't perform random access or any reads from it on CPU, as it may be very slow.
-
-\subsection usage_patterns_readback Readback
-
-<b>When:</b>
-Resources that contain data written by GPU that you want to read back on CPU,
-e.g. results of some computations.
-
-<b>What to do:</b>
-Create them using #VMA_MEMORY_USAGE_GPU_TO_CPU.
-You can write to them directly on GPU, as well as map and read them on CPU.
-
-\section usage_patterns_advanced Advanced patterns
-
-\subsection usage_patterns_integrated_graphics Detecting integrated graphics
-
-You can support integrated graphics (like Intel HD Graphics, AMD APU) better
-by detecting it in Vulkan.
-To do it, call `vkGetPhysicalDeviceProperties()`, inspect
-`VkPhysicalDeviceProperties::deviceType` and look for `VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU`.
-When you find it, you can assume that memory is unified and all memory types are comparably fast
-to access from GPU, regardless of `VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT`.
-
-You can then sum up sizes of all available memory heaps and treat them as useful for
-your GPU resources, instead of only `DEVICE_LOCAL` ones.
-You can also prefer to create your resources in memory types that are `HOST_VISIBLE` to map them
-directly instead of submitting explicit transfer (see below).
-
-\subsection usage_patterns_direct_vs_transfer Direct access versus transfer
-
-For resources that you frequently write on CPU and read on GPU, many solutions are possible:
-
--# Create one copy in video memory using #VMA_MEMORY_USAGE_GPU_ONLY,
- second copy in system memory using #VMA_MEMORY_USAGE_CPU_ONLY and submit explicit tranfer each time.
--# Create just single copy using #VMA_MEMORY_USAGE_CPU_TO_GPU, map it and fill it on CPU,
- read it directly on GPU.
--# Create just single copy using #VMA_MEMORY_USAGE_CPU_ONLY, map it and fill it on CPU,
- read it directly on GPU.
-
-Which solution is the most efficient depends on your resource and especially on the GPU.
-It is best to measure it and then make the decision.
-Some general recommendations:
-
-- On integrated graphics use (2) or (3) to avoid unnecesary time and memory overhead
- related to using a second copy and making transfer.
-- For small resources (e.g. constant buffers) use (2).
- Discrete AMD cards have special 256 MiB pool of video memory that is directly mappable.
- Even if the resource ends up in system memory, its data may be cached on GPU after first
- fetch over PCIe bus.
-- For larger resources (e.g. textures), decide between (1) and (2).
- You may want to differentiate NVIDIA and AMD, e.g. by looking for memory type that is
- both `DEVICE_LOCAL` and `HOST_VISIBLE`. When you find it, use (2), otherwise use (1).
-
-Similarly, for resources that you frequently write on GPU and read on CPU, multiple
-solutions are possible:
-
--# Create one copy in video memory using #VMA_MEMORY_USAGE_GPU_ONLY,
- second copy in system memory using #VMA_MEMORY_USAGE_GPU_TO_CPU and submit explicit tranfer each time.
--# Create just single copy using #VMA_MEMORY_USAGE_GPU_TO_CPU, write to it directly on GPU,
- map it and read it on CPU.
-
-You should take some measurements to decide which option is faster in case of your specific
-resource.
-
-If you don't want to specialize your code for specific types of GPUs, you can still make
-an simple optimization for cases when your resource ends up in mappable memory to use it
-directly in this case instead of creating CPU-side staging copy.
-For details see [Finding out if memory is mappable](@ref memory_mapping_finding_if_memory_mappable).
-
-
-\page configuration Configuration
-
-Please check "CONFIGURATION SECTION" in the code to find macros that you can define
-before each include of this file or change directly in this file to provide
-your own implementation of basic facilities like assert, `min()` and `max()` functions,
-mutex, atomic etc.
-The library uses its own implementation of containers by default, but you can switch to using
-STL containers instead.
-
-For example, define `VMA_ASSERT(expr)` before including the library to provide
-custom implementation of the assertion, compatible with your project.
-By default it is defined to standard C `assert(expr)` in `_DEBUG` configuration
-and empty otherwise.
-
-\section config_Vulkan_functions Pointers to Vulkan functions
+ /// Buffer/image has been recreated at `dstTmpAllocation`, data has been copied, old buffer/image has been destroyed. `srcAllocation` should be changed to point to the new place. This is the default value set by vmaBeginDefragmentationPass().
+ VMA_DEFRAGMENTATION_MOVE_OPERATION_COPY = 0,
+ /// Set this value if you cannot move the allocation. New place reserved at `dstTmpAllocation` will be freed. `srcAllocation` will remain unchanged.
+ VMA_DEFRAGMENTATION_MOVE_OPERATION_IGNORE = 1,
+ /// Set this value if you decide to abandon the allocation and you destroyed the buffer/image. New place reserved at `dstTmpAllocation` will be freed, along with `srcAllocation`, which will be destroyed.
+ VMA_DEFRAGMENTATION_MOVE_OPERATION_DESTROY = 2,
+} VmaDefragmentationMoveOperation;
-The library uses Vulkan functions straight from the `vulkan.h` header by default.
-If you want to provide your own pointers to these functions, e.g. fetched using
-`vkGetInstanceProcAddr()` and `vkGetDeviceProcAddr()`:
+/** @} */
--# Define `VMA_STATIC_VULKAN_FUNCTIONS 0`.
--# Provide valid pointers through VmaAllocatorCreateInfo::pVulkanFunctions.
-
-\section custom_memory_allocator Custom host memory allocator
-
-If you use custom allocator for CPU memory rather than default operator `new`
-and `delete` from C++, you can make this library using your allocator as well
-by filling optional member VmaAllocatorCreateInfo::pAllocationCallbacks. These
-functions will be passed to Vulkan, as well as used by the library itself to
-make any CPU-side allocations.
-
-\section allocation_callbacks Device memory allocation callbacks
-
-The library makes calls to `vkAllocateMemory()` and `vkFreeMemory()` internally.
-You can setup callbacks to be informed about these calls, e.g. for the purpose
-of gathering some statistics. To do it, fill optional member
-VmaAllocatorCreateInfo::pDeviceMemoryCallbacks.
-
-\section heap_memory_limit Device heap memory limit
-
-When device memory of certain heap runs out of free space, new allocations may
-fail (returning error code) or they may succeed, silently pushing some existing
-memory blocks from GPU VRAM to system RAM (which degrades performance). This
-behavior is implementation-dependant - it depends on GPU vendor and graphics
-driver.
-
-On AMD cards it can be controlled while creating Vulkan device object by using
-VK_AMD_memory_overallocation_behavior extension, if available.
-
-Alternatively, if you want to test how your program behaves with limited amount of Vulkan device
-memory available without switching your graphics card to one that really has
-smaller VRAM, you can use a feature of this library intended for this purpose.
-To do it, fill optional member VmaAllocatorCreateInfo::pHeapSizeLimit.
-
-
-
-\page vk_khr_dedicated_allocation VK_KHR_dedicated_allocation
-
-VK_KHR_dedicated_allocation is a Vulkan extension which can be used to improve
-performance on some GPUs. It augments Vulkan API with possibility to query
-driver whether it prefers particular buffer or image to have its own, dedicated
-allocation (separate `VkDeviceMemory` block) for better efficiency - to be able
-to do some internal optimizations.
+/**
+\addtogroup group_virtual
+@{
+*/
-The extension is supported by this library. It will be used automatically when
-enabled. To enable it:
+/// Flags to be passed as VmaVirtualBlockCreateInfo::flags.
+typedef enum VmaVirtualBlockCreateFlagBits
+{
+ /** \brief Enables alternative, linear allocation algorithm in this virtual block.
-1 . When creating Vulkan device, check if following 2 device extensions are
-supported (call `vkEnumerateDeviceExtensionProperties()`).
-If yes, enable them (fill `VkDeviceCreateInfo::ppEnabledExtensionNames`).
+ Specify this flag to enable linear allocation algorithm, which always creates
+ new allocations after last one and doesn't reuse space from allocations freed in
+ between. It trades memory consumption for simplified algorithm and data
+ structure, which has better performance and uses less memory for metadata.
-- VK_KHR_get_memory_requirements2
-- VK_KHR_dedicated_allocation
+ By using this flag, you can achieve behavior of free-at-once, stack,
+ ring buffer, and double stack.
+ For details, see documentation chapter \ref linear_algorithm.
+ */
+ VMA_VIRTUAL_BLOCK_CREATE_LINEAR_ALGORITHM_BIT = 0x00000001,
-If you enabled these extensions:
+ /** \brief Bit mask to extract only `ALGORITHM` bits from entire set of flags.
+ */
+ VMA_VIRTUAL_BLOCK_CREATE_ALGORITHM_MASK =
+ VMA_VIRTUAL_BLOCK_CREATE_LINEAR_ALGORITHM_BIT,
-2 . Use #VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT flag when creating
-your #VmaAllocator`to inform the library that you enabled required extensions
-and you want the library to use them.
+ VMA_VIRTUAL_BLOCK_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VmaVirtualBlockCreateFlagBits;
+/// Flags to be passed as VmaVirtualBlockCreateInfo::flags. See #VmaVirtualBlockCreateFlagBits.
+typedef VkFlags VmaVirtualBlockCreateFlags;
-\code
-allocatorInfo.flags |= VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT;
+/// Flags to be passed as VmaVirtualAllocationCreateInfo::flags.
+typedef enum VmaVirtualAllocationCreateFlagBits
+{
+ /** \brief Allocation will be created from upper stack in a double stack pool.
-vmaCreateAllocator(&allocatorInfo, &allocator);
-\endcode
+ This flag is only allowed for virtual blocks created with #VMA_VIRTUAL_BLOCK_CREATE_LINEAR_ALGORITHM_BIT flag.
+ */
+ VMA_VIRTUAL_ALLOCATION_CREATE_UPPER_ADDRESS_BIT = VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT,
+ /** \brief Allocation strategy that tries to minimize memory usage.
+ */
+ VMA_VIRTUAL_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT = VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT,
+ /** \brief Allocation strategy that tries to minimize allocation time.
+ */
+ VMA_VIRTUAL_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT = VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT,
+ /** Allocation strategy that chooses always the lowest offset in available space.
+ This is not the most efficient strategy but achieves highly packed data.
+ */
+ VMA_VIRTUAL_ALLOCATION_CREATE_STRATEGY_MIN_OFFSET_BIT = VMA_ALLOCATION_CREATE_STRATEGY_MIN_OFFSET_BIT,
+ /** \brief A bit mask to extract only `STRATEGY` bits from entire set of flags.
-That's all. The extension will be automatically used whenever you create a
-buffer using vmaCreateBuffer() or image using vmaCreateImage().
+ These strategy flags are binary compatible with equivalent flags in #VmaAllocationCreateFlagBits.
+ */
+ VMA_VIRTUAL_ALLOCATION_CREATE_STRATEGY_MASK = VMA_ALLOCATION_CREATE_STRATEGY_MASK,
-When using the extension together with Vulkan Validation Layer, you will receive
-warnings like this:
+ VMA_VIRTUAL_ALLOCATION_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
+} VmaVirtualAllocationCreateFlagBits;
+/// Flags to be passed as VmaVirtualAllocationCreateInfo::flags. See #VmaVirtualAllocationCreateFlagBits.
+typedef VkFlags VmaVirtualAllocationCreateFlags;
- vkBindBufferMemory(): Binding memory to buffer 0x33 but vkGetBufferMemoryRequirements() has not been called on that buffer.
+/** @} */
-It is OK, you should just ignore it. It happens because you use function
-`vkGetBufferMemoryRequirements2KHR()` instead of standard
-`vkGetBufferMemoryRequirements()`, while the validation layer seems to be
-unaware of it.
+#endif // _VMA_ENUM_DECLARATIONS
-To learn more about this extension, see:
+#ifndef _VMA_DATA_TYPES_DECLARATIONS
-- [VK_KHR_dedicated_allocation in Vulkan specification](https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VK_KHR_dedicated_allocation)
-- [VK_KHR_dedicated_allocation unofficial manual](http://asawicki.info/articles/VK_KHR_dedicated_allocation.php5)
+/**
+\addtogroup group_init
+@{ */
+/** \struct VmaAllocator
+\brief Represents main object of this library initialized.
+Fill structure #VmaAllocatorCreateInfo and call function vmaCreateAllocator() to create it.
+Call function vmaDestroyAllocator() to destroy it.
-\page general_considerations General considerations
+It is recommended to create just one object of this type per `VkDevice` object,
+right after Vulkan is initialized and keep it alive until before Vulkan device is destroyed.
+*/
+VK_DEFINE_HANDLE(VmaAllocator)
-\section general_considerations_thread_safety Thread safety
+/** @} */
-- The library has no global state, so separate #VmaAllocator objects can be used
- independently.
- There should be no need to create multiple such objects though - one per `VkDevice` is enough.
-- By default, all calls to functions that take #VmaAllocator as first parameter
- are safe to call from multiple threads simultaneously because they are
- synchronized internally when needed.
-- When the allocator is created with #VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT
- flag, calls to functions that take such #VmaAllocator object must be
- synchronized externally.
-- Access to a #VmaAllocation object must be externally synchronized. For example,
- you must not call vmaGetAllocationInfo() and vmaMapMemory() from different
- threads at the same time if you pass the same #VmaAllocation object to these
- functions.
+/**
+\addtogroup group_alloc
+@{
+*/
-\section general_considerations_validation_layer_warnings Validation layer warnings
+/** \struct VmaPool
+\brief Represents custom memory pool
-When using this library, you can meet following types of warnings issued by
-Vulkan validation layer. They don't necessarily indicate a bug, so you may need
-to just ignore them.
+Fill structure VmaPoolCreateInfo and call function vmaCreatePool() to create it.
+Call function vmaDestroyPool() to destroy it.
-- *vkBindBufferMemory(): Binding memory to buffer 0xeb8e4 but vkGetBufferMemoryRequirements() has not been called on that buffer.*
- - It happens when VK_KHR_dedicated_allocation extension is enabled.
- `vkGetBufferMemoryRequirements2KHR` function is used instead, while validation layer seems to be unaware of it.
-- *Mapping an image with layout VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL can result in undefined behavior if this memory is used by the device. Only GENERAL or PREINITIALIZED should be used.*
- - It happens when you map a buffer or image, because the library maps entire
- `VkDeviceMemory` block, where different types of images and buffers may end
- up together, especially on GPUs with unified memory like Intel.
-- *Non-linear image 0xebc91 is aliased with linear buffer 0xeb8e4 which may indicate a bug.*
- - It happens when you use lost allocations, and a new image or buffer is
- created in place of an existing object that bacame lost.
- - It may happen also when you use [defragmentation](@ref defragmentation).
+For more information see [Custom memory pools](@ref choosing_memory_type_custom_memory_pools).
+*/
+VK_DEFINE_HANDLE(VmaPool)
-\section general_considerations_allocation_algorithm Allocation algorithm
+/** \struct VmaAllocation
+\brief Represents single memory allocation.
-The library uses following algorithm for allocation, in order:
+It may be either dedicated block of `VkDeviceMemory` or a specific region of a bigger block of this type
+plus unique offset.
--# Try to find free range of memory in existing blocks.
--# If failed, try to create a new block of `VkDeviceMemory`, with preferred block size.
--# If failed, try to create such block with size/2, size/4, size/8.
--# If failed and #VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT flag was
- specified, try to find space in existing blocks, possilby making some other
- allocations lost.
--# If failed, try to allocate separate `VkDeviceMemory` for this allocation,
- just like when you use #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT.
--# If failed, choose other memory type that meets the requirements specified in
- VmaAllocationCreateInfo and go to point 1.
--# If failed, return `VK_ERROR_OUT_OF_DEVICE_MEMORY`.
+There are multiple ways to create such object.
+You need to fill structure VmaAllocationCreateInfo.
+For more information see [Choosing memory type](@ref choosing_memory_type).
-\section general_considerations_features_not_supported Features not supported
+Although the library provides convenience functions that create Vulkan buffer or image,
+allocate memory for it and bind them together,
+binding of the allocation to a buffer or an image is out of scope of the allocation itself.
+Allocation object can exist without buffer/image bound,
+binding can be done manually by the user, and destruction of it can be done
+independently of destruction of the allocation.
-Features deliberately excluded from the scope of this library:
+The object also remembers its size and some other information.
+To retrieve this information, use function vmaGetAllocationInfo() and inspect
+returned structure VmaAllocationInfo.
+*/
+VK_DEFINE_HANDLE(VmaAllocation)
-- Data transfer. Uploading (straming) and downloading data of buffers and images
- between CPU and GPU memory and related synchronization is responsibility of the user.
- Defining some "texture" object that would automatically stream its data from a
- staging copy in CPU memory to GPU memory would rather be a feature of another,
- higher-level library implemented on top of VMA.
-- Allocations for imported/exported external memory. They tend to require
- explicit memory type index and dedicated allocation anyway, so they don't
- interact with main features of this library. Such special purpose allocations
- should be made manually, using `vkCreateBuffer()` and `vkAllocateMemory()`.
-- Recreation of buffers and images. Although the library has functions for
- buffer and image creation (vmaCreateBuffer(), vmaCreateImage()), you need to
- recreate these objects yourself after defragmentation. That's because the big
- structures `VkBufferCreateInfo`, `VkImageCreateInfo` are not stored in
- #VmaAllocation object.
-- Handling CPU memory allocation failures. When dynamically creating small C++
- objects in CPU memory (not Vulkan memory), allocation failures are not checked
- and handled gracefully, because that would complicate code significantly and
- is usually not needed in desktop PC applications anyway.
-- Code free of any compiler warnings. Maintaining the library to compile and
- work correctly on so many different platforms is hard enough. Being free of
- any warnings, on any version of any compiler, is simply not feasible.
-- This is a C++ library with C interface.
- Bindings or ports to any other programming languages are welcomed as external projects and
- are not going to be included into this repository.
+/** \struct VmaDefragmentationContext
+\brief An opaque object that represents started defragmentation process.
+Fill structure #VmaDefragmentationInfo and call function vmaBeginDefragmentation() to create it.
+Call function vmaEndDefragmentation() to destroy it.
*/
+VK_DEFINE_HANDLE(VmaDefragmentationContext)
-/*
-Define this macro to 0/1 to disable/enable support for recording functionality,
-available through VmaAllocatorCreateInfo::pRecordSettings.
-*/
-#ifndef VMA_RECORDING_ENABLED
- #define VMA_RECORDING_ENABLED 0
-#endif
+/** @} */
-#ifndef NOMINMAX
- #define NOMINMAX // For windows.h
-#endif
+/**
+\addtogroup group_virtual
+@{
+*/
-#ifndef VULKAN_H_
- #include <vulkan/vulkan.h>
-#endif
+/** \struct VmaVirtualAllocation
+\brief Represents single memory allocation done inside VmaVirtualBlock.
-#if VMA_RECORDING_ENABLED
- #include <windows.h>
-#endif
+Use it as a unique identifier to virtual allocation within the single block.
-// Define this macro to declare maximum supported Vulkan version in format AAABBBCCC,
-// where AAA = major, BBB = minor, CCC = patch.
-// If you want to use version > 1.0, it still needs to be enabled via VmaAllocatorCreateInfo::vulkanApiVersion.
-#if !defined(VMA_VULKAN_VERSION)
- #if defined(VK_VERSION_1_1)
- #define VMA_VULKAN_VERSION 1001000
- #else
- #define VMA_VULKAN_VERSION 1000000
- #endif
-#endif
+Use value `VK_NULL_HANDLE` to represent a null/invalid allocation.
+*/
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VmaVirtualAllocation);
-#if !defined(VMA_DEDICATED_ALLOCATION)
- #if VK_KHR_get_memory_requirements2 && VK_KHR_dedicated_allocation
- #define VMA_DEDICATED_ALLOCATION 1
- #else
- #define VMA_DEDICATED_ALLOCATION 0
- #endif
-#endif
+/** @} */
-#if !defined(VMA_BIND_MEMORY2)
- #if VK_KHR_bind_memory2
- #define VMA_BIND_MEMORY2 1
- #else
- #define VMA_BIND_MEMORY2 0
- #endif
-#endif
+/**
+\addtogroup group_virtual
+@{
+*/
-#if !defined(VMA_MEMORY_BUDGET)
- #if VK_EXT_memory_budget && (VK_KHR_get_physical_device_properties2 || VMA_VULKAN_VERSION >= 1001000)
- #define VMA_MEMORY_BUDGET 1
- #else
- #define VMA_MEMORY_BUDGET 0
- #endif
-#endif
+/** \struct VmaVirtualBlock
+\brief Handle to a virtual block object that allows to use core allocation algorithm without allocating any real GPU memory.
-// Define these macros to decorate all public functions with additional code,
-// before and after returned type, appropriately. This may be useful for
-// exporing the functions when compiling VMA as a separate library. Example:
-// #define VMA_CALL_PRE __declspec(dllexport)
-// #define VMA_CALL_POST __cdecl
-#ifndef VMA_CALL_PRE
- #define VMA_CALL_PRE
-#endif
-#ifndef VMA_CALL_POST
- #define VMA_CALL_POST
-#endif
+Fill in #VmaVirtualBlockCreateInfo structure and use vmaCreateVirtualBlock() to create it. Use vmaDestroyVirtualBlock() to destroy it.
+For more information, see documentation chapter \ref virtual_allocator.
-/** \struct VmaAllocator
-\brief Represents main object of this library initialized.
+This object is not thread-safe - should not be used from multiple threads simultaneously, must be synchronized externally.
+*/
+VK_DEFINE_HANDLE(VmaVirtualBlock)
-Fill structure #VmaAllocatorCreateInfo and call function vmaCreateAllocator() to create it.
-Call function vmaDestroyAllocator() to destroy it.
+/** @} */
-It is recommended to create just one object of this type per `VkDevice` object,
-right after Vulkan is initialized and keep it alive until before Vulkan device is destroyed.
+/**
+\addtogroup group_init
+@{
*/
-VK_DEFINE_HANDLE(VmaAllocator)
/// Callback function called after successful vkAllocateMemory.
-typedef void (VKAPI_PTR *PFN_vmaAllocateDeviceMemoryFunction)(
- VmaAllocator allocator,
- uint32_t memoryType,
- VkDeviceMemory memory,
- VkDeviceSize size);
+typedef void (VKAPI_PTR* PFN_vmaAllocateDeviceMemoryFunction)(
+ VmaAllocator VMA_NOT_NULL allocator,
+ uint32_t memoryType,
+ VkDeviceMemory VMA_NOT_NULL_NON_DISPATCHABLE memory,
+ VkDeviceSize size,
+ void* VMA_NULLABLE pUserData);
+
/// Callback function called before vkFreeMemory.
-typedef void (VKAPI_PTR *PFN_vmaFreeDeviceMemoryFunction)(
- VmaAllocator allocator,
- uint32_t memoryType,
- VkDeviceMemory memory,
- VkDeviceSize size);
+typedef void (VKAPI_PTR* PFN_vmaFreeDeviceMemoryFunction)(
+ VmaAllocator VMA_NOT_NULL allocator,
+ uint32_t memoryType,
+ VkDeviceMemory VMA_NOT_NULL_NON_DISPATCHABLE memory,
+ VkDeviceSize size,
+ void* VMA_NULLABLE pUserData);
/** \brief Set of callbacks that the library will call for `vkAllocateMemory` and `vkFreeMemory`.
@@ -1856,140 +936,66 @@ allocations or total amount of memory allocated in Vulkan.
Used in VmaAllocatorCreateInfo::pDeviceMemoryCallbacks.
*/
-typedef struct VmaDeviceMemoryCallbacks {
+typedef struct VmaDeviceMemoryCallbacks
+{
/// Optional, can be null.
- PFN_vmaAllocateDeviceMemoryFunction pfnAllocate;
+ PFN_vmaAllocateDeviceMemoryFunction VMA_NULLABLE pfnAllocate;
/// Optional, can be null.
- PFN_vmaFreeDeviceMemoryFunction pfnFree;
+ PFN_vmaFreeDeviceMemoryFunction VMA_NULLABLE pfnFree;
+ /// Optional, can be null.
+ void* VMA_NULLABLE pUserData;
} VmaDeviceMemoryCallbacks;
-/// Flags for created #VmaAllocator.
-typedef enum VmaAllocatorCreateFlagBits {
- /** \brief Allocator and all objects created from it will not be synchronized internally, so you must guarantee they are used from only one thread at a time or synchronized externally by you.
-
- Using this flag may increase performance because internal mutexes are not used.
- */
- VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT = 0x00000001,
- /** \brief Enables usage of VK_KHR_dedicated_allocation extension.
-
- The flag works only if VmaAllocatorCreateInfo::vulkanApiVersion `== VK_API_VERSION_1_0`.
- When it's `VK_API_VERSION_1_1`, the flag is ignored because the extension has been promoted to Vulkan 1.1.
-
- Using this extenion will automatically allocate dedicated blocks of memory for
- some buffers and images instead of suballocating place for them out of bigger
- memory blocks (as if you explicitly used #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT
- flag) when it is recommended by the driver. It may improve performance on some
- GPUs.
-
- You may set this flag only if you found out that following device extensions are
- supported, you enabled them while creating Vulkan device passed as
- VmaAllocatorCreateInfo::device, and you want them to be used internally by this
- library:
-
- - VK_KHR_get_memory_requirements2 (device extension)
- - VK_KHR_dedicated_allocation (device extension)
-
- When this flag is set, you can experience following warnings reported by Vulkan
- validation layer. You can ignore them.
-
- > vkBindBufferMemory(): Binding memory to buffer 0x2d but vkGetBufferMemoryRequirements() has not been called on that buffer.
- */
- VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT = 0x00000002,
- /**
- Enables usage of VK_KHR_bind_memory2 extension.
-
- The flag works only if VmaAllocatorCreateInfo::vulkanApiVersion `== VK_API_VERSION_1_0`.
- When it's `VK_API_VERSION_1_1`, the flag is ignored because the extension has been promoted to Vulkan 1.1.
-
- You may set this flag only if you found out that this device extension is supported,
- you enabled it while creating Vulkan device passed as VmaAllocatorCreateInfo::device,
- and you want it to be used internally by this library.
-
- The extension provides functions `vkBindBufferMemory2KHR` and `vkBindImageMemory2KHR`,
- which allow to pass a chain of `pNext` structures while binding.
- This flag is required if you use `pNext` parameter in vmaBindBufferMemory2() or vmaBindImageMemory2().
- */
- VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT = 0x00000004,
- /**
- Enables usage of VK_EXT_memory_budget extension.
-
- You may set this flag only if you found out that this device extension is supported,
- you enabled it while creating Vulkan device passed as VmaAllocatorCreateInfo::device,
- and you want it to be used internally by this library, along with another instance extension
- VK_KHR_get_physical_device_properties2, which is required by it (or Vulkan 1.1, where this extension is promoted).
-
- The extension provides query for current memory usage and budget, which will probably
- be more accurate than an estimation used by the library otherwise.
- */
- VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT = 0x00000008,
-
- VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
-} VmaAllocatorCreateFlagBits;
-typedef VkFlags VmaAllocatorCreateFlags;
-
/** \brief Pointers to some Vulkan functions - a subset used by the library.
Used in VmaAllocatorCreateInfo::pVulkanFunctions.
*/
-typedef struct VmaVulkanFunctions {
- PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties;
- PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties;
- PFN_vkAllocateMemory vkAllocateMemory;
- PFN_vkFreeMemory vkFreeMemory;
- PFN_vkMapMemory vkMapMemory;
- PFN_vkUnmapMemory vkUnmapMemory;
- PFN_vkFlushMappedMemoryRanges vkFlushMappedMemoryRanges;
- PFN_vkInvalidateMappedMemoryRanges vkInvalidateMappedMemoryRanges;
- PFN_vkBindBufferMemory vkBindBufferMemory;
- PFN_vkBindImageMemory vkBindImageMemory;
- PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements;
- PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements;
- PFN_vkCreateBuffer vkCreateBuffer;
- PFN_vkDestroyBuffer vkDestroyBuffer;
- PFN_vkCreateImage vkCreateImage;
- PFN_vkDestroyImage vkDestroyImage;
- PFN_vkCmdCopyBuffer vkCmdCopyBuffer;
+typedef struct VmaVulkanFunctions
+{
+ /// Required when using VMA_DYNAMIC_VULKAN_FUNCTIONS.
+ PFN_vkGetInstanceProcAddr VMA_NULLABLE vkGetInstanceProcAddr;
+ /// Required when using VMA_DYNAMIC_VULKAN_FUNCTIONS.
+ PFN_vkGetDeviceProcAddr VMA_NULLABLE vkGetDeviceProcAddr;
+ PFN_vkGetPhysicalDeviceProperties VMA_NULLABLE vkGetPhysicalDeviceProperties;
+ PFN_vkGetPhysicalDeviceMemoryProperties VMA_NULLABLE vkGetPhysicalDeviceMemoryProperties;
+ PFN_vkAllocateMemory VMA_NULLABLE vkAllocateMemory;
+ PFN_vkFreeMemory VMA_NULLABLE vkFreeMemory;
+ PFN_vkMapMemory VMA_NULLABLE vkMapMemory;
+ PFN_vkUnmapMemory VMA_NULLABLE vkUnmapMemory;
+ PFN_vkFlushMappedMemoryRanges VMA_NULLABLE vkFlushMappedMemoryRanges;
+ PFN_vkInvalidateMappedMemoryRanges VMA_NULLABLE vkInvalidateMappedMemoryRanges;
+ PFN_vkBindBufferMemory VMA_NULLABLE vkBindBufferMemory;
+ PFN_vkBindImageMemory VMA_NULLABLE vkBindImageMemory;
+ PFN_vkGetBufferMemoryRequirements VMA_NULLABLE vkGetBufferMemoryRequirements;
+ PFN_vkGetImageMemoryRequirements VMA_NULLABLE vkGetImageMemoryRequirements;
+ PFN_vkCreateBuffer VMA_NULLABLE vkCreateBuffer;
+ PFN_vkDestroyBuffer VMA_NULLABLE vkDestroyBuffer;
+ PFN_vkCreateImage VMA_NULLABLE vkCreateImage;
+ PFN_vkDestroyImage VMA_NULLABLE vkDestroyImage;
+ PFN_vkCmdCopyBuffer VMA_NULLABLE vkCmdCopyBuffer;
#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000
- PFN_vkGetBufferMemoryRequirements2KHR vkGetBufferMemoryRequirements2KHR;
- PFN_vkGetImageMemoryRequirements2KHR vkGetImageMemoryRequirements2KHR;
+ /// Fetch "vkGetBufferMemoryRequirements2" on Vulkan >= 1.1, fetch "vkGetBufferMemoryRequirements2KHR" when using VK_KHR_dedicated_allocation extension.
+ PFN_vkGetBufferMemoryRequirements2KHR VMA_NULLABLE vkGetBufferMemoryRequirements2KHR;
+ /// Fetch "vkGetImageMemoryRequirements2" on Vulkan >= 1.1, fetch "vkGetImageMemoryRequirements2KHR" when using VK_KHR_dedicated_allocation extension.
+ PFN_vkGetImageMemoryRequirements2KHR VMA_NULLABLE vkGetImageMemoryRequirements2KHR;
#endif
#if VMA_BIND_MEMORY2 || VMA_VULKAN_VERSION >= 1001000
- PFN_vkBindBufferMemory2KHR vkBindBufferMemory2KHR;
- PFN_vkBindImageMemory2KHR vkBindImageMemory2KHR;
+ /// Fetch "vkBindBufferMemory2" on Vulkan >= 1.1, fetch "vkBindBufferMemory2KHR" when using VK_KHR_bind_memory2 extension.
+ PFN_vkBindBufferMemory2KHR VMA_NULLABLE vkBindBufferMemory2KHR;
+ /// Fetch "vkBindImageMemory2" on Vulkan >= 1.1, fetch "vkBindImageMemory2KHR" when using VK_KHR_bind_memory2 extension.
+ PFN_vkBindImageMemory2KHR VMA_NULLABLE vkBindImageMemory2KHR;
#endif
#if VMA_MEMORY_BUDGET || VMA_VULKAN_VERSION >= 1001000
- PFN_vkGetPhysicalDeviceMemoryProperties2KHR vkGetPhysicalDeviceMemoryProperties2KHR;
+ PFN_vkGetPhysicalDeviceMemoryProperties2KHR VMA_NULLABLE vkGetPhysicalDeviceMemoryProperties2KHR;
+#endif
+#if VMA_VULKAN_VERSION >= 1003000
+ /// Fetch from "vkGetDeviceBufferMemoryRequirements" on Vulkan >= 1.3, but you can also fetch it from "vkGetDeviceBufferMemoryRequirementsKHR" if you enabled extension VK_KHR_maintenance4.
+ PFN_vkGetDeviceBufferMemoryRequirements VMA_NULLABLE vkGetDeviceBufferMemoryRequirements;
+ /// Fetch from "vkGetDeviceImageMemoryRequirements" on Vulkan >= 1.3, but you can also fetch it from "vkGetDeviceImageMemoryRequirementsKHR" if you enabled extension VK_KHR_maintenance4.
+ PFN_vkGetDeviceImageMemoryRequirements VMA_NULLABLE vkGetDeviceImageMemoryRequirements;
#endif
} VmaVulkanFunctions;
-/// Flags to be used in VmaRecordSettings::flags.
-typedef enum VmaRecordFlagBits {
- /** \brief Enables flush after recording every function call.
-
- Enable it if you expect your application to crash, which may leave recording file truncated.
- It may degrade performance though.
- */
- VMA_RECORD_FLUSH_AFTER_CALL_BIT = 0x00000001,
-
- VMA_RECORD_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
-} VmaRecordFlagBits;
-typedef VkFlags VmaRecordFlags;
-
-/// Parameters for recording calls to VMA functions. To be used in VmaAllocatorCreateInfo::pRecordSettings.
-typedef struct VmaRecordSettings
-{
- /// Flags for recording. Use #VmaRecordFlagBits enum.
- VmaRecordFlags flags;
- /** \brief Path to the file that should be written by the recording.
-
- Suggested extension: "csv".
- If the file already exists, it will be overwritten.
- It will be opened for the whole time #VmaAllocator object is alive.
- If opening this file fails, creation of the whole allocator object fails.
- */
- const char* pFilePath;
-} VmaRecordSettings;
-
/// Description of a Allocator to be created.
typedef struct VmaAllocatorCreateInfo
{
@@ -1997,33 +1003,19 @@ typedef struct VmaAllocatorCreateInfo
VmaAllocatorCreateFlags flags;
/// Vulkan physical device.
/** It must be valid throughout whole lifetime of created allocator. */
- VkPhysicalDevice physicalDevice;
+ VkPhysicalDevice VMA_NOT_NULL physicalDevice;
/// Vulkan device.
/** It must be valid throughout whole lifetime of created allocator. */
- VkDevice device;
+ VkDevice VMA_NOT_NULL device;
/// Preferred size of a single `VkDeviceMemory` block to be allocated from large heaps > 1 GiB. Optional.
/** Set to 0 to use default, which is currently 256 MiB. */
VkDeviceSize preferredLargeHeapBlockSize;
/// Custom CPU memory allocation callbacks. Optional.
/** Optional, can be null. When specified, will also be used for all CPU-side memory allocations. */
- const VkAllocationCallbacks* pAllocationCallbacks;
+ const VkAllocationCallbacks* VMA_NULLABLE pAllocationCallbacks;
/// Informative callbacks for `vkAllocateMemory`, `vkFreeMemory`. Optional.
/** Optional, can be null. */
- const VmaDeviceMemoryCallbacks* pDeviceMemoryCallbacks;
- /** \brief Maximum number of additional frames that are in use at the same time as current frame.
-
- This value is used only when you make allocations with
- VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT flag. Such allocation cannot become
- lost if allocation.lastUseFrameIndex >= allocator.currentFrameIndex - frameInUseCount.
-
- For example, if you double-buffer your command buffers, so resources used for
- rendering in previous frame may still be in use by the GPU at the moment you
- allocate resources needed for the current frame, set this value to 1.
-
- If you want to allow any allocations other than used in the current frame to
- become lost, set this value to 0.
- */
- uint32_t frameInUseCount;
+ const VmaDeviceMemoryCallbacks* VMA_NULLABLE pDeviceMemoryCallbacks;
/** \brief Either null or a pointer to an array of limits on maximum number of bytes that can be allocated out of particular Vulkan memory heap.
If not NULL, it must be a pointer to an array of
@@ -2048,666 +1040,720 @@ typedef struct VmaAllocatorCreateInfo
blocks to system RAM. This driver behavior can also be controlled using
VK_AMD_memory_overallocation_behavior extension.
*/
- const VkDeviceSize* pHeapSizeLimit;
- /** \brief Pointers to Vulkan functions. Can be null if you leave define `VMA_STATIC_VULKAN_FUNCTIONS 1`.
+ const VkDeviceSize* VMA_NULLABLE VMA_LEN_IF_NOT_NULL("VkPhysicalDeviceMemoryProperties::memoryHeapCount") pHeapSizeLimit;
- If you leave define `VMA_STATIC_VULKAN_FUNCTIONS 1` in configuration section,
- you can pass null as this member, because the library will fetch pointers to
- Vulkan functions internally in a static way, like:
-
- vulkanFunctions.vkAllocateMemory = &vkAllocateMemory;
-
- Fill this member if you want to provide your own pointers to Vulkan functions,
- e.g. fetched using `vkGetInstanceProcAddr()` and `vkGetDeviceProcAddr()`.
- */
- const VmaVulkanFunctions* pVulkanFunctions;
- /** \brief Parameters for recording of VMA calls. Can be null.
+ /** \brief Pointers to Vulkan functions. Can be null.
- If not null, it enables recording of calls to VMA functions to a file.
- If support for recording is not enabled using `VMA_RECORDING_ENABLED` macro,
- creation of the allocator object fails with `VK_ERROR_FEATURE_NOT_PRESENT`.
+ For details see [Pointers to Vulkan functions](@ref config_Vulkan_functions).
*/
- const VmaRecordSettings* pRecordSettings;
- /** \brief Optional handle to Vulkan instance object.
+ const VmaVulkanFunctions* VMA_NULLABLE pVulkanFunctions;
+ /** \brief Handle to Vulkan instance object.
- Optional, can be null. Must be set if #VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT flas is used
- or if `vulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0)`.
+ Starting from version 3.0.0 this member is no longer optional, it must be set!
*/
- VkInstance instance;
+ VkInstance VMA_NOT_NULL instance;
/** \brief Optional. The highest version of Vulkan that the application is designed to use.
-
+
It must be a value in the format as created by macro `VK_MAKE_VERSION` or a constant like: `VK_API_VERSION_1_1`, `VK_API_VERSION_1_0`.
The patch version number specified is ignored. Only the major and minor versions are considered.
- It must be less or euqal (preferably equal) to value as passed to `vkCreateInstance` as `VkApplicationInfo::apiVersion`.
- Only versions 1.0 and 1.1 are supported by the current implementation.
+ It must be less or equal (preferably equal) to value as passed to `vkCreateInstance` as `VkApplicationInfo::apiVersion`.
+ Only versions 1.0, 1.1, 1.2, 1.3 are supported by the current implementation.
Leaving it initialized to zero is equivalent to `VK_API_VERSION_1_0`.
*/
uint32_t vulkanApiVersion;
+#if VMA_EXTERNAL_MEMORY
+ /** \brief Either null or a pointer to an array of external memory handle types for each Vulkan memory type.
+
+ If not NULL, it must be a pointer to an array of `VkPhysicalDeviceMemoryProperties::memoryTypeCount`
+ elements, defining external memory handle types of particular Vulkan memory type,
+ to be passed using `VkExportMemoryAllocateInfoKHR`.
+
+ Any of the elements may be equal to 0, which means not to use `VkExportMemoryAllocateInfoKHR` on this memory type.
+ This is also the default in case of `pTypeExternalMemoryHandleTypes` = NULL.
+ */
+ const VkExternalMemoryHandleTypeFlagsKHR* VMA_NULLABLE VMA_LEN_IF_NOT_NULL("VkPhysicalDeviceMemoryProperties::memoryTypeCount") pTypeExternalMemoryHandleTypes;
+#endif // #if VMA_EXTERNAL_MEMORY
} VmaAllocatorCreateInfo;
-/// Creates Allocator object.
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateAllocator(
- const VmaAllocatorCreateInfo* pCreateInfo,
- VmaAllocator* pAllocator);
+/// Information about existing #VmaAllocator object.
+typedef struct VmaAllocatorInfo
+{
+ /** \brief Handle to Vulkan instance object.
-/// Destroys allocator object.
-VMA_CALL_PRE void VMA_CALL_POST vmaDestroyAllocator(
- VmaAllocator allocator);
+ This is the same value as has been passed through VmaAllocatorCreateInfo::instance.
+ */
+ VkInstance VMA_NOT_NULL instance;
+ /** \brief Handle to Vulkan physical device object.
-/**
-PhysicalDeviceProperties are fetched from physicalDevice by the allocator.
-You can access it here, without fetching it again on your own.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaGetPhysicalDeviceProperties(
- VmaAllocator allocator,
- const VkPhysicalDeviceProperties** ppPhysicalDeviceProperties);
+ This is the same value as has been passed through VmaAllocatorCreateInfo::physicalDevice.
+ */
+ VkPhysicalDevice VMA_NOT_NULL physicalDevice;
+ /** \brief Handle to Vulkan device object.
+
+ This is the same value as has been passed through VmaAllocatorCreateInfo::device.
+ */
+ VkDevice VMA_NOT_NULL device;
+} VmaAllocatorInfo;
+
+/** @} */
/**
-PhysicalDeviceMemoryProperties are fetched from physicalDevice by the allocator.
-You can access it here, without fetching it again on your own.
+\addtogroup group_stats
+@{
*/
-VMA_CALL_PRE void VMA_CALL_POST vmaGetMemoryProperties(
- VmaAllocator allocator,
- const VkPhysicalDeviceMemoryProperties** ppPhysicalDeviceMemoryProperties);
-/**
-\brief Given Memory Type Index, returns Property Flags of this memory type.
+/** \brief Calculated statistics of memory usage e.g. in a specific memory type, heap, custom pool, or total.
-This is just a convenience function. Same information can be obtained using
-vmaGetMemoryProperties().
+These are fast to calculate.
+See functions: vmaGetHeapBudgets(), vmaGetPoolStatistics().
*/
-VMA_CALL_PRE void VMA_CALL_POST vmaGetMemoryTypeProperties(
- VmaAllocator allocator,
- uint32_t memoryTypeIndex,
- VkMemoryPropertyFlags* pFlags);
+typedef struct VmaStatistics
+{
+ /** \brief Number of `VkDeviceMemory` objects - Vulkan memory blocks allocated.
+ */
+ uint32_t blockCount;
+ /** \brief Number of #VmaAllocation objects allocated.
+
+ Dedicated allocations have their own blocks, so each one adds 1 to `allocationCount` as well as `blockCount`.
+ */
+ uint32_t allocationCount;
+ /** \brief Number of bytes allocated in `VkDeviceMemory` blocks.
+
+ \note To avoid confusion, please be aware that what Vulkan calls an "allocation" - a whole `VkDeviceMemory` object
+ (e.g. as in `VkPhysicalDeviceLimits::maxMemoryAllocationCount`) is called a "block" in VMA, while VMA calls
+ "allocation" a #VmaAllocation object that represents a memory region sub-allocated from such block, usually for a single buffer or image.
+ */
+ VkDeviceSize blockBytes;
+ /** \brief Total number of bytes occupied by all #VmaAllocation objects.
+
+ Always less or equal than `blockBytes`.
+ Difference `(blockBytes - allocationBytes)` is the amount of memory allocated from Vulkan
+ but unused by any #VmaAllocation.
+ */
+ VkDeviceSize allocationBytes;
+} VmaStatistics;
-/** \brief Sets index of the current frame.
+/** \brief More detailed statistics than #VmaStatistics.
-This function must be used if you make allocations with
-#VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT and
-#VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT flags to inform the allocator
-when a new frame begins. Allocations queried using vmaGetAllocationInfo() cannot
-become lost in the current frame.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaSetCurrentFrameIndex(
- VmaAllocator allocator,
- uint32_t frameIndex);
+These are slower to calculate. Use for debugging purposes.
+See functions: vmaCalculateStatistics(), vmaCalculatePoolStatistics().
+
+Previous version of the statistics API provided averages, but they have been removed
+because they can be easily calculated as:
-/** \brief Calculated statistics of memory usage in entire allocator.
+\code
+VkDeviceSize allocationSizeAvg = detailedStats.statistics.allocationBytes / detailedStats.statistics.allocationCount;
+VkDeviceSize unusedBytes = detailedStats.statistics.blockBytes - detailedStats.statistics.allocationBytes;
+VkDeviceSize unusedRangeSizeAvg = unusedBytes / detailedStats.unusedRangeCount;
+\endcode
*/
-typedef struct VmaStatInfo
+typedef struct VmaDetailedStatistics
{
- /// Number of `VkDeviceMemory` Vulkan memory blocks allocated.
- uint32_t blockCount;
- /// Number of #VmaAllocation allocation objects allocated.
- uint32_t allocationCount;
+ /// Basic statistics.
+ VmaStatistics statistics;
/// Number of free ranges of memory between allocations.
uint32_t unusedRangeCount;
- /// Total number of bytes occupied by all allocations.
- VkDeviceSize usedBytes;
- /// Total number of bytes occupied by unused ranges.
- VkDeviceSize unusedBytes;
- VkDeviceSize allocationSizeMin, allocationSizeAvg, allocationSizeMax;
- VkDeviceSize unusedRangeSizeMin, unusedRangeSizeAvg, unusedRangeSizeMax;
-} VmaStatInfo;
-
-/// General statistics from current state of Allocator.
-typedef struct VmaStats
-{
- VmaStatInfo memoryType[VK_MAX_MEMORY_TYPES];
- VmaStatInfo memoryHeap[VK_MAX_MEMORY_HEAPS];
- VmaStatInfo total;
-} VmaStats;
-
-/** \brief Retrieves statistics from current state of the Allocator.
+ /// Smallest allocation size. `VK_WHOLE_SIZE` if there are 0 allocations.
+ VkDeviceSize allocationSizeMin;
+ /// Largest allocation size. 0 if there are 0 allocations.
+ VkDeviceSize allocationSizeMax;
+ /// Smallest empty range size. `VK_WHOLE_SIZE` if there are 0 empty ranges.
+ VkDeviceSize unusedRangeSizeMin;
+ /// Largest empty range size. 0 if there are 0 empty ranges.
+ VkDeviceSize unusedRangeSizeMax;
+} VmaDetailedStatistics;
-This function is called "calculate" not "get" because it has to traverse all
-internal data structures, so it may be quite slow. For faster but more brief statistics
-suitable to be called every frame or every allocation, use vmaGetBudget().
+/** \brief General statistics from current state of the Allocator -
+total memory usage across all memory heaps and types.
-Note that when using allocator from multiple threads, returned information may immediately
-become outdated.
+These are slower to calculate. Use for debugging purposes.
+See function vmaCalculateStatistics().
*/
-VMA_CALL_PRE void VMA_CALL_POST vmaCalculateStats(
- VmaAllocator allocator,
- VmaStats* pStats);
+typedef struct VmaTotalStatistics
+{
+ VmaDetailedStatistics memoryType[VK_MAX_MEMORY_TYPES];
+ VmaDetailedStatistics memoryHeap[VK_MAX_MEMORY_HEAPS];
+ VmaDetailedStatistics total;
+} VmaTotalStatistics;
+
+/** \brief Statistics of current memory usage and available budget for a specific memory heap.
-/** \brief Statistics of current memory usage and available budget, in bytes, for specific memory heap.
+These are fast to calculate.
+See function vmaGetHeapBudgets().
*/
typedef struct VmaBudget
{
- /** \brief Sum size of all `VkDeviceMemory` blocks allocated from particular heap, in bytes.
+ /** \brief Statistics fetched from the library.
*/
- VkDeviceSize blockBytes;
-
- /** \brief Sum size of all allocations created in particular heap, in bytes.
-
- Usually less or equal than `blockBytes`.
- Difference `blockBytes - allocationBytes` is the amount of memory allocated but unused -
- available for new allocations or wasted due to fragmentation.
-
- It might be greater than `blockBytes` if there are some allocations in lost state, as they account
- to this value as well.
- */
- VkDeviceSize allocationBytes;
-
+ VmaStatistics statistics;
/** \brief Estimated current memory usage of the program, in bytes.
-
- Fetched from system using `VK_EXT_memory_budget` extension if enabled.
-
- It might be different than `blockBytes` (usually higher) due to additional implicit objects
+
+ Fetched from system using VK_EXT_memory_budget extension if enabled.
+
+ It might be different than `statistics.blockBytes` (usually higher) due to additional implicit objects
also occupying the memory, like swapchain, pipelines, descriptor heaps, command buffers, or
`VkDeviceMemory` blocks allocated outside of this library, if any.
*/
VkDeviceSize usage;
-
/** \brief Estimated amount of memory available to the program, in bytes.
-
- Fetched from system using `VK_EXT_memory_budget` extension if enabled.
-
+
+ Fetched from system using VK_EXT_memory_budget extension if enabled.
+
It might be different (most probably smaller) than `VkMemoryHeap::size[heapIndex]` due to factors
- external to the program, like other programs also consuming system resources.
+ external to the program, decided by the operating system.
Difference `budget - usage` is the amount of additional memory that can probably
be allocated without problems. Exceeding the budget may result in various problems.
*/
VkDeviceSize budget;
} VmaBudget;
-/** \brief Retrieves information about current memory budget for all memory heaps.
+/** @} */
-\param[out] pBudget Must point to array with number of elements at least equal to number of memory heaps in physical device used.
+/**
+\addtogroup group_alloc
+@{
+*/
-This function is called "get" not "calculate" because it is very fast, suitable to be called
-every frame or every allocation. For more detailed statistics use vmaCalculateStats().
+/** \brief Parameters of new #VmaAllocation.
-Note that when using allocator from multiple threads, returned information may immediately
-become outdated.
+To be used with functions like vmaCreateBuffer(), vmaCreateImage(), and many others.
*/
-VMA_CALL_PRE void VMA_CALL_POST vmaGetBudget(
- VmaAllocator allocator,
- VmaBudget* pBudget);
+typedef struct VmaAllocationCreateInfo
+{
+ /// Use #VmaAllocationCreateFlagBits enum.
+ VmaAllocationCreateFlags flags;
+ /** \brief Intended usage of memory.
-#ifndef VMA_STATS_STRING_ENABLED
-#define VMA_STATS_STRING_ENABLED 1
-#endif
+ You can leave #VMA_MEMORY_USAGE_UNKNOWN if you specify memory requirements in other way. \n
+ If `pool` is not null, this member is ignored.
+ */
+ VmaMemoryUsage usage;
+ /** \brief Flags that must be set in a Memory Type chosen for an allocation.
-#if VMA_STATS_STRING_ENABLED
+ Leave 0 if you specify memory requirements in other way. \n
+ If `pool` is not null, this member is ignored.*/
+ VkMemoryPropertyFlags requiredFlags;
+ /** \brief Flags that preferably should be set in a memory type chosen for an allocation.
-/// Builds and returns statistics as string in JSON format.
-/** @param[out] ppStatsString Must be freed using vmaFreeStatsString() function.
-*/
-VMA_CALL_PRE void VMA_CALL_POST vmaBuildStatsString(
- VmaAllocator allocator,
- char** ppStatsString,
- VkBool32 detailedMap);
+ Set to 0 if no additional flags are preferred. \n
+ If `pool` is not null, this member is ignored. */
+ VkMemoryPropertyFlags preferredFlags;
+ /** \brief Bitmask containing one bit set for every memory type acceptable for this allocation.
-VMA_CALL_PRE void VMA_CALL_POST vmaFreeStatsString(
- VmaAllocator allocator,
- char* pStatsString);
+ Value 0 is equivalent to `UINT32_MAX` - it means any memory type is accepted if
+ it meets other requirements specified by this structure, with no further
+ restrictions on memory type index. \n
+ If `pool` is not null, this member is ignored.
+ */
+ uint32_t memoryTypeBits;
+ /** \brief Pool that this allocation should be created in.
-#endif // #if VMA_STATS_STRING_ENABLED
+ Leave `VK_NULL_HANDLE` to allocate from default pool. If not null, members:
+ `usage`, `requiredFlags`, `preferredFlags`, `memoryTypeBits` are ignored.
+ */
+ VmaPool VMA_NULLABLE pool;
+ /** \brief Custom general-purpose pointer that will be stored in #VmaAllocation, can be read as VmaAllocationInfo::pUserData and changed using vmaSetAllocationUserData().
-/** \struct VmaPool
-\brief Represents custom memory pool
+ If #VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT is used, it must be either
+ null or pointer to a null-terminated string. The string will be then copied to
+ internal buffer, so it doesn't need to be valid after allocation call.
+ */
+ void* VMA_NULLABLE pUserData;
+ /** \brief A floating-point value between 0 and 1, indicating the priority of the allocation relative to other memory allocations.
-Fill structure VmaPoolCreateInfo and call function vmaCreatePool() to create it.
-Call function vmaDestroyPool() to destroy it.
+ It is used only when #VMA_ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT flag was used during creation of the #VmaAllocator object
+ and this allocation ends up as dedicated or is explicitly forced as dedicated using #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT.
+ Otherwise, it has the priority of a memory block where it is placed and this variable is ignored.
+ */
+ float priority;
+} VmaAllocationCreateInfo;
-For more information see [Custom memory pools](@ref choosing_memory_type_custom_memory_pools).
+/// Describes parameter of created #VmaPool.
+typedef struct VmaPoolCreateInfo
+{
+ /** \brief Vulkan memory type index to allocate this pool from.
+ */
+ uint32_t memoryTypeIndex;
+ /** \brief Use combination of #VmaPoolCreateFlagBits.
+ */
+ VmaPoolCreateFlags flags;
+ /** \brief Size of a single `VkDeviceMemory` block to be allocated as part of this pool, in bytes. Optional.
+
+ Specify nonzero to set explicit, constant size of memory blocks used by this
+ pool.
+
+ Leave 0 to use default and let the library manage block sizes automatically.
+ Sizes of particular blocks may vary.
+ In this case, the pool will also support dedicated allocations.
+ */
+ VkDeviceSize blockSize;
+ /** \brief Minimum number of blocks to be always allocated in this pool, even if they stay empty.
+
+ Set to 0 to have no preallocated blocks and allow the pool be completely empty.
+ */
+ size_t minBlockCount;
+ /** \brief Maximum number of blocks that can be allocated in this pool. Optional.
+
+ Set to 0 to use default, which is `SIZE_MAX`, which means no limit.
+
+ Set to same value as VmaPoolCreateInfo::minBlockCount to have fixed amount of memory allocated
+ throughout whole lifetime of this pool.
+ */
+ size_t maxBlockCount;
+ /** \brief A floating-point value between 0 and 1, indicating the priority of the allocations in this pool relative to other memory allocations.
+
+ It is used only when #VMA_ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT flag was used during creation of the #VmaAllocator object.
+ Otherwise, this variable is ignored.
+ */
+ float priority;
+ /** \brief Additional minimum alignment to be used for all allocations created from this pool. Can be 0.
+
+ Leave 0 (default) not to impose any additional alignment. If not 0, it must be a power of two.
+ It can be useful in cases where alignment returned by Vulkan by functions like `vkGetBufferMemoryRequirements` is not enough,
+ e.g. when doing interop with OpenGL.
+ */
+ VkDeviceSize minAllocationAlignment;
+ /** \brief Additional `pNext` chain to be attached to `VkMemoryAllocateInfo` used for every allocation made by this pool. Optional.
+
+ Optional, can be null. If not null, it must point to a `pNext` chain of structures that can be attached to `VkMemoryAllocateInfo`.
+ It can be useful for special needs such as adding `VkExportMemoryAllocateInfoKHR`.
+ Structures pointed by this member must remain alive and unchanged for the whole lifetime of the custom pool.
+
+ Please note that some structures, e.g. `VkMemoryPriorityAllocateInfoEXT`, `VkMemoryDedicatedAllocateInfoKHR`,
+ can be attached automatically by this library when using other, more convenient of its features.
+ */
+ void* VMA_NULLABLE pMemoryAllocateNext;
+} VmaPoolCreateInfo;
+
+/** @} */
+
+/**
+\addtogroup group_alloc
+@{
*/
-VK_DEFINE_HANDLE(VmaPool)
-typedef enum VmaMemoryUsage
+/// Parameters of #VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().
+typedef struct VmaAllocationInfo
{
- /** No intended memory usage specified.
- Use other members of VmaAllocationCreateInfo to specify your requirements.
+ /** \brief Memory type index that this allocation was allocated from.
+
+ It never changes.
*/
- VMA_MEMORY_USAGE_UNKNOWN = 0,
- /** Memory will be used on device only, so fast access from the device is preferred.
- It usually means device-local GPU (video) memory.
- No need to be mappable on host.
- It is roughly equivalent of `D3D12_HEAP_TYPE_DEFAULT`.
+ uint32_t memoryType;
+ /** \brief Handle to Vulkan memory object.
- Usage:
-
- - Resources written and read by device, e.g. images used as attachments.
- - Resources transferred from host once (immutable) or infrequently and read by
- device multiple times, e.g. textures to be sampled, vertex buffers, uniform
- (constant) buffers, and majority of other types of resources used on GPU.
-
- Allocation may still end up in `HOST_VISIBLE` memory on some implementations.
- In such case, you are free to map it.
- You can use #VMA_ALLOCATION_CREATE_MAPPED_BIT with this usage type.
+ Same memory object can be shared by multiple allocations.
+
+ It can change after the allocation is moved during \ref defragmentation.
*/
- VMA_MEMORY_USAGE_GPU_ONLY = 1,
- /** Memory will be mappable on host.
- It usually means CPU (system) memory.
- Guarantees to be `HOST_VISIBLE` and `HOST_COHERENT`.
- CPU access is typically uncached. Writes may be write-combined.
- Resources created in this pool may still be accessible to the device, but access to them can be slow.
- It is roughly equivalent of `D3D12_HEAP_TYPE_UPLOAD`.
-
- Usage: Staging copy of resources used as transfer source.
+ VkDeviceMemory VMA_NULLABLE_NON_DISPATCHABLE deviceMemory;
+ /** \brief Offset in `VkDeviceMemory` object to the beginning of this allocation, in bytes. `(deviceMemory, offset)` pair is unique to this allocation.
+
+ You usually don't need to use this offset. If you create a buffer or an image together with the allocation using e.g. function
+ vmaCreateBuffer(), vmaCreateImage(), functions that operate on these resources refer to the beginning of the buffer or image,
+ not entire device memory block. Functions like vmaMapMemory(), vmaBindBufferMemory() also refer to the beginning of the allocation
+ and apply this offset automatically.
+
+ It can change after the allocation is moved during \ref defragmentation.
*/
- VMA_MEMORY_USAGE_CPU_ONLY = 2,
- /**
- Memory that is both mappable on host (guarantees to be `HOST_VISIBLE`) and preferably fast to access by GPU.
- CPU access is typically uncached. Writes may be write-combined.
+ VkDeviceSize offset;
+ /** \brief Size of this allocation, in bytes.
+
+ It never changes.
- Usage: Resources written frequently by host (dynamic), read by device. E.g. textures, vertex buffers, uniform buffers updated every frame or every draw call.
+ \note Allocation size returned in this variable may be greater than the size
+ requested for the resource e.g. as `VkBufferCreateInfo::size`. Whole size of the
+ allocation is accessible for operations on memory e.g. using a pointer after
+ mapping with vmaMapMemory(), but operations on the resource e.g. using
+ `vkCmdCopyBuffer` must be limited to the size of the resource.
*/
- VMA_MEMORY_USAGE_CPU_TO_GPU = 3,
- /** Memory mappable on host (guarantees to be `HOST_VISIBLE`) and cached.
- It is roughly equivalent of `D3D12_HEAP_TYPE_READBACK`.
+ VkDeviceSize size;
+ /** \brief Pointer to the beginning of this allocation as mapped data.
- Usage:
+ If the allocation hasn't been mapped using vmaMapMemory() and hasn't been
+ created with #VMA_ALLOCATION_CREATE_MAPPED_BIT flag, this value is null.
- - Resources written by device, read by host - results of some computations, e.g. screen capture, average scene luminance for HDR tone mapping.
- - Any resources read or accessed randomly on host, e.g. CPU-side copy of vertex buffer used as source of transfer, but also used for collision detection.
+ It can change after call to vmaMapMemory(), vmaUnmapMemory().
+ It can also change after the allocation is moved during \ref defragmentation.
*/
- VMA_MEMORY_USAGE_GPU_TO_CPU = 4,
- /** CPU memory - memory that is preferably not `DEVICE_LOCAL`, but also not guaranteed to be `HOST_VISIBLE`.
+ void* VMA_NULLABLE pMappedData;
+ /** \brief Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vmaSetAllocationUserData().
- Usage: Staging copy of resources moved from GPU memory to CPU memory as part
- of custom paging/residency mechanism, to be moved back to GPU memory when needed.
+ It can change after call to vmaSetAllocationUserData() for this allocation.
*/
- VMA_MEMORY_USAGE_CPU_COPY = 5,
- /** Lazily allocated GPU memory having `VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT`.
- Exists mostly on mobile platforms. Using it on desktop PC or other GPUs with no such memory type present will fail the allocation.
+ void* VMA_NULLABLE pUserData;
+ /** \brief Custom allocation name that was set with vmaSetAllocationName().
- Usage: Memory for transient attachment images (color attachments, depth attachments etc.), created with `VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT`.
+ It can change after call to vmaSetAllocationName() for this allocation.
+
+ Another way to set custom name is to pass it in VmaAllocationCreateInfo::pUserData with
+ additional flag #VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT set [DEPRECATED].
+ */
+ const char* VMA_NULLABLE pName;
+} VmaAllocationInfo;
- Allocations with this usage are always created as dedicated - it implies #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT.
+/** \brief Parameters for defragmentation.
+
+To be used with function vmaBeginDefragmentation().
+*/
+typedef struct VmaDefragmentationInfo
+{
+ /// \brief Use combination of #VmaDefragmentationFlagBits.
+ VmaDefragmentationFlags flags;
+ /** \brief Custom pool to be defragmented.
+
+ If null then default pools will undergo defragmentation process.
*/
- VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED = 6,
+ VmaPool VMA_NULLABLE pool;
+ /** \brief Maximum numbers of bytes that can be copied during single pass, while moving allocations to different places.
- VMA_MEMORY_USAGE_MAX_ENUM = 0x7FFFFFFF
-} VmaMemoryUsage;
+ `0` means no limit.
+ */
+ VkDeviceSize maxBytesPerPass;
+ /** \brief Maximum number of allocations that can be moved during single pass to a different place.
-/// Flags to be passed as VmaAllocationCreateInfo::flags.
-typedef enum VmaAllocationCreateFlagBits {
- /** \brief Set this flag if the allocation should have its own memory block.
-
- Use it for special, big resources, like fullscreen images used as attachments.
-
- You should not use this flag if VmaAllocationCreateInfo::pool is not null.
+ `0` means no limit.
*/
- VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT = 0x00000001,
+ uint32_t maxAllocationsPerPass;
+} VmaDefragmentationInfo;
- /** \brief Set this flag to only try to allocate from existing `VkDeviceMemory` blocks and never create new such block.
+/// Single move of an allocation to be done for defragmentation.
+typedef struct VmaDefragmentationMove
+{
+ /// Operation to be performed on the allocation by vmaEndDefragmentationPass(). Default value is #VMA_DEFRAGMENTATION_MOVE_OPERATION_COPY. You can modify it.
+ VmaDefragmentationMoveOperation operation;
+ /// Allocation that should be moved.
+ VmaAllocation VMA_NOT_NULL srcAllocation;
+ /** \brief Temporary allocation pointing to destination memory that will replace `srcAllocation`.
- If new allocation cannot be placed in any of the existing blocks, allocation
- fails with `VK_ERROR_OUT_OF_DEVICE_MEMORY` error.
+ \warning Do not store this allocation in your data structures! It exists only temporarily, for the duration of the defragmentation pass,
+ to be used for binding new buffer/image to the destination memory using e.g. vmaBindBufferMemory().
+ vmaEndDefragmentationPass() will destroy it and make `srcAllocation` point to this memory.
+ */
+ VmaAllocation VMA_NOT_NULL dstTmpAllocation;
+} VmaDefragmentationMove;
+
+/** \brief Parameters for incremental defragmentation steps.
+
+To be used with function vmaBeginDefragmentationPass().
+*/
+typedef struct VmaDefragmentationPassMoveInfo
+{
+ /// Number of elements in the `pMoves` array.
+ uint32_t moveCount;
+ /** \brief Array of moves to be performed by the user in the current defragmentation pass.
- You should not use #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT and
- #VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT at the same time. It makes no sense.
+ Pointer to an array of `moveCount` elements, owned by VMA, created in vmaBeginDefragmentationPass(), destroyed in vmaEndDefragmentationPass().
+
+ For each element, you should:
- If VmaAllocationCreateInfo::pool is not null, this flag is implied and ignored. */
- VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT = 0x00000002,
- /** \brief Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.
+ 1. Create a new buffer/image in the place pointed by VmaDefragmentationMove::dstMemory + VmaDefragmentationMove::dstOffset.
+ 2. Copy data from the VmaDefragmentationMove::srcAllocation e.g. using `vkCmdCopyBuffer`, `vkCmdCopyImage`.
+ 3. Make sure these commands finished executing on the GPU.
+ 4. Destroy the old buffer/image.
- Pointer to mapped memory will be returned through VmaAllocationInfo::pMappedData.
+ Only then you can finish defragmentation pass by calling vmaEndDefragmentationPass().
+ After this call, the allocation will point to the new place in memory.
- Is it valid to use this flag for allocation made from memory type that is not
- `HOST_VISIBLE`. This flag is then ignored and memory is not mapped. This is
- useful if you need an allocation that is efficient to use on GPU
- (`DEVICE_LOCAL`) and still want to map it directly if possible on platforms that
- support it (e.g. Intel GPU).
+ Alternatively, if you cannot move specific allocation, you can set VmaDefragmentationMove::operation to #VMA_DEFRAGMENTATION_MOVE_OPERATION_IGNORE.
+
+ Alternatively, if you decide you want to completely remove the allocation:
- You should not use this flag together with #VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT.
+ 1. Destroy its buffer/image.
+ 2. Set VmaDefragmentationMove::operation to #VMA_DEFRAGMENTATION_MOVE_OPERATION_DESTROY.
+
+ Then, after vmaEndDefragmentationPass() the allocation will be freed.
*/
- VMA_ALLOCATION_CREATE_MAPPED_BIT = 0x00000004,
- /** Allocation created with this flag can become lost as a result of another
- allocation with #VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT flag, so you
- must check it before use.
+ VmaDefragmentationMove* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(moveCount) pMoves;
+} VmaDefragmentationPassMoveInfo;
- To check if allocation is not lost, call vmaGetAllocationInfo() and check if
- VmaAllocationInfo::deviceMemory is not `VK_NULL_HANDLE`.
+/// Statistics returned for defragmentation process in function vmaEndDefragmentation().
+typedef struct VmaDefragmentationStats
+{
+ /// Total number of bytes that have been copied while moving allocations to different places.
+ VkDeviceSize bytesMoved;
+ /// Total number of bytes that have been released to the system by freeing empty `VkDeviceMemory` objects.
+ VkDeviceSize bytesFreed;
+ /// Number of allocations that have been moved to different places.
+ uint32_t allocationsMoved;
+ /// Number of empty `VkDeviceMemory` objects that have been released to the system.
+ uint32_t deviceMemoryBlocksFreed;
+} VmaDefragmentationStats;
- For details about supporting lost allocations, see Lost Allocations
- chapter of User Guide on Main Page.
+/** @} */
- You should not use this flag together with #VMA_ALLOCATION_CREATE_MAPPED_BIT.
- */
- VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT = 0x00000008,
- /** While creating allocation using this flag, other allocations that were
- created with flag #VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT can become lost.
+/**
+\addtogroup group_virtual
+@{
+*/
- For details about supporting lost allocations, see Lost Allocations
- chapter of User Guide on Main Page.
- */
- VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT = 0x00000010,
- /** Set this flag to treat VmaAllocationCreateInfo::pUserData as pointer to a
- null-terminated string. Instead of copying pointer value, a local copy of the
- string is made and stored in allocation's `pUserData`. The string is automatically
- freed together with the allocation. It is also used in vmaBuildStatsString().
- */
- VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT = 0x00000020,
- /** Allocation will be created from upper stack in a double stack pool.
+/// Parameters of created #VmaVirtualBlock object to be passed to vmaCreateVirtualBlock().
+typedef struct VmaVirtualBlockCreateInfo
+{
+ /** \brief Total size of the virtual block.
- This flag is only allowed for custom pools created with #VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT flag.
- */
- VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT = 0x00000040,
- /** Create both buffer/image and allocation, but don't bind them together.
- It is useful when you want to bind yourself to do some more advanced binding, e.g. using some extensions.
- The flag is meaningful only with functions that bind by default: vmaCreateBuffer(), vmaCreateImage().
- Otherwise it is ignored.
+ Sizes can be expressed in bytes or any units you want as long as you are consistent in using them.
+ For example, if you allocate from some array of structures, 1 can mean single instance of entire structure.
*/
- VMA_ALLOCATION_CREATE_DONT_BIND_BIT = 0x00000080,
- /** Create allocation only if additional device memory required for it, if any, won't exceed
- memory budget. Otherwise return `VK_ERROR_OUT_OF_DEVICE_MEMORY`.
- */
- VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT = 0x00000100,
+ VkDeviceSize size;
- /** Allocation strategy that chooses smallest possible free range for the
- allocation.
+ /** \brief Use combination of #VmaVirtualBlockCreateFlagBits.
*/
- VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT = 0x00010000,
- /** Allocation strategy that chooses biggest possible free range for the
- allocation.
- */
- VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT = 0x00020000,
- /** Allocation strategy that chooses first suitable free range for the
- allocation.
+ VmaVirtualBlockCreateFlags flags;
+
+ /** \brief Custom CPU memory allocation callbacks. Optional.
- "First" doesn't necessarily means the one with smallest offset in memory,
- but rather the one that is easiest and fastest to find.
+ Optional, can be null. When specified, they will be used for all CPU-side memory allocations.
*/
- VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT = 0x00040000,
+ const VkAllocationCallbacks* VMA_NULLABLE pAllocationCallbacks;
+} VmaVirtualBlockCreateInfo;
+
+/// Parameters of created virtual allocation to be passed to vmaVirtualAllocate().
+typedef struct VmaVirtualAllocationCreateInfo
+{
+ /** \brief Size of the allocation.
- /** Allocation strategy that tries to minimize memory usage.
+ Cannot be zero.
*/
- VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT = VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT,
- /** Allocation strategy that tries to minimize allocation time.
+ VkDeviceSize size;
+ /** \brief Required alignment of the allocation. Optional.
+
+ Must be power of two. Special value 0 has the same meaning as 1 - means no special alignment is required, so allocation can start at any offset.
*/
- VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT = VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT,
- /** Allocation strategy that tries to minimize memory fragmentation.
+ VkDeviceSize alignment;
+ /** \brief Use combination of #VmaVirtualAllocationCreateFlagBits.
*/
- VMA_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT = VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT,
+ VmaVirtualAllocationCreateFlags flags;
+ /** \brief Custom pointer to be associated with the allocation. Optional.
- /** A bit mask to extract only `STRATEGY` bits from entire set of flags.
+ It can be any value and can be used for user-defined purposes. It can be fetched or changed later.
*/
- VMA_ALLOCATION_CREATE_STRATEGY_MASK =
- VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT |
- VMA_ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT |
- VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT,
-
- VMA_ALLOCATION_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
-} VmaAllocationCreateFlagBits;
-typedef VkFlags VmaAllocationCreateFlags;
+ void* VMA_NULLABLE pUserData;
+} VmaVirtualAllocationCreateInfo;
-typedef struct VmaAllocationCreateInfo
+/// Parameters of an existing virtual allocation, returned by vmaGetVirtualAllocationInfo().
+typedef struct VmaVirtualAllocationInfo
{
- /// Use #VmaAllocationCreateFlagBits enum.
- VmaAllocationCreateFlags flags;
- /** \brief Intended usage of memory.
-
- You can leave #VMA_MEMORY_USAGE_UNKNOWN if you specify memory requirements in other way. \n
- If `pool` is not null, this member is ignored.
+ /** \brief Offset of the allocation.
+
+ Offset at which the allocation was made.
*/
- VmaMemoryUsage usage;
- /** \brief Flags that must be set in a Memory Type chosen for an allocation.
-
- Leave 0 if you specify memory requirements in other way. \n
- If `pool` is not null, this member is ignored.*/
- VkMemoryPropertyFlags requiredFlags;
- /** \brief Flags that preferably should be set in a memory type chosen for an allocation.
-
- Set to 0 if no additional flags are prefered. \n
- If `pool` is not null, this member is ignored. */
- VkMemoryPropertyFlags preferredFlags;
- /** \brief Bitmask containing one bit set for every memory type acceptable for this allocation.
+ VkDeviceSize offset;
+ /** \brief Size of the allocation.
- Value 0 is equivalent to `UINT32_MAX` - it means any memory type is accepted if
- it meets other requirements specified by this structure, with no further
- restrictions on memory type index. \n
- If `pool` is not null, this member is ignored.
+ Same value as passed in VmaVirtualAllocationCreateInfo::size.
*/
- uint32_t memoryTypeBits;
- /** \brief Pool that this allocation should be created in.
+ VkDeviceSize size;
+ /** \brief Custom pointer associated with the allocation.
- Leave `VK_NULL_HANDLE` to allocate from default pool. If not null, members:
- `usage`, `requiredFlags`, `preferredFlags`, `memoryTypeBits` are ignored.
- */
- VmaPool pool;
- /** \brief Custom general-purpose pointer that will be stored in #VmaAllocation, can be read as VmaAllocationInfo::pUserData and changed using vmaSetAllocationUserData().
-
- If #VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT is used, it must be either
- null or pointer to a null-terminated string. The string will be then copied to
- internal buffer, so it doesn't need to be valid after allocation call.
+ Same value as passed in VmaVirtualAllocationCreateInfo::pUserData or to vmaSetVirtualAllocationUserData().
*/
- void* pUserData;
-} VmaAllocationCreateInfo;
+ void* VMA_NULLABLE pUserData;
+} VmaVirtualAllocationInfo;
-/**
-\brief Helps to find memoryTypeIndex, given memoryTypeBits and VmaAllocationCreateInfo.
+/** @} */
-This algorithm tries to find a memory type that:
+#endif // _VMA_DATA_TYPES_DECLARATIONS
-- Is allowed by memoryTypeBits.
-- Contains all the flags from pAllocationCreateInfo->requiredFlags.
-- Matches intended usage.
-- Has as many flags from pAllocationCreateInfo->preferredFlags as possible.
+#ifndef _VMA_FUNCTION_HEADERS
-\return Returns VK_ERROR_FEATURE_NOT_PRESENT if not found. Receiving such result
-from this function or any other allocating function probably means that your
-device doesn't support any memory type with requested features for the specific
-type of resource you want to use it for. Please check parameters of your
-resource, like image layout (OPTIMAL versus LINEAR) or mip level count.
+/**
+\addtogroup group_init
+@{
*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaFindMemoryTypeIndex(
- VmaAllocator allocator,
- uint32_t memoryTypeBits,
- const VmaAllocationCreateInfo* pAllocationCreateInfo,
- uint32_t* pMemoryTypeIndex);
-/**
-\brief Helps to find memoryTypeIndex, given VkBufferCreateInfo and VmaAllocationCreateInfo.
+/// Creates #VmaAllocator object.
+VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateAllocator(
+ const VmaAllocatorCreateInfo* VMA_NOT_NULL pCreateInfo,
+ VmaAllocator VMA_NULLABLE* VMA_NOT_NULL pAllocator);
-It can be useful e.g. to determine value to be used as VmaPoolCreateInfo::memoryTypeIndex.
-It internally creates a temporary, dummy buffer that never has memory bound.
-It is just a convenience function, equivalent to calling:
+/// Destroys allocator object.
+VMA_CALL_PRE void VMA_CALL_POST vmaDestroyAllocator(
+ VmaAllocator VMA_NULLABLE allocator);
+
+/** \brief Returns information about existing #VmaAllocator object - handle to Vulkan device etc.
-- `vkCreateBuffer`
-- `vkGetBufferMemoryRequirements`
-- `vmaFindMemoryTypeIndex`
-- `vkDestroyBuffer`
+It might be useful if you want to keep just the #VmaAllocator handle and fetch other required handles to
+`VkPhysicalDevice`, `VkDevice` etc. every time using this function.
*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaFindMemoryTypeIndexForBufferInfo(
- VmaAllocator allocator,
- const VkBufferCreateInfo* pBufferCreateInfo,
- const VmaAllocationCreateInfo* pAllocationCreateInfo,
- uint32_t* pMemoryTypeIndex);
+VMA_CALL_PRE void VMA_CALL_POST vmaGetAllocatorInfo(
+ VmaAllocator VMA_NOT_NULL allocator,
+ VmaAllocatorInfo* VMA_NOT_NULL pAllocatorInfo);
/**
-\brief Helps to find memoryTypeIndex, given VkImageCreateInfo and VmaAllocationCreateInfo.
-
-It can be useful e.g. to determine value to be used as VmaPoolCreateInfo::memoryTypeIndex.
-It internally creates a temporary, dummy image that never has memory bound.
-It is just a convenience function, equivalent to calling:
-
-- `vkCreateImage`
-- `vkGetImageMemoryRequirements`
-- `vmaFindMemoryTypeIndex`
-- `vkDestroyImage`
+PhysicalDeviceProperties are fetched from physicalDevice by the allocator.
+You can access it here, without fetching it again on your own.
*/
-VMA_CALL_PRE VkResult VMA_CALL_POST vmaFindMemoryTypeIndexForImageInfo(
- VmaAllocator allocator,
- const VkImageCreateInfo* pImageCreateInfo,
- const VmaAllocationCreateInfo* pAllocationCreateInfo,
- uint32_t* pMemoryTypeIndex);
+VMA_CALL_PRE void VMA_CALL_POST vmaGetPhysicalDeviceProperties(
+ VmaAllocator VMA_NOT_NULL allocator,
+ const VkPhysicalDeviceProperties* VMA_NULLABLE* VMA_NOT_NULL ppPhysicalDeviceProperties);
-/// Flags to be passed as VmaPoolCreateInfo::flags.
-typedef enum VmaPoolCreateFlagBits {
- /** \brief Use this flag if you always allocate only buffers and linear images or only optimal images out of this pool and so Buffer-Image Granularity can be ignored.
+/**
+PhysicalDeviceMemoryProperties are fetched from physicalDevice by the allocator.
+You can access it here, without fetching it again on your own.
+*/
+VMA_CALL_PRE void VMA_CALL_POST vmaGetMemoryProperties(
+ VmaAllocator VMA_NOT_NULL allocator,
+ const VkPhysicalDeviceMemoryProperties* VMA_NULLABLE* VMA_NOT_NULL ppPhysicalDeviceMemoryProperties);
- This is an optional optimization flag.
+/**
+\brief Given Memory Type Index, returns Property Flags of this memory type.
- If you always allocate using vmaCreateBuffer(), vmaCreateImage(),
- vmaAllocateMemoryForBuffer(), then you don't need to use it because allocator
- knows exact type of your allocations so it can handle Buffer-Image Granularity
- in the optimal way.
+This is just a convenience function. Same information can be obtained using
+vmaGetMemoryProperties().
+*/
+VMA_CALL_PRE void VMA_CALL_POST vmaGetMemoryTypeProperties(
+ VmaAllocator VMA_NOT_NULL allocator,
+ uint32_t memoryTypeIndex,
+ VkMemoryPropertyFlags* VMA_NOT_NULL pFlags);
- If you also allocate using vmaAllocateMemoryForImage() or vmaAllocateMemory(),
- exact type of such allocations is not known, so allocator must be conservative
- in handling Buffer-Image Granularity, which can lead to suboptimal allocation
- (wasted memory). In that case, if you can make sure you always allocate only
- buffers and linear images or only optimal images out of this pool, use this flag
- to make allocator disregard Buffer-Image Granularity and so make allocations
- faster and more optimal.
- */
- VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT = 0x00000002,
+/** \brief Sets index of the current frame.
+*/
+VMA_CALL_PRE void VMA_CALL_POST vmaSetCurrentFrameIndex(
+ VmaAllocator VMA_NOT_NULL allocator,
+ uint32_t frameIndex);
- /** \brief Enables alternative, linear allocation algorithm in this pool.
+/** @} */
- Specify this flag to enable linear allocation algorithm, which always creates
- new allocations after last one and doesn't reuse space from allocations freed in
- between. It trades memory consumption for simplified algorithm and data
- structure, which has better performance and uses less memory for metadata.
+/**
+\addtogroup group_stats
+@{
+*/
- By using this flag, you can achieve behavior of free-at-once, stack,
- ring buffer, and double stack. For details, see documentation chapter
- \ref linear_algorithm.
+/** \brief Retrieves statistics from current state of the Allocator.
- When using this flag, you must specify VmaPoolCreateInfo::maxBlockCount == 1 (or 0 for default).
+This function is called "calculate" not "get" because it has to traverse all
+internal data structures, so it may be quite slow. Use it for debugging purposes.
+For faster but more brief statistics suitable to be called every frame or every allocation,
+use vmaGetHeapBudgets().