Merge branch 'Vulkan1_2'

This commit is contained in:
Adam Sawicki 2020-03-02 15:43:47 +01:00
commit 8ef0d201ef
4 changed files with 25 additions and 7 deletions

View File

@ -46,7 +46,7 @@ Additional features:
- Support for sparse binding and sparse residency: Convenience functions that allocate or free multiple memory pages at once.
- Custom memory pools: Create a pool with desired parameters (e.g. fixed or limited maximum size) and allocate memory out of it.
- Linear allocator: Create a pool with linear algorithm and use it for much faster allocations and deallocations in free-at-once, stack, double stack, or ring buffer fashion.
- Support for Vulkan 1.0 as well as 1.1.
- Support for Vulkan 1.0, 1.1, 1.2.
- Support for VK_KHR_dedicated_allocation extension: Just enable it and it will be used automatically by the library.
- Support for VK_AMD_device_coherent_memory extension.
- Defragmentation of GPU and CPU memory: Let the library move data around to free some memory blocks and make your allocations better compacted.

View File

@ -59,6 +59,7 @@ include all public interface declarations. Example:
//#define VMA_DEBUG_GLOBAL_MUTEX 1
//#define VMA_MEMORY_BUDGET 0
//#define VMA_VULKAN_VERSION 1002000 // Vulkan 1.2
#define VMA_VULKAN_VERSION 1001000 // Vulkan 1.1
//#define VMA_VULKAN_VERSION 1000000 // Vulkan 1.0
@ -95,4 +96,4 @@ include all public interface declarations. Example:
#pragma warning(pop)
#endif
#endif
#endif

View File

@ -32,8 +32,8 @@ static const char* const SHADER_PATH1 = "./";
static const char* const SHADER_PATH2 = "../bin/";
static const wchar_t* const WINDOW_CLASS_NAME = L"VULKAN_MEMORY_ALLOCATOR_SAMPLE";
static const char* const VALIDATION_LAYER_NAME = "VK_LAYER_LUNARG_standard_validation";
static const char* const APP_TITLE_A = "Vulkan Memory Allocator Sample 2.3.0";
static const wchar_t* const APP_TITLE_W = L"Vulkan Memory Allocator Sample 2.3.0";
static const char* const APP_TITLE_A = "Vulkan Memory Allocator Sample 2.4.0";
static const wchar_t* const APP_TITLE_W = L"Vulkan Memory Allocator Sample 2.4.0";
static const bool VSYNC = true;
static const uint32_t COMMAND_BUFFER_COUNT = 2;
@ -1118,7 +1118,16 @@ static void DestroySwapchain(bool destroyActualSwapchain)
static constexpr uint32_t GetVulkanApiVersion()
{
return VMA_VULKAN_VERSION == 1001000 ? VK_API_VERSION_1_1 : VK_API_VERSION_1_0;
#if VMA_VULKAN_VERSION == 1002000
return VK_API_VERSION_1_2;
#elif VMA_VULKAN_VERSION == 1001000
return VK_API_VERSION_1_1;
#elif VMA_VULKAN_VERSION == 1000000
return VK_API_VERSION_1_0;
#else
#error Invalid VMA_VULKAN_VERSION.
return UINT32_MAX;
#endif
}
void SetAllocatorCreateInfo(VmaAllocatorCreateInfo& outInfo)

View File

@ -1843,7 +1843,9 @@ available through VmaAllocatorCreateInfo::pRecordSettings.
// where AAA = major, BBB = minor, CCC = patch.
// If you want to use version > 1.0, it still needs to be enabled via VmaAllocatorCreateInfo::vulkanApiVersion.
#if !defined(VMA_VULKAN_VERSION)
#if defined(VK_VERSION_1_1)
#if defined(VK_VERSION_1_2)
#define VMA_VULKAN_VERSION 1002000
#elif defined(VK_VERSION_1_1)
#define VMA_VULKAN_VERSION 1001000
#else
#define VMA_VULKAN_VERSION 1000000
@ -15032,6 +15034,12 @@ VmaAllocator_T::VmaAllocator_T(const VmaAllocatorCreateInfo* pCreateInfo) :
VMA_ASSERT(0 && "VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT set but required extension is disabled by preprocessor macros.");
}
#endif
#if VMA_VULKAN_VERSION < 1002000
if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 2, 0))
{
VMA_ASSERT(0 && "vulkanApiVersion >= VK_API_VERSION_1_2 but required Vulkan version is disabled by preprocessor macros.");
}
#endif
#if VMA_VULKAN_VERSION < 1001000
if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 1, 0))
{
@ -16838,7 +16846,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateAllocator(
{
VMA_ASSERT(pCreateInfo && pAllocator);
VMA_ASSERT(pCreateInfo->vulkanApiVersion == 0 ||
(VK_VERSION_MAJOR(pCreateInfo->vulkanApiVersion) == 1 && VK_VERSION_MINOR(pCreateInfo->vulkanApiVersion) <= 1));
(VK_VERSION_MAJOR(pCreateInfo->vulkanApiVersion) == 1 && VK_VERSION_MINOR(pCreateInfo->vulkanApiVersion) <= 2));
VMA_DEBUG_LOG("vmaCreateAllocator");
*pAllocator = vma_new(pCreateInfo->pAllocationCallbacks, VmaAllocator_T)(pCreateInfo);
return (*pAllocator)->Init(pCreateInfo);