mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14: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 };
|
VkExportSemaphoreCreateInfo exportInfo = { VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO };
|
||||||
exportInfo.handleTypes = info.sharedType;
|
exportInfo.handleTypes = info.sharedType;
|
||||||
|
|
||||||
if (info.sharedType != VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM)
|
VkExternalSemaphoreFeatureFlags externalFeatures = 0;
|
||||||
typeInfo.pNext = &exportInfo;
|
|
||||||
|
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 };
|
VkSemaphoreCreateInfo semaphoreInfo = { VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, &typeInfo };
|
||||||
|
|
||||||
@ -26,14 +43,18 @@ namespace dxvk {
|
|||||||
throw DxvkError("Failed to create timeline semaphore");
|
throw DxvkError("Failed to create timeline semaphore");
|
||||||
|
|
||||||
if (info.sharedHandle != INVALID_HANDLE_VALUE) {
|
if (info.sharedHandle != INVALID_HANDLE_VALUE) {
|
||||||
VkImportSemaphoreWin32HandleInfoKHR importInfo = { VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR };
|
if (externalFeatures & VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT) {
|
||||||
importInfo.semaphore = m_semaphore;
|
VkImportSemaphoreWin32HandleInfoKHR importInfo = { VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR };
|
||||||
importInfo.handleType = info.sharedType;
|
importInfo.semaphore = m_semaphore;
|
||||||
importInfo.handle = info.sharedHandle;
|
importInfo.handleType = info.sharedType;
|
||||||
|
importInfo.handle = info.sharedHandle;
|
||||||
|
|
||||||
vr = m_vkd->vkImportSemaphoreWin32HandleKHR(m_vkd->device(), &importInfo);
|
vr = m_vkd->vkImportSemaphoreWin32HandleKHR(m_vkd->device(), &importInfo);
|
||||||
if (vr != VK_SUCCESS)
|
if (vr != VK_SUCCESS)
|
||||||
throw DxvkError("Failed to import timeline semaphore");
|
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(); });
|
m_thread = dxvk::thread([this] { run(); });
|
||||||
|
@ -85,6 +85,7 @@ namespace dxvk::vk {
|
|||||||
VULKAN_FN(vkDestroyInstance);
|
VULKAN_FN(vkDestroyInstance);
|
||||||
VULKAN_FN(vkEnumerateDeviceExtensionProperties);
|
VULKAN_FN(vkEnumerateDeviceExtensionProperties);
|
||||||
VULKAN_FN(vkEnumeratePhysicalDevices);
|
VULKAN_FN(vkEnumeratePhysicalDevices);
|
||||||
|
VULKAN_FN(vkGetPhysicalDeviceExternalSemaphoreProperties);
|
||||||
VULKAN_FN(vkGetPhysicalDeviceFeatures);
|
VULKAN_FN(vkGetPhysicalDeviceFeatures);
|
||||||
VULKAN_FN(vkGetPhysicalDeviceFeatures2);
|
VULKAN_FN(vkGetPhysicalDeviceFeatures2);
|
||||||
VULKAN_FN(vkGetPhysicalDeviceFormatProperties);
|
VULKAN_FN(vkGetPhysicalDeviceFormatProperties);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user