Use the parameter of the image handle to allocate memory.

The original code will use Vulkan.Image.Handle to query the requirement of
the image to be allocated memory, which is unreasonable, since the handle
for the image has been given as the parameter "image" already. When reuse
this function to create other images, the program would crash in the
driver side for this reason.
This commit is contained in:
Xinzhao@SWAT-06
2016-12-20 16:23:49 +08:00
parent ace944f547
commit 35ff9cc8f0
2 changed files with 4 additions and 4 deletions

View File

@@ -242,7 +242,7 @@ namespace ApiWithoutSecrets {
bool Tutorial06::AllocateImageMemory( VkImage image, VkMemoryPropertyFlagBits property, VkDeviceMemory *memory ) {
VkMemoryRequirements image_memory_requirements;
vkGetImageMemoryRequirements( GetDevice(), Vulkan.Image.Handle, &image_memory_requirements );
vkGetImageMemoryRequirements( GetDevice(), image, &image_memory_requirements );
VkPhysicalDeviceMemoryProperties memory_properties;
vkGetPhysicalDeviceMemoryProperties( GetPhysicalDevice(), &memory_properties );
@@ -1219,4 +1219,4 @@ namespace ApiWithoutSecrets {
}
}
} // namespace ApiWithoutSecrets
} // namespace ApiWithoutSecrets