@@ -6259,15 +6259,39 @@ static void TestAllocationAliasing()
6259
6259
VkImage aliasingImage;
6260
6260
imageInfo.extent .width = 480 ;
6261
6261
imageInfo.extent .height = 256 ;
6262
- res = vkCreateImage (g_hDevice, &imageInfo, nullptr , &aliasingImage);
6262
+ res = vkCreateImage (g_hDevice, &imageInfo, g_Allocs , &aliasingImage);
6263
6263
TEST (res == VK_SUCCESS);
6264
6264
// Now with VMA_ALLOCATION_CREATE_CAN_ALIAS_BIT flag validation error is no more
6265
6265
res = vmaBindImageMemory (g_hAllocator, allocation, aliasingImage);
6266
6266
TEST (res == VK_SUCCESS);
6267
6267
6268
- vkDestroyImage (g_hDevice, aliasingImage, nullptr );
6268
+ vkDestroyImage (g_hDevice, aliasingImage, g_Allocs );
6269
6269
vmaDestroyImage (g_hAllocator, originalImage, allocation);
6270
6270
}
6271
+
6272
+ // Test creating buffer without DEDICATED flag, but large enought to end up as dedicated.
6273
+ allocationCreateInfo.flags = VMA_ALLOCATION_CREATE_CAN_ALIAS_BIT;
6274
+
6275
+ VkBufferCreateInfo bufCreateInfo = {VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO};
6276
+ bufCreateInfo.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT;
6277
+ bufCreateInfo.size = 300 * MEGABYTE;
6278
+
6279
+ {
6280
+ VkBuffer origBuf;
6281
+ VmaAllocation alloc;
6282
+ VmaAllocationInfo allocInfo;
6283
+ VkResult res = vmaCreateBuffer (g_hAllocator, &bufCreateInfo, &allocationCreateInfo, &origBuf, &alloc, &allocInfo);
6284
+ TEST (res == VK_SUCCESS && origBuf && alloc);
6285
+ TEST (allocInfo.offset == 0 ); // Dedicated
6286
+
6287
+ VkBuffer aliasingBuf;
6288
+ bufCreateInfo.size = 200 * MEGABYTE;
6289
+ res = vmaCreateAliasingBuffer (g_hAllocator, alloc, &bufCreateInfo, &aliasingBuf);
6290
+ TEST (res == VK_SUCCESS && aliasingBuf);
6291
+
6292
+ vkDestroyBuffer (g_hDevice, aliasingBuf, g_Allocs);
6293
+ vmaDestroyBuffer (g_hAllocator, origBuf, alloc);
6294
+ }
6271
6295
}
6272
6296
6273
6297
static void TestMapping ()
0 commit comments