From 35ff9cc8f075212bb39c205fa0a48143af6adcd9 Mon Sep 17 00:00:00 2001 From: "Xinzhao@SWAT-06" Date: Tue, 20 Dec 2016 16:23:49 +0800 Subject: [PATCH] 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. --- Project/Tutorial06/Tutorial06.cpp | 4 ++-- Project/Tutorial07/Tutorial07.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Project/Tutorial06/Tutorial06.cpp b/Project/Tutorial06/Tutorial06.cpp index 1186d1d..2b9ac0a 100644 --- a/Project/Tutorial06/Tutorial06.cpp +++ b/Project/Tutorial06/Tutorial06.cpp @@ -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 \ No newline at end of file +} // namespace ApiWithoutSecrets diff --git a/Project/Tutorial07/Tutorial07.cpp b/Project/Tutorial07/Tutorial07.cpp index 2f3af06..e4e6078 100644 --- a/Project/Tutorial07/Tutorial07.cpp +++ b/Project/Tutorial07/Tutorial07.cpp @@ -242,7 +242,7 @@ namespace ApiWithoutSecrets { bool Tutorial07::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 ); @@ -1361,4 +1361,4 @@ namespace ApiWithoutSecrets { } } -} // namespace ApiWithoutSecrets \ No newline at end of file +} // namespace ApiWithoutSecrets