@@ -2585,58 +2585,54 @@ vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice, cons
25852585 return disp -> GetPhysicalDeviceSurfaceCapabilities2KHR (unwrapped_phys_dev , pSurfaceInfo , pSurfaceCapabilities );
25862586}
25872587
2588- void emulate_VK_EXT_surface_maintenance1 (struct loader_icd_term * icd_term , const VkPhysicalDeviceSurfaceInfo2KHR * pSurfaceInfo ,
2588+ void emulate_VK_KHR_surface_maintenance1 (struct loader_icd_term * icd_term , const VkPhysicalDeviceSurfaceInfo2KHR * pSurfaceInfo ,
25892589 VkSurfaceCapabilities2KHR * pSurfaceCapabilities ) {
2590- // Because VK_EXT_surface_maintenance1 is an instance extension, applications will use it to query info on drivers which do
2590+ // Because VK_KHR_surface_maintenance1 is an instance extension, applications will use it to query info on drivers which do
25912591 // not support the extension. Thus we need to emulate the driver filling out the structs in that case.
2592- if (!icd_term -> enabled_instance_extensions .ext_surface_maintenance1 ) {
2593- VkPresentModeKHR present_mode = VK_PRESENT_MODE_MAX_ENUM_KHR ;
2594- const void * void_pNext = pSurfaceInfo -> pNext ;
2595- while (void_pNext ) {
2596- VkBaseOutStructure out_structure = {0 };
2597- memcpy (& out_structure , void_pNext , sizeof (VkBaseOutStructure ));
2598- if (out_structure .sType == VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_EXT ) {
2599- VkSurfacePresentModeEXT * surface_present_mode = (VkSurfacePresentModeEXT * )void_pNext ;
2600- present_mode = surface_present_mode -> presentMode ;
2601- }
2602- void_pNext = out_structure .pNext ;
2603- }
2604- // If no VkSurfacePresentModeEXT was present, return
2605- if (present_mode == VK_PRESENT_MODE_MAX_ENUM_KHR ) {
2606- return ;
2592+ VkPresentModeKHR present_mode = VK_PRESENT_MODE_MAX_ENUM_KHR ;
2593+ const void * void_pNext = pSurfaceInfo -> pNext ;
2594+ while (void_pNext ) {
2595+ VkBaseOutStructure out_structure = {0 };
2596+ memcpy (& out_structure , void_pNext , sizeof (VkBaseOutStructure ));
2597+ if (out_structure .sType == VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_KHR ) {
2598+ VkSurfacePresentModeKHR * surface_present_mode = (VkSurfacePresentModeKHR * )void_pNext ;
2599+ present_mode = surface_present_mode -> presentMode ;
26072600 }
2608-
2609- void_pNext = pSurfaceCapabilities -> pNext ;
2610- while (void_pNext ) {
2611- VkBaseOutStructure out_structure = {0 };
2612- memcpy (& out_structure , void_pNext , sizeof (VkBaseOutStructure ));
2613- if (out_structure .sType == VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_EXT ) {
2614- VkSurfacePresentModeCompatibilityEXT * surface_present_mode_compatibility =
2615- (VkSurfacePresentModeCompatibilityEXT * )void_pNext ;
2616- if (surface_present_mode_compatibility -> pPresentModes ) {
2617- if (surface_present_mode_compatibility -> presentModeCount != 0 ) {
2618- surface_present_mode_compatibility -> pPresentModes [0 ] = present_mode ;
2619- surface_present_mode_compatibility -> presentModeCount = 1 ;
2620- }
2621- } else {
2601+ void_pNext = out_structure .pNext ;
2602+ }
2603+ // If no VkSurfacePresentModeKHR was present, return
2604+ if (present_mode == VK_PRESENT_MODE_MAX_ENUM_KHR ) {
2605+ return ;
2606+ }
2607+
2608+ void_pNext = pSurfaceCapabilities -> pNext ;
2609+ while (void_pNext ) {
2610+ VkBaseOutStructure out_structure = {0 };
2611+ memcpy (& out_structure , void_pNext , sizeof (VkBaseOutStructure ));
2612+ if (out_structure .sType == VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_KHR ) {
2613+ VkSurfacePresentModeCompatibilityKHR * surface_present_mode_compatibility =
2614+ (VkSurfacePresentModeCompatibilityKHR * )void_pNext ;
2615+ if (surface_present_mode_compatibility -> pPresentModes ) {
2616+ if (surface_present_mode_compatibility -> presentModeCount != 0 ) {
2617+ surface_present_mode_compatibility -> pPresentModes [0 ] = present_mode ;
26222618 surface_present_mode_compatibility -> presentModeCount = 1 ;
26232619 }
2624-
2625- } else if (out_structure .sType == VK_STRUCTURE_TYPE_SURFACE_PRESENT_SCALING_CAPABILITIES_EXT ) {
2626- // Because there is no way to fill out the information faithfully, set scaled max/min image extent to the
2627- // surface capabilities max/min extent and the rest to zero.
2628- VkSurfacePresentScalingCapabilitiesEXT * surface_present_scaling_capabilities =
2629- (VkSurfacePresentScalingCapabilitiesEXT * )void_pNext ;
2630- surface_present_scaling_capabilities -> supportedPresentScaling = 0 ;
2631- surface_present_scaling_capabilities -> supportedPresentGravityX = 0 ;
2632- surface_present_scaling_capabilities -> supportedPresentGravityY = 0 ;
2633- surface_present_scaling_capabilities -> maxScaledImageExtent =
2634- pSurfaceCapabilities -> surfaceCapabilities .maxImageExtent ;
2635- surface_present_scaling_capabilities -> minScaledImageExtent =
2636- pSurfaceCapabilities -> surfaceCapabilities .minImageExtent ;
2620+ } else {
2621+ surface_present_mode_compatibility -> presentModeCount = 1 ;
26372622 }
2638- void_pNext = out_structure .pNext ;
2623+
2624+ } else if (out_structure .sType == VK_STRUCTURE_TYPE_SURFACE_PRESENT_SCALING_CAPABILITIES_KHR ) {
2625+ // Because there is no way to fill out the information faithfully, set scaled max/min image extent to the
2626+ // surface capabilities max/min extent and the rest to zero.
2627+ VkSurfacePresentScalingCapabilitiesKHR * surface_present_scaling_capabilities =
2628+ (VkSurfacePresentScalingCapabilitiesKHR * )void_pNext ;
2629+ surface_present_scaling_capabilities -> supportedPresentScaling = 0 ;
2630+ surface_present_scaling_capabilities -> supportedPresentGravityX = 0 ;
2631+ surface_present_scaling_capabilities -> supportedPresentGravityY = 0 ;
2632+ surface_present_scaling_capabilities -> maxScaledImageExtent = pSurfaceCapabilities -> surfaceCapabilities .maxImageExtent ;
2633+ surface_present_scaling_capabilities -> minScaledImageExtent = pSurfaceCapabilities -> surfaceCapabilities .minImageExtent ;
26392634 }
2635+ void_pNext = out_structure .pNext ;
26402636 }
26412637}
26422638
@@ -2684,8 +2680,9 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceCapabilities2K
26842680
26852681 // Because VK_EXT_surface_maintenance1 is an instance extension, applications will use it to query info on drivers which do
26862682 // not support the extension. Thus we need to emulate the driver filling out the structs in that case.
2687- if (!icd_term -> enabled_instance_extensions .ext_surface_maintenance1 ) {
2688- emulate_VK_EXT_surface_maintenance1 (icd_term , pSurfaceInfo , pSurfaceCapabilities );
2683+ if (!icd_term -> enabled_instance_extensions .khr_surface_maintenance1 &&
2684+ !icd_term -> enabled_instance_extensions .ext_surface_maintenance1 ) {
2685+ emulate_VK_KHR_surface_maintenance1 (icd_term , pSurfaceInfo , pSurfaceCapabilities );
26892686 }
26902687
26912688 return res ;
@@ -2708,7 +2705,10 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceCapabilities2K
27082705 VkResult res = icd_term -> dispatch .GetPhysicalDeviceSurfaceCapabilitiesKHR (phys_dev_term -> phys_dev , surface ,
27092706 & pSurfaceCapabilities -> surfaceCapabilities );
27102707
2711- emulate_VK_EXT_surface_maintenance1 (icd_term , pSurfaceInfo , pSurfaceCapabilities );
2708+ if (!icd_term -> enabled_instance_extensions .khr_surface_maintenance1 &&
2709+ !icd_term -> enabled_instance_extensions .ext_surface_maintenance1 ) {
2710+ emulate_VK_KHR_surface_maintenance1 (icd_term , pSurfaceInfo , pSurfaceCapabilities );
2711+ }
27122712 return res ;
27132713 }
27142714}
0 commit comments