mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[dxvk] Add feature check for external semaphores
This commit is contained in:
parent
08424ccb2e
commit
c1cb4d9d18
@ -14,8 +14,25 @@ namespace dxvk {
|
||||
VkExportSemaphoreCreateInfo exportInfo = { VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO };
|
||||
exportInfo.handleTypes = info.sharedType;
|
||||
|
||||
if (info.sharedType != VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM)
|
||||
VkExternalSemaphoreFeatureFlags externalFeatures = 0;
|
||||
|
||||
if (info.sharedType != VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM) {
|
||||
auto vki = device->adapter()->vki();
|
||||
|
||||
VkPhysicalDeviceExternalSemaphoreInfo externalInfo = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO, &typeInfo };
|
||||
externalInfo.handleType = info.sharedType;
|
||||
|
||||
VkExternalSemaphoreProperties externalProperties = { };
|
||||
vki->vkGetPhysicalDeviceExternalSemaphoreProperties(
|
||||
device->adapter()->handle(), &externalInfo, &externalProperties);
|
||||
|
||||
externalFeatures = externalProperties.externalSemaphoreFeatures;
|
||||
|
||||
if (externalFeatures & VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT)
|
||||
typeInfo.pNext = &exportInfo;
|
||||
else
|
||||
Logger::warn(str::format("Exporting semaphores of type ", info.sharedType, " not supported by device"));
|
||||
}
|
||||
|
||||
VkSemaphoreCreateInfo semaphoreInfo = { VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, &typeInfo };
|
||||
|
||||
@ -26,6 +43,7 @@ namespace dxvk {
|
||||
throw DxvkError("Failed to create timeline semaphore");
|
||||
|
||||
if (info.sharedHandle != INVALID_HANDLE_VALUE) {
|
||||
if (externalFeatures & VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT) {
|
||||
VkImportSemaphoreWin32HandleInfoKHR importInfo = { VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR };
|
||||
importInfo.semaphore = m_semaphore;
|
||||
importInfo.handleType = info.sharedType;
|
||||
@ -34,6 +52,9 @@ namespace dxvk {
|
||||
vr = m_vkd->vkImportSemaphoreWin32HandleKHR(m_vkd->device(), &importInfo);
|
||||
if (vr != VK_SUCCESS)
|
||||
throw DxvkError("Failed to import timeline semaphore");
|
||||
} else {
|
||||
Logger::warn(str::format("Importing semaphores of type ", info.sharedType, " not supported by device"));
|
||||
}
|
||||
}
|
||||
|
||||
m_thread = dxvk::thread([this] { run(); });
|
||||
|
@ -85,6 +85,7 @@ namespace dxvk::vk {
|
||||
VULKAN_FN(vkDestroyInstance);
|
||||
VULKAN_FN(vkEnumerateDeviceExtensionProperties);
|
||||
VULKAN_FN(vkEnumeratePhysicalDevices);
|
||||
VULKAN_FN(vkGetPhysicalDeviceExternalSemaphoreProperties);
|
||||
VULKAN_FN(vkGetPhysicalDeviceFeatures);
|
||||
VULKAN_FN(vkGetPhysicalDeviceFeatures2);
|
||||
VULKAN_FN(vkGetPhysicalDeviceFormatProperties);
|
||||
|
Loading…
x
Reference in New Issue
Block a user