Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions samples/api/hello_triangle_1_3/hello_triangle_1_3.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2024, Huawei Technologies Co., Ltd.
/* Copyright (c) 2024-2025, Huawei Technologies Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -165,6 +165,18 @@ void HelloTriangleV13::init_instance()
}
#endif

#if (defined(VKB_ENABLE_PORTABILITY))
required_instance_extensions.push_back(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME);
bool portability_enumeration_available = false;
if (std::any_of(available_instance_extensions.begin(),
available_instance_extensions.end(),
[](VkExtensionProperties const &extension) { return strcmp(extension.extensionName, VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME) == 0; }))
{
required_instance_extensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME);
portability_enumeration_available = true;
}
#endif

#if defined(VK_USE_PLATFORM_ANDROID_KHR)
required_instance_extensions.push_back(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME);
#elif defined(VK_USE_PLATFORM_WIN32_KHR)
Expand Down Expand Up @@ -241,6 +253,13 @@ void HelloTriangleV13::init_instance()
}
#endif

#if (defined(VKB_ENABLE_PORTABILITY))
if (portability_enumeration_available)
{
instance_info.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
}
#endif

// Create the Vulkan instance
VK_CHECK(vkCreateInstance(&instance_info, nullptr, &context.instance));

Expand Down Expand Up @@ -1146,7 +1165,10 @@ void HelloTriangleV13::transition_image_layout(
HelloTriangleV13::~HelloTriangleV13()
{
// Don't release anything until the GPU is completely idle.
vkDeviceWaitIdle(context.device);
if (context.device != VK_NULL_HANDLE)
{
vkDeviceWaitIdle(context.device);
}

for (auto &per_frame : context.per_frame)
{
Expand Down
Loading