This commit is contained in:
iceman1001 2024-04-07 11:38:51 +02:00
commit 4e540053e9
28 changed files with 2007 additions and 2066 deletions

File diff suppressed because it is too large Load diff

View file

@ -101,11 +101,11 @@ typedef cl_int CL_API_CALL
clGetDeviceIDsFromD3D10KHR_t(
cl_platform_id platform,
cl_d3d10_device_source_khr d3d_device_source,
void* d3d_object,
void *d3d_object,
cl_d3d10_device_set_khr d3d_device_set,
cl_uint num_entries,
cl_device_id* devices,
cl_uint* num_devices);
cl_device_id *devices,
cl_uint *num_devices);
typedef clGetDeviceIDsFromD3D10KHR_t *
clGetDeviceIDsFromD3D10KHR_fn CL_API_SUFFIX__VERSION_1_0;
@ -114,8 +114,8 @@ typedef cl_mem CL_API_CALL
clCreateFromD3D10BufferKHR_t(
cl_context context,
cl_mem_flags flags,
ID3D10Buffer* resource,
cl_int* errcode_ret);
ID3D10Buffer *resource,
cl_int *errcode_ret);
typedef clCreateFromD3D10BufferKHR_t *
clCreateFromD3D10BufferKHR_fn CL_API_SUFFIX__VERSION_1_0;
@ -124,9 +124,9 @@ typedef cl_mem CL_API_CALL
clCreateFromD3D10Texture2DKHR_t(
cl_context context,
cl_mem_flags flags,
ID3D10Texture2D* resource,
ID3D10Texture2D *resource,
UINT subresource,
cl_int* errcode_ret);
cl_int *errcode_ret);
typedef clCreateFromD3D10Texture2DKHR_t *
clCreateFromD3D10Texture2DKHR_fn CL_API_SUFFIX__VERSION_1_0;
@ -135,9 +135,9 @@ typedef cl_mem CL_API_CALL
clCreateFromD3D10Texture3DKHR_t(
cl_context context,
cl_mem_flags flags,
ID3D10Texture3D* resource,
ID3D10Texture3D *resource,
UINT subresource,
cl_int* errcode_ret);
cl_int *errcode_ret);
typedef clCreateFromD3D10Texture3DKHR_t *
clCreateFromD3D10Texture3DKHR_fn CL_API_SUFFIX__VERSION_1_0;
@ -146,10 +146,10 @@ typedef cl_int CL_API_CALL
clEnqueueAcquireD3D10ObjectsKHR_t(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event);
const cl_event *event_wait_list,
cl_event *event);
typedef clEnqueueAcquireD3D10ObjectsKHR_t *
clEnqueueAcquireD3D10ObjectsKHR_fn CL_API_SUFFIX__VERSION_1_0;
@ -158,10 +158,10 @@ typedef cl_int CL_API_CALL
clEnqueueReleaseD3D10ObjectsKHR_t(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event);
const cl_event *event_wait_list,
cl_event *event);
typedef clEnqueueReleaseD3D10ObjectsKHR_t *
clEnqueueReleaseD3D10ObjectsKHR_fn CL_API_SUFFIX__VERSION_1_0;
@ -172,52 +172,52 @@ extern CL_API_ENTRY cl_int CL_API_CALL
clGetDeviceIDsFromD3D10KHR(
cl_platform_id platform,
cl_d3d10_device_source_khr d3d_device_source,
void* d3d_object,
void *d3d_object,
cl_d3d10_device_set_khr d3d_device_set,
cl_uint num_entries,
cl_device_id* devices,
cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_0;
cl_device_id *devices,
cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_mem CL_API_CALL
clCreateFromD3D10BufferKHR(
cl_context context,
cl_mem_flags flags,
ID3D10Buffer* resource,
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
ID3D10Buffer *resource,
cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_mem CL_API_CALL
clCreateFromD3D10Texture2DKHR(
cl_context context,
cl_mem_flags flags,
ID3D10Texture2D* resource,
ID3D10Texture2D *resource,
UINT subresource,
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_mem CL_API_CALL
clCreateFromD3D10Texture3DKHR(
cl_context context,
cl_mem_flags flags,
ID3D10Texture3D* resource,
ID3D10Texture3D *resource,
UINT subresource,
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_int CL_API_CALL
clEnqueueAcquireD3D10ObjectsKHR(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event) CL_API_SUFFIX__VERSION_1_0;
const cl_event *event_wait_list,
cl_event *event) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_int CL_API_CALL
clEnqueueReleaseD3D10ObjectsKHR(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event) CL_API_SUFFIX__VERSION_1_0;
const cl_event *event_wait_list,
cl_event *event) CL_API_SUFFIX__VERSION_1_0;
#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
@ -236,8 +236,8 @@ clGetSupportedD3D10TextureFormatsINTEL_t(
cl_mem_flags flags,
cl_mem_object_type image_type,
cl_uint num_entries,
DXGI_FORMAT* d3d10_formats,
cl_uint* num_texture_formats);
DXGI_FORMAT *d3d10_formats,
cl_uint *num_texture_formats);
typedef clGetSupportedD3D10TextureFormatsINTEL_t *
clGetSupportedD3D10TextureFormatsINTEL_fn ;
@ -250,8 +250,8 @@ clGetSupportedD3D10TextureFormatsINTEL(
cl_mem_flags flags,
cl_mem_object_type image_type,
cl_uint num_entries,
DXGI_FORMAT* d3d10_formats,
cl_uint* num_texture_formats) ;
DXGI_FORMAT *d3d10_formats,
cl_uint *num_texture_formats) ;
#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */

View file

@ -101,11 +101,11 @@ typedef cl_int CL_API_CALL
clGetDeviceIDsFromD3D11KHR_t(
cl_platform_id platform,
cl_d3d11_device_source_khr d3d_device_source,
void* d3d_object,
void *d3d_object,
cl_d3d11_device_set_khr d3d_device_set,
cl_uint num_entries,
cl_device_id* devices,
cl_uint* num_devices);
cl_device_id *devices,
cl_uint *num_devices);
typedef clGetDeviceIDsFromD3D11KHR_t *
clGetDeviceIDsFromD3D11KHR_fn CL_API_SUFFIX__VERSION_1_2;
@ -114,8 +114,8 @@ typedef cl_mem CL_API_CALL
clCreateFromD3D11BufferKHR_t(
cl_context context,
cl_mem_flags flags,
ID3D11Buffer* resource,
cl_int* errcode_ret);
ID3D11Buffer *resource,
cl_int *errcode_ret);
typedef clCreateFromD3D11BufferKHR_t *
clCreateFromD3D11BufferKHR_fn CL_API_SUFFIX__VERSION_1_2;
@ -124,9 +124,9 @@ typedef cl_mem CL_API_CALL
clCreateFromD3D11Texture2DKHR_t(
cl_context context,
cl_mem_flags flags,
ID3D11Texture2D* resource,
ID3D11Texture2D *resource,
UINT subresource,
cl_int* errcode_ret);
cl_int *errcode_ret);
typedef clCreateFromD3D11Texture2DKHR_t *
clCreateFromD3D11Texture2DKHR_fn CL_API_SUFFIX__VERSION_1_2;
@ -135,9 +135,9 @@ typedef cl_mem CL_API_CALL
clCreateFromD3D11Texture3DKHR_t(
cl_context context,
cl_mem_flags flags,
ID3D11Texture3D* resource,
ID3D11Texture3D *resource,
UINT subresource,
cl_int* errcode_ret);
cl_int *errcode_ret);
typedef clCreateFromD3D11Texture3DKHR_t *
clCreateFromD3D11Texture3DKHR_fn CL_API_SUFFIX__VERSION_1_2;
@ -146,10 +146,10 @@ typedef cl_int CL_API_CALL
clEnqueueAcquireD3D11ObjectsKHR_t(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event);
const cl_event *event_wait_list,
cl_event *event);
typedef clEnqueueAcquireD3D11ObjectsKHR_t *
clEnqueueAcquireD3D11ObjectsKHR_fn CL_API_SUFFIX__VERSION_1_2;
@ -158,10 +158,10 @@ typedef cl_int CL_API_CALL
clEnqueueReleaseD3D11ObjectsKHR_t(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event);
const cl_event *event_wait_list,
cl_event *event);
typedef clEnqueueReleaseD3D11ObjectsKHR_t *
clEnqueueReleaseD3D11ObjectsKHR_fn CL_API_SUFFIX__VERSION_1_2;
@ -172,52 +172,52 @@ extern CL_API_ENTRY cl_int CL_API_CALL
clGetDeviceIDsFromD3D11KHR(
cl_platform_id platform,
cl_d3d11_device_source_khr d3d_device_source,
void* d3d_object,
void *d3d_object,
cl_d3d11_device_set_khr d3d_device_set,
cl_uint num_entries,
cl_device_id* devices,
cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_2;
cl_device_id *devices,
cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_2;
extern CL_API_ENTRY cl_mem CL_API_CALL
clCreateFromD3D11BufferKHR(
cl_context context,
cl_mem_flags flags,
ID3D11Buffer* resource,
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
ID3D11Buffer *resource,
cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2;
extern CL_API_ENTRY cl_mem CL_API_CALL
clCreateFromD3D11Texture2DKHR(
cl_context context,
cl_mem_flags flags,
ID3D11Texture2D* resource,
ID3D11Texture2D *resource,
UINT subresource,
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2;
extern CL_API_ENTRY cl_mem CL_API_CALL
clCreateFromD3D11Texture3DKHR(
cl_context context,
cl_mem_flags flags,
ID3D11Texture3D* resource,
ID3D11Texture3D *resource,
UINT subresource,
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2;
extern CL_API_ENTRY cl_int CL_API_CALL
clEnqueueAcquireD3D11ObjectsKHR(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event) CL_API_SUFFIX__VERSION_1_2;
const cl_event *event_wait_list,
cl_event *event) CL_API_SUFFIX__VERSION_1_2;
extern CL_API_ENTRY cl_int CL_API_CALL
clEnqueueReleaseD3D11ObjectsKHR(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event) CL_API_SUFFIX__VERSION_1_2;
const cl_event *event_wait_list,
cl_event *event) CL_API_SUFFIX__VERSION_1_2;
#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
@ -237,8 +237,8 @@ clGetSupportedD3D11TextureFormatsINTEL_t(
cl_mem_object_type image_type,
cl_uint plane,
cl_uint num_entries,
DXGI_FORMAT* d3d11_formats,
cl_uint* num_texture_formats);
DXGI_FORMAT *d3d11_formats,
cl_uint *num_texture_formats);
typedef clGetSupportedD3D11TextureFormatsINTEL_t *
clGetSupportedD3D11TextureFormatsINTEL_fn ;
@ -252,8 +252,8 @@ clGetSupportedD3D11TextureFormatsINTEL(
cl_mem_object_type image_type,
cl_uint plane,
cl_uint num_entries,
DXGI_FORMAT* d3d11_formats,
cl_uint* num_texture_formats) ;
DXGI_FORMAT *d3d11_formats,
cl_uint *num_texture_formats) ;
#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */

View file

@ -72,7 +72,7 @@ typedef cl_uint cl_dx9_media_adapter_set_khr;
#if defined(_WIN32)
typedef struct _cl_dx9_surface_info_khr {
IDirect3DSurface9* resource;
IDirect3DSurface9 *resource;
HANDLE shared_handle;
} cl_dx9_surface_info_khr;
@ -114,12 +114,12 @@ typedef cl_int CL_API_CALL
clGetDeviceIDsFromDX9MediaAdapterKHR_t(
cl_platform_id platform,
cl_uint num_media_adapters,
cl_dx9_media_adapter_type_khr* media_adapter_type,
void* media_adapters,
cl_dx9_media_adapter_type_khr *media_adapter_type,
void *media_adapters,
cl_dx9_media_adapter_set_khr media_adapter_set,
cl_uint num_entries,
cl_device_id* devices,
cl_uint* num_devices);
cl_device_id *devices,
cl_uint *num_devices);
typedef clGetDeviceIDsFromDX9MediaAdapterKHR_t *
clGetDeviceIDsFromDX9MediaAdapterKHR_fn CL_API_SUFFIX__VERSION_1_2;
@ -129,9 +129,9 @@ clCreateFromDX9MediaSurfaceKHR_t(
cl_context context,
cl_mem_flags flags,
cl_dx9_media_adapter_type_khr adapter_type,
void* surface_info,
void *surface_info,
cl_uint plane,
cl_int* errcode_ret);
cl_int *errcode_ret);
typedef clCreateFromDX9MediaSurfaceKHR_t *
clCreateFromDX9MediaSurfaceKHR_fn CL_API_SUFFIX__VERSION_1_2;
@ -140,10 +140,10 @@ typedef cl_int CL_API_CALL
clEnqueueAcquireDX9MediaSurfacesKHR_t(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event);
const cl_event *event_wait_list,
cl_event *event);
typedef clEnqueueAcquireDX9MediaSurfacesKHR_t *
clEnqueueAcquireDX9MediaSurfacesKHR_fn CL_API_SUFFIX__VERSION_1_2;
@ -152,10 +152,10 @@ typedef cl_int CL_API_CALL
clEnqueueReleaseDX9MediaSurfacesKHR_t(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event);
const cl_event *event_wait_list,
cl_event *event);
typedef clEnqueueReleaseDX9MediaSurfacesKHR_t *
clEnqueueReleaseDX9MediaSurfacesKHR_fn CL_API_SUFFIX__VERSION_1_2;
@ -166,39 +166,39 @@ extern CL_API_ENTRY cl_int CL_API_CALL
clGetDeviceIDsFromDX9MediaAdapterKHR(
cl_platform_id platform,
cl_uint num_media_adapters,
cl_dx9_media_adapter_type_khr* media_adapter_type,
void* media_adapters,
cl_dx9_media_adapter_type_khr *media_adapter_type,
void *media_adapters,
cl_dx9_media_adapter_set_khr media_adapter_set,
cl_uint num_entries,
cl_device_id* devices,
cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_2;
cl_device_id *devices,
cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_2;
extern CL_API_ENTRY cl_mem CL_API_CALL
clCreateFromDX9MediaSurfaceKHR(
cl_context context,
cl_mem_flags flags,
cl_dx9_media_adapter_type_khr adapter_type,
void* surface_info,
void *surface_info,
cl_uint plane,
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2;
extern CL_API_ENTRY cl_int CL_API_CALL
clEnqueueAcquireDX9MediaSurfacesKHR(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event) CL_API_SUFFIX__VERSION_1_2;
const cl_event *event_wait_list,
cl_event *event) CL_API_SUFFIX__VERSION_1_2;
extern CL_API_ENTRY cl_int CL_API_CALL
clEnqueueReleaseDX9MediaSurfacesKHR(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event) CL_API_SUFFIX__VERSION_1_2;
const cl_event *event_wait_list,
cl_event *event) CL_API_SUFFIX__VERSION_1_2;
#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
@ -248,11 +248,11 @@ typedef cl_int CL_API_CALL
clGetDeviceIDsFromDX9INTEL_t(
cl_platform_id platform,
cl_dx9_device_source_intel dx9_device_source,
void* dx9_object,
void *dx9_object,
cl_dx9_device_set_intel dx9_device_set,
cl_uint num_entries,
cl_device_id* devices,
cl_uint* num_devices);
cl_device_id *devices,
cl_uint *num_devices);
typedef clGetDeviceIDsFromDX9INTEL_t *
clGetDeviceIDsFromDX9INTEL_fn CL_API_SUFFIX__VERSION_1_1;
@ -261,10 +261,10 @@ typedef cl_mem CL_API_CALL
clCreateFromDX9MediaSurfaceINTEL_t(
cl_context context,
cl_mem_flags flags,
IDirect3DSurface9* resource,
IDirect3DSurface9 *resource,
HANDLE sharedHandle,
UINT plane,
cl_int* errcode_ret);
cl_int *errcode_ret);
typedef clCreateFromDX9MediaSurfaceINTEL_t *
clCreateFromDX9MediaSurfaceINTEL_fn CL_API_SUFFIX__VERSION_1_1;
@ -273,10 +273,10 @@ typedef cl_int CL_API_CALL
clEnqueueAcquireDX9ObjectsINTEL_t(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event);
const cl_event *event_wait_list,
cl_event *event);
typedef clEnqueueAcquireDX9ObjectsINTEL_t *
clEnqueueAcquireDX9ObjectsINTEL_fn CL_API_SUFFIX__VERSION_1_1;
@ -285,10 +285,10 @@ typedef cl_int CL_API_CALL
clEnqueueReleaseDX9ObjectsINTEL_t(
cl_command_queue command_queue,
cl_uint num_objects,
cl_mem* mem_objects,
cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event);
const cl_event *event_wait_list,
cl_event *event);
typedef clEnqueueReleaseDX9ObjectsINTEL_t *
clEnqueueReleaseDX9ObjectsINTEL_fn CL_API_SUFFIX__VERSION_1_1;
@ -299,38 +299,38 @@ extern CL_API_ENTRY cl_int CL_API_CALL
clGetDeviceIDsFromDX9INTEL(
cl_platform_id platform,
cl_dx9_device_source_intel dx9_device_source,
void* dx9_object,
void *dx9_object,
cl_dx9_device_set_intel dx9_device_set,
cl_uint num_entries,
cl_device_id* devices,
cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_1;
cl_device_id *devices,
cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_1;
extern CL_API_ENTRY cl_mem CL_API_CALL
clCreateFromDX9MediaSurfaceINTEL(
cl_context context,
cl_mem_flags flags,
IDirect3DSurface9* resource,
IDirect3DSurface9 *resource,
HANDLE sharedHandle,
UINT plane,
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1;
cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_1;
extern CL_API_ENTRY cl_int CL_API_CALL
clEnqueueAcquireDX9ObjectsINTEL(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event) CL_API_SUFFIX__VERSION_1_1;
const cl_event *event_wait_list,
cl_event *event) CL_API_SUFFIX__VERSION_1_1;
extern CL_API_ENTRY cl_int CL_API_CALL
clEnqueueReleaseDX9ObjectsINTEL(
cl_command_queue command_queue,
cl_uint num_objects,
cl_mem* mem_objects,
cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event) CL_API_SUFFIX__VERSION_1_1;
const cl_event *event_wait_list,
cl_event *event) CL_API_SUFFIX__VERSION_1_1;
#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
@ -350,8 +350,8 @@ clGetSupportedDX9MediaSurfaceFormatsINTEL_t(
cl_mem_object_type image_type,
cl_uint plane,
cl_uint num_entries,
D3DFORMAT* dx9_formats,
cl_uint* num_surface_formats);
D3DFORMAT *dx9_formats,
cl_uint *num_surface_formats);
typedef clGetSupportedDX9MediaSurfaceFormatsINTEL_t *
clGetSupportedDX9MediaSurfaceFormatsINTEL_fn ;
@ -365,8 +365,8 @@ clGetSupportedDX9MediaSurfaceFormatsINTEL(
cl_mem_object_type image_type,
cl_uint plane,
cl_uint num_entries,
D3DFORMAT* dx9_formats,
cl_uint* num_surface_formats) ;
D3DFORMAT *dx9_formats,
cl_uint *num_surface_formats) ;
#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */

View file

@ -61,10 +61,10 @@ extern "C" {
#define CL_EGL_RESOURCE_NOT_ACQUIRED_KHR -1092
/* CLeglImageKHR is an opaque handle to an EGLImage */
typedef void* CLeglImageKHR;
typedef void *CLeglImageKHR;
/* CLeglDisplayKHR is an opaque handle to an EGLDisplay */
typedef void* CLeglDisplayKHR;
typedef void *CLeglDisplayKHR;
/* properties passed to clCreateFromEGLImageKHR */
typedef intptr_t cl_egl_image_properties_khr;
@ -76,8 +76,8 @@ clCreateFromEGLImageKHR_t(
CLeglDisplayKHR egldisplay,
CLeglImageKHR eglimage,
cl_mem_flags flags,
const cl_egl_image_properties_khr* properties,
cl_int* errcode_ret);
const cl_egl_image_properties_khr *properties,
cl_int *errcode_ret);
typedef clCreateFromEGLImageKHR_t *
clCreateFromEGLImageKHR_fn CL_API_SUFFIX__VERSION_1_0;
@ -86,10 +86,10 @@ typedef cl_int CL_API_CALL
clEnqueueAcquireEGLObjectsKHR_t(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event);
const cl_event *event_wait_list,
cl_event *event);
typedef clEnqueueAcquireEGLObjectsKHR_t *
clEnqueueAcquireEGLObjectsKHR_fn CL_API_SUFFIX__VERSION_1_0;
@ -98,10 +98,10 @@ typedef cl_int CL_API_CALL
clEnqueueReleaseEGLObjectsKHR_t(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event);
const cl_event *event_wait_list,
cl_event *event);
typedef clEnqueueReleaseEGLObjectsKHR_t *
clEnqueueReleaseEGLObjectsKHR_fn CL_API_SUFFIX__VERSION_1_0;
@ -114,26 +114,26 @@ clCreateFromEGLImageKHR(
CLeglDisplayKHR egldisplay,
CLeglImageKHR eglimage,
cl_mem_flags flags,
const cl_egl_image_properties_khr* properties,
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
const cl_egl_image_properties_khr *properties,
cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_int CL_API_CALL
clEnqueueAcquireEGLObjectsKHR(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event) CL_API_SUFFIX__VERSION_1_0;
const cl_event *event_wait_list,
cl_event *event) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_int CL_API_CALL
clEnqueueReleaseEGLObjectsKHR(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event) CL_API_SUFFIX__VERSION_1_0;
const cl_event *event_wait_list,
cl_event *event) CL_API_SUFFIX__VERSION_1_0;
#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
@ -148,7 +148,7 @@ clEnqueueReleaseEGLObjectsKHR(
/* type CLeglDisplayKHR */
/* CLeglSyncKHR is an opaque handle to an EGLSync object */
typedef void* CLeglSyncKHR;
typedef void *CLeglSyncKHR;
typedef cl_event CL_API_CALL
@ -156,7 +156,7 @@ clCreateEventFromEGLSyncKHR_t(
cl_context context,
CLeglSyncKHR sync,
CLeglDisplayKHR display,
cl_int* errcode_ret);
cl_int *errcode_ret);
typedef clCreateEventFromEGLSyncKHR_t *
clCreateEventFromEGLSyncKHR_fn CL_API_SUFFIX__VERSION_1_0;
@ -168,7 +168,7 @@ clCreateEventFromEGLSyncKHR(
cl_context context,
CLeglSyncKHR sync,
CLeglDisplayKHR display,
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */

File diff suppressed because it is too large Load diff

View file

@ -93,11 +93,11 @@ typedef cl_uint cl_gl_platform_info;
typedef cl_int CL_API_CALL
clGetGLContextInfoKHR_t(
const cl_context_properties* properties,
const cl_context_properties *properties,
cl_gl_context_info param_name,
size_t param_value_size,
void* param_value,
size_t* param_value_size_ret);
void *param_value,
size_t *param_value_size_ret);
typedef clGetGLContextInfoKHR_t *
clGetGLContextInfoKHR_fn CL_API_SUFFIX__VERSION_1_0;
@ -107,7 +107,7 @@ clCreateFromGLBuffer_t(
cl_context context,
cl_mem_flags flags,
cl_GLuint bufobj,
cl_int* errcode_ret);
cl_int *errcode_ret);
typedef clCreateFromGLBuffer_t *
clCreateFromGLBuffer_fn CL_API_SUFFIX__VERSION_1_0;
@ -116,18 +116,18 @@ clCreateFromGLBuffer_fn CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_int CL_API_CALL
clGetGLContextInfoKHR(
const cl_context_properties* properties,
const cl_context_properties *properties,
cl_gl_context_info param_name,
size_t param_value_size,
void* param_value,
size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
void *param_value,
size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_mem CL_API_CALL
clCreateFromGLBuffer(
cl_context context,
cl_mem_flags flags,
cl_GLuint bufobj,
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
@ -140,7 +140,7 @@ clCreateFromGLTexture_t(
cl_GLenum target,
cl_GLint miplevel,
cl_GLuint texture,
cl_int* errcode_ret);
cl_int *errcode_ret);
typedef clCreateFromGLTexture_t *
clCreateFromGLTexture_fn CL_API_SUFFIX__VERSION_1_2;
@ -154,7 +154,7 @@ clCreateFromGLTexture(
cl_GLenum target,
cl_GLint miplevel,
cl_GLuint texture,
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2;
#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
@ -166,7 +166,7 @@ clCreateFromGLRenderbuffer_t(
cl_context context,
cl_mem_flags flags,
cl_GLuint renderbuffer,
cl_int* errcode_ret);
cl_int *errcode_ret);
typedef clCreateFromGLRenderbuffer_t *
clCreateFromGLRenderbuffer_fn CL_API_SUFFIX__VERSION_1_0;
@ -174,8 +174,8 @@ clCreateFromGLRenderbuffer_fn CL_API_SUFFIX__VERSION_1_0;
typedef cl_int CL_API_CALL
clGetGLObjectInfo_t(
cl_mem memobj,
cl_gl_object_type* gl_object_type,
cl_GLuint* gl_object_name);
cl_gl_object_type *gl_object_type,
cl_GLuint *gl_object_name);
typedef clGetGLObjectInfo_t *
clGetGLObjectInfo_fn CL_API_SUFFIX__VERSION_1_0;
@ -185,8 +185,8 @@ clGetGLTextureInfo_t(
cl_mem memobj,
cl_gl_texture_info param_name,
size_t param_value_size,
void* param_value,
size_t* param_value_size_ret);
void *param_value,
size_t *param_value_size_ret);
typedef clGetGLTextureInfo_t *
clGetGLTextureInfo_fn CL_API_SUFFIX__VERSION_1_0;
@ -195,10 +195,10 @@ typedef cl_int CL_API_CALL
clEnqueueAcquireGLObjects_t(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event);
const cl_event *event_wait_list,
cl_event *event);
typedef clEnqueueAcquireGLObjects_t *
clEnqueueAcquireGLObjects_fn CL_API_SUFFIX__VERSION_1_0;
@ -207,10 +207,10 @@ typedef cl_int CL_API_CALL
clEnqueueReleaseGLObjects_t(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event);
const cl_event *event_wait_list,
cl_event *event);
typedef clEnqueueReleaseGLObjects_t *
clEnqueueReleaseGLObjects_fn CL_API_SUFFIX__VERSION_1_0;
@ -222,39 +222,39 @@ clCreateFromGLRenderbuffer(
cl_context context,
cl_mem_flags flags,
cl_GLuint renderbuffer,
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_int CL_API_CALL
clGetGLObjectInfo(
cl_mem memobj,
cl_gl_object_type* gl_object_type,
cl_GLuint* gl_object_name) CL_API_SUFFIX__VERSION_1_0;
cl_gl_object_type *gl_object_type,
cl_GLuint *gl_object_name) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_int CL_API_CALL
clGetGLTextureInfo(
cl_mem memobj,
cl_gl_texture_info param_name,
size_t param_value_size,
void* param_value,
size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
void *param_value,
size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_int CL_API_CALL
clEnqueueAcquireGLObjects(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event) CL_API_SUFFIX__VERSION_1_0;
const cl_event *event_wait_list,
cl_event *event) CL_API_SUFFIX__VERSION_1_0;
extern CL_API_ENTRY cl_int CL_API_CALL
clEnqueueReleaseGLObjects(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event) CL_API_SUFFIX__VERSION_1_0;
const cl_event *event_wait_list,
cl_event *event) CL_API_SUFFIX__VERSION_1_0;
#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
@ -267,7 +267,7 @@ clCreateFromGLTexture2D_t(
cl_GLenum target,
cl_GLint miplevel,
cl_GLuint texture,
cl_int* errcode_ret);
cl_int *errcode_ret);
typedef clCreateFromGLTexture2D_t *
clCreateFromGLTexture2D_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
@ -279,7 +279,7 @@ clCreateFromGLTexture3D_t(
cl_GLenum target,
cl_GLint miplevel,
cl_GLuint texture,
cl_int* errcode_ret);
cl_int *errcode_ret);
typedef clCreateFromGLTexture3D_t *
clCreateFromGLTexture3D_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
@ -293,7 +293,7 @@ clCreateFromGLTexture2D(
cl_GLenum target,
cl_GLint miplevel,
cl_GLuint texture,
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
extern CL_API_ENTRY cl_mem CL_API_CALL
clCreateFromGLTexture3D(
@ -302,7 +302,7 @@ clCreateFromGLTexture3D(
cl_GLenum target,
cl_GLint miplevel,
cl_GLuint texture,
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
@ -313,7 +313,7 @@ clCreateFromGLTexture3D(
#define CL_KHR_GL_EVENT_EXTENSION_NAME \
"cl_khr_gl_event"
typedef struct __GLsync * cl_GLsync;
typedef struct __GLsync *cl_GLsync;
/* cl_command_type */
#define CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR 0x200D
@ -323,7 +323,7 @@ typedef cl_event CL_API_CALL
clCreateEventFromGLsyncKHR_t(
cl_context context,
cl_GLsync sync,
cl_int* errcode_ret);
cl_int *errcode_ret);
typedef clCreateEventFromGLsyncKHR_t *
clCreateEventFromGLsyncKHR_fn CL_API_SUFFIX__VERSION_1_1;
@ -334,7 +334,7 @@ extern CL_API_ENTRY cl_event CL_API_CALL
clCreateEventFromGLsyncKHR(
cl_context context,
cl_GLsync sync,
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1;
cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_1;
#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
@ -376,8 +376,8 @@ clGetSupportedGLTextureFormatsINTEL_t(
cl_mem_flags flags,
cl_mem_object_type image_type,
cl_uint num_entries,
cl_GLenum* gl_formats,
cl_uint* num_texture_formats);
cl_GLenum *gl_formats,
cl_uint *num_texture_formats);
typedef clGetSupportedGLTextureFormatsINTEL_t *
clGetSupportedGLTextureFormatsINTEL_fn ;
@ -390,8 +390,8 @@ clGetSupportedGLTextureFormatsINTEL(
cl_mem_flags flags,
cl_mem_object_type image_type,
cl_uint num_entries,
cl_GLenum* gl_formats,
cl_uint* num_texture_formats) ;
cl_GLenum *gl_formats,
cl_uint *num_texture_formats) ;
#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */

View file

@ -41,12 +41,11 @@ extern "C" {
/**
* Rounding mode used when converting to cl_half.
*/
typedef enum
{
CL_HALF_RTE, // round to nearest even
CL_HALF_RTZ, // round towards zero
CL_HALF_RTP, // round towards positive infinity
CL_HALF_RTN, // round towards negative infinity
typedef enum {
CL_HALF_RTE, // round to nearest even
CL_HALF_RTZ, // round towards zero
CL_HALF_RTP, // round towards positive infinity
CL_HALF_RTN, // round towards negative infinity
} cl_half_rounding_mode;
@ -59,372 +58,317 @@ typedef enum
* Utility to deal with values that overflow when converting to half precision.
*/
static inline cl_half cl_half_handle_overflow(cl_half_rounding_mode rounding_mode,
uint16_t sign)
{
if (rounding_mode == CL_HALF_RTZ)
{
// Round overflow towards zero -> largest finite number (preserving sign)
return (sign << 15) | CL_HALF_MAX_FINITE_MAG;
}
else if (rounding_mode == CL_HALF_RTP && sign)
{
// Round negative overflow towards positive infinity -> most negative finite number
return (1 << 15) | CL_HALF_MAX_FINITE_MAG;
}
else if (rounding_mode == CL_HALF_RTN && !sign)
{
// Round positive overflow towards negative infinity -> largest finite number
return CL_HALF_MAX_FINITE_MAG;
}
uint16_t sign) {
if (rounding_mode == CL_HALF_RTZ) {
// Round overflow towards zero -> largest finite number (preserving sign)
return (sign << 15) | CL_HALF_MAX_FINITE_MAG;
} else if (rounding_mode == CL_HALF_RTP && sign) {
// Round negative overflow towards positive infinity -> most negative finite number
return (1 << 15) | CL_HALF_MAX_FINITE_MAG;
} else if (rounding_mode == CL_HALF_RTN && !sign) {
// Round positive overflow towards negative infinity -> largest finite number
return CL_HALF_MAX_FINITE_MAG;
}
// Overflow to infinity
return (sign << 15) | CL_HALF_EXP_MASK;
// Overflow to infinity
return (sign << 15) | CL_HALF_EXP_MASK;
}
/*
* Utility to deal with values that underflow when converting to half precision.
*/
static inline cl_half cl_half_handle_underflow(cl_half_rounding_mode rounding_mode,
uint16_t sign)
{
if (rounding_mode == CL_HALF_RTP && !sign)
{
// Round underflow towards positive infinity -> smallest positive value
return (sign << 15) | 1;
}
else if (rounding_mode == CL_HALF_RTN && sign)
{
// Round underflow towards negative infinity -> largest negative value
return (sign << 15) | 1;
}
uint16_t sign) {
if (rounding_mode == CL_HALF_RTP && !sign) {
// Round underflow towards positive infinity -> smallest positive value
return (sign << 15) | 1;
} else if (rounding_mode == CL_HALF_RTN && sign) {
// Round underflow towards negative infinity -> largest negative value
return (sign << 15) | 1;
}
// Flush to zero
return (sign << 15);
// Flush to zero
return (sign << 15);
}
/**
* Convert a cl_float to a cl_half.
*/
static inline cl_half cl_half_from_float(cl_float f, cl_half_rounding_mode rounding_mode)
{
// Type-punning to get direct access to underlying bits
union
{
cl_float f;
uint32_t i;
} f32;
f32.f = f;
static inline cl_half cl_half_from_float(cl_float f, cl_half_rounding_mode rounding_mode) {
// Type-punning to get direct access to underlying bits
union {
cl_float f;
uint32_t i;
} f32;
f32.f = f;
// Extract sign bit
uint16_t sign = f32.i >> 31;
// Extract sign bit
uint16_t sign = f32.i >> 31;
// Extract FP32 exponent and mantissa
uint32_t f_exp = (f32.i >> (CL_FLT_MANT_DIG - 1)) & 0xFF;
uint32_t f_mant = f32.i & ((1 << (CL_FLT_MANT_DIG - 1)) - 1);
// Extract FP32 exponent and mantissa
uint32_t f_exp = (f32.i >> (CL_FLT_MANT_DIG - 1)) & 0xFF;
uint32_t f_mant = f32.i & ((1 << (CL_FLT_MANT_DIG - 1)) - 1);
// Remove FP32 exponent bias
int32_t exp = f_exp - CL_FLT_MAX_EXP + 1;
// Remove FP32 exponent bias
int32_t exp = f_exp - CL_FLT_MAX_EXP + 1;
// Add FP16 exponent bias
uint16_t h_exp = (uint16_t)(exp + CL_HALF_MAX_EXP - 1);
// Add FP16 exponent bias
uint16_t h_exp = (uint16_t)(exp + CL_HALF_MAX_EXP - 1);
// Position of the bit that will become the FP16 mantissa LSB
uint32_t lsb_pos = CL_FLT_MANT_DIG - CL_HALF_MANT_DIG;
// Position of the bit that will become the FP16 mantissa LSB
uint32_t lsb_pos = CL_FLT_MANT_DIG - CL_HALF_MANT_DIG;
// Check for NaN / infinity
if (f_exp == 0xFF)
{
if (f_mant)
{
// NaN -> propagate mantissa and silence it
uint16_t h_mant = (uint16_t)(f_mant >> lsb_pos);
h_mant |= 0x200;
return (sign << 15) | CL_HALF_EXP_MASK | h_mant;
// Check for NaN / infinity
if (f_exp == 0xFF) {
if (f_mant) {
// NaN -> propagate mantissa and silence it
uint16_t h_mant = (uint16_t)(f_mant >> lsb_pos);
h_mant |= 0x200;
return (sign << 15) | CL_HALF_EXP_MASK | h_mant;
} else {
// Infinity -> zero mantissa
return (sign << 15) | CL_HALF_EXP_MASK;
}
}
else
{
// Infinity -> zero mantissa
return (sign << 15) | CL_HALF_EXP_MASK;
// Check for zero
if (!f_exp && !f_mant) {
return (sign << 15);
}
}
// Check for zero
if (!f_exp && !f_mant)
{
return (sign << 15);
}
// Check for overflow
if (exp >= CL_HALF_MAX_EXP) {
return cl_half_handle_overflow(rounding_mode, sign);
}
// Check for overflow
if (exp >= CL_HALF_MAX_EXP)
{
return cl_half_handle_overflow(rounding_mode, sign);
}
// Check for underflow
if (exp < (CL_HALF_MIN_EXP - CL_HALF_MANT_DIG - 1)) {
return cl_half_handle_underflow(rounding_mode, sign);
}
// Check for underflow
if (exp < (CL_HALF_MIN_EXP - CL_HALF_MANT_DIG - 1))
{
return cl_half_handle_underflow(rounding_mode, sign);
}
// Check for value that will become denormal
if (exp < -14) {
// Denormal -> include the implicit 1 from the FP32 mantissa
h_exp = 0;
f_mant |= 1 << (CL_FLT_MANT_DIG - 1);
// Check for value that will become denormal
if (exp < -14)
{
// Denormal -> include the implicit 1 from the FP32 mantissa
h_exp = 0;
f_mant |= 1 << (CL_FLT_MANT_DIG - 1);
// Mantissa shift amount depends on exponent
lsb_pos = -exp + (CL_FLT_MANT_DIG - 25);
}
// Mantissa shift amount depends on exponent
lsb_pos = -exp + (CL_FLT_MANT_DIG - 25);
}
// Generate FP16 mantissa by shifting FP32 mantissa
uint16_t h_mant = (uint16_t)(f_mant >> lsb_pos);
// Generate FP16 mantissa by shifting FP32 mantissa
uint16_t h_mant = (uint16_t)(f_mant >> lsb_pos);
// Check whether we need to round
uint32_t halfway = 1 << (lsb_pos - 1);
uint32_t mask = (halfway << 1) - 1;
switch (rounding_mode) {
case CL_HALF_RTE:
if ((f_mant & mask) > halfway) {
// More than halfway -> round up
h_mant += 1;
} else if ((f_mant & mask) == halfway) {
// Exactly halfway -> round to nearest even
if (h_mant & 0x1)
h_mant += 1;
}
break;
case CL_HALF_RTZ:
// Mantissa has already been truncated -> do nothing
break;
case CL_HALF_RTP:
if ((f_mant & mask) && !sign) {
// Round positive numbers up
h_mant += 1;
}
break;
case CL_HALF_RTN:
if ((f_mant & mask) && sign) {
// Round negative numbers down
h_mant += 1;
}
break;
}
// Check whether we need to round
uint32_t halfway = 1 << (lsb_pos - 1);
uint32_t mask = (halfway << 1) - 1;
switch (rounding_mode)
{
case CL_HALF_RTE:
if ((f_mant & mask) > halfway)
{
// More than halfway -> round up
h_mant += 1;
}
else if ((f_mant & mask) == halfway)
{
// Exactly halfway -> round to nearest even
if (h_mant & 0x1)
h_mant += 1;
}
break;
case CL_HALF_RTZ:
// Mantissa has already been truncated -> do nothing
break;
case CL_HALF_RTP:
if ((f_mant & mask) && !sign)
{
// Round positive numbers up
h_mant += 1;
}
break;
case CL_HALF_RTN:
if ((f_mant & mask) && sign)
{
// Round negative numbers down
h_mant += 1;
}
break;
}
// Check for mantissa overflow
if (h_mant & 0x400) {
h_exp += 1;
h_mant = 0;
}
// Check for mantissa overflow
if (h_mant & 0x400)
{
h_exp += 1;
h_mant = 0;
}
return (sign << 15) | (h_exp << 10) | h_mant;
return (sign << 15) | (h_exp << 10) | h_mant;
}
/**
* Convert a cl_double to a cl_half.
*/
static inline cl_half cl_half_from_double(cl_double d, cl_half_rounding_mode rounding_mode)
{
// Type-punning to get direct access to underlying bits
union
{
cl_double d;
uint64_t i;
} f64;
f64.d = d;
static inline cl_half cl_half_from_double(cl_double d, cl_half_rounding_mode rounding_mode) {
// Type-punning to get direct access to underlying bits
union {
cl_double d;
uint64_t i;
} f64;
f64.d = d;
// Extract sign bit
uint16_t sign = f64.i >> 63;
// Extract sign bit
uint16_t sign = f64.i >> 63;
// Extract FP64 exponent and mantissa
uint64_t d_exp = (f64.i >> (CL_DBL_MANT_DIG - 1)) & 0x7FF;
uint64_t d_mant = f64.i & (((uint64_t)1 << (CL_DBL_MANT_DIG - 1)) - 1);
// Extract FP64 exponent and mantissa
uint64_t d_exp = (f64.i >> (CL_DBL_MANT_DIG - 1)) & 0x7FF;
uint64_t d_mant = f64.i & (((uint64_t)1 << (CL_DBL_MANT_DIG - 1)) - 1);
// Remove FP64 exponent bias
int64_t exp = d_exp - CL_DBL_MAX_EXP + 1;
// Remove FP64 exponent bias
int64_t exp = d_exp - CL_DBL_MAX_EXP + 1;
// Add FP16 exponent bias
uint16_t h_exp = (uint16_t)(exp + CL_HALF_MAX_EXP - 1);
// Add FP16 exponent bias
uint16_t h_exp = (uint16_t)(exp + CL_HALF_MAX_EXP - 1);
// Position of the bit that will become the FP16 mantissa LSB
uint32_t lsb_pos = CL_DBL_MANT_DIG - CL_HALF_MANT_DIG;
// Position of the bit that will become the FP16 mantissa LSB
uint32_t lsb_pos = CL_DBL_MANT_DIG - CL_HALF_MANT_DIG;
// Check for NaN / infinity
if (d_exp == 0x7FF)
{
if (d_mant)
{
// NaN -> propagate mantissa and silence it
uint16_t h_mant = (uint16_t)(d_mant >> lsb_pos);
h_mant |= 0x200;
return (sign << 15) | CL_HALF_EXP_MASK | h_mant;
// Check for NaN / infinity
if (d_exp == 0x7FF) {
if (d_mant) {
// NaN -> propagate mantissa and silence it
uint16_t h_mant = (uint16_t)(d_mant >> lsb_pos);
h_mant |= 0x200;
return (sign << 15) | CL_HALF_EXP_MASK | h_mant;
} else {
// Infinity -> zero mantissa
return (sign << 15) | CL_HALF_EXP_MASK;
}
}
else
{
// Infinity -> zero mantissa
return (sign << 15) | CL_HALF_EXP_MASK;
// Check for zero
if (!d_exp && !d_mant) {
return (sign << 15);
}
}
// Check for zero
if (!d_exp && !d_mant)
{
return (sign << 15);
}
// Check for overflow
if (exp >= CL_HALF_MAX_EXP) {
return cl_half_handle_overflow(rounding_mode, sign);
}
// Check for overflow
if (exp >= CL_HALF_MAX_EXP)
{
return cl_half_handle_overflow(rounding_mode, sign);
}
// Check for underflow
if (exp < (CL_HALF_MIN_EXP - CL_HALF_MANT_DIG - 1)) {
return cl_half_handle_underflow(rounding_mode, sign);
}
// Check for underflow
if (exp < (CL_HALF_MIN_EXP - CL_HALF_MANT_DIG - 1))
{
return cl_half_handle_underflow(rounding_mode, sign);
}
// Check for value that will become denormal
if (exp < -14) {
// Include the implicit 1 from the FP64 mantissa
h_exp = 0;
d_mant |= (uint64_t)1 << (CL_DBL_MANT_DIG - 1);
// Check for value that will become denormal
if (exp < -14)
{
// Include the implicit 1 from the FP64 mantissa
h_exp = 0;
d_mant |= (uint64_t)1 << (CL_DBL_MANT_DIG - 1);
// Mantissa shift amount depends on exponent
lsb_pos = (uint32_t)(-exp + (CL_DBL_MANT_DIG - 25));
}
// Mantissa shift amount depends on exponent
lsb_pos = (uint32_t)(-exp + (CL_DBL_MANT_DIG - 25));
}
// Generate FP16 mantissa by shifting FP64 mantissa
uint16_t h_mant = (uint16_t)(d_mant >> lsb_pos);
// Generate FP16 mantissa by shifting FP64 mantissa
uint16_t h_mant = (uint16_t)(d_mant >> lsb_pos);
// Check whether we need to round
uint64_t halfway = (uint64_t)1 << (lsb_pos - 1);
uint64_t mask = (halfway << 1) - 1;
switch (rounding_mode) {
case CL_HALF_RTE:
if ((d_mant & mask) > halfway) {
// More than halfway -> round up
h_mant += 1;
} else if ((d_mant & mask) == halfway) {
// Exactly halfway -> round to nearest even
if (h_mant & 0x1)
h_mant += 1;
}
break;
case CL_HALF_RTZ:
// Mantissa has already been truncated -> do nothing
break;
case CL_HALF_RTP:
if ((d_mant & mask) && !sign) {
// Round positive numbers up
h_mant += 1;
}
break;
case CL_HALF_RTN:
if ((d_mant & mask) && sign) {
// Round negative numbers down
h_mant += 1;
}
break;
}
// Check whether we need to round
uint64_t halfway = (uint64_t)1 << (lsb_pos - 1);
uint64_t mask = (halfway << 1) - 1;
switch (rounding_mode)
{
case CL_HALF_RTE:
if ((d_mant & mask) > halfway)
{
// More than halfway -> round up
h_mant += 1;
}
else if ((d_mant & mask) == halfway)
{
// Exactly halfway -> round to nearest even
if (h_mant & 0x1)
h_mant += 1;
}
break;
case CL_HALF_RTZ:
// Mantissa has already been truncated -> do nothing
break;
case CL_HALF_RTP:
if ((d_mant & mask) && !sign)
{
// Round positive numbers up
h_mant += 1;
}
break;
case CL_HALF_RTN:
if ((d_mant & mask) && sign)
{
// Round negative numbers down
h_mant += 1;
}
break;
}
// Check for mantissa overflow
if (h_mant & 0x400) {
h_exp += 1;
h_mant = 0;
}
// Check for mantissa overflow
if (h_mant & 0x400)
{
h_exp += 1;
h_mant = 0;
}
return (sign << 15) | (h_exp << 10) | h_mant;
return (sign << 15) | (h_exp << 10) | h_mant;
}
/**
* Convert a cl_half to a cl_float.
*/
static inline cl_float cl_half_to_float(cl_half h)
{
// Type-punning to get direct access to underlying bits
union
{
cl_float f;
uint32_t i;
} f32;
static inline cl_float cl_half_to_float(cl_half h) {
// Type-punning to get direct access to underlying bits
union {
cl_float f;
uint32_t i;
} f32;
// Extract sign bit
uint16_t sign = h >> 15;
// Extract sign bit
uint16_t sign = h >> 15;
// Extract FP16 exponent and mantissa
uint16_t h_exp = (h >> (CL_HALF_MANT_DIG - 1)) & 0x1F;
uint16_t h_mant = h & 0x3FF;
// Extract FP16 exponent and mantissa
uint16_t h_exp = (h >> (CL_HALF_MANT_DIG - 1)) & 0x1F;
uint16_t h_mant = h & 0x3FF;
// Remove FP16 exponent bias
int32_t exp = h_exp - CL_HALF_MAX_EXP + 1;
// Remove FP16 exponent bias
int32_t exp = h_exp - CL_HALF_MAX_EXP + 1;
// Add FP32 exponent bias
uint32_t f_exp = exp + CL_FLT_MAX_EXP - 1;
// Add FP32 exponent bias
uint32_t f_exp = exp + CL_FLT_MAX_EXP - 1;
// Check for NaN / infinity
if (h_exp == 0x1F)
{
if (h_mant)
{
// NaN -> propagate mantissa and silence it
uint32_t f_mant = h_mant << (CL_FLT_MANT_DIG - CL_HALF_MANT_DIG);
f_mant |= 0x400000;
f32.i = (sign << 31) | 0x7F800000 | f_mant;
return f32.f;
// Check for NaN / infinity
if (h_exp == 0x1F) {
if (h_mant) {
// NaN -> propagate mantissa and silence it
uint32_t f_mant = h_mant << (CL_FLT_MANT_DIG - CL_HALF_MANT_DIG);
f_mant |= 0x400000;
f32.i = (sign << 31) | 0x7F800000 | f_mant;
return f32.f;
} else {
// Infinity -> zero mantissa
f32.i = (sign << 31) | 0x7F800000;
return f32.f;
}
}
else
{
// Infinity -> zero mantissa
f32.i = (sign << 31) | 0x7F800000;
return f32.f;
}
}
// Check for zero / denormal
if (h_exp == 0)
{
if (h_mant == 0)
{
// Zero -> zero exponent
f_exp = 0;
// Check for zero / denormal
if (h_exp == 0) {
if (h_mant == 0) {
// Zero -> zero exponent
f_exp = 0;
} else {
// Denormal -> normalize it
// - Shift mantissa to make most-significant 1 implicit
// - Adjust exponent accordingly
uint32_t shift = 0;
while ((h_mant & 0x400) == 0) {
h_mant <<= 1;
shift++;
}
h_mant &= 0x3FF;
f_exp -= shift - 1;
}
}
else
{
// Denormal -> normalize it
// - Shift mantissa to make most-significant 1 implicit
// - Adjust exponent accordingly
uint32_t shift = 0;
while ((h_mant & 0x400) == 0)
{
h_mant <<= 1;
shift++;
}
h_mant &= 0x3FF;
f_exp -= shift - 1;
}
}
f32.i = (sign << 31) | (f_exp << 23) | (h_mant << 13);
return f32.f;
f32.i = (sign << 31) | (f_exp << 23) | (h_mant << 13);
return f32.f;
}

View file

@ -36,274 +36,274 @@ extern "C" {
/* Vendor dispatch table structure */
typedef struct _cl_icd_dispatch {
/* OpenCL 1.0 */
clGetPlatformIDs_t *clGetPlatformIDs;
clGetPlatformInfo_t *clGetPlatformInfo;
clGetDeviceIDs_t *clGetDeviceIDs;
clGetDeviceInfo_t *clGetDeviceInfo;
clCreateContext_t *clCreateContext;
clCreateContextFromType_t *clCreateContextFromType;
clRetainContext_t *clRetainContext;
clReleaseContext_t *clReleaseContext;
clGetContextInfo_t *clGetContextInfo;
clCreateCommandQueue_t *clCreateCommandQueue;
clRetainCommandQueue_t *clRetainCommandQueue;
clReleaseCommandQueue_t *clReleaseCommandQueue;
clGetCommandQueueInfo_t *clGetCommandQueueInfo;
clSetCommandQueueProperty_t *clSetCommandQueueProperty;
clCreateBuffer_t *clCreateBuffer;
clCreateImage2D_t *clCreateImage2D;
clCreateImage3D_t *clCreateImage3D;
clRetainMemObject_t *clRetainMemObject;
clReleaseMemObject_t *clReleaseMemObject;
clGetSupportedImageFormats_t *clGetSupportedImageFormats;
clGetMemObjectInfo_t *clGetMemObjectInfo;
clGetImageInfo_t *clGetImageInfo;
clCreateSampler_t *clCreateSampler;
clRetainSampler_t *clRetainSampler;
clReleaseSampler_t *clReleaseSampler;
clGetSamplerInfo_t *clGetSamplerInfo;
clCreateProgramWithSource_t *clCreateProgramWithSource;
clCreateProgramWithBinary_t *clCreateProgramWithBinary;
clRetainProgram_t *clRetainProgram;
clReleaseProgram_t *clReleaseProgram;
clBuildProgram_t *clBuildProgram;
clUnloadCompiler_t *clUnloadCompiler;
clGetProgramInfo_t *clGetProgramInfo;
clGetProgramBuildInfo_t *clGetProgramBuildInfo;
clCreateKernel_t *clCreateKernel;
clCreateKernelsInProgram_t *clCreateKernelsInProgram;
clRetainKernel_t *clRetainKernel;
clReleaseKernel_t *clReleaseKernel;
clSetKernelArg_t *clSetKernelArg;
clGetKernelInfo_t *clGetKernelInfo;
clGetKernelWorkGroupInfo_t *clGetKernelWorkGroupInfo;
clWaitForEvents_t *clWaitForEvents;
clGetEventInfo_t *clGetEventInfo;
clRetainEvent_t *clRetainEvent;
clReleaseEvent_t *clReleaseEvent;
clGetEventProfilingInfo_t *clGetEventProfilingInfo;
clFlush_t *clFlush;
clFinish_t *clFinish;
clEnqueueReadBuffer_t *clEnqueueReadBuffer;
clEnqueueWriteBuffer_t *clEnqueueWriteBuffer;
clEnqueueCopyBuffer_t *clEnqueueCopyBuffer;
clEnqueueReadImage_t *clEnqueueReadImage;
clEnqueueWriteImage_t *clEnqueueWriteImage;
clEnqueueCopyImage_t *clEnqueueCopyImage;
clEnqueueCopyImageToBuffer_t *clEnqueueCopyImageToBuffer;
clEnqueueCopyBufferToImage_t *clEnqueueCopyBufferToImage;
clEnqueueMapBuffer_t *clEnqueueMapBuffer;
clEnqueueMapImage_t *clEnqueueMapImage;
clEnqueueUnmapMemObject_t *clEnqueueUnmapMemObject;
clEnqueueNDRangeKernel_t *clEnqueueNDRangeKernel;
clEnqueueTask_t *clEnqueueTask;
clEnqueueNativeKernel_t *clEnqueueNativeKernel;
clEnqueueMarker_t *clEnqueueMarker;
clEnqueueWaitForEvents_t *clEnqueueWaitForEvents;
clEnqueueBarrier_t *clEnqueueBarrier;
clGetExtensionFunctionAddress_t *clGetExtensionFunctionAddress;
clCreateFromGLBuffer_t *clCreateFromGLBuffer;
clCreateFromGLTexture2D_t *clCreateFromGLTexture2D;
clCreateFromGLTexture3D_t *clCreateFromGLTexture3D;
clCreateFromGLRenderbuffer_t *clCreateFromGLRenderbuffer;
clGetGLObjectInfo_t *clGetGLObjectInfo;
clGetGLTextureInfo_t *clGetGLTextureInfo;
clEnqueueAcquireGLObjects_t *clEnqueueAcquireGLObjects;
clEnqueueReleaseGLObjects_t *clEnqueueReleaseGLObjects;
clGetGLContextInfoKHR_t *clGetGLContextInfoKHR;
/* OpenCL 1.0 */
clGetPlatformIDs_t *clGetPlatformIDs;
clGetPlatformInfo_t *clGetPlatformInfo;
clGetDeviceIDs_t *clGetDeviceIDs;
clGetDeviceInfo_t *clGetDeviceInfo;
clCreateContext_t *clCreateContext;
clCreateContextFromType_t *clCreateContextFromType;
clRetainContext_t *clRetainContext;
clReleaseContext_t *clReleaseContext;
clGetContextInfo_t *clGetContextInfo;
clCreateCommandQueue_t *clCreateCommandQueue;
clRetainCommandQueue_t *clRetainCommandQueue;
clReleaseCommandQueue_t *clReleaseCommandQueue;
clGetCommandQueueInfo_t *clGetCommandQueueInfo;
clSetCommandQueueProperty_t *clSetCommandQueueProperty;
clCreateBuffer_t *clCreateBuffer;
clCreateImage2D_t *clCreateImage2D;
clCreateImage3D_t *clCreateImage3D;
clRetainMemObject_t *clRetainMemObject;
clReleaseMemObject_t *clReleaseMemObject;
clGetSupportedImageFormats_t *clGetSupportedImageFormats;
clGetMemObjectInfo_t *clGetMemObjectInfo;
clGetImageInfo_t *clGetImageInfo;
clCreateSampler_t *clCreateSampler;
clRetainSampler_t *clRetainSampler;
clReleaseSampler_t *clReleaseSampler;
clGetSamplerInfo_t *clGetSamplerInfo;
clCreateProgramWithSource_t *clCreateProgramWithSource;
clCreateProgramWithBinary_t *clCreateProgramWithBinary;
clRetainProgram_t *clRetainProgram;
clReleaseProgram_t *clReleaseProgram;
clBuildProgram_t *clBuildProgram;
clUnloadCompiler_t *clUnloadCompiler;
clGetProgramInfo_t *clGetProgramInfo;
clGetProgramBuildInfo_t *clGetProgramBuildInfo;
clCreateKernel_t *clCreateKernel;
clCreateKernelsInProgram_t *clCreateKernelsInProgram;
clRetainKernel_t *clRetainKernel;
clReleaseKernel_t *clReleaseKernel;
clSetKernelArg_t *clSetKernelArg;
clGetKernelInfo_t *clGetKernelInfo;
clGetKernelWorkGroupInfo_t *clGetKernelWorkGroupInfo;
clWaitForEvents_t *clWaitForEvents;
clGetEventInfo_t *clGetEventInfo;
clRetainEvent_t *clRetainEvent;
clReleaseEvent_t *clReleaseEvent;
clGetEventProfilingInfo_t *clGetEventProfilingInfo;
clFlush_t *clFlush;
clFinish_t *clFinish;
clEnqueueReadBuffer_t *clEnqueueReadBuffer;
clEnqueueWriteBuffer_t *clEnqueueWriteBuffer;
clEnqueueCopyBuffer_t *clEnqueueCopyBuffer;
clEnqueueReadImage_t *clEnqueueReadImage;
clEnqueueWriteImage_t *clEnqueueWriteImage;
clEnqueueCopyImage_t *clEnqueueCopyImage;
clEnqueueCopyImageToBuffer_t *clEnqueueCopyImageToBuffer;
clEnqueueCopyBufferToImage_t *clEnqueueCopyBufferToImage;
clEnqueueMapBuffer_t *clEnqueueMapBuffer;
clEnqueueMapImage_t *clEnqueueMapImage;
clEnqueueUnmapMemObject_t *clEnqueueUnmapMemObject;
clEnqueueNDRangeKernel_t *clEnqueueNDRangeKernel;
clEnqueueTask_t *clEnqueueTask;
clEnqueueNativeKernel_t *clEnqueueNativeKernel;
clEnqueueMarker_t *clEnqueueMarker;
clEnqueueWaitForEvents_t *clEnqueueWaitForEvents;
clEnqueueBarrier_t *clEnqueueBarrier;
clGetExtensionFunctionAddress_t *clGetExtensionFunctionAddress;
clCreateFromGLBuffer_t *clCreateFromGLBuffer;
clCreateFromGLTexture2D_t *clCreateFromGLTexture2D;
clCreateFromGLTexture3D_t *clCreateFromGLTexture3D;
clCreateFromGLRenderbuffer_t *clCreateFromGLRenderbuffer;
clGetGLObjectInfo_t *clGetGLObjectInfo;
clGetGLTextureInfo_t *clGetGLTextureInfo;
clEnqueueAcquireGLObjects_t *clEnqueueAcquireGLObjects;
clEnqueueReleaseGLObjects_t *clEnqueueReleaseGLObjects;
clGetGLContextInfoKHR_t *clGetGLContextInfoKHR;
/* cl_khr_d3d10_sharing */
/* cl_khr_d3d10_sharing */
#ifdef _WIN32
clGetDeviceIDsFromD3D10KHR_t *clGetDeviceIDsFromD3D10KHR;
clCreateFromD3D10BufferKHR_t *clCreateFromD3D10BufferKHR;
clCreateFromD3D10Texture2DKHR_t *clCreateFromD3D10Texture2DKHR;
clCreateFromD3D10Texture3DKHR_t *clCreateFromD3D10Texture3DKHR;
clEnqueueAcquireD3D10ObjectsKHR_t *clEnqueueAcquireD3D10ObjectsKHR;
clEnqueueReleaseD3D10ObjectsKHR_t *clEnqueueReleaseD3D10ObjectsKHR;
clGetDeviceIDsFromD3D10KHR_t *clGetDeviceIDsFromD3D10KHR;
clCreateFromD3D10BufferKHR_t *clCreateFromD3D10BufferKHR;
clCreateFromD3D10Texture2DKHR_t *clCreateFromD3D10Texture2DKHR;
clCreateFromD3D10Texture3DKHR_t *clCreateFromD3D10Texture3DKHR;
clEnqueueAcquireD3D10ObjectsKHR_t *clEnqueueAcquireD3D10ObjectsKHR;
clEnqueueReleaseD3D10ObjectsKHR_t *clEnqueueReleaseD3D10ObjectsKHR;
#else
void *clGetDeviceIDsFromD3D10KHR;
void *clCreateFromD3D10BufferKHR;
void *clCreateFromD3D10Texture2DKHR;
void *clCreateFromD3D10Texture3DKHR;
void *clEnqueueAcquireD3D10ObjectsKHR;
void *clEnqueueReleaseD3D10ObjectsKHR;
void *clGetDeviceIDsFromD3D10KHR;
void *clCreateFromD3D10BufferKHR;
void *clCreateFromD3D10Texture2DKHR;
void *clCreateFromD3D10Texture3DKHR;
void *clEnqueueAcquireD3D10ObjectsKHR;
void *clEnqueueReleaseD3D10ObjectsKHR;
#endif
/* OpenCL 1.1 */
/* OpenCL 1.1 */
#ifdef CL_VERSION_1_1
clSetEventCallback_t *clSetEventCallback;
clCreateSubBuffer_t *clCreateSubBuffer;
clSetMemObjectDestructorCallback_t *clSetMemObjectDestructorCallback;
clCreateUserEvent_t *clCreateUserEvent;
clSetUserEventStatus_t *clSetUserEventStatus;
clEnqueueReadBufferRect_t *clEnqueueReadBufferRect;
clEnqueueWriteBufferRect_t *clEnqueueWriteBufferRect;
clEnqueueCopyBufferRect_t *clEnqueueCopyBufferRect;
clSetEventCallback_t *clSetEventCallback;
clCreateSubBuffer_t *clCreateSubBuffer;
clSetMemObjectDestructorCallback_t *clSetMemObjectDestructorCallback;
clCreateUserEvent_t *clCreateUserEvent;
clSetUserEventStatus_t *clSetUserEventStatus;
clEnqueueReadBufferRect_t *clEnqueueReadBufferRect;
clEnqueueWriteBufferRect_t *clEnqueueWriteBufferRect;
clEnqueueCopyBufferRect_t *clEnqueueCopyBufferRect;
#else
void *clSetEventCallback;
void *clCreateSubBuffer;
void *clSetMemObjectDestructorCallback;
void *clCreateUserEvent;
void *clSetUserEventStatus;
void *clEnqueueReadBufferRect;
void *clEnqueueWriteBufferRect;
void *clEnqueueCopyBufferRect;
void *clSetEventCallback;
void *clCreateSubBuffer;
void *clSetMemObjectDestructorCallback;
void *clCreateUserEvent;
void *clSetUserEventStatus;
void *clEnqueueReadBufferRect;
void *clEnqueueWriteBufferRect;
void *clEnqueueCopyBufferRect;
#endif
/* cl_ext_device_fission */
clCreateSubDevicesEXT_t *clCreateSubDevicesEXT;
clRetainDeviceEXT_t *clRetainDeviceEXT;
clReleaseDeviceEXT_t *clReleaseDeviceEXT;
/* cl_ext_device_fission */
clCreateSubDevicesEXT_t *clCreateSubDevicesEXT;
clRetainDeviceEXT_t *clRetainDeviceEXT;
clReleaseDeviceEXT_t *clReleaseDeviceEXT;
/* cl_khr_gl_event */
clCreateEventFromGLsyncKHR_t *clCreateEventFromGLsyncKHR;
/* cl_khr_gl_event */
clCreateEventFromGLsyncKHR_t *clCreateEventFromGLsyncKHR;
/* OpenCL 1.2 */
/* OpenCL 1.2 */
#ifdef CL_VERSION_1_2
clCreateSubDevices_t *clCreateSubDevices;
clRetainDevice_t *clRetainDevice;
clReleaseDevice_t *clReleaseDevice;
clCreateImage_t *clCreateImage;
clCreateProgramWithBuiltInKernels_t *clCreateProgramWithBuiltInKernels;
clCompileProgram_t *clCompileProgram;
clLinkProgram_t *clLinkProgram;
clUnloadPlatformCompiler_t *clUnloadPlatformCompiler;
clGetKernelArgInfo_t *clGetKernelArgInfo;
clEnqueueFillBuffer_t *clEnqueueFillBuffer;
clEnqueueFillImage_t *clEnqueueFillImage;
clEnqueueMigrateMemObjects_t *clEnqueueMigrateMemObjects;
clEnqueueMarkerWithWaitList_t *clEnqueueMarkerWithWaitList;
clEnqueueBarrierWithWaitList_t *clEnqueueBarrierWithWaitList;
clGetExtensionFunctionAddressForPlatform_t *
clGetExtensionFunctionAddressForPlatform;
clCreateFromGLTexture_t *clCreateFromGLTexture;
clCreateSubDevices_t *clCreateSubDevices;
clRetainDevice_t *clRetainDevice;
clReleaseDevice_t *clReleaseDevice;
clCreateImage_t *clCreateImage;
clCreateProgramWithBuiltInKernels_t *clCreateProgramWithBuiltInKernels;
clCompileProgram_t *clCompileProgram;
clLinkProgram_t *clLinkProgram;
clUnloadPlatformCompiler_t *clUnloadPlatformCompiler;
clGetKernelArgInfo_t *clGetKernelArgInfo;
clEnqueueFillBuffer_t *clEnqueueFillBuffer;
clEnqueueFillImage_t *clEnqueueFillImage;
clEnqueueMigrateMemObjects_t *clEnqueueMigrateMemObjects;
clEnqueueMarkerWithWaitList_t *clEnqueueMarkerWithWaitList;
clEnqueueBarrierWithWaitList_t *clEnqueueBarrierWithWaitList;
clGetExtensionFunctionAddressForPlatform_t *
clGetExtensionFunctionAddressForPlatform;
clCreateFromGLTexture_t *clCreateFromGLTexture;
#else
void *clCreateSubDevices;
void *clRetainDevice;
void *clReleaseDevice;
void *clCreateImage;
void *clCreateProgramWithBuiltInKernels;
void *clCompileProgram;
void *clLinkProgram;
void *clUnloadPlatformCompiler;
void *clGetKernelArgInfo;
void *clEnqueueFillBuffer;
void *clEnqueueFillImage;
void *clEnqueueMigrateMemObjects;
void *clEnqueueMarkerWithWaitList;
void *clEnqueueBarrierWithWaitList;
void *clGetExtensionFunctionAddressForPlatform;
void *clCreateFromGLTexture;
void *clCreateSubDevices;
void *clRetainDevice;
void *clReleaseDevice;
void *clCreateImage;
void *clCreateProgramWithBuiltInKernels;
void *clCompileProgram;
void *clLinkProgram;
void *clUnloadPlatformCompiler;
void *clGetKernelArgInfo;
void *clEnqueueFillBuffer;
void *clEnqueueFillImage;
void *clEnqueueMigrateMemObjects;
void *clEnqueueMarkerWithWaitList;
void *clEnqueueBarrierWithWaitList;
void *clGetExtensionFunctionAddressForPlatform;
void *clCreateFromGLTexture;
#endif
/* cl_khr_d3d11_sharing and cl_khr_dx9_media_sharing */
/* cl_khr_d3d11_sharing and cl_khr_dx9_media_sharing */
#ifdef _WIN32
clGetDeviceIDsFromD3D11KHR_t *clGetDeviceIDsFromD3D11KHR;
clCreateFromD3D11BufferKHR_t *clCreateFromD3D11BufferKHR;
clCreateFromD3D11Texture2DKHR_t *clCreateFromD3D11Texture2DKHR;
clCreateFromD3D11Texture3DKHR_t *clCreateFromD3D11Texture3DKHR;
clCreateFromDX9MediaSurfaceKHR_t *clCreateFromDX9MediaSurfaceKHR;
clEnqueueAcquireD3D11ObjectsKHR_t *clEnqueueAcquireD3D11ObjectsKHR;
clEnqueueReleaseD3D11ObjectsKHR_t *clEnqueueReleaseD3D11ObjectsKHR;
clGetDeviceIDsFromDX9MediaAdapterKHR_t *
clGetDeviceIDsFromDX9MediaAdapterKHR;
clEnqueueAcquireDX9MediaSurfacesKHR_t *
clEnqueueAcquireDX9MediaSurfacesKHR;
clEnqueueReleaseDX9MediaSurfacesKHR_t *
clEnqueueReleaseDX9MediaSurfacesKHR;
clGetDeviceIDsFromD3D11KHR_t *clGetDeviceIDsFromD3D11KHR;
clCreateFromD3D11BufferKHR_t *clCreateFromD3D11BufferKHR;
clCreateFromD3D11Texture2DKHR_t *clCreateFromD3D11Texture2DKHR;
clCreateFromD3D11Texture3DKHR_t *clCreateFromD3D11Texture3DKHR;
clCreateFromDX9MediaSurfaceKHR_t *clCreateFromDX9MediaSurfaceKHR;
clEnqueueAcquireD3D11ObjectsKHR_t *clEnqueueAcquireD3D11ObjectsKHR;
clEnqueueReleaseD3D11ObjectsKHR_t *clEnqueueReleaseD3D11ObjectsKHR;
clGetDeviceIDsFromDX9MediaAdapterKHR_t *
clGetDeviceIDsFromDX9MediaAdapterKHR;
clEnqueueAcquireDX9MediaSurfacesKHR_t *
clEnqueueAcquireDX9MediaSurfacesKHR;
clEnqueueReleaseDX9MediaSurfacesKHR_t *
clEnqueueReleaseDX9MediaSurfacesKHR;
#else
void *clGetDeviceIDsFromD3D11KHR;
void *clCreateFromD3D11BufferKHR;
void *clCreateFromD3D11Texture2DKHR;
void *clCreateFromD3D11Texture3DKHR;
void *clCreateFromDX9MediaSurfaceKHR;
void *clEnqueueAcquireD3D11ObjectsKHR;
void *clEnqueueReleaseD3D11ObjectsKHR;
void *clGetDeviceIDsFromDX9MediaAdapterKHR;
void *clEnqueueAcquireDX9MediaSurfacesKHR;
void *clEnqueueReleaseDX9MediaSurfacesKHR;
void *clGetDeviceIDsFromD3D11KHR;
void *clCreateFromD3D11BufferKHR;
void *clCreateFromD3D11Texture2DKHR;
void *clCreateFromD3D11Texture3DKHR;
void *clCreateFromDX9MediaSurfaceKHR;
void *clEnqueueAcquireD3D11ObjectsKHR;
void *clEnqueueReleaseD3D11ObjectsKHR;
void *clGetDeviceIDsFromDX9MediaAdapterKHR;
void *clEnqueueAcquireDX9MediaSurfacesKHR;
void *clEnqueueReleaseDX9MediaSurfacesKHR;
#endif
/* cl_khr_egl_image */
clCreateFromEGLImageKHR_t *clCreateFromEGLImageKHR;
clEnqueueAcquireEGLObjectsKHR_t *clEnqueueAcquireEGLObjectsKHR;
clEnqueueReleaseEGLObjectsKHR_t *clEnqueueReleaseEGLObjectsKHR;
/* cl_khr_egl_image */
clCreateFromEGLImageKHR_t *clCreateFromEGLImageKHR;
clEnqueueAcquireEGLObjectsKHR_t *clEnqueueAcquireEGLObjectsKHR;
clEnqueueReleaseEGLObjectsKHR_t *clEnqueueReleaseEGLObjectsKHR;
/* cl_khr_egl_event */
clCreateEventFromEGLSyncKHR_t *clCreateEventFromEGLSyncKHR;
/* cl_khr_egl_event */
clCreateEventFromEGLSyncKHR_t *clCreateEventFromEGLSyncKHR;
/* OpenCL 2.0 */
/* OpenCL 2.0 */
#ifdef CL_VERSION_2_0
clCreateCommandQueueWithProperties_t *clCreateCommandQueueWithProperties;
clCreatePipe_t *clCreatePipe;
clGetPipeInfo_t *clGetPipeInfo;
clSVMAlloc_t *clSVMAlloc;
clSVMFree_t *clSVMFree;
clEnqueueSVMFree_t *clEnqueueSVMFree;
clEnqueueSVMMemcpy_t *clEnqueueSVMMemcpy;
clEnqueueSVMMemFill_t *clEnqueueSVMMemFill;
clEnqueueSVMMap_t *clEnqueueSVMMap;
clEnqueueSVMUnmap_t *clEnqueueSVMUnmap;
clCreateSamplerWithProperties_t *clCreateSamplerWithProperties;
clSetKernelArgSVMPointer_t *clSetKernelArgSVMPointer;
clSetKernelExecInfo_t *clSetKernelExecInfo;
clCreateCommandQueueWithProperties_t *clCreateCommandQueueWithProperties;
clCreatePipe_t *clCreatePipe;
clGetPipeInfo_t *clGetPipeInfo;
clSVMAlloc_t *clSVMAlloc;
clSVMFree_t *clSVMFree;
clEnqueueSVMFree_t *clEnqueueSVMFree;
clEnqueueSVMMemcpy_t *clEnqueueSVMMemcpy;
clEnqueueSVMMemFill_t *clEnqueueSVMMemFill;
clEnqueueSVMMap_t *clEnqueueSVMMap;
clEnqueueSVMUnmap_t *clEnqueueSVMUnmap;
clCreateSamplerWithProperties_t *clCreateSamplerWithProperties;
clSetKernelArgSVMPointer_t *clSetKernelArgSVMPointer;
clSetKernelExecInfo_t *clSetKernelExecInfo;
#else
void *clCreateCommandQueueWithProperties;
void *clCreatePipe;
void *clGetPipeInfo;
void *clSVMAlloc;
void *clSVMFree;
void *clEnqueueSVMFree;
void *clEnqueueSVMMemcpy;
void *clEnqueueSVMMemFill;
void *clEnqueueSVMMap;
void *clEnqueueSVMUnmap;
void *clCreateSamplerWithProperties;
void *clSetKernelArgSVMPointer;
void *clSetKernelExecInfo;
void *clCreateCommandQueueWithProperties;
void *clCreatePipe;
void *clGetPipeInfo;
void *clSVMAlloc;
void *clSVMFree;
void *clEnqueueSVMFree;
void *clEnqueueSVMMemcpy;
void *clEnqueueSVMMemFill;
void *clEnqueueSVMMap;
void *clEnqueueSVMUnmap;
void *clCreateSamplerWithProperties;
void *clSetKernelArgSVMPointer;
void *clSetKernelExecInfo;
#endif
/* cl_khr_sub_groups */
clGetKernelSubGroupInfoKHR_t *clGetKernelSubGroupInfoKHR;
/* cl_khr_sub_groups */
clGetKernelSubGroupInfoKHR_t *clGetKernelSubGroupInfoKHR;
/* OpenCL 2.1 */
/* OpenCL 2.1 */
#ifdef CL_VERSION_2_1
clCloneKernel_t *clCloneKernel;
clCreateProgramWithIL_t *clCreateProgramWithIL;
clEnqueueSVMMigrateMem_t *clEnqueueSVMMigrateMem;
clGetDeviceAndHostTimer_t *clGetDeviceAndHostTimer;
clGetHostTimer_t *clGetHostTimer;
clGetKernelSubGroupInfo_t *clGetKernelSubGroupInfo;
clSetDefaultDeviceCommandQueue_t *clSetDefaultDeviceCommandQueue;
clCloneKernel_t *clCloneKernel;
clCreateProgramWithIL_t *clCreateProgramWithIL;
clEnqueueSVMMigrateMem_t *clEnqueueSVMMigrateMem;
clGetDeviceAndHostTimer_t *clGetDeviceAndHostTimer;
clGetHostTimer_t *clGetHostTimer;
clGetKernelSubGroupInfo_t *clGetKernelSubGroupInfo;
clSetDefaultDeviceCommandQueue_t *clSetDefaultDeviceCommandQueue;
#else
void *clCloneKernel;
void *clCreateProgramWithIL;
void *clEnqueueSVMMigrateMem;
void *clGetDeviceAndHostTimer;
void *clGetHostTimer;
void *clGetKernelSubGroupInfo;
void *clSetDefaultDeviceCommandQueue;
void *clCloneKernel;
void *clCreateProgramWithIL;
void *clEnqueueSVMMigrateMem;
void *clGetDeviceAndHostTimer;
void *clGetHostTimer;
void *clGetKernelSubGroupInfo;
void *clSetDefaultDeviceCommandQueue;
#endif
/* OpenCL 2.2 */
/* OpenCL 2.2 */
#ifdef CL_VERSION_2_2
clSetProgramReleaseCallback_t *clSetProgramReleaseCallback;
clSetProgramSpecializationConstant_t *clSetProgramSpecializationConstant;
clSetProgramReleaseCallback_t *clSetProgramReleaseCallback;
clSetProgramSpecializationConstant_t *clSetProgramSpecializationConstant;
#else
void *clSetProgramReleaseCallback;
void *clSetProgramSpecializationConstant;
void *clSetProgramReleaseCallback;
void *clSetProgramSpecializationConstant;
#endif
/* OpenCL 3.0 */
/* OpenCL 3.0 */
#ifdef CL_VERSION_3_0
clCreateBufferWithProperties_t *clCreateBufferWithProperties;
clCreateImageWithProperties_t *clCreateImageWithProperties;
clSetContextDestructorCallback_t *clSetContextDestructorCallback;
clCreateBufferWithProperties_t *clCreateBufferWithProperties;
clCreateImageWithProperties_t *clCreateImageWithProperties;
clSetContextDestructorCallback_t *clSetContextDestructorCallback;
#else
void *clCreateBufferWithProperties;
void *clCreateImageWithProperties;
void *clSetContextDestructorCallback;
void *clCreateBufferWithProperties;
void *clCreateImageWithProperties;
void *clSetContextDestructorCallback;
#endif
} cl_icd_dispatch;

File diff suppressed because it is too large Load diff

View file

@ -62,8 +62,8 @@ clGetSupportedVA_APIMediaSurfaceFormatsINTEL_t(
cl_mem_object_type image_type,
cl_uint plane,
cl_uint num_entries,
VAImageFormat* va_api_formats,
cl_uint* num_surface_formats);
VAImageFormat *va_api_formats,
cl_uint *num_surface_formats);
typedef clGetSupportedVA_APIMediaSurfaceFormatsINTEL_t *
clGetSupportedVA_APIMediaSurfaceFormatsINTEL_fn ;
@ -77,8 +77,8 @@ clGetSupportedVA_APIMediaSurfaceFormatsINTEL(
cl_mem_object_type image_type,
cl_uint plane,
cl_uint num_entries,
VAImageFormat* va_api_formats,
cl_uint* num_surface_formats) ;
VAImageFormat *va_api_formats,
cl_uint *num_surface_formats) ;
#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
@ -123,11 +123,11 @@ typedef cl_int CL_API_CALL
clGetDeviceIDsFromVA_APIMediaAdapterINTEL_t(
cl_platform_id platform,
cl_va_api_device_source_intel media_adapter_type,
void* media_adapter,
void *media_adapter,
cl_va_api_device_set_intel media_adapter_set,
cl_uint num_entries,
cl_device_id* devices,
cl_uint* num_devices);
cl_device_id *devices,
cl_uint *num_devices);
typedef clGetDeviceIDsFromVA_APIMediaAdapterINTEL_t *
clGetDeviceIDsFromVA_APIMediaAdapterINTEL_fn CL_API_SUFFIX__VERSION_1_2;
@ -136,9 +136,9 @@ typedef cl_mem CL_API_CALL
clCreateFromVA_APIMediaSurfaceINTEL_t(
cl_context context,
cl_mem_flags flags,
VASurfaceID* surface,
VASurfaceID *surface,
cl_uint plane,
cl_int* errcode_ret);
cl_int *errcode_ret);
typedef clCreateFromVA_APIMediaSurfaceINTEL_t *
clCreateFromVA_APIMediaSurfaceINTEL_fn CL_API_SUFFIX__VERSION_1_2;
@ -147,10 +147,10 @@ typedef cl_int CL_API_CALL
clEnqueueAcquireVA_APIMediaSurfacesINTEL_t(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event);
const cl_event *event_wait_list,
cl_event *event);
typedef clEnqueueAcquireVA_APIMediaSurfacesINTEL_t *
clEnqueueAcquireVA_APIMediaSurfacesINTEL_fn CL_API_SUFFIX__VERSION_1_2;
@ -159,10 +159,10 @@ typedef cl_int CL_API_CALL
clEnqueueReleaseVA_APIMediaSurfacesINTEL_t(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event);
const cl_event *event_wait_list,
cl_event *event);
typedef clEnqueueReleaseVA_APIMediaSurfacesINTEL_t *
clEnqueueReleaseVA_APIMediaSurfacesINTEL_fn CL_API_SUFFIX__VERSION_1_2;
@ -173,37 +173,37 @@ extern CL_API_ENTRY cl_int CL_API_CALL
clGetDeviceIDsFromVA_APIMediaAdapterINTEL(
cl_platform_id platform,
cl_va_api_device_source_intel media_adapter_type,
void* media_adapter,
void *media_adapter,
cl_va_api_device_set_intel media_adapter_set,
cl_uint num_entries,
cl_device_id* devices,
cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_2;
cl_device_id *devices,
cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_2;
extern CL_API_ENTRY cl_mem CL_API_CALL
clCreateFromVA_APIMediaSurfaceINTEL(
cl_context context,
cl_mem_flags flags,
VASurfaceID* surface,
VASurfaceID *surface,
cl_uint plane,
cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2;
extern CL_API_ENTRY cl_int CL_API_CALL
clEnqueueAcquireVA_APIMediaSurfacesINTEL(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event) CL_API_SUFFIX__VERSION_1_2;
const cl_event *event_wait_list,
cl_event *event) CL_API_SUFFIX__VERSION_1_2;
extern CL_API_ENTRY cl_int CL_API_CALL
clEnqueueReleaseVA_APIMediaSurfacesINTEL(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem* mem_objects,
const cl_mem *mem_objects,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event) CL_API_SUFFIX__VERSION_1_2;
const cl_event *event_wait_list,
cl_event *event) CL_API_SUFFIX__VERSION_1_2;
#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */

View file

@ -342,13 +342,15 @@ int main(int argc, char **argv) {
switch (e) {
case 0: // UID
if (!strncmp(argv[optind], "0x", 2) || !strncmp(argv[optind], "0X", 2)) {
if (strlen(argv[optind]) != 2 + 8) {
printf("Error: invalid UID length\n"); usage(argv[0]);
if (strlen(argv[optind]) != 2 + 8) {
printf("Error: invalid UID length\n");
usage(argv[0]);
}
uid = (uint32_t) rev32(hexreversetoulong(argv[optind] + 2));
} else {
if (strlen(argv[optind]) != 8) {
printf("Error: invalid UID length\n"); usage(argv[0]);
printf("Error: invalid UID length\n");
usage(argv[0]);
}
uid = (uint32_t) rev32(hexreversetoulong(argv[optind]));
}
@ -357,12 +359,14 @@ int main(int argc, char **argv) {
case 1: // nR1
if (!strncmp(argv[optind], "0x", 2) || !strncmp(argv[optind], "0X", 2)) {
if (strlen(argv[optind]) != 2 + 8) {
printf("Error: invalid nR1 length\n"); usage(argv[0]);
printf("Error: invalid nR1 length\n");
usage(argv[0]);
}
nR1 = (uint32_t) rev32(hexreversetoulong(argv[optind] + 2));
} else {
if (strlen(argv[optind]) != 8) {
printf("Error: invalid nR1 length\n"); usage(argv[0]);
printf("Error: invalid nR1 length\n");
usage(argv[0]);
}
nR1 = (uint32_t) rev32(hexreversetoulong(argv[optind]));
}
@ -370,7 +374,8 @@ int main(int argc, char **argv) {
case 2: // aR1
if (strlen(argv[optind]) != 8) {
printf("Error: invalid aR1 length\n"); usage(argv[0]);
printf("Error: invalid aR1 length\n");
usage(argv[0]);
}
aR1 = (uint32_t) strtoul(argv[optind], NULL, 16);
break;
@ -378,12 +383,14 @@ int main(int argc, char **argv) {
case 3: // nR2
if (!strncmp(argv[optind], "0x", 2) || !strncmp(argv[optind], "0X", 2)) {
if (strlen(argv[optind]) != 2 + 8) {
printf("Error: invalid nR2 length\n"); usage(argv[0]);
printf("Error: invalid nR2 length\n");
usage(argv[0]);
}
nR2 = (uint32_t) rev32(hexreversetoulong(argv[optind] + 2));
} else {
if (strlen(argv[optind]) != 8) {
printf("Error: invalid nR2 length\n"); usage(argv[0]);
printf("Error: invalid nR2 length\n");
usage(argv[0]);
}
nR2 = (uint32_t) rev32(hexreversetoulong(argv[optind]));
}
@ -391,7 +398,8 @@ int main(int argc, char **argv) {
case 4: // aR2
if (strlen(argv[optind]) != 8) {
printf("Error: invalid aR2 length\n"); usage(argv[0]);
printf("Error: invalid aR2 length\n");
usage(argv[0]);
}
aR2 = (uint32_t) strtoul(argv[optind], NULL, 16);
break;
@ -1182,10 +1190,10 @@ int main(int argc, char **argv) {
printf(")\n\n");
} else {
printf(", Profile %u, Async Threads %s, HiTag2 key verify on device %s)\n\n"
, profile
, (ctx.thread_sched_type == THREAD_TYPE_ASYNC) ? "yes" : "no"
, (force_hitag2_opencl) ? "yes" : "no"
);
, profile
, (ctx.thread_sched_type == THREAD_TYPE_ASYNC) ? "yes" : "no"
, (force_hitag2_opencl) ? "yes" : "no"
);
}
if (gettimeofday(&cpu_t_start, NULL) == -1) {
@ -1216,9 +1224,9 @@ int main(int argc, char **argv) {
}
printf("\nKey found @ slice %zu/%zu [ \x1b[32m"
, t_arg[y].slice
, t_arg[y].max_slices
);
, t_arg[y].slice
, t_arg[y].max_slices
);
for (int i = 0; i < 6; i++) {
printf("%02X", (uint8_t)(t_arg[y].key & 0xff));