From 66afe099f1cf1f79c270471e9c0f02139072057d Mon Sep 17 00:00:00 2001 From: Adam Sawicki Date: Mon, 6 Mar 2023 11:43:13 +0100 Subject: [PATCH] Improved documentation chapter "Resource aliasing (overlap)" --- docs/html/resource_aliasing.html | 3 ++- include/vk_mem_alloc.h | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/html/resource_aliasing.html b/docs/html/resource_aliasing.html index bc03b30..c941d03 100644 --- a/docs/html/resource_aliasing.html +++ b/docs/html/resource_aliasing.html @@ -150,7 +150,8 @@ $(function() {
Parameters of new VmaAllocation.
Definition: vk_mem_alloc.h:1219
VkMemoryPropertyFlags preferredFlags
Flags that preferably should be set in a memory type chosen for an allocation.
Definition: vk_mem_alloc.h:1237
Represents single memory allocation.
-

Remember that using resources that alias in memory requires proper synchronization. You need to issue a memory barrier to make sure commands that use img1 and img2 don't overlap on GPU timeline. You also need to treat a resource after aliasing as uninitialized - containing garbage data. For example, if you use img1 and then want to use img2, you need to issue an image memory barrier for img2 with oldLayout = VK_IMAGE_LAYOUT_UNDEFINED.

+

VMA also provides convenience functions that create a buffer or image and bind it to memory represented by an existing VmaAllocation: vmaCreateAliasingBuffer(), vmaCreateAliasingBuffer2(), vmaCreateAliasingImage(), vmaCreateAliasingImage2(). Versions with "2" offer additional parameter allocationLocalOffset.

+

Remember that using resources that alias in memory requires proper synchronization. You need to issue a memory barrier to make sure commands that use img1 and img2 don't overlap on GPU timeline. You also need to treat a resource after aliasing as uninitialized - containing garbage data. For example, if you use img1 and then want to use img2, you need to issue an image memory barrier for img2 with oldLayout = VK_IMAGE_LAYOUT_UNDEFINED.

Additional considerations: