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.
This commit is contained in:
Adam Sawicki 2020-03-31 19:11:41 +02:00
parent a39951c716
commit f575c5070b
16 changed files with 15542 additions and 15360 deletions

View file

@ -69,19 +69,19 @@ $(function() {
<div class="title">Enabling buffer device address </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>Device extensions VK_EXT_buffer_device_address / VK_KHR_buffer_device_address allow to fetch raw GPU pointer to a buffer and pass it for usage in a shader code. They are promoted to core Vulkan 1.2.</p>
<div class="textblock"><p>Device extension VK_KHR_buffer_device_address allow to fetch raw GPU pointer to a buffer and pass it for usage in a shader code. It is promoted to core Vulkan 1.2.</p>
<p>If you want to use this feature in connection with VMA, follow these steps:</p>
<h1><a class="anchor" id="enabling_buffer_device_address_initialization"></a>
Initialization</h1>
<p>1) (For Vulkan version &lt; 1.2) Call <code>vkEnumerateDeviceExtensionProperties</code> for the physical device. Check if the extension is supported - if returned array of <code>VkExtensionProperties</code> contains "VK_EXT_buffer_device_address" or "VK_KHR_buffer_device_address".</p>
<p>1) (For Vulkan version &lt; 1.2) Call <code>vkEnumerateDeviceExtensionProperties</code> for the physical device. Check if the extension is supported - if returned array of <code>VkExtensionProperties</code> contains "VK_KHR_buffer_device_address".</p>
<p>2) Call <code>vkGetPhysicalDeviceFeatures2</code> for the physical device instead of old <code>vkGetPhysicalDeviceFeatures</code>. Attach additional structure <code>VkPhysicalDeviceBufferDeviceAddressFeatures*</code> to <code>VkPhysicalDeviceFeatures2::pNext</code> to be returned. Check if the device feature is really supported - check if <code>VkPhysicalDeviceBufferDeviceAddressFeatures*::bufferDeviceAddress</code> is true.</p>
<p>3) (For Vulkan version &lt; 1.2) While creating device with <code>vkCreateDevice</code>, enable this extension - add "VK_EXT_buffer_device_address" or "VK_KHR_buffer_device_address" to the list passed as <code>VkDeviceCreateInfo::ppEnabledExtensionNames</code>.</p>
<p>3) (For Vulkan version &lt; 1.2) While creating device with <code>vkCreateDevice</code>, enable this extension - add "VK_KHR_buffer_device_address" to the list passed as <code>VkDeviceCreateInfo::ppEnabledExtensionNames</code>.</p>
<p>4) While creating the device, also don't set <code>VkDeviceCreateInfo::pEnabledFeatures</code>. Fill in <code>VkPhysicalDeviceFeatures2</code> structure instead and pass it as <code>VkDeviceCreateInfo::pNext</code>. Enable this device feature - attach additional structure <code>VkPhysicalDeviceBufferDeviceAddressFeatures*</code> to <code>VkPhysicalDeviceFeatures2::pNext</code> and set its member <code>bufferDeviceAddress</code> to <code>VK_TRUE</code>.</p>
<p>5) While creating <a class="el" href="struct_vma_allocator.html" title="Represents main object of this library initialized.">VmaAllocator</a> with <a class="el" href="vk__mem__alloc_8h.html#a200692051ddb34240248234f5f4c17bb" title="Creates Allocator object.">vmaCreateAllocator()</a> inform VMA that you have enabled this feature - add <a class="el" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca5f1b28b0414319d1687e1f2b30ab0089">VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT</a> to <a class="el" href="struct_vma_allocator_create_info.html#a392ea2ecbaff93f91a7c49f735ad4346" title="Flags for created allocator. Use VmaAllocatorCreateFlagBits enum.">VmaAllocatorCreateInfo::flags</a>.</p>
<h1><a class="anchor" id="enabling_buffer_device_address_usage"></a>
Usage</h1>
<p>After following steps described above, you can create buffers with <code>VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT</code> using VMA. The library automatically adds <code>VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR</code> to allocated memory blocks wherever it might be needed.</p>
<p>Please note that the library supports only <code>VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT</code>. The second part of this functionality related to "capture and replay" is not supported, as it is intended for usage in debugging tools like RenderDoc, not in everyday Vulkan usage.</p>
<p>After following steps described above, you can create buffers with <code>VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT*</code> using VMA. The library automatically adds <code>VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT*</code> to allocated memory blocks wherever it might be needed.</p>
<p>Please note that the library supports only <code>VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT*</code>. The second part of this functionality related to "capture and replay" is not supported, as it is intended for usage in debugging tools like RenderDoc, not in everyday Vulkan usage.</p>
<h1><a class="anchor" id="enabling_buffer_device_address_more_information"></a>
More information</h1>
<p>To learn more about this extension, see <a href="https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/chap46.html#VK_KHR_buffer_device_address">VK_KHR_buffer_device_address in Vulkan specification</a></p>