diff --git a/docs/html/index.html b/docs/html/index.html index 34f866f..d21f630 100644 --- a/docs/html/index.html +++ b/docs/html/index.html @@ -77,7 +77,7 @@ License: MIT

  • Configuration
  • Thread safety
  • diff --git a/docs/html/search/all_e.js b/docs/html/search/all_e.js index 718f72e..dc7e02f 100644 --- a/docs/html/search/all_e.js +++ b/docs/html/search/all_e.js @@ -1,7 +1,7 @@ var searchData= [ ['vulkan_20memory_20allocator',['Vulkan Memory Allocator',['../index.html',1,'']]], - ['vk_5fkhr_5fdedicated_5fallocation',['VK_KHR_dedicated_allocation',['../_v_k__k_h_r_dedicated_allocation.html',1,'index']]], + ['vk_5fkhr_5fdedicated_5fallocation',['VK_KHR_dedicated_allocation',['../vk_khr_dedicated_allocation.html',1,'index']]], ['vk_5fmem_5falloc_2eh',['vk_mem_alloc.h',['../vk__mem__alloc_8h.html',1,'']]], ['vkallocatememory',['vkAllocateMemory',['../struct_vma_vulkan_functions.html#a2943bf99dfd784a0e8f599d987e22e6c',1,'VmaVulkanFunctions']]], ['vkbindbuffermemory',['vkBindBufferMemory',['../struct_vma_vulkan_functions.html#a94fc4f3a605d9880bb3c0ba2c2fc80b2',1,'VmaVulkanFunctions']]], diff --git a/docs/html/search/pages_6.js b/docs/html/search/pages_6.js index e2d4aaf..f9c7890 100644 --- a/docs/html/search/pages_6.js +++ b/docs/html/search/pages_6.js @@ -1,5 +1,5 @@ var searchData= [ ['vulkan_20memory_20allocator',['Vulkan Memory Allocator',['../index.html',1,'']]], - ['vk_5fkhr_5fdedicated_5fallocation',['VK_KHR_dedicated_allocation',['../_v_k__k_h_r_dedicated_allocation.html',1,'index']]] + ['vk_5fkhr_5fdedicated_5fallocation',['VK_KHR_dedicated_allocation',['../vk_khr_dedicated_allocation.html',1,'index']]] ]; diff --git a/docs/html/vk_khr_dedicated_allocation.html b/docs/html/vk_khr_dedicated_allocation.html new file mode 100644 index 0000000..fded3c2 --- /dev/null +++ b/docs/html/vk_khr_dedicated_allocation.html @@ -0,0 +1,100 @@ + + + + + + + +Vulkan Memory Allocator: VK_KHR_dedicated_allocation + + + + + + + + + +
    +
    + + + + + + +
    +
    Vulkan Memory Allocator +
    +
    +
    + + + + + + + + +
    +
    + + +
    + +
    + + +
    +
    +
    +
    VK_KHR_dedicated_allocation
    +
    +
    +

    VK_KHR_dedicated_allocation is a Vulkan extension which can be used to improve performance on some GPUs. It augments Vulkan API with possibility to query driver whether it prefers particular buffer or image to have its own, dedicated allocation (separate VkDeviceMemory block) for better efficiency - to be able to do some internal optimizations.

    +

    The extension is supported by this library. It will be used automatically when enabled. To enable it:

    +

    1 . When creating Vulkan device, check if following 2 device extensions are supported (call vkEnumerateDeviceExtensionProperties()). If yes, enable them (fill VkDeviceCreateInfo::ppEnabledExtensionNames).

    + +

    If you enabled these extensions:

    +

    2 . Query device for pointers to following 2 extension functions, using vkGetDeviceProcAddr(). Pass them in structure VmaVulkanFunctions while creating your VmaAllocator.

    + +

    Other members of this structure can be null as long as you leave VMA_STATIC_VULKAN_FUNCTIONS defined to 1, which is the default.

    +
    VmaVulkanFunctions vulkanFunctions = {};
    (PFN_vkGetBufferMemoryRequirements2KHR)vkGetDeviceProcAddr(device, "vkGetBufferMemoryRequirements2KHR");
    (PFN_vkGetImageMemoryRequirements2KHR)vkGetDeviceProcAddr(device, "vkGetImageMemoryRequirements2KHR");
    VmaAllocatorCreateInfo allocatorInfo = {};
    allocatorInfo.pVulkanFunctions = &vulkanFunctions;
    // Fill other members of allocatorInfo...

    3 . Use VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT flag when creating your VmaAllocator to inform the library that you enabled required extensions and you want the library to use them.

    +
    vmaCreateAllocator(&allocatorInfo, &allocator);

    That's all. The extension will be automatically used whenever you create a buffer using vmaCreateBuffer() or image using vmaCreateImage().

    +

    When using the extension together with Vulkan Validation Layer, you will receive warnings like this:

    vkBindBufferMemory(): Binding memory to buffer 0x33 but vkGetBufferMemoryRequirements() has not been called on that buffer.
    +

    It is OK, you should just ignore it. It happens because you use function vkGetBufferMemoryRequirements2KHR() instead of standard vkGetBufferMemoryRequirements(), while the validation layer seems to be unaware of it.

    +

    To learn more about this extension, see:

    + +
    + + + + diff --git a/src/vk_mem_alloc.h b/src/vk_mem_alloc.h index 0e92290..4cc87ca 100644 --- a/src/vk_mem_alloc.h +++ b/src/vk_mem_alloc.h @@ -45,7 +45,7 @@ Table of contents: - \subpage defragmentation - \subpage lost_allocations - \subpage configuration - - \subpage VK_KHR_dedicated_allocation + - \subpage vk_khr_dedicated_allocation - \subpage thread_safety See also: @@ -400,7 +400,7 @@ To do it, fill optional member VmaAllocatorCreateInfo::pHeapSizeLimit. -\page VK_KHR_dedicated_allocation VK_KHR_dedicated_allocation +\page vk_khr_dedicated_allocation VK_KHR_dedicated_allocation VK_KHR_dedicated_allocation is a Vulkan extension which can be used to improve performance on some GPUs. It augments Vulkan API with possibility to query