VulkanMemoryAllocator 0.3.11 → 0.3.12
raw patch · 5 files changed
+79/−81 lines, 5 filesdep ~vulkanPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: vulkan
API changes (from Hackage documentation)
Files
- VulkanMemoryAllocator.cabal +3/−3
- VulkanMemoryAllocator/src/vk_mem_alloc.h +2/−2
- changelog.md +7/−0
- package.yaml +2/−2
- src/VulkanMemoryAllocator.hs +65/−74
VulkanMemoryAllocator.cabal view
@@ -1,11 +1,11 @@ cabal-version: 2.2 --- This file has been generated from package.yaml by hpack version 0.34.2.+-- This file has been generated from package.yaml by hpack version 0.34.3. -- -- see: https://github.com/sol/hpack name: VulkanMemoryAllocator-version: 0.3.11+version: 0.3.12 synopsis: Bindings to the VulkanMemoryAllocator library category: Graphics homepage: https://github.com/expipiplus1/vulkan#readme@@ -63,7 +63,7 @@ , bytestring , transformers , vector- , vulkan >=3.6 && <3.9+ , vulkan >=3.6 && <3.10 if flag(safe-foreign-calls) cpp-options: -DSAFE_FOREIGN_CALLS if flag(vma-ndebug)
VulkanMemoryAllocator/src/vk_mem_alloc.h view
@@ -15602,9 +15602,9 @@ // There is room for optimization since sstream is quite slow. // Is there a better way to convert std::this_thread::get_id() to uint32_t? std::thread::id thread_id = std::this_thread::get_id(); - stringstream thread_id_to_string_converter; + std::stringstream thread_id_to_string_converter; thread_id_to_string_converter << thread_id; - string thread_id_as_string = thread_id_to_string_converter.str(); + std::string thread_id_as_string = thread_id_to_string_converter.str(); outParams.threadId = static_cast<uint32_t>(std::stoi(thread_id_as_string.c_str())); #endif
changelog.md view
@@ -2,6 +2,13 @@ ## WIP +## [0.3.12] - 2021-01-09++- Calling traceEventIO before and after every VulkanMemoryAllocator command if+ `vulkan` was compiled with the `trace-calls` flag+- Don't bother poking empty vectors in `withZeroCStruct`+- Bump VMA, fixes compilation issue when vma-recording is enabled.+ ## [0.3.11] - 2020-11-30 - Raise upper bound on `vulkan`
package.yaml view
@@ -1,5 +1,5 @@ name: VulkanMemoryAllocator-version: "0.3.11"+version: "0.3.12" synopsis: Bindings to the VulkanMemoryAllocator library category: Graphics maintainer: Joe Hermaszewski <live.long.and.prosper@monoid.al>@@ -20,7 +20,7 @@ src/lib.cpp dependencies: - base <5- - vulkan >= 3.6 && < 3.9+ - vulkan >= 3.6 && < 3.10 - bytestring - transformers - vector
src/VulkanMemoryAllocator.hs view
@@ -174,6 +174,7 @@ import Vulkan.CStruct.Utils (FixedArray) import Vulkan.Internal.Utils (enumReadPrec) import Vulkan.Internal.Utils (enumShowsPrec)+import Vulkan.Internal.Utils (traceAroundEvent) import Vulkan.CStruct.Extends (forgetExtensions) import Vulkan.CStruct.Utils (advancePtrBytes) import Vulkan.CStruct.Utils (lowerArrayPtr)@@ -196,6 +197,7 @@ import Numeric (showHex) import Data.ByteString (packCString) import Data.ByteString (useAsCString)+import Data.Coerce (coerce) import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.Cont (evalContT) import Data.Vector (generateM)@@ -232,6 +234,7 @@ import Data.Typeable (Typeable) import Foreign.C.Types (CChar) import Foreign.C.Types (CSize)+import Foreign.C.Types (CSize(..)) import Foreign.C.Types (CSize(CSize)) import Foreign.Storable (Storable) import Foreign.Storable (Storable(peek))@@ -268,7 +271,7 @@ createAllocator createInfo = liftIO . evalContT $ do pCreateInfo <- ContT $ withCStruct (createInfo) pPAllocator <- ContT $ bracket (callocBytes @Allocator 8) free- r <- lift $ (ffiVmaCreateAllocator) pCreateInfo (pPAllocator)+ r <- lift $ traceAroundEvent "vmaCreateAllocator" ((ffiVmaCreateAllocator) pCreateInfo (pPAllocator)) lift $ when (r < SUCCESS) (throwIO (VulkanException r)) pAllocator <- lift $ peek @Allocator pPAllocator pure $ (pAllocator)@@ -301,7 +304,7 @@ Allocator -> io () destroyAllocator allocator = liftIO $ do- (ffiVmaDestroyAllocator) (allocator)+ traceAroundEvent "vmaDestroyAllocator" ((ffiVmaDestroyAllocator) (allocator)) pure $ () @@ -325,7 +328,7 @@ -> io (AllocatorInfo) getAllocatorInfo allocator = liftIO . evalContT $ do pPAllocatorInfo <- ContT (withZeroCStruct @AllocatorInfo)- lift $ (ffiVmaGetAllocatorInfo) (allocator) (pPAllocatorInfo)+ lift $ traceAroundEvent "vmaGetAllocatorInfo" ((ffiVmaGetAllocatorInfo) (allocator) (pPAllocatorInfo)) pAllocatorInfo <- lift $ peekCStruct @AllocatorInfo pPAllocatorInfo pure $ (pAllocatorInfo) @@ -347,7 +350,7 @@ -> io (Ptr PhysicalDeviceProperties) getPhysicalDeviceProperties allocator = liftIO . evalContT $ do pPpPhysicalDeviceProperties <- ContT $ bracket (callocBytes @(Ptr PhysicalDeviceProperties) 8) free- lift $ (ffiVmaGetPhysicalDeviceProperties) (allocator) (pPpPhysicalDeviceProperties)+ lift $ traceAroundEvent "vmaGetPhysicalDeviceProperties" ((ffiVmaGetPhysicalDeviceProperties) (allocator) (pPpPhysicalDeviceProperties)) ppPhysicalDeviceProperties <- lift $ peek @(Ptr PhysicalDeviceProperties) pPpPhysicalDeviceProperties pure $ (ppPhysicalDeviceProperties) @@ -369,7 +372,7 @@ -> io (Ptr PhysicalDeviceMemoryProperties) getMemoryProperties allocator = liftIO . evalContT $ do pPpPhysicalDeviceMemoryProperties <- ContT $ bracket (callocBytes @(Ptr PhysicalDeviceMemoryProperties) 8) free- lift $ (ffiVmaGetMemoryProperties) (allocator) (pPpPhysicalDeviceMemoryProperties)+ lift $ traceAroundEvent "vmaGetMemoryProperties" ((ffiVmaGetMemoryProperties) (allocator) (pPpPhysicalDeviceMemoryProperties)) ppPhysicalDeviceMemoryProperties <- lift $ peek @(Ptr PhysicalDeviceMemoryProperties) pPpPhysicalDeviceMemoryProperties pure $ (ppPhysicalDeviceMemoryProperties) @@ -394,7 +397,7 @@ -> io (MemoryPropertyFlags) getMemoryTypeProperties allocator memoryTypeIndex = liftIO . evalContT $ do pPFlags <- ContT $ bracket (callocBytes @MemoryPropertyFlags 4) free- lift $ (ffiVmaGetMemoryTypeProperties) (allocator) (memoryTypeIndex) (pPFlags)+ lift $ traceAroundEvent "vmaGetMemoryTypeProperties" ((ffiVmaGetMemoryTypeProperties) (allocator) (memoryTypeIndex) (pPFlags)) pFlags <- lift $ peek @MemoryPropertyFlags pPFlags pure $ (pFlags) @@ -421,7 +424,7 @@ ("frameIndex" ::: Word32) -> io () setCurrentFrameIndex allocator frameIndex = liftIO $ do- (ffiVmaSetCurrentFrameIndex) (allocator) (frameIndex)+ traceAroundEvent "vmaSetCurrentFrameIndex" ((ffiVmaSetCurrentFrameIndex) (allocator) (frameIndex)) pure $ () @@ -448,7 +451,7 @@ -> io (Stats) calculateStats allocator = liftIO . evalContT $ do pPStats <- ContT (withZeroCStruct @Stats)- lift $ (ffiVmaCalculateStats) (allocator) (pPStats)+ lift $ traceAroundEvent "vmaCalculateStats" ((ffiVmaCalculateStats) (allocator) (pPStats)) pStats <- lift $ peekCStruct @Stats pPStats pure $ (pStats) @@ -484,7 +487,7 @@ getBudget allocator = liftIO . evalContT $ do pPBudget <- ContT $ bracket (callocBytes @Budget ((MAX_MEMORY_HEAPS) * 32)) free _ <- traverse (\i -> ContT $ pokeZeroCStruct (pPBudget `advancePtrBytes` (i * 32) :: Ptr Budget) . ($ ())) [0..(MAX_MEMORY_HEAPS) - 1]- lift $ (ffiVmaGetBudget) (allocator) ((pPBudget))+ lift $ traceAroundEvent "vmaGetBudget" ((ffiVmaGetBudget) (allocator) ((pPBudget))) pBudget <- lift $ generateM (MAX_MEMORY_HEAPS) (\i -> peekCStruct @Budget (((pPBudget) `advancePtrBytes` (32 * (i)) :: Ptr Budget))) pure $ (pBudget) @@ -513,7 +516,7 @@ -> io (("statsString" ::: Ptr CChar)) buildStatsString allocator detailedMap = liftIO . evalContT $ do pPpStatsString <- ContT $ bracket (callocBytes @(Ptr CChar) 8) free- lift $ (ffiVmaBuildStatsString) (allocator) (pPpStatsString) (boolToBool32 (detailedMap))+ lift $ traceAroundEvent "vmaBuildStatsString" ((ffiVmaBuildStatsString) (allocator) (pPpStatsString) (boolToBool32 (detailedMap))) ppStatsString <- lift $ peek @(Ptr CChar) pPpStatsString pure $ (ppStatsString) @@ -534,7 +537,7 @@ ("statsString" ::: Ptr CChar) -> io () freeStatsString allocator statsString = liftIO $ do- (ffiVmaFreeStatsString) (allocator) (statsString)+ traceAroundEvent "vmaFreeStatsString" ((ffiVmaFreeStatsString) (allocator) (statsString)) pure $ () @@ -579,7 +582,7 @@ findMemoryTypeIndex allocator memoryTypeBits allocationCreateInfo = liftIO . evalContT $ do pAllocationCreateInfo <- ContT $ withCStruct (allocationCreateInfo) pPMemoryTypeIndex <- ContT $ bracket (callocBytes @Word32 4) free- r <- lift $ (ffiVmaFindMemoryTypeIndex) (allocator) (memoryTypeBits) pAllocationCreateInfo (pPMemoryTypeIndex)+ r <- lift $ traceAroundEvent "vmaFindMemoryTypeIndex" ((ffiVmaFindMemoryTypeIndex) (allocator) (memoryTypeBits) pAllocationCreateInfo (pPMemoryTypeIndex)) lift $ when (r < SUCCESS) (throwIO (VulkanException r)) pMemoryTypeIndex <- lift $ peek @Word32 pPMemoryTypeIndex pure $ (pMemoryTypeIndex)@@ -620,7 +623,7 @@ pBufferCreateInfo <- ContT $ withCStruct (bufferCreateInfo) pAllocationCreateInfo <- ContT $ withCStruct (allocationCreateInfo) pPMemoryTypeIndex <- ContT $ bracket (callocBytes @Word32 4) free- r <- lift $ (ffiVmaFindMemoryTypeIndexForBufferInfo) (allocator) (forgetExtensions pBufferCreateInfo) pAllocationCreateInfo (pPMemoryTypeIndex)+ r <- lift $ traceAroundEvent "vmaFindMemoryTypeIndexForBufferInfo" ((ffiVmaFindMemoryTypeIndexForBufferInfo) (allocator) (forgetExtensions pBufferCreateInfo) pAllocationCreateInfo (pPMemoryTypeIndex)) lift $ when (r < SUCCESS) (throwIO (VulkanException r)) pMemoryTypeIndex <- lift $ peek @Word32 pPMemoryTypeIndex pure $ (pMemoryTypeIndex)@@ -661,7 +664,7 @@ pImageCreateInfo <- ContT $ withCStruct (imageCreateInfo) pAllocationCreateInfo <- ContT $ withCStruct (allocationCreateInfo) pPMemoryTypeIndex <- ContT $ bracket (callocBytes @Word32 4) free- r <- lift $ (ffiVmaFindMemoryTypeIndexForImageInfo) (allocator) (forgetExtensions pImageCreateInfo) pAllocationCreateInfo (pPMemoryTypeIndex)+ r <- lift $ traceAroundEvent "vmaFindMemoryTypeIndexForImageInfo" ((ffiVmaFindMemoryTypeIndexForImageInfo) (allocator) (forgetExtensions pImageCreateInfo) pAllocationCreateInfo (pPMemoryTypeIndex)) lift $ when (r < SUCCESS) (throwIO (VulkanException r)) pMemoryTypeIndex <- lift $ peek @Word32 pPMemoryTypeIndex pure $ (pMemoryTypeIndex)@@ -695,7 +698,7 @@ createPool allocator createInfo = liftIO . evalContT $ do pCreateInfo <- ContT $ withCStruct (createInfo) pPPool <- ContT $ bracket (callocBytes @Pool 8) free- r <- lift $ (ffiVmaCreatePool) (allocator) pCreateInfo (pPPool)+ r <- lift $ traceAroundEvent "vmaCreatePool" ((ffiVmaCreatePool) (allocator) pCreateInfo (pPPool)) lift $ when (r < SUCCESS) (throwIO (VulkanException r)) pPool <- lift $ peek @Pool pPPool pure $ (pPool)@@ -730,7 +733,7 @@ Pool -> io () destroyPool allocator pool = liftIO $ do- (ffiVmaDestroyPool) (allocator) (pool)+ traceAroundEvent "vmaDestroyPool" ((ffiVmaDestroyPool) (allocator) (pool)) pure $ () @@ -761,7 +764,7 @@ -> io (PoolStats) getPoolStats allocator pool = liftIO . evalContT $ do pPPoolStats <- ContT (withZeroCStruct @PoolStats)- lift $ (ffiVmaGetPoolStats) (allocator) (pool) (pPPoolStats)+ lift $ traceAroundEvent "vmaGetPoolStats" ((ffiVmaGetPoolStats) (allocator) (pool) (pPPoolStats)) pPoolStats <- lift $ peekCStruct @PoolStats pPPoolStats pure $ (pPoolStats) @@ -796,9 +799,9 @@ -> io (("lostAllocationCount" ::: Word64)) makePoolAllocationsLost allocator pool = liftIO . evalContT $ do pPLostAllocationCount <- ContT $ bracket (callocBytes @CSize 8) free- lift $ (ffiVmaMakePoolAllocationsLost) (allocator) (pool) (pPLostAllocationCount)+ lift $ traceAroundEvent "vmaMakePoolAllocationsLost" ((ffiVmaMakePoolAllocationsLost) (allocator) (pool) (pPLostAllocationCount)) pLostAllocationCount <- lift $ peek @CSize pPLostAllocationCount- pure $ (((\(CSize a) -> a) pLostAllocationCount))+ pure $ ((coerce @CSize @Word64 pLostAllocationCount)) foreign import ccall@@ -837,7 +840,7 @@ Pool -> io () checkPoolCorruption allocator pool = liftIO $ do- r <- (ffiVmaCheckPoolCorruption) (allocator) (pool)+ r <- traceAroundEvent "vmaCheckPoolCorruption" ((ffiVmaCheckPoolCorruption) (allocator) (pool)) when (r < SUCCESS) (throwIO (VulkanException r)) @@ -863,7 +866,7 @@ -> io (("name" ::: Ptr CChar)) getPoolName allocator pool = liftIO . evalContT $ do pPpName <- ContT $ bracket (callocBytes @(Ptr CChar) 8) free- lift $ (ffiVmaGetPoolName) (allocator) (pool) (pPpName)+ lift $ traceAroundEvent "vmaGetPoolName" ((ffiVmaGetPoolName) (allocator) (pool) (pPpName)) ppName <- lift $ peek @(Ptr CChar) pPpName pure $ (ppName) @@ -893,7 +896,7 @@ pName <- case (name) of Nothing -> pure nullPtr Just j -> ContT $ useAsCString (j)- lift $ (ffiVmaSetPoolName) (allocator) (pool) pName+ lift $ traceAroundEvent "vmaSetPoolName" ((ffiVmaSetPoolName) (allocator) (pool) pName) pure $ () @@ -935,7 +938,7 @@ pCreateInfo <- ContT $ withCStruct (createInfo) pPAllocation <- ContT $ bracket (callocBytes @Allocation 8) free pPAllocationInfo <- ContT (withZeroCStruct @AllocationInfo)- r <- lift $ (ffiVmaAllocateMemory) (allocator) pVkMemoryRequirements pCreateInfo (pPAllocation) (pPAllocationInfo)+ r <- lift $ traceAroundEvent "vmaAllocateMemory" ((ffiVmaAllocateMemory) (allocator) pVkMemoryRequirements pCreateInfo (pPAllocation) (pPAllocationInfo)) lift $ when (r < SUCCESS) (throwIO (VulkanException r)) pAllocation <- lift $ peek @Allocation pPAllocation pAllocationInfo <- lift $ peekCStruct @AllocationInfo pPAllocationInfo@@ -1017,7 +1020,7 @@ pPAllocations <- ContT $ bracket (callocBytes @Allocation ((fromIntegral ((fromIntegral pVkMemoryRequirementsLength :: CSize))) * 8)) free pPAllocationInfo <- ContT $ bracket (callocBytes @AllocationInfo ((fromIntegral ((fromIntegral pVkMemoryRequirementsLength :: CSize))) * 48)) free _ <- traverse (\i -> ContT $ pokeZeroCStruct (pPAllocationInfo `advancePtrBytes` (i * 48) :: Ptr AllocationInfo) . ($ ())) [0..(fromIntegral ((fromIntegral pVkMemoryRequirementsLength :: CSize))) - 1]- r <- lift $ (ffiVmaAllocateMemoryPages) (allocator) (pPVkMemoryRequirements) (pPCreateInfo) ((fromIntegral pVkMemoryRequirementsLength :: CSize)) (pPAllocations) ((pPAllocationInfo))+ r <- lift $ traceAroundEvent "vmaAllocateMemoryPages" ((ffiVmaAllocateMemoryPages) (allocator) (pPVkMemoryRequirements) (pPCreateInfo) ((fromIntegral pVkMemoryRequirementsLength :: CSize)) (pPAllocations) ((pPAllocationInfo))) lift $ when (r < SUCCESS) (throwIO (VulkanException r)) pAllocations <- lift $ generateM (fromIntegral ((fromIntegral pVkMemoryRequirementsLength :: CSize))) (\i -> peek @Allocation ((pPAllocations `advancePtrBytes` (8 * (i)) :: Ptr Allocation))) pAllocationInfo <- lift $ generateM (fromIntegral ((fromIntegral pVkMemoryRequirementsLength :: CSize))) (\i -> peekCStruct @AllocationInfo (((pPAllocationInfo) `advancePtrBytes` (48 * (i)) :: Ptr AllocationInfo)))@@ -1068,7 +1071,7 @@ pCreateInfo <- ContT $ withCStruct (createInfo) pPAllocation <- ContT $ bracket (callocBytes @Allocation 8) free pPAllocationInfo <- ContT (withZeroCStruct @AllocationInfo)- r <- lift $ (ffiVmaAllocateMemoryForBuffer) (allocator) (buffer) pCreateInfo (pPAllocation) (pPAllocationInfo)+ r <- lift $ traceAroundEvent "vmaAllocateMemoryForBuffer" ((ffiVmaAllocateMemoryForBuffer) (allocator) (buffer) pCreateInfo (pPAllocation) (pPAllocationInfo)) lift $ when (r < SUCCESS) (throwIO (VulkanException r)) pAllocation <- lift $ peek @Allocation pPAllocation pAllocationInfo <- lift $ peekCStruct @AllocationInfo pPAllocationInfo@@ -1109,7 +1112,7 @@ pCreateInfo <- ContT $ withCStruct (createInfo) pPAllocation <- ContT $ bracket (callocBytes @Allocation 8) free pPAllocationInfo <- ContT (withZeroCStruct @AllocationInfo)- r <- lift $ (ffiVmaAllocateMemoryForImage) (allocator) (image) pCreateInfo (pPAllocation) (pPAllocationInfo)+ r <- lift $ traceAroundEvent "vmaAllocateMemoryForImage" ((ffiVmaAllocateMemoryForImage) (allocator) (image) pCreateInfo (pPAllocation) (pPAllocationInfo)) lift $ when (r < SUCCESS) (throwIO (VulkanException r)) pAllocation <- lift $ peek @Allocation pPAllocation pAllocationInfo <- lift $ peekCStruct @AllocationInfo pPAllocationInfo@@ -1149,7 +1152,7 @@ Allocation -> io () freeMemory allocator allocation = liftIO $ do- (ffiVmaFreeMemory) (allocator) (allocation)+ traceAroundEvent "vmaFreeMemory" ((ffiVmaFreeMemory) (allocator) (allocation)) pure $ () @@ -1182,7 +1185,7 @@ freeMemoryPages allocator allocations = liftIO . evalContT $ do pPAllocations <- ContT $ allocaBytesAligned @Allocation ((Data.Vector.length (allocations)) * 8) 8 lift $ Data.Vector.imapM_ (\i e -> poke (pPAllocations `plusPtr` (8 * (i)) :: Ptr Allocation) (e)) (allocations)- lift $ (ffiVmaFreeMemoryPages) (allocator) ((fromIntegral (Data.Vector.length $ (allocations)) :: CSize)) (pPAllocations)+ lift $ traceAroundEvent "vmaFreeMemoryPages" ((ffiVmaFreeMemoryPages) (allocator) ((fromIntegral (Data.Vector.length $ (allocations)) :: CSize)) (pPAllocations)) pure $ () @@ -1212,7 +1215,7 @@ ("newSize" ::: DeviceSize) -> io () resizeAllocation allocator allocation newSize = liftIO $ do- r <- (ffiVmaResizeAllocation) (allocator) (allocation) (newSize)+ r <- traceAroundEvent "vmaResizeAllocation" ((ffiVmaResizeAllocation) (allocator) (allocation) (newSize)) when (r < SUCCESS) (throwIO (VulkanException r)) @@ -1252,7 +1255,7 @@ -> io (AllocationInfo) getAllocationInfo allocator allocation = liftIO . evalContT $ do pPAllocationInfo <- ContT (withZeroCStruct @AllocationInfo)- lift $ (ffiVmaGetAllocationInfo) (allocator) (allocation) (pPAllocationInfo)+ lift $ traceAroundEvent "vmaGetAllocationInfo" ((ffiVmaGetAllocationInfo) (allocator) (allocation) (pPAllocationInfo)) pAllocationInfo <- lift $ peekCStruct @AllocationInfo pPAllocationInfo pure $ (pAllocationInfo) @@ -1290,7 +1293,7 @@ Allocation -> io (Bool) touchAllocation allocator allocation = liftIO $ do- r <- (ffiVmaTouchAllocation) (allocator) (allocation)+ r <- traceAroundEvent "vmaTouchAllocation" ((ffiVmaTouchAllocation) (allocator) (allocation)) pure $ ((bool32ToBool r)) @@ -1325,7 +1328,7 @@ ("userData" ::: Ptr ()) -> io () setAllocationUserData allocator allocation userData = liftIO $ do- (ffiVmaSetAllocationUserData) (allocator) (allocation) (userData)+ traceAroundEvent "vmaSetAllocationUserData" ((ffiVmaSetAllocationUserData) (allocator) (allocation) (userData)) pure $ () @@ -1352,7 +1355,7 @@ -> io (Allocation) createLostAllocation allocator = liftIO . evalContT $ do pPAllocation <- ContT $ bracket (callocBytes @Allocation 8) free- lift $ (ffiVmaCreateLostAllocation) (allocator) (pPAllocation)+ lift $ traceAroundEvent "vmaCreateLostAllocation" ((ffiVmaCreateLostAllocation) (allocator) (pPAllocation)) pAllocation <- lift $ peek @Allocation pPAllocation pure $ (pAllocation) @@ -1426,7 +1429,7 @@ -> io (("data" ::: Ptr ())) mapMemory allocator allocation = liftIO . evalContT $ do pPpData <- ContT $ bracket (callocBytes @(Ptr ()) 8) free- r <- lift $ (ffiVmaMapMemory) (allocator) (allocation) (pPpData)+ r <- lift $ traceAroundEvent "vmaMapMemory" ((ffiVmaMapMemory) (allocator) (allocation) (pPpData)) lift $ when (r < SUCCESS) (throwIO (VulkanException r)) ppData <- lift $ peek @(Ptr ()) pPpData pure $ (ppData)@@ -1469,7 +1472,7 @@ Allocation -> io () unmapMemory allocator allocation = liftIO $ do- (ffiVmaUnmapMemory) (allocator) (allocation)+ traceAroundEvent "vmaUnmapMemory" ((ffiVmaUnmapMemory) (allocator) (allocation)) pure $ () @@ -1519,7 +1522,7 @@ DeviceSize -> io () flushAllocation allocator allocation offset size = liftIO $ do- r <- (ffiVmaFlushAllocation) (allocator) (allocation) (offset) (size)+ r <- traceAroundEvent "vmaFlushAllocation" ((ffiVmaFlushAllocation) (allocator) (allocation) (offset) (size)) when (r < SUCCESS) (throwIO (VulkanException r)) @@ -1570,7 +1573,7 @@ DeviceSize -> io () invalidateAllocation allocator allocation offset size = liftIO $ do- r <- (ffiVmaInvalidateAllocation) (allocator) (allocation) (offset) (size)+ r <- traceAroundEvent "vmaInvalidateAllocation" ((ffiVmaInvalidateAllocation) (allocator) (allocation) (offset) (size)) when (r < SUCCESS) (throwIO (VulkanException r)) @@ -1641,7 +1644,7 @@ pSizes <- ContT $ allocaBytesAligned @DeviceSize (((Data.Vector.length (sizes))) * 8) 8 lift $ Data.Vector.imapM_ (\i e -> poke (pSizes `plusPtr` (8 * (i)) :: Ptr DeviceSize) (e)) ((sizes)) pure $ pSizes- r <- lift $ (ffiVmaFlushAllocations) (allocator) ((fromIntegral allocationsLength :: Word32)) (pAllocations) offsets' sizes'+ r <- lift $ traceAroundEvent "vmaFlushAllocations" ((ffiVmaFlushAllocations) (allocator) ((fromIntegral allocationsLength :: Word32)) (pAllocations) offsets' sizes') lift $ when (r < SUCCESS) (throwIO (VulkanException r)) @@ -1713,7 +1716,7 @@ pSizes <- ContT $ allocaBytesAligned @DeviceSize (((Data.Vector.length (sizes))) * 8) 8 lift $ Data.Vector.imapM_ (\i e -> poke (pSizes `plusPtr` (8 * (i)) :: Ptr DeviceSize) (e)) ((sizes)) pure $ pSizes- r <- lift $ (ffiVmaInvalidateAllocations) (allocator) ((fromIntegral allocationsLength :: Word32)) (pAllocations) offsets' sizes'+ r <- lift $ traceAroundEvent "vmaInvalidateAllocations" ((ffiVmaInvalidateAllocations) (allocator) ((fromIntegral allocationsLength :: Word32)) (pAllocations) offsets' sizes') lift $ when (r < SUCCESS) (throwIO (VulkanException r)) @@ -1760,7 +1763,7 @@ ("memoryTypeBits" ::: Word32) -> io () checkCorruption allocator memoryTypeBits = liftIO $ do- r <- (ffiVmaCheckCorruption) (allocator) (memoryTypeBits)+ r <- traceAroundEvent "vmaCheckCorruption" ((ffiVmaCheckCorruption) (allocator) (memoryTypeBits)) when (r < SUCCESS) (throwIO (VulkanException r)) @@ -1834,7 +1837,7 @@ pInfo <- ContT $ withCStruct (info) pPStats <- ContT (withZeroCStruct @DefragmentationStats) pPContext <- ContT $ bracket (callocBytes @DefragmentationContext 8) free- r <- lift $ (ffiVmaDefragmentationBegin) (allocator) pInfo (pPStats) (pPContext)+ r <- lift $ traceAroundEvent "vmaDefragmentationBegin" ((ffiVmaDefragmentationBegin) (allocator) pInfo (pPStats) (pPContext)) lift $ when (r < SUCCESS) (throwIO (VulkanException r)) pStats <- lift $ peekCStruct @DefragmentationStats pPStats pContext <- lift $ peek @DefragmentationContext pPContext@@ -1874,7 +1877,7 @@ DefragmentationContext -> io () defragmentationEnd allocator context = liftIO $ do- r <- (ffiVmaDefragmentationEnd) (allocator) (context)+ r <- traceAroundEvent "vmaDefragmentationEnd" ((ffiVmaDefragmentationEnd) (allocator) (context)) when (r < SUCCESS) (throwIO (VulkanException r)) @@ -1895,7 +1898,7 @@ -> io (DefragmentationPassInfo) beginDefragmentationPass allocator context = liftIO . evalContT $ do pPInfo <- ContT (withZeroCStruct @DefragmentationPassInfo)- r <- lift $ (ffiVmaBeginDefragmentationPass) (allocator) (context) (pPInfo)+ r <- lift $ traceAroundEvent "vmaBeginDefragmentationPass" ((ffiVmaBeginDefragmentationPass) (allocator) (context) (pPInfo)) lift $ when (r < SUCCESS) (throwIO (VulkanException r)) pInfo <- lift $ peekCStruct @DefragmentationPassInfo pPInfo pure $ (pInfo)@@ -1930,7 +1933,7 @@ DefragmentationContext -> io () endDefragmentationPass allocator context = liftIO $ do- r <- (ffiVmaEndDefragmentationPass) (allocator) (context)+ r <- traceAroundEvent "vmaEndDefragmentationPass" ((ffiVmaEndDefragmentationPass) (allocator) (context)) when (r < SUCCESS) (throwIO (VulkanException r)) @@ -2029,7 +2032,7 @@ Nothing -> pure nullPtr Just j -> ContT $ withCStruct (j) pPDefragmentationStats <- ContT (withZeroCStruct @DefragmentationStats)- r <- lift $ (ffiVmaDefragment) (allocator) (pPAllocations) ((fromIntegral (Data.Vector.length $ (allocations)) :: CSize)) (pPAllocationsChanged) pDefragmentationInfo (pPDefragmentationStats)+ r <- lift $ traceAroundEvent "vmaDefragment" ((ffiVmaDefragment) (allocator) (pPAllocations) ((fromIntegral (Data.Vector.length $ (allocations)) :: CSize)) (pPAllocationsChanged) pDefragmentationInfo (pPDefragmentationStats)) lift $ when (r < SUCCESS) (throwIO (VulkanException r)) pAllocationsChanged <- lift $ generateM (fromIntegral ((fromIntegral (Data.Vector.length $ (allocations)) :: CSize))) (\i -> do pAllocationsChangedElem <- peek @Bool32 ((pPAllocationsChanged `advancePtrBytes` (4 * (i)) :: Ptr Bool32))@@ -2068,7 +2071,7 @@ Buffer -> io () bindBufferMemory allocator allocation buffer = liftIO $ do- r <- (ffiVmaBindBufferMemory) (allocator) (allocation) (buffer)+ r <- traceAroundEvent "vmaBindBufferMemory" ((ffiVmaBindBufferMemory) (allocator) (allocation) (buffer)) when (r < SUCCESS) (throwIO (VulkanException r)) @@ -2114,7 +2117,7 @@ ("next" ::: Ptr ()) -> io () bindBufferMemory2 allocator allocation allocationLocalOffset buffer next = liftIO $ do- r <- (ffiVmaBindBufferMemory2) (allocator) (allocation) (allocationLocalOffset) (buffer) (next)+ r <- traceAroundEvent "vmaBindBufferMemory2" ((ffiVmaBindBufferMemory2) (allocator) (allocation) (allocationLocalOffset) (buffer) (next)) when (r < SUCCESS) (throwIO (VulkanException r)) @@ -2148,7 +2151,7 @@ Image -> io () bindImageMemory allocator allocation image = liftIO $ do- r <- (ffiVmaBindImageMemory) (allocator) (allocation) (image)+ r <- traceAroundEvent "vmaBindImageMemory" ((ffiVmaBindImageMemory) (allocator) (allocation) (image)) when (r < SUCCESS) (throwIO (VulkanException r)) @@ -2194,7 +2197,7 @@ ("next" ::: Ptr ()) -> io () bindImageMemory2 allocator allocation allocationLocalOffset image next = liftIO $ do- r <- (ffiVmaBindImageMemory2) (allocator) (allocation) (allocationLocalOffset) (image) (next)+ r <- traceAroundEvent "vmaBindImageMemory2" ((ffiVmaBindImageMemory2) (allocator) (allocation) (allocationLocalOffset) (image) (next)) when (r < SUCCESS) (throwIO (VulkanException r)) @@ -2264,7 +2267,7 @@ pPBuffer <- ContT $ bracket (callocBytes @Buffer 8) free pPAllocation <- ContT $ bracket (callocBytes @Allocation 8) free pPAllocationInfo <- ContT (withZeroCStruct @AllocationInfo)- r <- lift $ (ffiVmaCreateBuffer) (allocator) (forgetExtensions pBufferCreateInfo) pAllocationCreateInfo (pPBuffer) (pPAllocation) (pPAllocationInfo)+ r <- lift $ traceAroundEvent "vmaCreateBuffer" ((ffiVmaCreateBuffer) (allocator) (forgetExtensions pBufferCreateInfo) pAllocationCreateInfo (pPBuffer) (pPAllocation) (pPAllocationInfo)) lift $ when (r < SUCCESS) (throwIO (VulkanException r)) pBuffer <- lift $ peek @Buffer pPBuffer pAllocation <- lift $ peek @Allocation pPAllocation@@ -2310,7 +2313,7 @@ Allocation -> io () destroyBuffer allocator buffer allocation = liftIO $ do- (ffiVmaDestroyBuffer) (allocator) (buffer) (allocation)+ traceAroundEvent "vmaDestroyBuffer" ((ffiVmaDestroyBuffer) (allocator) (buffer) (allocation)) pure $ () @@ -2337,7 +2340,7 @@ pPImage <- ContT $ bracket (callocBytes @Image 8) free pPAllocation <- ContT $ bracket (callocBytes @Allocation 8) free pPAllocationInfo <- ContT (withZeroCStruct @AllocationInfo)- r <- lift $ (ffiVmaCreateImage) (allocator) (forgetExtensions pImageCreateInfo) pAllocationCreateInfo (pPImage) (pPAllocation) (pPAllocationInfo)+ r <- lift $ traceAroundEvent "vmaCreateImage" ((ffiVmaCreateImage) (allocator) (forgetExtensions pImageCreateInfo) pAllocationCreateInfo (pPImage) (pPAllocation) (pPAllocationInfo)) lift $ when (r < SUCCESS) (throwIO (VulkanException r)) pImage <- lift $ peek @Image pPImage pAllocation <- lift $ peek @Allocation pPAllocation@@ -2383,7 +2386,7 @@ Allocation -> io () destroyImage allocator image allocation = liftIO $ do- (ffiVmaDestroyImage) (allocator) (image) (allocation)+ traceAroundEvent "vmaDestroyImage" ((ffiVmaDestroyImage) (allocator) (image) (allocation)) pure $ () @@ -3355,12 +3358,6 @@ cStructSize = 3920 cStructAlignment = 8 pokeZeroCStruct p f = do- unless ((Data.Vector.length $ (mempty)) <= MAX_MEMORY_TYPES) $- throwIO $ IOError Nothing InvalidArgument "" "memoryType is too long, a maximum of MAX_MEMORY_TYPES elements are allowed" Nothing Nothing- Data.Vector.imapM_ (\i e -> poke ((lowerArrayPtr ((p `plusPtr` 0 :: Ptr (FixedArray MAX_MEMORY_TYPES StatInfo)))) `plusPtr` (80 * (i)) :: Ptr StatInfo) (e)) (mempty)- unless ((Data.Vector.length $ (mempty)) <= MAX_MEMORY_HEAPS) $- throwIO $ IOError Nothing InvalidArgument "" "memoryHeap is too long, a maximum of MAX_MEMORY_HEAPS elements are allowed" Nothing Nothing- Data.Vector.imapM_ (\i e -> poke ((lowerArrayPtr ((p `plusPtr` 2560 :: Ptr (FixedArray MAX_MEMORY_HEAPS StatInfo)))) `plusPtr` (80 * (i)) :: Ptr StatInfo) (e)) (mempty) poke ((p `plusPtr` 3840 :: Ptr StatInfo)) (zero) f @@ -4013,7 +4010,7 @@ maxBlockCount <- peek @CSize ((p `plusPtr` 24 :: Ptr CSize)) frameInUseCount <- peek @Word32 ((p `plusPtr` 32 :: Ptr Word32)) pure $ PoolCreateInfo- memoryTypeIndex flags blockSize ((\(CSize a) -> a) minBlockCount) ((\(CSize a) -> a) maxBlockCount) frameInUseCount+ memoryTypeIndex flags blockSize (coerce @CSize @Word64 minBlockCount) (coerce @CSize @Word64 maxBlockCount) frameInUseCount instance Storable PoolCreateInfo where sizeOf ~_ = 40@@ -4092,7 +4089,7 @@ unusedRangeSizeMax <- peek @DeviceSize ((p `plusPtr` 32 :: Ptr DeviceSize)) blockCount <- peek @CSize ((p `plusPtr` 40 :: Ptr CSize)) pure $ PoolStats- size unusedSize ((\(CSize a) -> a) allocationCount) ((\(CSize a) -> a) unusedRangeCount) unusedRangeSizeMax ((\(CSize a) -> a) blockCount)+ size unusedSize (coerce @CSize @Word64 allocationCount) (coerce @CSize @Word64 unusedRangeCount) unusedRangeSizeMax (coerce @CSize @Word64 blockCount) instance Storable PoolStats where sizeOf ~_ = 48@@ -4398,19 +4395,13 @@ lift $ f cStructSize = 80 cStructAlignment = 8- pokeZeroCStruct p f = evalContT $ do- lift $ poke ((p `plusPtr` 0 :: Ptr DefragmentationFlags)) (zero)- pPAllocations' <- ContT $ allocaBytesAligned @Allocation ((Data.Vector.length (mempty)) * 8) 8- lift $ Data.Vector.imapM_ (\i e -> poke (pPAllocations' `plusPtr` (8 * (i)) :: Ptr Allocation) (e)) (mempty)- lift $ poke ((p `plusPtr` 8 :: Ptr (Ptr Allocation))) (pPAllocations')- pPPools' <- ContT $ allocaBytesAligned @Pool ((Data.Vector.length (mempty)) * 8) 8- lift $ Data.Vector.imapM_ (\i e -> poke (pPPools' `plusPtr` (8 * (i)) :: Ptr Pool) (e)) (mempty)- lift $ poke ((p `plusPtr` 32 :: Ptr (Ptr Pool))) (pPPools')- lift $ poke ((p `plusPtr` 40 :: Ptr DeviceSize)) (zero)- lift $ poke ((p `plusPtr` 48 :: Ptr Word32)) (zero)- lift $ poke ((p `plusPtr` 56 :: Ptr DeviceSize)) (zero)- lift $ poke ((p `plusPtr` 64 :: Ptr Word32)) (zero)- lift $ f+ pokeZeroCStruct p f = do+ poke ((p `plusPtr` 0 :: Ptr DefragmentationFlags)) (zero)+ poke ((p `plusPtr` 40 :: Ptr DeviceSize)) (zero)+ poke ((p `plusPtr` 48 :: Ptr Word32)) (zero)+ poke ((p `plusPtr` 56 :: Ptr DeviceSize)) (zero)+ poke ((p `plusPtr` 64 :: Ptr Word32)) (zero)+ f instance FromCStruct DefragmentationInfo2 where peekCStruct p = do