MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / VmaBlocksOnSamePage

Function VmaBlocksOnSamePage

include/vk_mem_alloc.h:3755–3767  ·  view source on GitHub ↗

Returns true if two memory blocks occupy overlapping pages. ResourceA must be in less memory offset than ResourceB. Algorithm is based on "Vulkan 1.0.39 - A Specification (with all registered Vulkan extensions)" chapter 11.6 "Resource Memory Association", paragraph "Buffer-Image Granularity". */

Source from the content-addressed store, hash-verified

3753chapter 11.6 "Resource Memory Association", paragraph "Buffer-Image Granularity".
3754*/
3755static inline bool VmaBlocksOnSamePage(
3756 VkDeviceSize resourceAOffset,
3757 VkDeviceSize resourceASize,
3758 VkDeviceSize resourceBOffset,
3759 VkDeviceSize pageSize)
3760{
3761 VMA_ASSERT(resourceAOffset + resourceASize <= resourceBOffset && resourceASize > 0 && pageSize > 0);
3762 VkDeviceSize resourceAEnd = resourceAOffset + resourceASize - 1;
3763 VkDeviceSize resourceAEndPage = resourceAEnd & ~(pageSize - 1);
3764 VkDeviceSize resourceBStart = resourceBOffset;
3765 VkDeviceSize resourceBStartPage = resourceBStart & ~(pageSize - 1);
3766 return resourceAEndPage == resourceBStartPage;
3767}
3768
3769/*
3770Returns true if given suballocation types could conflict and must respect

Calls

no outgoing calls

Tested by

no test coverage detected