Skip to content

Commit

Permalink
remove removed external memory and semaphore extensions (KhronosGroup…
Browse files Browse the repository at this point in the history
…#295)

* add include guards around external memory handle types

* remove removed external memory and semaphore extensions

* fix one more leftover dx fence code snip
  • Loading branch information
bashbaug authored Jun 26, 2024
1 parent 4cda222 commit 3f452e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 40 deletions.
29 changes: 9 additions & 20 deletions include/CL/opencl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1561,9 +1561,6 @@ inline cl_int getInfoHelper(Func f, cl_uint name, T* param, int, typename T::cl_
F(cl_device_info, CL_DEVICE_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR, cl::vector<cl_external_semaphore_handle_type_khr>) \
F(cl_semaphore_info_khr, CL_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR, cl::vector<cl_external_semaphore_handle_type_khr>) \

#define CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_DX_FENCE_EXT(F) \
F(cl_external_semaphore_handle_type_khr, CL_SEMAPHORE_HANDLE_D3D12_FENCE_KHR, void*) \

#define CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_OPAQUE_FD_EXT(F) \
F(cl_external_semaphore_handle_type_khr, CL_SEMAPHORE_HANDLE_OPAQUE_FD_KHR, int) \

Expand Down Expand Up @@ -1700,9 +1697,6 @@ CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_MEMORY_(CL_HPP_DECLARE_PARAM_TRAITS_)
CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_(CL_HPP_DECLARE_PARAM_TRAITS_)
#endif // cl_khr_external_semaphore

#if defined(cl_khr_external_semaphore_dx_fence)
CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_DX_FENCE_EXT(CL_HPP_DECLARE_PARAM_TRAITS_)
#endif // cl_khr_external_semaphore_dx_fence
#if defined(cl_khr_external_semaphore_opaque_fd)
CL_HPP_PARAM_NAME_CL_KHR_EXTERNAL_SEMAPHORE_OPAQUE_FD_EXT(CL_HPP_DECLARE_PARAM_TRAITS_)
#endif // cl_khr_external_semaphore_opaque_fd
Expand Down Expand Up @@ -7190,20 +7184,18 @@ inline Kernel::Kernel(const Program& program, const char* name, cl_int* err)
enum class ExternalMemoryType : cl_external_memory_handle_type_khr
{
None = 0,

#ifdef cl_khr_external_memory_opaque_fd
OpaqueFd = CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR,
#endif // cl_khr_external_memory_opaque_fd
#ifdef cl_khr_external_memory_win32
OpaqueWin32 = CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KHR,
OpaqueWin32Kmt = CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KMT_KHR,

D3D11Texture = CL_EXTERNAL_MEMORY_HANDLE_D3D11_TEXTURE_KHR,
D3D11TextureKmt = CL_EXTERNAL_MEMORY_HANDLE_D3D11_TEXTURE_KMT_KHR,

D3D12Heap = CL_EXTERNAL_MEMORY_HANDLE_D3D12_HEAP_KHR,
D3D12Resource = CL_EXTERNAL_MEMORY_HANDLE_D3D12_RESOURCE_KHR,

#endif // cl_khr_external_memory_win32
#ifdef cl_khr_external_memory_dma_buf
DmaBuf = CL_EXTERNAL_MEMORY_HANDLE_DMA_BUF_KHR,
#endif // cl_khr_external_memory_dma_buf
};
#endif
#endif // cl_khr_external_memory

enum class QueueProperties : cl_command_queue_properties
{
Expand Down Expand Up @@ -10906,15 +10898,12 @@ namespace compatibility {
enum ExternalSemaphoreType : cl_external_semaphore_handle_type_khr
{
None = 0,
#ifdef cl_khr_external_semaphore_dx_fence
D3D12Fence = CL_SEMAPHORE_HANDLE_D3D12_FENCE_KHR,
#endif
#ifdef cl_khr_external_semaphore_opaque_fd
OpaqueFd = CL_SEMAPHORE_HANDLE_OPAQUE_FD_KHR,
#endif
#endif // cl_khr_external_semaphore_opaque_fd
#ifdef cl_khr_external_semaphore_sync_fd
SyncFd = CL_SEMAPHORE_HANDLE_SYNC_FD_KHR,
#endif
#endif // cl_khr_external_semaphore_sync_fd
#ifdef cl_khr_external_semaphore_win32
OpaqueWin32 = CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR,
OpaqueWin32Kmt = CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR,
Expand Down
20 changes: 0 additions & 20 deletions tests/test_openclhpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4594,20 +4594,6 @@ static cl_int clGetSemaphoreHandleForTypeKHR_GetHandles(
(void) num_calls;

switch (handle_type) {
#if defined(cl_khr_external_semaphore_dx_fence)
case CL_SEMAPHORE_HANDLE_D3D12_FENCE_KHR:
{
void* ret = make_external_semaphore_handle(handle_type);
if (handle_size == sizeof(ret) && handle_ptr) {
void** pHandle = static_cast<void**>(handle_ptr);
*pHandle = ret;
}
if (handle_size_ret) {
*handle_size_ret = sizeof(ret);
}
return CL_SUCCESS;
}
#endif
#if defined(cl_khr_external_semaphore_win32)
case CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR:
case CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR:
Expand Down Expand Up @@ -4668,12 +4654,6 @@ void testTemplateGetSemaphoreHandleForTypeKHR(void)
clGetSemaphoreHandleForTypeKHR_StubWithCallback(clGetSemaphoreHandleForTypeKHR_GetHandles);

cl::Semaphore semaphore;
#if defined(cl_khr_external_semaphore_dx_fence)
{
auto handle0 = semaphore.getHandleForTypeKHR<cl::ExternalSemaphoreType::D3D12Fence>(device);
TEST_ASSERT_EQUAL(handle0, make_external_semaphore_handle(cl::ExternalSemaphoreType::D3D12Fence));
}
#endif
#if defined(cl_khr_external_semaphore_opaque_fd)
{
auto fd0 = semaphore.getHandleForTypeKHR<cl::ExternalSemaphoreType::OpaqueFd>(device);
Expand Down

0 comments on commit 3f452e6

Please sign in to comment.