VmaBlockMetadata_Buddy: Added (simple way of) respecting bufferImageGranularity.
Minor fixes in documentation.
This commit is contained in:
parent
9933c5cadf
commit
1e8cf94558
1 changed files with 20 additions and 10 deletions
|
@ -1965,23 +1965,23 @@ typedef enum VmaPoolCreateFlagBits {
|
||||||
(wasted memory). In that case, if you can make sure you always allocate only
|
(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
|
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
|
to make allocator disregard Buffer-Image Granularity and so make allocations
|
||||||
more optimal.
|
faster and more optimal.
|
||||||
*/
|
*/
|
||||||
VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT = 0x00000002,
|
VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT = 0x00000002,
|
||||||
|
|
||||||
/** \brief Enables alternative, linear allocation algorithm in this pool.
|
/** \brief Enables alternative, linear allocation algorithm in this pool.
|
||||||
|
|
||||||
Specify this flag to enable linear allocation algorithm, which always creates
|
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
|
new allocations after last one and doesn't reuse space from allocations freed in
|
||||||
between. It trades memory consumption for simplified algorithm and data
|
between. It trades memory consumption for simplified algorithm and data
|
||||||
structure, which has better performance and uses less memory for metadata.
|
structure, which has better performance and uses less memory for metadata.
|
||||||
|
|
||||||
By using this flag, you can achieve behavior of free-at-once, stack,
|
By using this flag, you can achieve behavior of free-at-once, stack,
|
||||||
ring buffer, and double stack. For details, see documentation chapter
|
ring buffer, and double stack. For details, see documentation chapter
|
||||||
\ref linear_algorithm.
|
\ref linear_algorithm.
|
||||||
|
|
||||||
When using this flag, you must specify VmaPoolCreateInfo::maxBlockCount == 1 (or 0 for default).
|
When using this flag, you must specify VmaPoolCreateInfo::maxBlockCount == 1 (or 0 for default).
|
||||||
*/
|
*/
|
||||||
VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT = 0x00000004,
|
VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT = 0x00000004,
|
||||||
|
|
||||||
/** TODO */
|
/** TODO */
|
||||||
|
@ -9392,6 +9392,16 @@ bool VmaBlockMetadata_Buddy::CreateAllocationRequest(
|
||||||
{
|
{
|
||||||
VMA_ASSERT(!upperAddress && "VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT can be used only with linear algorithm.");
|
VMA_ASSERT(!upperAddress && "VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT can be used only with linear algorithm.");
|
||||||
|
|
||||||
|
// Simple way to respect bufferImageGranularity. May be optimized some day.
|
||||||
|
// Whenever it might be an OPTIMAL image...
|
||||||
|
if(allocType == VMA_SUBALLOCATION_TYPE_UNKNOWN ||
|
||||||
|
allocType == VMA_SUBALLOCATION_TYPE_IMAGE_UNKNOWN ||
|
||||||
|
allocType == VMA_SUBALLOCATION_TYPE_IMAGE_OPTIMAL)
|
||||||
|
{
|
||||||
|
allocAlignment = VMA_MAX(allocAlignment, bufferImageGranularity);
|
||||||
|
allocSize = VMA_MAX(allocSize, bufferImageGranularity);
|
||||||
|
}
|
||||||
|
|
||||||
if(allocSize > m_UsableSize)
|
if(allocSize > m_UsableSize)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue