VKPhysicalDevice由struct改为class
This commit is contained in:
parent
9bf934ed5c
commit
e50adf12a2
@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include<hgl/graph/vulkan/VK.h>
|
||||
#include<hgl/type/BaseString.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
struct PhysicalDevice
|
||||
class PhysicalDevice
|
||||
{
|
||||
VkInstance instance=nullptr;
|
||||
VkPhysicalDevice physical_device=nullptr;
|
||||
@ -20,6 +20,9 @@ public:
|
||||
PhysicalDevice(VkInstance,VkPhysicalDevice);
|
||||
~PhysicalDevice()=default;
|
||||
|
||||
operator VkPhysicalDevice(){return physical_device;}
|
||||
operator const VkPhysicalDevice()const{return physical_device;}
|
||||
|
||||
const bool CheckMemoryType(uint32_t,VkFlags,uint32_t *)const;
|
||||
|
||||
VkPhysicalDeviceType GetDeviceType()const{return properties.deviceType;}
|
||||
@ -35,8 +38,14 @@ public:
|
||||
const char * GetDriverName ()const{return driver_properties.driverName;}
|
||||
const char * GetDriverInfo ()const{return driver_properties.driverInfo;}
|
||||
|
||||
public:
|
||||
|
||||
const uint32_t GetConstantSize()const{return properties.limits.maxPushConstantsSize;}
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* 获取该设备是否是显卡
|
||||
* 获取该设备是否是显卡
|
||||
*/
|
||||
const bool isGPU()const
|
||||
{
|
||||
@ -47,9 +56,9 @@ public:
|
||||
return(false);
|
||||
}
|
||||
|
||||
const bool isDiscreteGPU ()const{return(properties.deviceType==VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU);} ///<是否是独立显卡
|
||||
const bool isIntegratedGPU ()const{return(properties.deviceType==VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU);} ///<是否是集成显卡
|
||||
const bool isVirtualGPU ()const{return(properties.deviceType==VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU);} ///<是否是虚拟显卡
|
||||
const bool isDiscreteGPU ()const{return(properties.deviceType==VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU);} ///<是否是独立显卡
|
||||
const bool isIntegratedGPU ()const{return(properties.deviceType==VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU);} ///<是否是集成显卡
|
||||
const bool isVirtualGPU ()const{return(properties.deviceType==VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU);} ///<是否是虚拟显卡
|
||||
|
||||
public:
|
||||
|
||||
@ -61,5 +70,5 @@ public:
|
||||
|
||||
return fp;
|
||||
}
|
||||
};//struct PhysicalDevice
|
||||
};//class PhysicalDevice
|
||||
VK_NAMESPACE_END
|
@ -11,7 +11,7 @@ DeviceAttribute::DeviceAttribute(VkInstance inst,const PhysicalDevice *pd,VkSurf
|
||||
physical_device=pd;
|
||||
surface=s;
|
||||
|
||||
VkPhysicalDevice pdevice=physical_device->physical_device;
|
||||
VkPhysicalDevice pdevice=*physical_device;
|
||||
|
||||
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(pdevice,surface,&surface_caps);
|
||||
|
||||
|
@ -546,7 +546,7 @@ Device *CreateRenderDevice(VkInstance inst,const PhysicalDevice *physical_device
|
||||
if(attr->graphics_family==ERROR_FAMILY_INDEX)
|
||||
return(nullptr);
|
||||
|
||||
attr->device=CreateDevice(inst,physical_device->physical_device,attr->graphics_family);
|
||||
attr->device=CreateDevice(inst,*physical_device,attr->graphics_family);
|
||||
|
||||
if(!attr->device)
|
||||
return(nullptr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user