Skip to content

Commit 0961a5a

Browse files
moved Semaphore to khr namespace
1 parent 5692dd9 commit 0961a5a

2 files changed

Lines changed: 18 additions & 12 deletions

File tree

include/CL/opencl.hpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,9 @@ namespace cl {
729729
class Buffer;
730730
class Pipe;
731731
#ifdef cl_khr_semaphore
732+
namespace khr{
732733
class Semaphore;
734+
}
733735
#endif
734736
#if defined(cl_khr_command_buffer)
735737
namespace khr {
@@ -9178,13 +9180,13 @@ typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueReleaseD3D10ObjectsKHR)(
91789180

91799181
#ifdef cl_khr_semaphore
91809182
cl_int enqueueWaitSemaphores(
9181-
const vector<Semaphore> &sema_objects,
9183+
const vector<khr::Semaphore> &sema_objects,
91829184
const vector<cl_semaphore_payload_khr> &sema_payloads = {},
91839185
const vector<Event>* events_wait_list = nullptr,
91849186
Event *event = nullptr) const;
91859187

91869188
cl_int enqueueSignalSemaphores(
9187-
const vector<Semaphore> &sema_objects,
9189+
const vector<khr::Semaphore> &sema_objects,
91889190
const vector<cl_semaphore_payload_khr>& sema_payloads = {},
91899191
const vector<Event>* events_wait_list = nullptr,
91909192
Event* event = nullptr);
@@ -10775,6 +10777,7 @@ enum ExternalSemaphoreType : cl_external_semaphore_handle_type_khr
1077510777
};
1077610778
#endif // cl_khr_external_semaphore
1077710779

10780+
namespace khr {
1077810781
class Semaphore : public detail::Wrapper<cl_semaphore_khr>
1077910782
{
1078010783
public:
@@ -10931,11 +10934,12 @@ class Semaphore : public detail::Wrapper<cl_semaphore_khr>
1093110934
}
1093210935

1093310936
};
10937+
} // namespace khr
1093410938

10935-
CL_HPP_DEFINE_STATIC_MEMBER_ std::once_flag Semaphore::ext_init_;
10939+
CL_HPP_DEFINE_STATIC_MEMBER_ std::once_flag khr::Semaphore::ext_init_;
1093610940

1093710941
inline cl_int CommandQueue::enqueueWaitSemaphores(
10938-
const vector<Semaphore> &sema_objects,
10942+
const vector<khr::Semaphore> &sema_objects,
1093910943
const vector<cl_semaphore_payload_khr> &sema_payloads,
1094010944
const vector<Event>* events_wait_list,
1094110945
Event *event) const
@@ -10963,7 +10967,7 @@ inline cl_int CommandQueue::enqueueWaitSemaphores(
1096310967
}
1096410968

1096510969
inline cl_int CommandQueue::enqueueSignalSemaphores(
10966-
const vector<Semaphore> &sema_objects,
10970+
const vector<khr::Semaphore> &sema_objects,
1096710971
const vector<cl_semaphore_payload_khr>& sema_payloads,
1096810972
const vector<Event>* events_wait_list,
1096910973
Event* event)

tests/test_openclhpp.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static cl::Program programPool[POOL_MAX];
8686
static cl::khr::CommandBuffer commandBufferKhrPool[POOL_MAX];
8787
#endif
8888
#if defined(cl_khr_semaphore)
89-
static cl::Semaphore semaphorePool[POOL_MAX];
89+
static cl::khr::Semaphore semaphorePool[POOL_MAX];
9090
#endif
9191
static cl::Device devicePool[POOL_MAX];
9292

@@ -3633,15 +3633,17 @@ void testDevice_GetInfo_CLDeviceName()
36333633
}
36343634

36353635
/****************************************************************************
3636-
* Tests for cl::Semaphore
3636+
* Tests for cl::khr::Semaphore
36373637
****************************************************************************/
36383638
#if defined(cl_khr_semaphore)
36393639
void testMoveAssignSemaphoreNonNull(void);
36403640
void testMoveAssignSemaphoreNull(void);
36413641
void testMoveConstructSemaphoreNonNull(void);
36423642
void testMoveConstructSemaphoreNull(void);
36433643
namespace cl{
3644-
MAKE_MOVE_TESTS(Semaphore, make_semaphore_khr, clReleaseSemaphoreKHR, semaphorePool);
3644+
namespace khr{
3645+
MAKE_MOVE_TESTS(Semaphore, make_semaphore_khr, clReleaseSemaphoreKHR, semaphorePool);
3646+
}
36453647
}
36463648
#else
36473649
void testMoveAssignSemaphoreNonNull(void) {}
@@ -3682,7 +3684,7 @@ void testEnqueueWaitSemaphores(void)
36823684
{
36833685
clEnqueueWaitSemaphoresKHR_StubWithCallback(clEnqueueWaitSemaphoresKHR_testEnqueueWaitSemaphores);
36843686

3685-
VECTOR_CLASS<cl::Semaphore> sema_objects;
3687+
VECTOR_CLASS<cl::khr::Semaphore> sema_objects;
36863688
sema_objects.emplace_back(make_semaphore_khr(1));
36873689
VECTOR_CLASS<cl_semaphore_payload_khr> sema_payloads(1);
36883690
cl::Event event;
@@ -3727,7 +3729,7 @@ void testEnqueueSignalSemaphores(void)
37273729
{
37283730
clEnqueueSignalSemaphoresKHR_StubWithCallback(clEnqueueSignalSemaphoresKHR_testEnqueueSignalSemaphores);
37293731

3730-
VECTOR_CLASS<cl::Semaphore> sema_objects;
3732+
VECTOR_CLASS<cl::khr::Semaphore> sema_objects;
37313733
sema_objects.emplace_back(make_semaphore_khr(2));
37323734
VECTOR_CLASS<cl_semaphore_payload_khr> sema_payloads(1);
37333735
cl::Event event;
@@ -3770,7 +3772,7 @@ void testSemaphoreWithProperties(void)
37703772

37713773
VECTOR_CLASS<cl_semaphore_properties_khr> sema_props{CL_SEMAPHORE_TYPE_KHR};
37723774
cl_int err = CL_INVALID_OPERATION;
3773-
cl::Semaphore sem(contextPool[0], sema_props, &err);
3775+
cl::khr::Semaphore sem(contextPool[0], sema_props, &err);
37743776

37753777
TEST_ASSERT_EQUAL(CL_SUCCESS, err);
37763778
TEST_ASSERT_EQUAL_PTR(make_semaphore_khr(1), sem());
@@ -4118,7 +4120,7 @@ void testTemplateGetSemaphoreHandleForTypeKHR()
41184120

41194121
clGetSemaphoreHandleForTypeKHR_StubWithCallback(clGetSemaphoreHandleForTypeKHR_GetHandles);
41204122

4121-
cl::Semaphore semaphore;
4123+
cl::khr::Semaphore semaphore;
41224124
#if defined(cl_khr_external_semaphore_dx_fence)
41234125
{
41244126
auto handle0 = semaphore.getHandleForTypeKHR<cl::ExternalSemaphoreType::D3D12Fence>(device);

0 commit comments

Comments
 (0)