VulkanMemoryAllocator 0.3.7 → 0.3.7.1
raw patch · 6 files changed
+168/−36 lines, 6 filesdep ~basesetup-changedPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- VulkanMemoryAllocator: instance GHC.Generics.Generic VulkanMemoryAllocator.AllocationCreateInfo
- VulkanMemoryAllocator: instance GHC.Generics.Generic VulkanMemoryAllocator.AllocationInfo
- VulkanMemoryAllocator: instance GHC.Generics.Generic VulkanMemoryAllocator.AllocatorCreateInfo
- VulkanMemoryAllocator: instance GHC.Generics.Generic VulkanMemoryAllocator.AllocatorInfo
- VulkanMemoryAllocator: instance GHC.Generics.Generic VulkanMemoryAllocator.Budget
- VulkanMemoryAllocator: instance GHC.Generics.Generic VulkanMemoryAllocator.DefragmentationInfo
- VulkanMemoryAllocator: instance GHC.Generics.Generic VulkanMemoryAllocator.DefragmentationInfo2
- VulkanMemoryAllocator: instance GHC.Generics.Generic VulkanMemoryAllocator.DefragmentationPassInfo
- VulkanMemoryAllocator: instance GHC.Generics.Generic VulkanMemoryAllocator.DefragmentationPassMoveInfo
- VulkanMemoryAllocator: instance GHC.Generics.Generic VulkanMemoryAllocator.DefragmentationStats
- VulkanMemoryAllocator: instance GHC.Generics.Generic VulkanMemoryAllocator.DeviceMemoryCallbacks
- VulkanMemoryAllocator: instance GHC.Generics.Generic VulkanMemoryAllocator.PoolCreateInfo
- VulkanMemoryAllocator: instance GHC.Generics.Generic VulkanMemoryAllocator.PoolStats
- VulkanMemoryAllocator: instance GHC.Generics.Generic VulkanMemoryAllocator.RecordSettings
- VulkanMemoryAllocator: instance GHC.Generics.Generic VulkanMemoryAllocator.StatInfo
- VulkanMemoryAllocator: instance GHC.Generics.Generic VulkanMemoryAllocator.Stats
- VulkanMemoryAllocator: instance GHC.Generics.Generic VulkanMemoryAllocator.VulkanFunctions
Files
- Setup.hs +2/−0
- VulkanMemoryAllocator.cabal +4/−3
- VulkanMemoryAllocator/src/vk_mem_alloc.h +41/−28
- changelog.md +5/−0
- package.yaml +110/−0
- src/VulkanMemoryAllocator.hs +6/−5
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
VulkanMemoryAllocator.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 2409855eee8a648b340f898fbd9f82497d17fa8bc8ca23028fa87888eff1848d+-- hash: bc2600808d2a3ef448255465e2fc5e1165aa7f40e9cb43ec1ab15ec0f8cce272 name: VulkanMemoryAllocator-version: 0.3.7+version: 0.3.7.1 synopsis: Bindings to the VulkanMemoryAllocator library category: Graphics homepage: https://github.com/expipiplus1/vulkan#readme@@ -19,6 +19,7 @@ extra-source-files: readme.md changelog.md+ package.yaml VulkanMemoryAllocator/src/vk_mem_alloc.h source-repository head@@ -60,7 +61,7 @@ extra-libraries: stdc++ build-depends:- base <4.15+ base <5 , bytestring , transformers , vector
VulkanMemoryAllocator/src/vk_mem_alloc.h view
@@ -1749,7 +1749,7 @@ 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 +behavior is implementation-dependent - it depends on GPU vendor and graphics driver. On AMD cards it can be controlled while creating Vulkan device object by using @@ -2000,16 +2000,6 @@ */ -#if VMA_RECORDING_ENABLED - #include <chrono> - #if defined(_WIN32) - #include <windows.h> - #else - #include <sstream> - #include <thread> - #endif -#endif - #ifdef __cplusplus extern "C" { #endif @@ -2022,7 +2012,7 @@ #define VMA_RECORDING_ENABLED 0 #endif -#ifndef NOMINMAX +#if !defined(NOMINMAX) && defined(VMA_IMPLEMENTATION) #define NOMINMAX // For windows.h #endif @@ -2298,10 +2288,10 @@ 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`. + 2. Found as available and enabled device feature `VkPhysicalDeviceBufferDeviceAddressFeatures::bufferDeviceAddress`. - 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 + 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. For more information, see documentation chapter \ref enabling_buffer_device_address. @@ -2859,7 +2849,7 @@ 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 + 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. @@ -3329,7 +3319,7 @@ /** \brief Returns current information about specified allocation and atomically marks it as used in current frame. -Current paramters of given allocation are returned in `pAllocationInfo`. +Current paramteres of given allocation are returned in `pAllocationInfo`. This function also atomically "touches" allocation - marks it as used in current frame, just like vmaTouchAllocation(). @@ -3966,6 +3956,16 @@ #include <cstring> #include <utility> +#if VMA_RECORDING_ENABLED + #include <chrono> + #if defined(_WIN32) + #include <windows.h> + #else + #include <sstream> + #include <thread> + #endif +#endif + /******************************************************************************* CONFIGURATION SECTION @@ -4057,7 +4057,7 @@ #if defined(__ANDROID_API__) && (__ANDROID_API__ < 16) #include <cstdlib> -void *vma_aligned_alloc(size_t alignment, size_t size) +static void* vma_aligned_alloc(size_t alignment, size_t size) { // alignment must be >= sizeof(void*) if(alignment < sizeof(void*)) @@ -4074,7 +4074,7 @@ #include <AvailabilityMacros.h> #endif -void *vma_aligned_alloc(size_t alignment, size_t size) +static void* vma_aligned_alloc(size_t alignment, size_t size) { #if defined(__APPLE__) && (defined(MAC_OS_X_VERSION_10_16) || defined(__IPHONE_14_0)) #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_16 || __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0 @@ -4100,17 +4100,29 @@ return VMA_NULL; } #elif defined(_WIN32) -void *vma_aligned_alloc(size_t alignment, size_t size) +static void* vma_aligned_alloc(size_t alignment, size_t size) { return _aligned_malloc(size, alignment); } #else -void *vma_aligned_alloc(size_t alignment, size_t size) +static void* vma_aligned_alloc(size_t alignment, size_t size) { return aligned_alloc(alignment, size); } #endif +#if defined(_WIN32) +static void vma_aligned_free(void* ptr) +{ + _aligned_free(ptr); +} +#else +static void vma_aligned_free(void* ptr) +{ + free(ptr); +} +#endif + // If your compiler is not compatible with C++11 and definition of // aligned_alloc() function is missing, uncommeting following line may help: @@ -4143,12 +4155,13 @@ #define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment) vma_aligned_alloc((alignment), (size)) #endif -#ifndef VMA_SYSTEM_FREE - #if defined(_WIN32) - #define VMA_SYSTEM_FREE(ptr) _aligned_free(ptr) +#ifndef VMA_SYSTEM_ALIGNED_FREE + // VMA_SYSTEM_FREE is the old name, but might have been defined by the user + #if defined(VMA_SYSTEM_FREE) + #define VMA_SYSTEM_ALIGNED_FREE(ptr) VMA_SYSTEM_FREE(ptr) #else - #define VMA_SYSTEM_FREE(ptr) free(ptr) - #endif + #define VMA_SYSTEM_ALIGNED_FREE(ptr) vma_aligned_free(ptr) + #endif #endif #ifndef VMA_MIN @@ -4799,7 +4812,7 @@ } else { - VMA_SYSTEM_FREE(ptr); + VMA_SYSTEM_ALIGNED_FREE(ptr); } } @@ -13763,7 +13776,7 @@ { VmaMutexLockWrite lock(m_Mutex, m_hAllocator->m_UseMutex); - const uint32_t moveCount = std::min(uint32_t(pCtx->defragmentationMoves.size()) - pCtx->defragmentationMovesProcessed, maxMoves); + const uint32_t moveCount = VMA_MIN(uint32_t(pCtx->defragmentationMoves.size()) - pCtx->defragmentationMovesProcessed, maxMoves); for(uint32_t i = 0; i < moveCount; ++ i) {
changelog.md view
@@ -2,6 +2,11 @@ ## WIP +## [0.3.7.1] - 2020-11-01++- Bump VMA, just documentation changes+- Raise bound on base+ ## [0.3.7] - 2020-08-27 - Bugfix https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/issues/143 - Documentation changes
+ package.yaml view
@@ -0,0 +1,110 @@+name: VulkanMemoryAllocator+version: "0.3.7.1"+synopsis: Bindings to the VulkanMemoryAllocator library+category: Graphics+maintainer: Joe Hermaszewski <live.long.and.prosper@monoid.al>+github: expipiplus1/vulkan+extra-source-files:+ - readme.md+ - changelog.md+ - package.yaml+ - VulkanMemoryAllocator/src/vk_mem_alloc.h++library:+ source-dirs: src+ include-dirs:+ VulkanMemoryAllocator/src+ extra-libraries:+ stdc+++ cxx-sources:+ src/lib.cpp+ dependencies:+ - base <5+ - vulkan == 3.6.*+ - bytestring+ - transformers+ - vector+ when:+ - condition: flag(safe-foreign-calls)+ cpp-options: -DSAFE_FOREIGN_CALLS+ - condition: flag(vma-ndebug)+ cxx-options: -DNDEBUG+ - condition: flag(vma-recording)+ cxx-options: -DVMA_RECORDING_ENABLED+ - condition: flag(generic-instances)+ cpp-options: -DGENERIC_INSTANCES+ ghc-options:+ - -Wall+ - -Wno-unticked-promoted-constructors+ - -Wno-missing-pattern-synonym-signatures+ - -Wno-unused-imports+ - -Wno-missing-signatures+ - -Wno-partial-type-signatures+ cxx-options:+ - -std=c++11+ verbatim:+ other-modules:++flags:+ safe-foreign-calls:+ description:+ Do not mark foreign imports as 'unsafe'. This means that callbacks from+ VulkanMemoryAllocator to Haskell will work. If you are using these then+ make sure this flag is enabled.+ default: no+ manual: yes++ generic-instances:+ description:+ Derive Generic instances for all structs. Disabled by default because of+ code size and compile time impact.+ default: no+ manual: yes++ vma-ndebug:+ description:+ Compile VulkanMemoryAllocator with NDEBUG to disable assertions.+ default: no+ manual: yes++ vma-recording:+ description:+ Compile VulkanMemoryAllocator with VMA_RECORDING_ENABLED to enable+ recording functionality.+ default: no+ manual: yes++default-extensions:+ - AllowAmbiguousTypes+ - CPP+ - DataKinds+ - DefaultSignatures+ - DeriveAnyClass+ - DeriveGeneric+ - DerivingStrategies+ - DuplicateRecordFields+ - FlexibleContexts+ - FlexibleInstances+ - GADTs+ - GeneralizedNewtypeDeriving+ - InstanceSigs+ - LambdaCase+ - MagicHash+ - NoMonomorphismRestriction+ - OverloadedStrings+ - PartialTypeSignatures+ - PatternSynonyms+ - PolyKinds+ - QuantifiedConstraints+ - RankNTypes+ - RecordWildCards+ - RoleAnnotations+ - ScopedTypeVariables+ - StandaloneDeriving+ - Strict+ - TypeApplications+ - TypeFamilyDependencies+ - TypeOperators+ - TypeSynonymInstances+ - UndecidableInstances+ - ViewPatterns
src/VulkanMemoryAllocator.hs view
@@ -1228,7 +1228,8 @@ -- | Returns current information about specified allocation and atomically -- marks it as used in current frame. ----- Current paramters of given allocation are returned in @pAllocationInfo@.+-- Current paramteres of given allocation are returned in+-- @pAllocationInfo@. -- -- This function also atomically \"touches\" allocation - marks it as used -- in current frame, just like 'touchAllocation'. If the allocation is in@@ -2679,11 +2680,11 @@ -- to core Vulkan 1.2. -- -- 2. Found as available and enabled device feature--- @VkPhysicalDeviceBufferDeviceAddressFeatures*::bufferDeviceAddress@.+-- @VkPhysicalDeviceBufferDeviceAddressFeatures::bufferDeviceAddress@. -- -- 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+-- @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. -- -- For more information, see documentation chapter /Enabling buffer device@@ -3741,7 +3742,7 @@ , -- | Flags that preferably should be set in a memory type chosen for an -- allocation. --- -- Set to 0 if no additional flags are prefered. If @pool@ is not null,+ -- Set to 0 if no additional flags are preferred. If @pool@ is not null, -- this member is ignored. preferredFlags :: MemoryPropertyFlags , -- | Bitmask containing one bit set for every memory type acceptable for this