diff --git a/inc/hgl/graph/VKDeviceCreater.h b/inc/hgl/graph/VKDeviceCreater.h index 405c3944..9e42091f 100644 --- a/inc/hgl/graph/VKDeviceCreater.h +++ b/inc/hgl/graph/VKDeviceCreater.h @@ -250,16 +250,7 @@ public: const PreferFormats *spf_depth, const VulkanHardwareRequirement *req); - virtual bool ChoosePhysicalDevice() - { - physical_device=nullptr; - - if(!physical_device)physical_device=instance->GetDevice(VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU); //先找独显 - if(!physical_device)physical_device=instance->GetDevice(VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU); //再找集显 - if(!physical_device)physical_device=instance->GetDevice(VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU); //最后找虚拟显卡 - - return physical_device; - } + virtual bool ChoosePhysicalDevice(); virtual bool RequirementCheck(); diff --git a/src/SceneGraph/Vulkan/VKDeviceCreater.cpp b/src/SceneGraph/Vulkan/VKDeviceCreater.cpp index eb3124f3..ba5f7206 100644 --- a/src/SceneGraph/Vulkan/VKDeviceCreater.cpp +++ b/src/SceneGraph/Vulkan/VKDeviceCreater.cpp @@ -9,6 +9,7 @@ #include #include +#include VK_NAMESPACE_BEGIN VkPipelineCache CreatePipelineCache(VkDevice device,const VkPhysicalDeviceProperties &); @@ -32,9 +33,11 @@ void LogSurfaceFormat(const VkSurfaceFormatKHR *surface_format_list,const uint32 cs=GetVulkanColorSpace(sf->colorSpace); if(select==i) - std::cout<<" * "<name<<", "<name<name<<", "<name<name<<", "<name<GetDevice(VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU); //先找独显 + if(!physical_device)physical_device=instance->GetDevice(VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU); //再找集显 + if(!physical_device)physical_device=instance->GetDevice(VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU); //最后找虚拟显卡 + + return physical_device; +} + bool VulkanDeviceCreater::RequirementCheck() { const VkPhysicalDeviceLimits &limits=physical_device->GetLimits(); @@ -389,14 +403,14 @@ GPUDevice *VulkanDeviceCreater::Create() return(nullptr); if(!ChoosePhysicalDevice()) - return(false); + return(nullptr); #ifdef _DEBUG OutputPhysicalDeviceCaps(physical_device); #endif//_DEBUG if(!RequirementCheck()) - return(false); + return(nullptr); surface=CreateVulkanSurface(*instance,window);