Commit Graph

631 Commits

Author SHA1 Message Date
Adam Sawicki
755fd47121 Minor fix in comment 2020-04-24 17:05:07 +02:00
Adam Sawicki
72740d8d63 Fix indentation - always use 4 spaces instead of tabs 2020-04-24 17:02:50 +02:00
Adam Sawicki
74bc7c78fe Port memory recording in VMA to C++11
Closes #126
2020-04-24 16:59:34 +02:00
Adam Sawicki
ff472352b9 Add .editorconfig file to configure supporting editors to use proper whitespaces for indentation 2020-04-24 12:42:06 +02:00
Adam Sawicki
25d9b2c0ec Add function vmaFlushAllocations, vmaInvalidateAllocations for multiple allocations at once
Closes #119
Added internal class VmaSmallVector.
Refactored common code into a new function VmaAllocator_T::GetFlushOrInvalidateRange.
Regenerated docs.
2020-04-19 19:02:28 +02:00
Adam Sawicki
a8a5b1f81b
Merge pull request #122 from expipiplus1/joe-120
Return VkResult in vmaInvalidateAllocation and vmaFlushAllocation
2020-04-19 17:20:57 +02:00
Adam Sawicki
ba9d4b3323
Merge pull request #121 from expipiplus1/joe-len
Add missing length annotation in vmaAllocateMemoryPages
2020-04-19 17:18:47 +02:00
Adam Sawicki
f6a4037af4 VmaDumpVis: Gracefully handle cases where there is nothing to put on the image, e.g. the stats string was generated without detailed map enabled
Message is printed in that case and 1 is returned instead of division by zero error.
Closes #125
2020-04-19 17:14:04 +02:00
Adam Sawicki
115d2971ae Minor fix in README 2020-04-15 13:50:18 +02:00
Adam Sawicki
d9c1c2abeb
Merge pull request #124 from expipiplus1/joe-mention-bindings
Mention Haskell bindings in readme
2020-04-15 13:47:18 +02:00
Joe Hermaszewski
b605c64f3d Mention Haskell bindings in readme 2020-04-11 12:46:05 +08:00
Joe Hermaszewski
b52c5a3e84 Return VkResult in vmaInvalidateAllocation and vmaFlushAllocation
Fixes #120
2020-04-10 21:39:27 +08:00
Joe Hermaszewski
fc931bd5ac Add missing length annotation in vmaAllocateMemoryPages 2020-04-10 21:27:55 +08:00
Adam Sawicki
6be35971a2 Minor fixes for #115 2020-04-09 16:20:13 +02:00
Adam Sawicki
3f35a0c9a1
Merge pull request #117 from expipiplus1/joe-const
Add const qualifier to handles where possible
2020-04-08 17:16:04 +02:00
Adam Sawicki
9b3a159515
Merge branch 'master' into joe-const 2020-04-08 17:15:53 +02:00
Adam Sawicki
facf05ee63 Some fixes after fb3a337 #115 2020-04-08 17:09:59 +02:00
Adam Sawicki
fb3a33777d
Merge pull request #115 from expipiplus1/joe-annotations
Add annotations for nullability and length
2020-04-08 16:31:39 +02:00
Adam Sawicki
b713c3435b Add #if VMA_DYNAMIC_VULKAN_FUNCTIONS == 1 around VmaAllocator_T::ImportVulkanFunctions_Dynamic
Refers to #56
2020-04-07 20:51:18 +02:00
Adam Sawicki
d8bdd78e26 Minor fix after c0cf25d 2020-04-07 20:47:25 +02:00
Adam Sawicki
c4bc165faa
Merge pull request #118 from expipiplus1/joe-recording
Add CPP error if trying to use recording on a non-Windows platform
2020-04-07 20:45:45 +02:00
Joe Hermaszewski
4810460894 Do not include nullability and length annotations in documentation 2020-04-07 22:41:03 +08:00
Joe Hermaszewski
f22cd7b3c6 Add const qualifier to handles where possible
This mirrors the Vulkan specification where handles are often passed with a const qualifier
2020-04-07 20:21:30 +08:00
Joe Hermaszewski
08bc59bee5 Add length annotation for VmaAllocatorCreateInfo::pHeapSizeLimit 2020-04-07 20:21:30 +08:00
Joe Hermaszewski
b9725fc203 Annotate types with lengths instead of parameters/members 2020-04-07 20:21:28 +08:00
Joe Hermaszewski
3a756282ab Disable -Wnullability-completeness for the implementation 2020-04-07 20:20:48 +08:00
Joe Hermaszewski
35939a0fd1 Add VMA_NULLABLE to pointed to out values 2020-04-07 20:20:48 +08:00
Joe Hermaszewski
c6f8c86085 Add annotations for nullability and length
These are only present on the declarations in the C API.

New macros
- `VMA_NULLABLE`
- `VMA_NOT_NULL`
- `VMA_NULLABLE_NON_DISPATCHABLE`
- `VMA_NOT_NULL_NON_DISPATCHABLE`
- `VMA_LEN_IF_NOT_NULL`

On clang `VMA_NOT_NULL` and `VMA_NULLABLE` are defined as `_Nonnull` and
`_Nullable`. Clang will use these annotations to generate diagnostics
when these functions or structs are incorrectly used.

`VMA_NULLABLE_NON_DISPATCHABLE` and `VMA_NOT_NULL_NON_DISPATCHABLE` are
not defined on platforms where Vulkan's non-dispatchable handles are not
pointers; on platforms where they are, these macros are defined to be
`VMA_NULLABLE` and `VMA_NOT_NULL` respectively.

`LEN_IF_NOT_NULL` is not defined for any compiler. It is included to
mirror the `len` attribute in the Vulkan XML spec in order to aid in
development of other language bindings for this library.

It was tempting to use C's array syntax (`foo(int len, int arr[len])`)to
specify lengths, however this is not possible to use with optional
pointers, nor is it possible to use inside structs. For the sake of
consistency only `VMA_LEN_IF_NOT_NULL` is used (additionally neither
clang not gcc generate warnings for function misuse when the array
length specifier is anything but an integer literal).

- Also correct a couple of typos
- Also add assert on ppName in vmaGetPoolName

Closes #114
2020-04-07 20:20:47 +08:00
Joe Hermaszewski
c0cf25df3d Add CPP #error if trying to use recording on a non-Windows platform 2020-04-07 19:59:33 +08:00
Joe Hermaszewski
0360182776 Add const qualifier to handles where possible
This mirrors the Vulkan specification where handles are often passed with a const qualifier
2020-04-07 17:40:40 +08:00
Adam Sawicki
5b602ce324
Merge pull request #116 from Ybalrid/patch-1
Fix a typo
2020-04-06 14:10:27 +02:00
Arthur Brainville
bc0528c0be
Fix a typo
I think this title was supposed to be "Binaries"
2020-04-06 13:57:07 +02:00
Adam Sawicki
f575c5070b Further changes in importing pointers to Vulkan functions
Reverted change removing configuration macro VMA_STATIC_VULKAN_FUNCTIONS.
Added configuration macro VMA_DYNAMIC_VULKAN_FUNCTIONS.
Fixes for Android.

Closes #111, also refers to #56.
2020-03-31 19:11:41 +02:00
Adam Sawicki
a39951c716
Merge pull request #109 from JustSid/master
Fixed a race condition with incremental defragmentation.
2020-03-31 17:01:25 +02:00
Sidney Just
bb7bdb99ec Fixed a race condition with incremental defragmentation. The issue here is that VmaBlockVector::DefragmentationEnd() relied on the mutex being previously locked to safely mutate its data, but with incremental defrag this isn't guaranteed to be the case anymore. 2020-03-27 09:58:25 -07:00
Adam Sawicki
3d1ce4ebb8 Support VK_KHR_buffer_device_address but not VK_EXT_buffer_device_address
To avoid mess in the code. They are not identical! "EXT" version lacks flag VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT* flag.

Refers to #56
2020-03-25 10:34:05 +01:00
Adam Sawicki
204a810449 Fix documentation to state that VmaAllocatorCreateInfo::instance is now required
Compatibility breaking!
Closes #107
2020-03-24 15:58:45 +01:00
Adam Sawicki
297639774c Remove outdated comment 2020-03-24 12:40:54 +01:00
Adam Sawicki
4405c51aab Fix compilation of VmaReplay project 2020-03-23 18:58:04 +01:00
Adam Sawicki
451bf601d8 Bump version number to 3.0.0-development as we broken backward compatibility
Also rebuilt the docs.
2020-03-23 18:24:02 +01:00
Adam Sawicki
b58de2be50
Merge pull request #105 from Didgy74/master
Add pUserData to VmaDeviceMemoryCallbacks
2020-03-23 18:21:16 +01:00
Adam Sawicki
2952959820 Fix a comment broken accidentally 2020-03-23 18:19:35 +01:00
Adam Sawicki
954631ac2a Improve internal fetching pointers to Vulkan functions to always use vkGetInstanceProcAddr/vkGetDeviceProcAddr
No longer refers to statically linked Vulkan functions.
Removed configuration macro VMA_STATIC_VULKAN_FUNCTIONS.
Hopefully will help for #56.
2020-03-23 18:13:36 +01:00
Adam Sawicki
77b55b38f4 Fix VmaAllocator_T::AllocateDedicatedMemory to make it compiling with Vulkan SDK 1.1.130.0 (linux)
Closes #104
2020-03-23 15:42:55 +01:00
Adam Sawicki
854b25df0d Update README.md to better describe extensions supported 2020-03-23 15:38:34 +01:00
Adam Sawicki
e73e988daf Add support for buffer device address, together with documentation and tests
Added VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT.
2020-03-20 18:05:42 +01:00
Nils Petter Skålerud
d00c9b6ff8 Fixed bug where pUserData was not being assigned during initialization.
Signed-off-by: Nils Petter Skålerud <np_skalerud@hotmail.com>
2020-03-19 19:38:52 +01:00
Nils Petter Skålerud
eebf47cd1c Added a member void* pUserData to VmaDeviceMemoryCallbacks
Updated PFN_vmaAllocateDeviceMemoryFunction to use new pUserData member
Updated PFN_vmaFreeDeviceMemoryFunction to use new pUserData member

Signed-off-by: Nils Petter Skålerud <np_skalerud@hotmail.com>
2020-03-19 19:20:19 +01:00
Adam Sawicki
39aeff7a43 Remove incorrect asserts from vmaCreateBuffer
Closes #102
2020-03-16 15:39:44 +01:00
Adam Sawicki
1b8bdb216e Remove unused variable in VmaBlockVector::AllocatePage
Fixes #101
2020-03-11 17:08:42 +01:00