splited DeviceAttribute::Refresh function.

This commit is contained in:
hyzboy 2021-12-15 19:54:07 +08:00
parent 75e25d16c7
commit d98acda22e
2 changed files with 56 additions and 41 deletions

View File

@ -55,7 +55,12 @@ public:
bool CheckMemoryType(uint32_t typeBits,VkMemoryPropertyFlags properties,uint32_t *typeIndex) const;
void Refresh();
void RefreshSurfaceCaps();
private:
void RefreshSurface();
void RefreshQueueFamily();
public:

View File

@ -13,7 +13,9 @@ GPUDeviceAttribute::GPUDeviceAttribute(VulkanInstance *inst,const GPUPhysicalDev
physical_device=pd;
surface=s;
Refresh();
RefreshSurfaceCaps();
RefreshSurface();
RefreshQueueFamily();
}
GPUDeviceAttribute::~GPUDeviceAttribute()
@ -42,11 +44,16 @@ bool GPUDeviceAttribute::CheckMemoryType(uint32_t typeBits,VkMemoryPropertyFlags
return physical_device->CheckMemoryType(typeBits,properties,typeIndex);
}
void GPUDeviceAttribute::Refresh()
void GPUDeviceAttribute::RefreshSurfaceCaps()
{
VkPhysicalDevice pdevice = *physical_device;
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(pdevice, surface, &surface_caps);
}
void GPUDeviceAttribute::RefreshSurface()
{
VkPhysicalDevice pdevice = *physical_device;
{
if (surface_caps.supportedTransforms & VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR)
@ -116,8 +123,12 @@ void GPUDeviceAttribute::Refresh()
present_modes.Clear();
}
}
}
void GPUDeviceAttribute::RefreshQueueFamily()
{
VkPhysicalDevice pdevice = *physical_device;
uint32_t family_count;
vkGetPhysicalDeviceQueueFamilyProperties(pdevice, &family_count, nullptr);
family_properties.SetCount(family_count);
@ -170,5 +181,4 @@ void GPUDeviceAttribute::Refresh()
}
}
}
}
VK_NAMESPACE_END