Refactor external semaphore scaffolding (#2300)

Remove the `CREATE_OPENCL_SEMAPHORE` macro and use derived class
instantiations of the `clExternalSemaphore` class, rather than base
pointers to derived class objects.

Remove the default argument for `queryParamName` in
`check_external_semaphore_handle_type()`.

Move `check_external_semaphore_handle_type()` checks to constructors of
`clExternalImportableSemaphore` and `clExternalExportableSemaphore`,
rather than manually making the check before creating an external
semaphore.

---------

Signed-off-by: Gorazd Sumkovski <gorazd.sumkovski@arm.com>
Co-authored-by: Kévin Petit <kpet@free.fr>
Co-authored-by: Kevin Petit <kevin.petit@arm.com>
This commit is contained in:
gorazd-sumkovski-arm
2025-04-16 04:41:38 +01:00
committed by GitHub
parent 4ce3d8968a
commit 33846e6673
6 changed files with 148 additions and 189 deletions

View File

@@ -254,13 +254,14 @@ int run_test_with_two_queue(
VulkanSemaphore vkVk2CLSemaphore(vkDevice, vkExternalSemaphoreHandleType);
VulkanSemaphore vkCl2VkSemaphore(vkDevice, vkExternalSemaphoreHandleType);
clExternalSemaphore *clVk2CLExternalSemaphore = NULL;
clExternalSemaphore *clCl2VkExternalSemaphore = NULL;
clExternalImportableSemaphore *clVk2CLExternalSemaphore = nullptr;
clExternalExportableSemaphore *clCl2VkExternalSemaphore = nullptr;
CREATE_OPENCL_SEMAPHORE(clVk2CLExternalSemaphore, vkVk2CLSemaphore, context,
vkExternalSemaphoreHandleType, deviceId, false);
CREATE_OPENCL_SEMAPHORE(clCl2VkExternalSemaphore, vkCl2VkSemaphore, context,
vkExternalSemaphoreHandleType, deviceId, true);
clVk2CLExternalSemaphore = new clExternalImportableSemaphore(
vkVk2CLSemaphore, context, vkExternalSemaphoreHandleType, deviceId);
clCl2VkExternalSemaphore = new clExternalExportableSemaphore(
vkCl2VkSemaphore, context, vkExternalSemaphoreHandleType, deviceId);
std::vector<VulkanDeviceMemory *> vkImage2DListDeviceMemory1;
std::vector<VulkanDeviceMemory *> vkImage2DListDeviceMemory2;
@@ -873,13 +874,14 @@ int run_test_with_one_queue(
VulkanSemaphore vkVk2CLSemaphore(vkDevice, vkExternalSemaphoreHandleType);
VulkanSemaphore vkCl2VkSemaphore(vkDevice, vkExternalSemaphoreHandleType);
clExternalSemaphore *clVk2CLExternalSemaphore = NULL;
clExternalSemaphore *clCl2VkExternalSemaphore = NULL;
clExternalImportableSemaphore *clVk2CLExternalSemaphore = nullptr;
clExternalExportableSemaphore *clCl2VkExternalSemaphore = nullptr;
CREATE_OPENCL_SEMAPHORE(clVk2CLExternalSemaphore, vkVk2CLSemaphore, context,
vkExternalSemaphoreHandleType, deviceId, false);
CREATE_OPENCL_SEMAPHORE(clCl2VkExternalSemaphore, vkCl2VkSemaphore, context,
vkExternalSemaphoreHandleType, deviceId, true);
clVk2CLExternalSemaphore = new clExternalImportableSemaphore(
vkVk2CLSemaphore, context, vkExternalSemaphoreHandleType, deviceId);
clCl2VkExternalSemaphore = new clExternalExportableSemaphore(
vkCl2VkSemaphore, context, vkExternalSemaphoreHandleType, deviceId);
std::vector<VulkanDeviceMemory *> vkImage2DListDeviceMemory1;
std::vector<VulkanDeviceMemory *> vkImage2DListDeviceMemory2;