Skip to content

Commit 3fa07b9

Browse files
authored
add APIs for semaphores, external semaphores, and external memory (#4)
1 parent b5a457c commit 3fa07b9

File tree

4 files changed

+428
-0
lines changed

4 files changed

+428
-0
lines changed

scripts/call_all.c.mako

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ defaultValueForType = {
2525
'cl_platform_id' : 'NULL',
2626
'cl_program' : 'NULL',
2727
'cl_sampler' : 'NULL',
28+
'cl_semaphore_khr' : 'NULL',
2829
'CLeglDisplayKHR' : 'NULL',
2930
'CLeglImageKHR' : 'NULL',
3031
'CLeglSyncKHR' : 'NULL',
@@ -45,6 +46,7 @@ defaultValueForType = {
4546
'cl_dx9_device_set_intel' : 'CL_ALL_DEVICES_FOR_DX9_INTEL',
4647
'cl_dx9_media_adapter_set_khr' : 'CL_ALL_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR',
4748
'cl_dx9_media_adapter_type_khr' : 'CL_ADAPTER_D3D9_KHR',
49+
'cl_external_semaphore_handle_type_khr' : '0',
4850
'cl_image_pitch_info_qcom' : 'CL_IMAGE_ROW_ALIGNMENT_QCOM',
4951
'cl_kernel_exec_info_arm' : 'CL_KERNEL_EXEC_INFO_SVM_PTRS_ARM',
5052
'cl_kernel_sub_group_info' : 'CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR',
@@ -56,6 +58,7 @@ defaultValueForType = {
5658
'cl_mem_migration_flags_ext' : 'CL_MIGRATE_MEM_OBJECT_HOST_EXT',
5759
'cl_mem_object_type' : 'CL_MEM_OBJECT_IMAGE2D',
5860
'cl_mipmap_filter_mode_img' : 'CL_MIPMAP_FILTER_ANY_IMG',
61+
'cl_semaphore_info_khr' : 'CL_SEMAPHORE_CONTEXT_KHR',
5962
'cl_svm_mem_flags_arm' : 'CL_MEM_SVM_FINE_GRAIN_BUFFER_ARM',
6063
'cl_va_api_device_source_intel' : 'CL_VA_API_DISPLAY_INTEL',
6164
'cl_va_api_device_set_intel' : 'CL_ALL_DEVICES_FOR_VA_API_INTEL',

scripts/openclext.cpp.mako

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,24 @@ static inline cl_platform_id _get_platform(cl_mem memobj)
262262
return _get_platform(context);
263263
}
264264

265+
#if defined(cl_khr_semaphore)
266+
267+
static inline cl_platform_id _get_platform(cl_semaphore_khr semaphore)
268+
{
269+
if (semaphore == NULL) return NULL;
270+
271+
cl_context context = NULL;
272+
clGetSemaphoreInfoKHR(
273+
semaphore,
274+
CL_SEMAPHORE_CONTEXT_KHR,
275+
sizeof(context),
276+
&context,
277+
NULL);
278+
return _get_platform(context);
279+
}
280+
281+
#endif // defined(cl_khr_semaphore)
282+
265283
#if defined(cl_intel_accelerator)
266284

267285
static inline cl_platform_id _get_platform(cl_accelerator_intel accelerator)

0 commit comments

Comments
 (0)