Semaphore types bug fixes revised (#1822)

* Added support for SYNC_FD and other handle types

* Fix consistency test

Deleted test cases that are no longer testable
according to the spec.

* Fix multi-import tests

-Delete obsolete code relating to offsets
-Propagate dedicated memory change

* Fix error handling

Some subtests did not fail on incorrect result.
Changes to macros to fail, so this does not occur
again.

* Delete invalid test cases

Test cases are not related to this extension.

* External memory test

Add support for any handle type supported by
the platform.

Change-Id: I6765fde5e7929988f49bfbf2df2f41d5263b6abc

* Update multi-import tests to use new semaphore types

* Fix formatting

* Addressed review comments. Deleted VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT_KMT as it appears to be redundant.
This commit is contained in:
joshqti
2023-11-29 02:32:59 -08:00
committed by GitHub
parent 5815e2ce33
commit f5bd92b83e
16 changed files with 1542 additions and 1451 deletions

View File

@@ -335,6 +335,16 @@ VulkanPhysicalDevice::VulkanPhysicalDevice(VkPhysicalDevice vkPhysicalDevice)
memoryHeap);
m_memoryTypeList.add(*memoryType);
}
uint32_t num_extensions = 0;
vkEnumerateDeviceExtensionProperties(m_vkPhysicalDevice, nullptr,
&num_extensions, nullptr);
if (num_extensions)
{
m_extensions.resize(num_extensions);
vkEnumerateDeviceExtensionProperties(
m_vkPhysicalDevice, nullptr, &num_extensions, m_extensions.data());
}
}
VulkanPhysicalDevice::~VulkanPhysicalDevice()
@@ -388,6 +398,18 @@ VulkanPhysicalDevice::operator VkPhysicalDevice() const
return m_vkPhysicalDevice;
}
bool VulkanPhysicalDevice::hasExtension(const char *extension_name) const
{
for (const auto &m_extension : m_extensions)
{
if (!strcmp(m_extension.extensionName, extension_name))
{
return true;
}
}
return false;
}
bool operator<(const VulkanQueueFamily &queueFamilyA,
const VulkanQueueFamily &queueFamilyB)
{
@@ -2256,6 +2278,8 @@ VulkanSemaphore::VulkanSemaphore(
vkCreateSemaphore(m_device, &vkSemaphoreCreateInfo, NULL, &m_vkSemaphore);
}
const VulkanDevice &VulkanSemaphore::getDevice() const { return m_device; }
VulkanSemaphore::~VulkanSemaphore()
{
vkDestroySemaphore(m_device, m_vkSemaphore, NULL);
@@ -2301,6 +2325,23 @@ int VulkanSemaphore::getHandle(
return fd;
}
else if (externalSemaphoreHandleType
== VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD)
{
int fd;
VkSemaphoreGetFdInfoKHR vkSemaphoreGetFdInfoKHR = {};
vkSemaphoreGetFdInfoKHR.sType =
VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR;
vkSemaphoreGetFdInfoKHR.pNext = NULL;
vkSemaphoreGetFdInfoKHR.semaphore = m_vkSemaphore;
vkSemaphoreGetFdInfoKHR.handleType =
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR;
vkGetSemaphoreFdKHR(m_device, &vkSemaphoreGetFdInfoKHR, &fd);
return fd;
}
return HANDLE_ERROR;
}
#endif