From b43d4cc5a35691248f60714ee2a56a7dc3cd857d Mon Sep 17 00:00:00 2001 From: "HuYingzhuo(hugo/hyzboy)" Date: Wed, 14 Jun 2023 20:17:10 +0800 Subject: [PATCH] fixed a bug that error in getting the value of features/properties of vkPhysicalDevice --- inc/hgl/graph/VKPhysicalDevice.h | 2 ++ src/SceneGraph/Vulkan/VKPhysicalDevice.cpp | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/inc/hgl/graph/VKPhysicalDevice.h b/inc/hgl/graph/VKPhysicalDevice.h index 0bb932c7..37673f43 100644 --- a/inc/hgl/graph/VKPhysicalDevice.h +++ b/inc/hgl/graph/VKPhysicalDevice.h @@ -48,6 +48,8 @@ public: operator VkPhysicalDevice() {return physical_device;} operator const VkPhysicalDevice()const {return physical_device;} + const uint32_t GetVulkanVersion()const{return properties.apiVersion;} + const int GetMemoryType(uint32_t,VkMemoryPropertyFlags)const; VkPhysicalDeviceType GetDeviceType()const{return properties.deviceType;} diff --git a/src/SceneGraph/Vulkan/VKPhysicalDevice.cpp b/src/SceneGraph/Vulkan/VKPhysicalDevice.cpp index ac87ab3b..92624fab 100644 --- a/src/SceneGraph/Vulkan/VKPhysicalDevice.cpp +++ b/src/SceneGraph/Vulkan/VKPhysicalDevice.cpp @@ -61,6 +61,10 @@ GPUPhysicalDevice::GPUPhysicalDevice(VkInstance inst,VkPhysicalDevice pd) physical_device=pd; { + hgl_zero(features11); + hgl_zero(features12); + hgl_zero(features13); + auto func=(PFN_vkGetPhysicalDeviceFeatures2KHR)vkGetInstanceProcAddr(inst,"vkGetPhysicalDeviceFeatures2KHR"); if(func) @@ -86,14 +90,14 @@ GPUPhysicalDevice::GPUPhysicalDevice(VkInstance inst,VkPhysicalDevice pd) else { vkGetPhysicalDeviceFeatures(physical_device,&features); - - hgl_zero(features11); - hgl_zero(features12); - hgl_zero(features13); } } { + hgl_zero(properties11); + hgl_zero(properties12); + hgl_zero(properties13); + auto func=(PFN_vkGetPhysicalDeviceProperties2KHR)vkGetInstanceProcAddr(inst,"vkGetPhysicalDeviceProperties2KHR"); if(func) @@ -119,10 +123,6 @@ GPUPhysicalDevice::GPUPhysicalDevice(VkInstance inst,VkPhysicalDevice pd) else { vkGetPhysicalDeviceProperties(physical_device,&properties); - - hgl_zero(properties11); - hgl_zero(properties12); - hgl_zero(properties13); } }