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

@@ -33,6 +33,7 @@ pfnclEnqueueAcquireExternalMemObjectsKHR
pfnclEnqueueReleaseExternalMemObjectsKHR
clEnqueueReleaseExternalMemObjectsKHRptr;
pfnclReleaseSemaphoreKHR clReleaseSemaphoreKHRptr;
pfnclGetSemaphoreHandleForTypeKHR clGetSemaphoreHandleForTypeKHRptr;
void init_cl_vk_ext(cl_platform_id opencl_platform)
{
@@ -69,6 +70,15 @@ void init_cl_vk_ext(cl_platform_id opencl_platform)
throw std::runtime_error("Failed to get the function pointer of "
"clCreateSemaphoreWithPropertiesKHRptr!");
}
clGetSemaphoreHandleForTypeKHRptr = (pfnclGetSemaphoreHandleForTypeKHR)
clGetExtensionFunctionAddressForPlatform(
opencl_platform, "clGetSemaphoreHandleForTypeKHR");
if (NULL == clGetSemaphoreHandleForTypeKHRptr)
{
throw std::runtime_error("Failed to get the function pointer of "
"clGetSemaphoreHandleForTypeKHRptr!");
}
}
cl_int setMaxImageDimensions(cl_device_id deviceID, size_t &max_width,
@@ -522,8 +532,8 @@ clExternalMemory::clExternalMemory(const clExternalMemory &externalMemory)
clExternalMemory::clExternalMemory(
const VulkanDeviceMemory *deviceMemory,
VulkanExternalMemoryHandleType externalMemoryHandleType, uint64_t offset,
uint64_t size, cl_context context, cl_device_id deviceId)
VulkanExternalMemoryHandleType externalMemoryHandleType, uint64_t size,
cl_context context, cl_device_id deviceId)
{
int err = 0;
m_externalMemory = NULL;
@@ -548,9 +558,9 @@ clExternalMemory::clExternalMemory(
{
case VULKAN_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD:
#ifdef _WIN32
log_info("Opaque file descriptors are not supported on Windows\n");
ASSERT(0);
#endif
log_info("Opaque file descriptors are not supported on Windows\n");
fd = (int)deviceMemory->getHandle(externalMemoryHandleType);
err = check_external_memory_handle_type(
devList[0], CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR);
@@ -728,56 +738,19 @@ clExternalMemoryImage::clExternalMemoryImage() {}
// clExternalSemaphore implementation //
//////////////////////////////////////////
clExternalSemaphore::clExternalSemaphore(
const clExternalSemaphore &externalSemaphore)
: m_externalSemaphore(externalSemaphore.m_externalSemaphore)
{}
clExternalSemaphore::clExternalSemaphore(
const VulkanSemaphore &semaphore, cl_context context,
VulkanExternalSemaphoreHandleType externalSemaphoreHandleType,
cl_device_id deviceId)
: m_deviceSemaphore(semaphore)
{
cl_int err = 0;
cl_device_id devList[] = { deviceId, NULL };
switch (externalSemaphoreHandleType)
{
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD:
if (!is_extension_available(devList[0],
"cl_khr_external_semaphore_opaque_fd"))
{
throw std::runtime_error("Device does not support "
"cl_khr_external_semaphore_opaque_fd "
"extension \n");
}
break;
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT:
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT:
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT_KMT:
if (!is_extension_available(devList[0],
"cl_khr_external_semaphore_win32"))
{
throw std::runtime_error(
"Device does not support "
"cl_khr_external_semaphore_win32 extension\n");
}
break;
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD:
if (!is_extension_available(devList[0],
"cl_khr_external_semaphore_sync_fd"))
{
throw std::runtime_error(
"Device does not support cl_khr_external_semaphore_sync_fd "
"extension \n");
}
break;
default:
throw std::runtime_error(
"Unsupported external semaphore handle type\n");
break;
}
m_externalHandleType = externalSemaphoreHandleType;
m_externalSemaphore = nullptr;
m_device = deviceId;
m_context = context;
std::vector<cl_semaphore_properties_khr> sema_props{
(cl_semaphore_properties_khr)CL_SEMAPHORE_TYPE_KHR,
@@ -873,16 +846,97 @@ clExternalSemaphore::~clExternalSemaphore() noexcept(false)
}
}
void clExternalSemaphore::signal(cl_command_queue cmd_queue)
int clExternalSemaphore::signal(cl_command_queue cmd_queue)
{
clEnqueueSignalSemaphoresKHRptr(cmd_queue, 1, &m_externalSemaphore, NULL, 0,
NULL, NULL);
int err = clEnqueueSignalSemaphoresKHRptr(
cmd_queue, 1, &m_externalSemaphore, NULL, 0, NULL, nullptr);
if (err != CL_SUCCESS)
{
return err;
}
if (m_externalHandleType == VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD)
{
err = clGetSemaphoreHandleForTypeKHRptr(m_externalSemaphore, m_device,
CL_SEMAPHORE_HANDLE_SYNC_FD_KHR,
sizeof(int), &fd, nullptr);
if (err != CL_SUCCESS)
{
log_error("Failed to export fd from semaphore\n");
return err;
}
VkImportSemaphoreFdInfoKHR import = {};
import.sType = VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR;
import.semaphore = m_deviceSemaphore;
import.fd = fd;
import.pNext = nullptr;
import.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR;
import.flags = 0;
VkResult res =
vkImportSemaphoreFdKHR(m_deviceSemaphore.getDevice(), &import);
ASSERT(res == VK_SUCCESS);
if (res != VK_SUCCESS)
{
err = CL_INVALID_OPERATION;
}
}
return err;
}
void clExternalSemaphore::wait(cl_command_queue cmd_queue)
int clExternalSemaphore::wait(cl_command_queue cmd_queue)
{
clEnqueueWaitSemaphoresKHRptr(cmd_queue, 1, &m_externalSemaphore, NULL, 0,
NULL, NULL);
int err = CL_SUCCESS;
if (m_externalHandleType == VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD)
{
cl_int err = 0;
cl_device_id devList[] = { m_device, NULL };
std::vector<cl_semaphore_properties_khr> sema_props{
(cl_semaphore_properties_khr)CL_SEMAPHORE_TYPE_KHR,
(cl_semaphore_properties_khr)CL_SEMAPHORE_TYPE_BINARY_KHR,
};
fd = (int)m_deviceSemaphore.getHandle(m_externalHandleType);
err = check_external_semaphore_handle_type(
devList[0], CL_SEMAPHORE_HANDLE_SYNC_FD_KHR);
if (CL_SUCCESS != err)
{
log_error("CL_SEMAPHORE_HANDLE_SYNC_FD_KHR not supported\n");
return err;
}
sema_props.push_back(
(cl_semaphore_properties_khr)CL_SEMAPHORE_HANDLE_SYNC_FD_KHR);
sema_props.push_back((cl_semaphore_properties_khr)fd);
sema_props.push_back(0);
if (m_externalSemaphore)
{
err = clReleaseSemaphoreKHRptr(m_externalSemaphore);
if (err != CL_SUCCESS)
{
log_error("Failed to release CL external semaphore\n");
return err;
}
m_externalSemaphore = nullptr;
}
m_externalSemaphore = clCreateSemaphoreWithPropertiesKHRptr(
m_context, sema_props.data(), &err);
if (CL_SUCCESS != err)
{
log_error("clCreateSemaphoreWithPropertiesKHRptr failed with %d\n",
err);
return err;
}
}
err = clEnqueueWaitSemaphoresKHRptr(cmd_queue, 1, &m_externalSemaphore,
NULL, 0, NULL, NULL);
return err;
}
cl_semaphore_khr &clExternalSemaphore::getCLSemaphore()

View File

@@ -50,6 +50,10 @@ typedef cl_int (*pfnclEnqueueReleaseExternalMemObjectsKHR)(
const cl_mem *mem_objects, cl_uint num_events_in_wait_list,
const cl_event *event_wait_list, cl_event *event);
typedef cl_int (*pfnclReleaseSemaphoreKHR)(cl_semaphore_khr sema_object);
typedef cl_int (*pfnclGetSemaphoreHandleForTypeKHR)(
cl_semaphore_khr sema_object, cl_device_id device,
cl_external_semaphore_handle_type_khr handleType, size_t handle_size,
void *handle, size_t *handleSize);
extern pfnclCreateSemaphoreWithPropertiesKHR
clCreateSemaphoreWithPropertiesKHRptr;
@@ -83,8 +87,7 @@ public:
clExternalMemory();
clExternalMemory(const VulkanDeviceMemory *deviceMemory,
VulkanExternalMemoryHandleType externalMemoryHandleType,
uint64_t offset, uint64_t size, cl_context context,
cl_device_id deviceId);
uint64_t size, cl_context context, cl_device_id deviceId);
virtual ~clExternalMemory();
cl_mem getExternalMemoryBuffer();
@@ -111,9 +114,12 @@ public:
class clExternalSemaphore {
protected:
cl_semaphore_khr m_externalSemaphore;
VulkanExternalSemaphoreHandleType m_externalHandleType;
cl_device_id m_device;
cl_context m_context;
const VulkanSemaphore &m_deviceSemaphore;
int fd;
void *handle;
clExternalSemaphore(const clExternalSemaphore &externalSemaphore);
public:
clExternalSemaphore(
@@ -121,8 +127,8 @@ public:
VulkanExternalSemaphoreHandleType externalSemaphoreHandleType,
cl_device_id deviceId);
virtual ~clExternalSemaphore() noexcept(false);
void signal(cl_command_queue command_queue);
void wait(cl_command_queue command_queue);
int signal(cl_command_queue command_queue);
int wait(cl_command_queue command_queue);
cl_semaphore_khr &getCLSemaphore();
// operator openclExternalSemaphore_t() const;
};

View File

@@ -98,8 +98,9 @@
VK_FUNC_DECL(vkGetPhysicalDeviceSurfaceFormatsKHR) \
VK_FUNC_DECL(vkGetPhysicalDeviceSurfacePresentModesKHR) \
VK_FUNC_DECL(vkEnumerateDeviceExtensionProperties) \
VK_FUNC_DECL(vkGetPhysicalDeviceSurfaceSupportKHR)
VK_FUNC_DECL(vkGetPhysicalDeviceSurfaceSupportKHR) \
VK_FUNC_DECL(vkImportSemaphoreFdKHR) \
VK_FUNC_DECL(vkGetPhysicalDeviceExternalSemaphorePropertiesKHR)
#define VK_WINDOWS_FUNC_LIST \
VK_FUNC_DECL(vkGetMemoryWin32HandleKHR) \
VK_FUNC_DECL(vkGetSemaphoreWin32HandleKHR)
@@ -192,7 +193,9 @@
_vkEnumerateDeviceExtensionProperties
#define vkGetPhysicalDeviceSurfaceSupportKHR \
_vkGetPhysicalDeviceSurfaceSupportKHR
#define vkImportSemaphoreFdKHR _vkImportSemaphoreFdKHR
#define vkGetPhysicalDeviceExternalSemaphorePropertiesKHR \
_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR
#define vkGetMemoryWin32HandleKHR _vkGetMemoryWin32HandleKHR
#define vkGetSemaphoreWin32HandleKHR _vkGetSemaphoreWin32HandleKHR

View File

@@ -336,6 +336,8 @@ const VulkanWrapper &
return (m_wrapperList.size() > 0) ? m_wrapperList[idx].get()
: m_constWrapperList[idx].get();
}
throw std::runtime_error("Out of bounds operator access");
}
template <class VulkanWrapper, class VulkanNative>

View File

@@ -24,6 +24,7 @@
#include <algorithm>
#include <CL/cl.h>
#include <CL/cl_ext.h>
#include "deviceInfo.h"
#if defined(_WIN32) || defined(_WIN64)
#include <versionhelpers.h>
#endif
@@ -174,7 +175,7 @@ getVulkanMemoryType(const VulkanDevice &device,
}
}
// CHECK_LT(mtIdx, memoryTypeList.size());
ASSERT(mtIdx < memoryTypeList.size());
return memoryTypeList[mtIdx];
}
@@ -236,30 +237,112 @@ getSupportedVulkanExternalMemoryHandleTypeList()
}
const std::vector<VulkanExternalSemaphoreHandleType>
getSupportedVulkanExternalSemaphoreHandleTypeList()
getSupportedVulkanExternalSemaphoreHandleTypeList(const VulkanDevice &vkDevice)
{
typedef struct
{
const char *extension_name;
VkExternalSemaphoreHandleTypeFlagBits vk_type;
VulkanExternalSemaphoreHandleType enum_type;
} VkSemaphoreHandleMap;
// Add all known handle types, use Vulkan queries to determine what is
// supported.
std::vector<VkSemaphoreHandleMap> all_known_handle_types;
all_known_handle_types.push_back(
{ "VK_KHR_external_semaphore_fd",
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR,
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD });
all_known_handle_types.push_back(
{ "VK_KHR_external_semaphore_fd",
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR,
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD });
all_known_handle_types.push_back(
{ "VK_KHR_external_semaphore_win32",
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR,
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT });
all_known_handle_types.push_back(
{ "VK_KHR_external_semaphore_win32",
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR,
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT });
std::vector<VulkanExternalSemaphoreHandleType>
externalSemaphoreHandleTypeList;
#if _WIN32
if (IsWindows8OrGreater())
for (auto handle_type : all_known_handle_types)
{
externalSemaphoreHandleTypeList.push_back(
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT);
if (!vkDevice.getPhysicalDevice().hasExtension(
handle_type.extension_name))
{
continue;
}
VkPhysicalDeviceExternalSemaphoreInfo handle_query = {
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO, nullptr,
handle_type.vk_type
};
VkExternalSemaphoreProperties query_result = {};
vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(
vkDevice.getPhysicalDevice(), &handle_query, &query_result);
if (query_result.externalSemaphoreFeatures
& (VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT_KHR
| VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT_KHR))
{
externalSemaphoreHandleTypeList.push_back(handle_type.enum_type);
}
}
externalSemaphoreHandleTypeList.push_back(
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT);
#elif defined(__ANDROID__)
externalSemaphoreHandleTypeList.push_back(
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD);
#else
externalSemaphoreHandleTypeList.push_back(
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD);
#endif
return externalSemaphoreHandleTypeList;
}
std::vector<VulkanExternalSemaphoreHandleType>
getSupportedInteropExternalSemaphoreHandleTypes(cl_device_id device,
VulkanDevice &vkDevice)
{
const std::vector<VulkanExternalSemaphoreHandleType>
supportedVkSemaphoreTypes =
getSupportedVulkanExternalSemaphoreHandleTypeList(vkDevice);
std::vector<VulkanExternalSemaphoreHandleType> supportedSemaphoreTypes;
if (is_extension_available(device, "cl_khr_external_semaphore_opaque_fd")
&& std::count(supportedVkSemaphoreTypes.begin(),
supportedVkSemaphoreTypes.end(),
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD))
{
supportedSemaphoreTypes.push_back(
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD);
}
if (is_extension_available(device, "cl_khr_external_semaphore_sync_fd")
&& std::count(supportedVkSemaphoreTypes.begin(),
supportedVkSemaphoreTypes.end(),
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD))
{
supportedSemaphoreTypes.push_back(
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD);
}
if (is_extension_available(device, "cl_khr_external_semaphore_win32")
&& std::count(supportedVkSemaphoreTypes.begin(),
supportedVkSemaphoreTypes.end(),
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT))
{
supportedSemaphoreTypes.push_back(
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT);
}
if (is_extension_available(device, "cl_khr_external_semaphore_win32")
&& std::count(supportedVkSemaphoreTypes.begin(),
supportedVkSemaphoreTypes.end(),
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT))
{
supportedSemaphoreTypes.push_back(
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT);
}
return supportedSemaphoreTypes;
}
const std::vector<VulkanFormat> getSupportedVulkanFormatList()
{
std::vector<VulkanFormat> formatList;
@@ -498,7 +581,6 @@ cl_external_semaphore_handle_type_khr getCLSemaphoreTypeFromVulkanType(
clExternalSemaphoreHandleTypeKhr =
CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR;
break;
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT_KMT:
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT:
clExternalSemaphoreHandleTypeKhr =
CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR;
@@ -631,8 +713,8 @@ operator<<(std::ostream &os,
return os << "Opaque NT handle";
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT:
return os << "Opaque D3DKMT handle";
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT_KMT:
return os << "Opaque NT and D3DKMT handle";
case VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD:
return os << "Sync fd semaphore handle";
}
return os;

View File

@@ -46,7 +46,10 @@ getDefaultVulkanQueueFamilyToQueueCountMap();
const std::vector<VulkanExternalMemoryHandleType>
getSupportedVulkanExternalMemoryHandleTypeList();
const std::vector<VulkanExternalSemaphoreHandleType>
getSupportedVulkanExternalSemaphoreHandleTypeList();
getSupportedVulkanExternalSemaphoreHandleTypeList(const VulkanDevice& vkDevice);
std::vector<VulkanExternalSemaphoreHandleType>
getSupportedInteropExternalSemaphoreHandleTypes(cl_device_id device,
VulkanDevice& vkDevice);
const std::vector<VulkanFormat> getSupportedVulkanFormatList();
uint32_t getVulkanFormatElementSize(VulkanFormat format);

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

View File

@@ -53,12 +53,15 @@ protected:
VulkanQueueFamilyList m_queueFamilyList;
VulkanMemoryHeapList m_memoryHeapList;
VulkanMemoryTypeList m_memoryTypeList;
std::vector<VkExtensionProperties> m_extensions;
VulkanPhysicalDevice(const VulkanPhysicalDevice &physicalDevice);
VulkanPhysicalDevice(VkPhysicalDevice vkPhysicalDevice);
virtual ~VulkanPhysicalDevice();
public:
bool hasExtension(const char *extension_name) const;
const VulkanQueueFamilyList &getQueueFamilyList() const;
const VulkanMemoryHeapList &getMemoryHeapList() const;
const VulkanMemoryTypeList &getMemoryTypeList() const;
@@ -537,6 +540,7 @@ protected:
uint64_t m_size;
bool m_isDedicated;
VulkanDeviceMemory(const VulkanDeviceMemory &deviceMemory);
public:
@@ -588,6 +592,7 @@ public:
VulkanExternalSemaphoreHandleType externalSemaphoreHandleType =
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_NONE,
const std::wstring name = L"");
const VulkanDevice &getDevice() const;
virtual ~VulkanSemaphore();
#ifdef _WIN32
HANDLE getHandle(

View File

@@ -167,9 +167,6 @@ enum VulkanExternalSemaphoreHandleType
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR,
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT =
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR,
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_NT_KMT =
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR
| VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR,
VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD =
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR
};