#include"RenderSurfaceAttribute.h" VK_NAMESPACE_BEGIN RenderSurfaceAttribute::RenderSurfaceAttribute(VkInstance inst,VkPhysicalDevice pd,VkSurfaceKHR s) { instance=inst; physical_device=pd; surface=s; vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physical_device,surface,&surface_caps); vkGetPhysicalDeviceFeatures(physical_device,&features); vkGetPhysicalDeviceProperties(physical_device,&properties); vkGetPhysicalDeviceMemoryProperties(physical_device,&memory_properties); { if(surface_caps.supportedTransforms&VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR) { preTransform=VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR; } else { preTransform=surface_caps.currentTransform; } } { constexpr VkCompositeAlphaFlagBitsKHR compositeAlphaFlags[4]={VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR, VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR, VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR, VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR}; for(uint32_t i=0; iformat==VK_FORMAT_UNDEFINED) format=VK_FORMAT_B8G8R8A8_UNORM; else format=sf->format; } } } { uint32_t mode_count; if(vkGetPhysicalDeviceSurfacePresentModesKHR(physical_device,surface,&mode_count,nullptr)==VK_SUCCESS) { present_modes.SetCount(mode_count); if(vkGetPhysicalDeviceSurfacePresentModesKHR(physical_device,surface,&mode_count,present_modes.GetData())!=VK_SUCCESS) present_modes.Clear(); } } { uint32_t family_count; vkGetPhysicalDeviceQueueFamilyProperties(physical_device,&family_count,nullptr); family_properties.SetCount(family_count); vkGetPhysicalDeviceQueueFamilyProperties(physical_device,&family_count,family_properties.GetData()); { supports_present.SetCount(family_count); VkBool32 *sp=supports_present.GetData(); for(uint32_t i=0; iqueueFlags&VK_QUEUE_GRAPHICS_BIT) { 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