splited DeviceAttribute::Refresh function.
This commit is contained in:
parent
75e25d16c7
commit
d98acda22e
@ -55,7 +55,12 @@ public:
|
|||||||
|
|
||||||
bool CheckMemoryType(uint32_t typeBits,VkMemoryPropertyFlags properties,uint32_t *typeIndex) const;
|
bool CheckMemoryType(uint32_t typeBits,VkMemoryPropertyFlags properties,uint32_t *typeIndex) const;
|
||||||
|
|
||||||
void Refresh();
|
void RefreshSurfaceCaps();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void RefreshSurface();
|
||||||
|
void RefreshQueueFamily();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -13,7 +13,9 @@ GPUDeviceAttribute::GPUDeviceAttribute(VulkanInstance *inst,const GPUPhysicalDev
|
|||||||
physical_device=pd;
|
physical_device=pd;
|
||||||
surface=s;
|
surface=s;
|
||||||
|
|
||||||
Refresh();
|
RefreshSurfaceCaps();
|
||||||
|
RefreshSurface();
|
||||||
|
RefreshQueueFamily();
|
||||||
}
|
}
|
||||||
|
|
||||||
GPUDeviceAttribute::~GPUDeviceAttribute()
|
GPUDeviceAttribute::~GPUDeviceAttribute()
|
||||||
@ -42,11 +44,16 @@ bool GPUDeviceAttribute::CheckMemoryType(uint32_t typeBits,VkMemoryPropertyFlags
|
|||||||
return physical_device->CheckMemoryType(typeBits,properties,typeIndex);
|
return physical_device->CheckMemoryType(typeBits,properties,typeIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPUDeviceAttribute::Refresh()
|
void GPUDeviceAttribute::RefreshSurfaceCaps()
|
||||||
{
|
{
|
||||||
VkPhysicalDevice pdevice = *physical_device;
|
VkPhysicalDevice pdevice = *physical_device;
|
||||||
|
|
||||||
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(pdevice, surface, &surface_caps);
|
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(pdevice, surface, &surface_caps);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GPUDeviceAttribute::RefreshSurface()
|
||||||
|
{
|
||||||
|
VkPhysicalDevice pdevice = *physical_device;
|
||||||
|
|
||||||
{
|
{
|
||||||
if (surface_caps.supportedTransforms & VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR)
|
if (surface_caps.supportedTransforms & VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR)
|
||||||
@ -116,58 +123,61 @@ void GPUDeviceAttribute::Refresh()
|
|||||||
present_modes.Clear();
|
present_modes.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GPUDeviceAttribute::RefreshQueueFamily()
|
||||||
|
{
|
||||||
|
VkPhysicalDevice pdevice = *physical_device;
|
||||||
|
|
||||||
|
uint32_t family_count;
|
||||||
|
vkGetPhysicalDeviceQueueFamilyProperties(pdevice, &family_count, nullptr);
|
||||||
|
family_properties.SetCount(family_count);
|
||||||
|
vkGetPhysicalDeviceQueueFamilyProperties(pdevice, &family_count, family_properties.GetData());
|
||||||
|
|
||||||
{
|
{
|
||||||
uint32_t family_count;
|
supports_present.SetCount(family_count);
|
||||||
vkGetPhysicalDeviceQueueFamilyProperties(pdevice, &family_count, nullptr);
|
VkBool32 *sp = supports_present.GetData();
|
||||||
family_properties.SetCount(family_count);
|
for (uint32_t i = 0; i < family_count; i++)
|
||||||
vkGetPhysicalDeviceQueueFamilyProperties(pdevice, &family_count, family_properties.GetData());
|
|
||||||
|
|
||||||
{
|
{
|
||||||
supports_present.SetCount(family_count);
|
vkGetPhysicalDeviceSurfaceSupportKHR(pdevice, i, surface, sp);
|
||||||
VkBool32 *sp = supports_present.GetData();
|
++sp;
|
||||||
for (uint32_t i = 0; i < family_count; i++)
|
|
||||||
{
|
|
||||||
vkGetPhysicalDeviceSurfaceSupportKHR(pdevice, i, surface, sp);
|
|
||||||
++sp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
VkQueueFamilyProperties *fp = family_properties.GetData();
|
||||||
|
VkBool32 *sp = supports_present.GetData();
|
||||||
|
for (uint32_t i = 0; i < family_count; i++)
|
||||||
{
|
{
|
||||||
VkQueueFamilyProperties *fp = family_properties.GetData();
|
if (fp->queueFlags & VK_QUEUE_GRAPHICS_BIT)
|
||||||
VkBool32 *sp = supports_present.GetData();
|
|
||||||
for (uint32_t i = 0; i < family_count; i++)
|
|
||||||
{
|
{
|
||||||
if (fp->queueFlags & VK_QUEUE_GRAPHICS_BIT)
|
if (graphics_family == ERROR_FAMILY_INDEX)
|
||||||
{
|
graphics_family = i;
|
||||||
if (graphics_family == ERROR_FAMILY_INDEX)
|
|
||||||
graphics_family = i;
|
|
||||||
|
|
||||||
if (*sp)
|
|
||||||
{
|
|
||||||
graphics_family = i;
|
|
||||||
present_family = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
++fp;
|
|
||||||
++sp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (present_family == ERROR_FAMILY_INDEX)
|
|
||||||
{
|
|
||||||
VkBool32 *sp = supports_present.GetData();
|
|
||||||
for (uint32_t i = 0; i < family_count; i++)
|
|
||||||
{
|
|
||||||
if (*sp)
|
if (*sp)
|
||||||
{
|
{
|
||||||
|
graphics_family = i;
|
||||||
present_family = i;
|
present_family = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++sp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
++fp;
|
||||||
|
++sp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (present_family == ERROR_FAMILY_INDEX)
|
||||||
|
{
|
||||||
|
VkBool32 *sp = supports_present.GetData();
|
||||||
|
for (uint32_t i = 0; i < family_count; i++)
|
||||||
|
{
|
||||||
|
if (*sp)
|
||||||
|
{
|
||||||
|
present_family = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++sp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user