Renamed macro VMA_DEBUG_ALIGNMENT to VMA_MIN_ALIGNMENT as there are valid use cases for it other than debugging purposes.

This commit is contained in:
Adam Sawicki 2021-06-14 17:01:33 +02:00
parent 49d9f99467
commit 8d4a9e9174
3 changed files with 16 additions and 12 deletions

View File

@ -63,7 +63,7 @@ Between them there can be zero or more lines with configuration options. They st
Extension,VK_AMD_device_coherent_memory,<bool> Extension,VK_AMD_device_coherent_memory,<bool>
Macro,VMA_DEBUG_ALWAYS_DEDICATED_MEMORY,<bool> Macro,VMA_DEBUG_ALWAYS_DEDICATED_MEMORY,<bool>
Macro,VMA_DEBUG_ALIGNMENT,<uint64> Macro,VMA_MIN_ALIGNMENT,<uint64>
Macro,VMA_DEBUG_MARGIN,<uint64> Macro,VMA_DEBUG_MARGIN,<uint64>
Macro,VMA_DEBUG_INITIALIZE_ALLOCATIONS,<bool> Macro,VMA_DEBUG_INITIALIZE_ALLOCATIONS,<bool>
Macro,VMA_DEBUG_DETECT_CORRUPTION,<bool> Macro,VMA_DEBUG_DETECT_CORRUPTION,<bool>
@ -313,7 +313,7 @@ An ordered sequence of values of some type, separated by single space.
Extension,VK_KHR_bind_memory2,1 Extension,VK_KHR_bind_memory2,1
Extension,VK_EXT_memory_budget,1 Extension,VK_EXT_memory_budget,1
Macro,VMA_DEBUG_ALWAYS_DEDICATED_MEMORY,0 Macro,VMA_DEBUG_ALWAYS_DEDICATED_MEMORY,0
Macro,VMA_DEBUG_ALIGNMENT,1 Macro,VMA_MIN_ALIGNMENT,1
Macro,VMA_DEBUG_MARGIN,0 Macro,VMA_DEBUG_MARGIN,0
Macro,VMA_DEBUG_INITIALIZE_ALLOCATIONS,0 Macro,VMA_DEBUG_INITIALIZE_ALLOCATIONS,0
Macro,VMA_DEBUG_DETECT_CORRUPTION,0 Macro,VMA_DEBUG_DETECT_CORRUPTION,0

View File

@ -4346,12 +4346,16 @@ If providing your own implementation, you need to implement a subset of std::ato
#define VMA_DEBUG_ALWAYS_DEDICATED_MEMORY (0) #define VMA_DEBUG_ALWAYS_DEDICATED_MEMORY (0)
#endif #endif
#ifndef VMA_DEBUG_ALIGNMENT #ifndef VMA_MIN_ALIGNMENT
/** /**
Minimum alignment of all allocations, in bytes. Minimum alignment of all allocations, in bytes.
Set to more than 1 for debugging purposes only. Must be power of two. Set to more than 1 for debugging purposes. Must be power of two.
*/ */
#define VMA_DEBUG_ALIGNMENT (1) #ifdef VMA_DEBUG_ALIGNMENT // Old name
#define VMA_MIN_ALIGNMENT VMA_DEBUG_ALIGNMENT
#else
#define VMA_MIN_ALIGNMENT (1)
#endif
#endif #endif
#ifndef VMA_DEBUG_MARGIN #ifndef VMA_DEBUG_MARGIN
@ -8229,8 +8233,8 @@ public:
VkDeviceSize GetMemoryTypeMinAlignment(uint32_t memTypeIndex) const VkDeviceSize GetMemoryTypeMinAlignment(uint32_t memTypeIndex) const
{ {
return IsMemoryTypeNonCoherent(memTypeIndex) ? return IsMemoryTypeNonCoherent(memTypeIndex) ?
VMA_MAX((VkDeviceSize)VMA_DEBUG_ALIGNMENT, m_PhysicalDeviceProperties.limits.nonCoherentAtomSize) : VMA_MAX((VkDeviceSize)VMA_MIN_ALIGNMENT, m_PhysicalDeviceProperties.limits.nonCoherentAtomSize) :
(VkDeviceSize)VMA_DEBUG_ALIGNMENT; (VkDeviceSize)VMA_MIN_ALIGNMENT;
} }
bool IsIntegratedGpu() const bool IsIntegratedGpu() const
@ -15907,7 +15911,7 @@ void VmaRecorder::WriteConfiguration(
fprintf(m_File, "Extension,VK_AMD_device_coherent_memory,%u\n", deviceCoherentMemoryExtensionEnabled ? 1 : 0); fprintf(m_File, "Extension,VK_AMD_device_coherent_memory,%u\n", deviceCoherentMemoryExtensionEnabled ? 1 : 0);
fprintf(m_File, "Macro,VMA_DEBUG_ALWAYS_DEDICATED_MEMORY,%u\n", VMA_DEBUG_ALWAYS_DEDICATED_MEMORY ? 1 : 0); fprintf(m_File, "Macro,VMA_DEBUG_ALWAYS_DEDICATED_MEMORY,%u\n", VMA_DEBUG_ALWAYS_DEDICATED_MEMORY ? 1 : 0);
fprintf(m_File, "Macro,VMA_DEBUG_ALIGNMENT,%llu\n", (VkDeviceSize)VMA_DEBUG_ALIGNMENT); fprintf(m_File, "Macro,VMA_MIN_ALIGNMENT,%llu\n", (VkDeviceSize)VMA_MIN_ALIGNMENT);
fprintf(m_File, "Macro,VMA_DEBUG_MARGIN,%llu\n", (VkDeviceSize)VMA_DEBUG_MARGIN); fprintf(m_File, "Macro,VMA_DEBUG_MARGIN,%llu\n", (VkDeviceSize)VMA_DEBUG_MARGIN);
fprintf(m_File, "Macro,VMA_DEBUG_INITIALIZE_ALLOCATIONS,%u\n", VMA_DEBUG_INITIALIZE_ALLOCATIONS ? 1 : 0); fprintf(m_File, "Macro,VMA_DEBUG_INITIALIZE_ALLOCATIONS,%u\n", VMA_DEBUG_INITIALIZE_ALLOCATIONS ? 1 : 0);
fprintf(m_File, "Macro,VMA_DEBUG_DETECT_CORRUPTION,%u\n", VMA_DEBUG_DETECT_CORRUPTION ? 1 : 0); fprintf(m_File, "Macro,VMA_DEBUG_DETECT_CORRUPTION,%u\n", VMA_DEBUG_DETECT_CORRUPTION ? 1 : 0);
@ -16090,7 +16094,7 @@ VmaAllocator_T::VmaAllocator_T(const VmaAllocatorCreateInfo* pCreateInfo) :
(*m_VulkanFunctions.vkGetPhysicalDeviceProperties)(m_PhysicalDevice, &m_PhysicalDeviceProperties); (*m_VulkanFunctions.vkGetPhysicalDeviceProperties)(m_PhysicalDevice, &m_PhysicalDeviceProperties);
(*m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties)(m_PhysicalDevice, &m_MemProps); (*m_VulkanFunctions.vkGetPhysicalDeviceMemoryProperties)(m_PhysicalDevice, &m_MemProps);
VMA_ASSERT(VmaIsPow2(VMA_DEBUG_ALIGNMENT)); VMA_ASSERT(VmaIsPow2(VMA_MIN_ALIGNMENT));
VMA_ASSERT(VmaIsPow2(VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY)); VMA_ASSERT(VmaIsPow2(VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY));
VMA_ASSERT(VmaIsPow2(m_PhysicalDeviceProperties.limits.bufferImageGranularity)); VMA_ASSERT(VmaIsPow2(m_PhysicalDeviceProperties.limits.bufferImageGranularity));
VMA_ASSERT(VmaIsPow2(m_PhysicalDeviceProperties.limits.nonCoherentAtomSize)); VMA_ASSERT(VmaIsPow2(m_PhysicalDeviceProperties.limits.nonCoherentAtomSize));

View File

@ -1089,7 +1089,7 @@ private:
Extension_VK_EXT_memory_budget, Extension_VK_EXT_memory_budget,
Extension_VK_AMD_device_coherent_memory, Extension_VK_AMD_device_coherent_memory,
Macro_VMA_DEBUG_ALWAYS_DEDICATED_MEMORY, Macro_VMA_DEBUG_ALWAYS_DEDICATED_MEMORY,
Macro_VMA_DEBUG_ALIGNMENT, Macro_VMA_MIN_ALIGNMENT,
Macro_VMA_DEBUG_MARGIN, Macro_VMA_DEBUG_MARGIN,
Macro_VMA_DEBUG_INITIALIZE_ALLOCATIONS, Macro_VMA_DEBUG_INITIALIZE_ALLOCATIONS,
Macro_VMA_DEBUG_DETECT_CORRUPTION, Macro_VMA_DEBUG_DETECT_CORRUPTION,
@ -1237,8 +1237,8 @@ bool ConfigurationParser::Parse(LineSplit& lineSplit)
const StrRange subOptionName = csvSplit.GetRange(1); const StrRange subOptionName = csvSplit.GetRange(1);
if(StrRangeEq(subOptionName, "VMA_DEBUG_ALWAYS_DEDICATED_MEMORY")) if(StrRangeEq(subOptionName, "VMA_DEBUG_ALWAYS_DEDICATED_MEMORY"))
SetOption(currLineNumber, OPTION::Macro_VMA_DEBUG_ALWAYS_DEDICATED_MEMORY, csvSplit.GetRange(2)); SetOption(currLineNumber, OPTION::Macro_VMA_DEBUG_ALWAYS_DEDICATED_MEMORY, csvSplit.GetRange(2));
else if(StrRangeEq(subOptionName, "VMA_DEBUG_ALIGNMENT")) else if(StrRangeEq(subOptionName, "VMA_MIN_ALIGNMENT") || StrRangeEq(subOptionName, "VMA_DEBUG_ALIGNMENT"))
SetOption(currLineNumber, OPTION::Macro_VMA_DEBUG_ALIGNMENT, csvSplit.GetRange(2)); SetOption(currLineNumber, OPTION::Macro_VMA_MIN_ALIGNMENT, csvSplit.GetRange(2));
else if(StrRangeEq(subOptionName, "VMA_DEBUG_MARGIN")) else if(StrRangeEq(subOptionName, "VMA_DEBUG_MARGIN"))
SetOption(currLineNumber, OPTION::Macro_VMA_DEBUG_MARGIN, csvSplit.GetRange(2)); SetOption(currLineNumber, OPTION::Macro_VMA_DEBUG_MARGIN, csvSplit.GetRange(2));
else if(StrRangeEq(subOptionName, "VMA_DEBUG_INITIALIZE_ALLOCATIONS")) else if(StrRangeEq(subOptionName, "VMA_DEBUG_INITIALIZE_ALLOCATIONS"))