| 3608 | #if defined(VK_USE_PLATFORM_DISPLAY_KHR) |
| 3609 | |
| 3610 | vk::Result Demo::create_display_surface() { |
| 3611 | auto display_properties_return = gpu.getDisplayPropertiesKHR(); |
| 3612 | VERIFY((display_properties_return.result == vk::Result::eSuccess) || |
| 3613 | (display_properties_return.result == vk::Result::eIncomplete)); |
| 3614 | |
| 3615 | auto display = display_properties_return.value.at(0).display; |
| 3616 | |
| 3617 | auto display_mode_props_return = gpu.getDisplayModePropertiesKHR(display); |
| 3618 | VERIFY(display_mode_props_return.result == vk::Result::eSuccess); |
| 3619 | |
| 3620 | if (display_mode_props_return.value.size() == 0) { |
| 3621 | printf("Cannot find any mode for the display!\n"); |
| 3622 | fflush(stdout); |
| 3623 | exit(1); |
| 3624 | } |
| 3625 | auto display_mode_prop = display_mode_props_return.value.at(0); |
| 3626 | |
| 3627 | // Get the list of planes |
| 3628 | auto display_plane_props_return = gpu.getDisplayPlanePropertiesKHR(); |
| 3629 | VERIFY(display_plane_props_return.result == vk::Result::eSuccess); |
| 3630 | |
| 3631 | if (display_plane_props_return.value.size() == 0) { |
| 3632 | printf("Cannot find any plane!\n"); |
| 3633 | fflush(stdout); |
| 3634 | exit(1); |
| 3635 | } |
| 3636 | auto display_plane_props = display_plane_props_return.value; |
| 3637 | |
| 3638 | vk::Bool32 found_plane = VK_FALSE; |
| 3639 | uint32_t plane_found = 0; |
| 3640 | // Find a plane compatible with the display |
| 3641 | for (uint32_t plane_index = 0; plane_index < display_plane_props.size(); plane_index++) { |
| 3642 | // Disqualify planes that are bound to a different display |
| 3643 | if (display_plane_props[plane_index].currentDisplay && (display_plane_props[plane_index].currentDisplay != display)) { |
| 3644 | continue; |
| 3645 | } |
| 3646 | |
| 3647 | auto display_plane_supported_displays_return = gpu.getDisplayPlaneSupportedDisplaysKHR(plane_index); |
| 3648 | VERIFY(display_plane_supported_displays_return.result == vk::Result::eSuccess); |
| 3649 | |
| 3650 | if (display_plane_supported_displays_return.value.size() == 0) { |
| 3651 | continue; |
| 3652 | } |
| 3653 | |
| 3654 | for (const auto &supported_display : display_plane_supported_displays_return.value) { |
| 3655 | if (supported_display == display) { |
| 3656 | found_plane = VK_TRUE; |
| 3657 | plane_found = plane_index; |
| 3658 | break; |
| 3659 | } |
| 3660 | } |
| 3661 | |
| 3662 | if (found_plane) { |
| 3663 | break; |
| 3664 | } |
| 3665 | } |
| 3666 | |
| 3667 | if (!found_plane) { |
nothing calls this directly
no outgoing calls
no test coverage detected