Skip to content

Commit

Permalink
Second plane (PLANE_1)'s storage must be aligned to VkMemoryRequireme…
Browse files Browse the repository at this point in the history
…nts::alignment
  • Loading branch information
ravi688 committed Feb 16, 2024
1 parent e2ae406 commit b7bcffd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/PlayVk/PlayVk.h
Original file line number Diff line number Diff line change
Expand Up @@ -1435,12 +1435,14 @@ PVK_LINKAGE PvkImage pvkCreateImage2(VkPhysicalDevice physicalDevice, VkDevice d
uint32_t imageBits = imageMemoryRequirements.memoryRequirements.memoryTypeBits;
VkDeviceSize imageSize = imageMemoryRequirements.memoryRequirements.size;
uint32_t plane0Offset = 0;
uint32_t plane1Offset = imageSize;

imagePlaneRequirementInfo.planeAspect = (VkImageAspectFlagBits)(VK_IMAGE_ASPECT_PLANE_1_BIT);
vkGetImageMemoryRequirements2(device, &info, &imageMemoryRequirements);
__pvkCheckForMemoryTypesSupport(physicalDevice, imageMemoryRequirements.memoryRequirements.memoryTypeBits);
imageBits |= imageMemoryRequirements.memoryRequirements.memoryTypeBits;
imageSize += (imageMemoryRequirements.memoryRequirements.alignment - (imageSize % imageMemoryRequirements.memoryRequirements.alignment))
% imageMemoryRequirements.memoryRequirements.alignment;
uint32_t plane1Offset = imageSize;
imageSize += imageMemoryRequirements.memoryRequirements.size;

VkDeviceMemory memory = pvkAllocateMemory(device, imageSize, __pvkGetMemoryTypeIndexFromMemoryProperty(physicalDevice, mflags));
Expand Down

0 comments on commit b7bcffd

Please sign in to comment.