Added opencl-version_1_2 patchset

This commit is contained in:
Alistair Leslie-Hughes 2019-03-15 09:51:33 +11:00
parent 993b6c9c83
commit 3d9797093d
7 changed files with 1941 additions and 1 deletions

View File

@ -0,0 +1,441 @@
From 3d9a49e946e17ac814c3680fdf9e7983eb76183b Mon Sep 17 00:00:00 2001
From: Nakarin Khankham <garuda2550@gmail.com>
Date: Sat, 9 Mar 2019 21:37:24 +0700
Subject: [PATCH 1/5] opencl: Add OpenCL 1.0 function pointer loader.
Signed-off-by: Nakarin Khankham <garuda2550@gmail.com>
---
configure | 56 +++++++++
configure.ac | 1 +
dlls/opencl/opencl.c | 321 +++++++++++++++++++++++++++++++++++++++++++++++++++
include/config.h.in | 3 +
4 files changed, 381 insertions(+)
diff --git a/configure b/configure
index 5a091db..1444fd4 100755
--- a/configure
+++ b/configure
@@ -11800,6 +11800,62 @@ if test "x$ac_cv_lib_OpenCL_clGetPlatformInfo" = xyes; then :
fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -lOpenCL" >&5
+$as_echo_n "checking for -lOpenCL... " >&6; }
+if ${ac_cv_lib_soname_OpenCL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_soname_save_LIBS=$LIBS
+LIBS="-lOpenCL $LIBS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char clGetPlatformInfo ();
+int
+main ()
+{
+return clGetPlatformInfo ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ case "$LIBEXT" in
+ dll) ac_cv_lib_soname_OpenCL=`$ac_cv_path_LDD conftest.exe | grep "OpenCL" | sed -e "s/dll.*/dll/"';2,$d'` ;;
+ dylib) ac_cv_lib_soname_OpenCL=`$OTOOL -L conftest$ac_exeext | grep "libOpenCL\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libOpenCL\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
+ *) ac_cv_lib_soname_OpenCL=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libOpenCL\\.$LIBEXT" | sed -e "s/^.*\\[\\(libOpenCL\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'`
+ if ${ac_cv_lib_soname_OpenCL:+false} :; then :
+ ac_cv_lib_soname_OpenCL=`$LDD conftest$ac_exeext | grep "libOpenCL\\.$LIBEXT" | sed -e "s/^.*\(libOpenCL\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'`
+fi ;;
+ esac
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_soname_save_LIBS
+fi
+if ${ac_cv_lib_soname_OpenCL:+false} :; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ cat >>confdefs.h <<_ACEOF
+#define SONAME_LIBOPENCL "libOpenCL.$LIBEXT"
+_ACEOF
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_OpenCL" >&5
+$as_echo "$ac_cv_lib_soname_OpenCL" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define SONAME_LIBOPENCL "$ac_cv_lib_soname_OpenCL"
+_ACEOF
+
+
+fi
fi
if test "x$ac_cv_lib_OpenCL_clGetPlatformInfo" != xyes; then :
case "x$with_opencl" in
diff --git a/configure.ac b/configure.ac
index 87d8bf5..0f0a459 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1252,6 +1252,7 @@ dnl **** Check for OpenCL ****
if test "$ac_cv_header_CL_cl_h" = "yes"
then
AC_CHECK_LIB(OpenCL,clGetPlatformInfo,[AC_SUBST(OPENCL_LIBS,["-lOpenCL"])])
+ WINE_CHECK_SONAME(OpenCL,clGetPlatformInfo,,[AC_DEFINE_UNQUOTED(SONAME_LIBOPENCL,["libOpenCL.$LIBEXT"])])
fi
WINE_NOTICE_WITH(opencl,[test "x$ac_cv_lib_OpenCL_clGetPlatformInfo" != xyes],
[OpenCL ${notice_platform}development files not found, OpenCL won't be supported.],
diff --git a/dlls/opencl/opencl.c b/dlls/opencl/opencl.c
index 2d145bf..7d292c0 100644
--- a/dlls/opencl/opencl.c
+++ b/dlls/opencl/opencl.c
@@ -43,6 +43,327 @@ WINE_DEFAULT_DEBUG_CHANNEL(opencl);
#define OPENCL_WITH_GL 0
+/* Platform API */
+static cl_int (*pclGetPlatformIDs)(cl_uint num_entries, cl_platform_id *platforms, cl_uint *num_platforms);
+static cl_int (*pclGetPlatformInfo)(cl_platform_id platform, cl_platform_info param_name,
+ size_t param_value_size, void * param_value, size_t * param_value_size_ret);
+
+/* Device APIs */
+static cl_int (*pclGetDeviceIDs)(cl_platform_id platform, cl_device_type device_type,
+ cl_uint num_entries, cl_device_id * devices, cl_uint * num_devices);
+static cl_int (*pclGetDeviceInfo)(cl_device_id device, cl_device_info param_name,
+ size_t param_value_size, void * param_value, size_t * param_value_size_ret);
+
+/* Context APIs */
+static cl_context (*pclCreateContext)(const cl_context_properties * properties, cl_uint num_devices, const cl_device_id * devices,
+ void (*pfn_notify)(const char *errinfo, const void *private_info, size_t cb, void *user_data),
+ void * user_data, cl_int * errcode_ret);
+static cl_context (*pclCreateContextFromType)(const cl_context_properties * properties, cl_device_type device_type,
+ void (*pfn_notify)(const char *errinfo, const void *private_info, size_t cb, void *user_data),
+ void * user_data, cl_int * errcode_ret);
+static cl_int (*pclRetainContext)(cl_context context);
+static cl_int (*pclReleaseContext)(cl_context context);
+static cl_int (*pclGetContextInfo)(cl_context context, cl_context_info param_name,
+ size_t param_value_size, void * param_value, size_t * param_value_size_ret);
+
+/* Command Queue APIs */
+static cl_command_queue (*pclCreateCommandQueue)(cl_context context, cl_device_id device,
+ cl_command_queue_properties properties, cl_int * errcode_ret);
+static cl_int (*pclRetainCommandQueue)(cl_command_queue command_queue);
+static cl_int (*pclReleaseCommandQueue)(cl_command_queue command_queue);
+static cl_int (*pclGetCommandQueueInfo)(cl_command_queue command_queue, cl_command_queue_info param_name,
+ size_t param_value_size, void * param_value, size_t * param_value_size_ret);
+static cl_int (*pclSetCommandQueueProperty)(cl_command_queue command_queue, cl_command_queue_properties properties, cl_bool enable,
+ cl_command_queue_properties * old_properties);
+
+/* Memory Object APIs */
+static cl_mem (*pclCreateBuffer)(cl_context context, cl_mem_flags flags, size_t size, void * host_ptr, cl_int * errcode_ret);
+static cl_mem (*pclCreateImage2D)(cl_context context, cl_mem_flags flags, cl_image_format * image_format,
+ size_t image_width, size_t image_height, size_t image_row_pitch, void * host_ptr, cl_int * errcode_ret);
+static cl_mem (*pclCreateImage3D)(cl_context context, cl_mem_flags flags, cl_image_format * image_format,
+ size_t image_width, size_t image_height, size_t image_depth, size_t image_row_pitch, size_t image_slice_pitch,
+ void * host_ptr, cl_int * errcode_ret);
+static cl_int (*pclRetainMemObject)(cl_mem memobj);
+static cl_int (*pclReleaseMemObject)(cl_mem memobj);
+static cl_int (*pclGetSupportedImageFormats)(cl_context context, cl_mem_flags flags, cl_mem_object_type image_type, cl_uint num_entries,
+ cl_image_format * image_formats, cl_uint * num_image_formats);
+static cl_int (*pclGetMemObjectInfo)(cl_mem memobj, cl_mem_info param_name, size_t param_value_size, void * param_value, size_t * param_value_size_ret);
+static cl_int (*pclGetImageInfo)(cl_mem image, cl_image_info param_name, size_t param_value_size, void * param_value, size_t * param_value_size_ret);
+
+/* Sampler APIs */
+static cl_sampler (*pclCreateSampler)(cl_context context, cl_bool normalized_coords, cl_addressing_mode addressing_mode,
+ cl_filter_mode filter_mode, cl_int * errcode_ret);
+static cl_int (*pclRetainSampler)(cl_sampler sampler);
+static cl_int (*pclReleaseSampler)(cl_sampler sampler);
+static cl_int (*pclGetSamplerInfo)(cl_sampler sampler, cl_sampler_info param_name, size_t param_value_size,
+ void * param_value, size_t * param_value_size_ret);
+
+/* Program Object APIs */
+static cl_program (*pclCreateProgramWithSource)(cl_context context, cl_uint count, const char ** strings,
+ const size_t * lengths, cl_int * errcode_ret);
+static cl_program (*pclCreateProgramWithBinary)(cl_context context, cl_uint num_devices, const cl_device_id * device_list,
+ const size_t * lengths, const unsigned char ** binaries, cl_int * binary_status,
+ cl_int * errcode_ret);
+static cl_int (*pclRetainProgram)(cl_program program);
+static cl_int (*pclReleaseProgram)(cl_program program);
+static cl_int (*pclBuildProgram)(cl_program program, cl_uint num_devices, const cl_device_id * device_list, const char * options,
+ void (*pfn_notify)(cl_program program, void * user_data),
+ void * user_data);
+static cl_int (*pclUnloadCompiler)(void);
+static cl_int (*pclGetProgramInfo)(cl_program program, cl_program_info param_name,
+ size_t param_value_size, void * param_value, size_t * param_value_size_ret);
+static cl_int (*pclGetProgramBuildInfo)(cl_program program, cl_device_id device,
+ cl_program_build_info param_name, size_t param_value_size, void * param_value,
+ size_t * param_value_size_ret);
+
+/* Kernel Object APIs */
+static cl_kernel (*pclCreateKernel)(cl_program program, char * kernel_name, cl_int * errcode_ret);
+static cl_int (*pclCreateKernelsInProgram)(cl_program program, cl_uint num_kernels,
+ cl_kernel * kernels, cl_uint * num_kernels_ret);
+static cl_int (*pclRetainKernel)(cl_kernel kernel);
+static cl_int (*pclReleaseKernel)(cl_kernel kernel);
+static cl_int (*pclSetKernelArg)(cl_kernel kernel, cl_uint arg_index, size_t arg_size, void * arg_value);
+static cl_int (*pclGetKernelInfo)(cl_kernel kernel, cl_kernel_info param_name,
+ size_t param_value_size, void * param_value, size_t * param_value_size_ret);
+static cl_int (*pclGetKernelWorkGroupInfo)(cl_kernel kernel, cl_device_id device,
+ cl_kernel_work_group_info param_name, size_t param_value_size,
+ void * param_value, size_t * param_value_size_ret);
+/* Event Object APIs */
+static cl_int (*pclWaitForEvents)(cl_uint num_events, cl_event * event_list);
+static cl_int (*pclGetEventInfo)(cl_event event, cl_event_info param_name, size_t param_value_size,
+ void * param_value, size_t * param_value_size_ret);
+static cl_int (*pclRetainEvent)(cl_event event);
+static cl_int (*pclReleaseEvent)(cl_event event);
+
+/* Profiling APIs */
+static cl_int (*pclGetEventProfilingInfo)(cl_event event, cl_profiling_info param_name, size_t param_value_size,
+ void * param_value, size_t * param_value_size_ret);
+
+/* Flush and Finish APIs */
+static cl_int (*pclFlush)(cl_command_queue command_queue);
+static cl_int (*pclFinish)(cl_command_queue command_queue);
+
+/* Enqueued Commands APIs */
+static cl_int (*pclEnqueueReadBuffer)(cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read,
+ size_t offset, size_t cb, void * ptr,
+ cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event);
+static cl_int (*pclEnqueueWriteBuffer)(cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write,
+ size_t offset, size_t cb, const void * ptr,
+ cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event);
+static cl_int (*pclEnqueueCopyBuffer)(cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer,
+ size_t src_offset, size_t dst_offset, size_t cb,
+ cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event);
+static cl_int (*pclEnqueueReadImage)(cl_command_queue command_queue, cl_mem image, cl_bool blocking_read,
+ const size_t * origin, const size_t * region,
+ size_t row_pitch, size_t slice_pitch, void * ptr,
+ cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event);
+static cl_int (*pclEnqueueWriteImage)(cl_command_queue command_queue, cl_mem image, cl_bool blocking_write,
+ const size_t * origin, const size_t * region,
+ size_t input_row_pitch, size_t input_slice_pitch, const void * ptr,
+ cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event);
+static cl_int (*pclEnqueueCopyImage)(cl_command_queue command_queue, cl_mem src_image, cl_mem dst_image,
+ size_t * src_origin, size_t * dst_origin, size_t * region,
+ cl_uint num_events_in_wait_list, cl_event * event_wait_list, cl_event * event);
+static cl_int (*pclEnqueueCopyImageToBuffer)(cl_command_queue command_queue, cl_mem src_image, cl_mem dst_buffer,
+ size_t * src_origin, size_t * region, size_t dst_offset,
+ cl_uint num_events_in_wait_list, cl_event * event_wait_list, cl_event * event);
+static cl_int (*pclEnqueueCopyBufferToImage)(cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_image,
+ size_t src_offset, size_t * dst_origin, size_t * region,
+ cl_uint num_events_in_wait_list, cl_event * event_wait_list, cl_event * event);
+static void * (*pclEnqueueMapBuffer)(cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_map,
+ cl_map_flags map_flags, size_t offset, size_t cb,
+ cl_uint num_events_in_wait_list, cl_event * event_wait_list, cl_event * event, cl_int * errcode_ret);
+static void * (*pclEnqueueMapImage)(cl_command_queue command_queue, cl_mem image, cl_bool blocking_map,
+ cl_map_flags map_flags, size_t * origin, size_t * region,
+ size_t * image_row_pitch, size_t * image_slice_pitch,
+ cl_uint num_events_in_wait_list, cl_event * event_wait_list, cl_event * event, cl_int * errcode_ret);
+static cl_int (*pclEnqueueUnmapMemObject)(cl_command_queue command_queue, cl_mem memobj, void * mapped_ptr,
+ cl_uint num_events_in_wait_list, cl_event * event_wait_list, cl_event * event);
+static cl_int (*pclEnqueueNDRangeKernel)(cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim,
+ size_t * global_work_offset, size_t * global_work_size, size_t * local_work_size,
+ cl_uint num_events_in_wait_list, cl_event * event_wait_list, cl_event * event);
+static cl_int (*pclEnqueueTask)(cl_command_queue command_queue, cl_kernel kernel,
+ cl_uint num_events_in_wait_list, cl_event * event_wait_list, cl_event * event);
+static cl_int (*pclEnqueueNativeKernel)(cl_command_queue command_queue,
+ void (*user_func)(void *args),
+ void * args, size_t cb_args,
+ cl_uint num_mem_objects, const cl_mem * mem_list, const void ** args_mem_loc,
+ cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event);
+static cl_int (*pclEnqueueMarker)(cl_command_queue command_queue, cl_event * event);
+static cl_int (*pclEnqueueWaitForEvents)(cl_command_queue command_queue, cl_uint num_events, cl_event * event_list);
+static cl_int (*pclEnqueueBarrier)(cl_command_queue command_queue);
+
+/* Extension function access */
+static void * (*pclGetExtensionFunctionAddress)(const char * func_name);
+
+
+static BOOL init_opencl(void);
+static BOOL load_opencl_func(void);
+
+static void * opencl_handle = NULL;
+
+
+/***********************************************************************
+ * DllMain [Internal]
+ *
+ * Initializes the internal 'opencl.dll'.
+ */
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved)
+{
+ TRACE("opencl.dll: %p,%x,%p\n", hinstDLL, reason, reserved);
+
+ switch (reason)
+ {
+ case DLL_PROCESS_ATTACH:
+ DisableThreadLibraryCalls(hinstDLL);
+ if (init_opencl())
+ load_opencl_func();
+ break;
+
+ case DLL_PROCESS_DETACH:
+ if (reserved) break;
+ if (opencl_handle) wine_dlclose(opencl_handle, NULL, 0);
+ }
+
+ return TRUE;
+}
+
+
+/***********************************************************************
+ * init_opencl [Internal]
+ *
+ * Initializes OpenCL library.
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ */
+static BOOL init_opencl(void)
+{
+#ifdef SONAME_LIBOPENCL
+ char error[256];
+
+ opencl_handle = wine_dlopen(SONAME_LIBOPENCL, RTLD_NOW, error, sizeof(error));
+ if (opencl_handle != NULL)
+ {
+ TRACE("Opened library %s\n", SONAME_LIBOPENCL);
+ return TRUE;
+ }
+ else
+ ERR("Failed to open library %s: %s\n", SONAME_LIBOPENCL, error);
+#else
+ ERR("OpenCL is needed but support was not included at build time\n");
+#endif
+ return FALSE;
+}
+
+
+/***********************************************************************
+ * load_opencl_func [Internal]
+ *
+ * Populate function table.
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ */
+static BOOL load_opencl_func(void)
+{
+ char error[256];
+
+ if (opencl_handle == NULL)
+ return FALSE;
+
+#define LOAD_FUNCPTR(f) \
+ if (!(p##f = wine_dlsym(opencl_handle, #f, error, sizeof(error)))) \
+ WARN("%s not found in %s (%s)\n", #f, SONAME_LIBOPENCL, error);
+
+ /* Platform API */
+ LOAD_FUNCPTR(clGetPlatformIDs);
+ LOAD_FUNCPTR(clGetPlatformInfo);
+ /* Device APIs */
+ LOAD_FUNCPTR(clGetDeviceIDs);
+ LOAD_FUNCPTR(clGetDeviceInfo);
+ /* Context APIs */
+ LOAD_FUNCPTR(clCreateContext);
+ LOAD_FUNCPTR(clCreateContextFromType);
+ LOAD_FUNCPTR(clRetainContext);
+ LOAD_FUNCPTR(clReleaseContext);
+ LOAD_FUNCPTR(clGetContextInfo);
+ /* Command Queue APIs */
+ LOAD_FUNCPTR(clCreateCommandQueue);
+ LOAD_FUNCPTR(clRetainCommandQueue);
+ LOAD_FUNCPTR(clReleaseCommandQueue);
+ LOAD_FUNCPTR(clGetCommandQueueInfo);
+ LOAD_FUNCPTR(clSetCommandQueueProperty);
+ /* Memory Object APIs */
+ LOAD_FUNCPTR(clCreateBuffer);
+ LOAD_FUNCPTR(clCreateImage2D);
+ LOAD_FUNCPTR(clCreateImage3D);
+ LOAD_FUNCPTR(clRetainMemObject);
+ LOAD_FUNCPTR(clReleaseMemObject);
+ LOAD_FUNCPTR(clGetSupportedImageFormats);
+ LOAD_FUNCPTR(clGetMemObjectInfo);
+ LOAD_FUNCPTR(clGetImageInfo);
+ /* Sampler APIs */
+ LOAD_FUNCPTR(clCreateSampler);
+ LOAD_FUNCPTR(clRetainSampler);
+ LOAD_FUNCPTR(clReleaseSampler);
+ LOAD_FUNCPTR(clGetSamplerInfo);
+ /* Program Object APIs */
+ LOAD_FUNCPTR(clCreateProgramWithSource);
+ LOAD_FUNCPTR(clCreateProgramWithBinary);
+ LOAD_FUNCPTR(clRetainProgram);
+ LOAD_FUNCPTR(clReleaseProgram);
+ LOAD_FUNCPTR(clBuildProgram);
+ LOAD_FUNCPTR(clUnloadCompiler);
+ LOAD_FUNCPTR(clGetProgramInfo);
+ LOAD_FUNCPTR(clGetProgramBuildInfo);
+ /* Kernel Object APIs */
+ LOAD_FUNCPTR(clCreateKernel);
+ LOAD_FUNCPTR(clCreateKernelsInProgram);
+ LOAD_FUNCPTR(clRetainKernel);
+ LOAD_FUNCPTR(clReleaseKernel);
+ LOAD_FUNCPTR(clSetKernelArg);
+ LOAD_FUNCPTR(clGetKernelInfo);
+ LOAD_FUNCPTR(clGetKernelWorkGroupInfo);
+ /* Event Object APIs */
+ LOAD_FUNCPTR(clWaitForEvents);
+ LOAD_FUNCPTR(clGetEventInfo);
+ LOAD_FUNCPTR(clRetainEvent);
+ LOAD_FUNCPTR(clReleaseEvent);
+ /* Profiling APIs */
+ LOAD_FUNCPTR(clGetEventProfilingInfo);
+ /* Flush and Finish APIs */
+ LOAD_FUNCPTR(clFlush);
+ LOAD_FUNCPTR(clFinish);
+ /* Enqueued Commands APIs */
+ LOAD_FUNCPTR(clEnqueueReadBuffer);
+ LOAD_FUNCPTR(clEnqueueWriteBuffer);
+ LOAD_FUNCPTR(clEnqueueCopyBuffer);
+ LOAD_FUNCPTR(clEnqueueReadImage);
+ LOAD_FUNCPTR(clEnqueueWriteImage);
+ LOAD_FUNCPTR(clEnqueueCopyImage);
+ LOAD_FUNCPTR(clEnqueueCopyImageToBuffer);
+ LOAD_FUNCPTR(clEnqueueCopyBufferToImage);
+ LOAD_FUNCPTR(clEnqueueMapBuffer);
+ LOAD_FUNCPTR(clEnqueueMapImage);
+ LOAD_FUNCPTR(clEnqueueUnmapMemObject);
+ LOAD_FUNCPTR(clEnqueueNDRangeKernel);
+ LOAD_FUNCPTR(clEnqueueTask);
+ LOAD_FUNCPTR(clEnqueueNativeKernel);
+ LOAD_FUNCPTR(clEnqueueMarker);
+ LOAD_FUNCPTR(clEnqueueWaitForEvents);
+ LOAD_FUNCPTR(clEnqueueBarrier);
+ /* Extension function access */
+ LOAD_FUNCPTR(clGetExtensionFunctionAddress);
+
+#undef LOAD_FUNCPTR
+
+ return TRUE;
+}
+
+
/*---------------------------------------------------------------*/
/* Platform API */
diff --git a/include/config.h.in b/include/config.h.in
index b3df2f3..1330d30 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -1443,6 +1443,9 @@
/* Define to the soname of the libopenal library. */
#undef SONAME_LIBOPENAL
+/* Define to the soname of the libOpenCL library. */
+#undef SONAME_LIBOPENCL
+
/* Define to the soname of the libOSMesa library. */
#undef SONAME_LIBOSMESA
--
1.9.1

View File

@ -0,0 +1,286 @@
From 73c7c7b43fcc85af543c53c2cf0180e6be1473a4 Mon Sep 17 00:00:00 2001
From: Nakarin Khankham <garuda2550@gmail.com>
Date: Sat, 9 Mar 2019 21:53:49 +0700
Subject: [PATCH 3/5] opencl: Add OpenCL 1.1 implementation.
Signed-off-by: Nakarin Khankham <garuda2550@gmail.com>
---
dlls/opencl/opencl.c | 194 ++++++++++++++++++++++++++++++++++++++++++++++++
dlls/opencl/opencl.spec | 10 +++
2 files changed, 204 insertions(+)
diff --git a/dlls/opencl/opencl.c b/dlls/opencl/opencl.c
index 221cf1a..41fc71b 100644
--- a/dlls/opencl/opencl.c
+++ b/dlls/opencl/opencl.c
@@ -196,6 +196,28 @@ static cl_int (*pclEnqueueBarrier)(cl_command_queue command_queue);
/* Extension function access */
static void * (*pclGetExtensionFunctionAddress)(const char * func_name);
+/* OpenCL 1.1 functions */
+static cl_mem (*pclCreateSubBuffer)(cl_mem buffer, cl_mem_flags flags,
+ cl_buffer_create_type buffer_create_type, const void * buffer_create_info, cl_int * errcode_ret);
+static cl_event (*pclCreateUserEvent)(cl_context context, cl_int * errcode_ret);
+static cl_int (*pclEnqueueCopyBufferRect)(cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer,
+ const size_t * src_origin, const size_t * dst_origin, const size_t * region,
+ size_t src_row_pitch, size_t src_slice_pitch,
+ size_t dst_row_pitch, size_t dst_slice_pitch,
+ cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event);
+static cl_int (*pclEnqueueReadBufferRect)(cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read,
+ const size_t * buffer_origin, const size_t * host_origin, const size_t * region,
+ size_t buffer_row_pitch, size_t buffer_slice_pitch, size_t host_row_pitch, size_t host_slice_pitch,
+ void * ptr, cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event);
+static cl_int (*pclEnqueueWriteBufferRect)(cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read,
+ const size_t * buffer_origin, const size_t * host_origin, const size_t * region,
+ size_t buffer_row_pitch, size_t buffer_slice_pitch, size_t host_row_pitch, size_t host_slice_pitch,
+ const void * ptr, cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event);
+static cl_int (*pclSetEventCallback)(cl_event event, cl_int command_exec_callback_type,
+ void (*pfn_notify)(cl_event, cl_int, void *), void *user_data);
+static cl_int (*pclSetMemObjectDestructorCallback)(cl_mem memobj, void (*pfn_notify)(cl_mem, void*), void *user_data);
+static cl_int (*pclSetUserEventStatus)(cl_event event, cl_int execution_status);
+
static BOOL init_opencl(void);
static BOOL load_opencl_func(void);
@@ -358,6 +380,18 @@ static BOOL load_opencl_func(void)
/* Extension function access */
LOAD_FUNCPTR(clGetExtensionFunctionAddress);
+ /* OpenCL 1.1 functions */
+#ifdef CL_VERSION_1_1
+ LOAD_FUNCPTR(clCreateSubBuffer);
+ LOAD_FUNCPTR(clCreateUserEvent);
+ LOAD_FUNCPTR(clEnqueueCopyBufferRect);
+ LOAD_FUNCPTR(clEnqueueReadBufferRect);
+ LOAD_FUNCPTR(clEnqueueWriteBufferRect);
+ LOAD_FUNCPTR(clSetEventCallback);
+ LOAD_FUNCPTR(clSetMemObjectDestructorCallback);
+ LOAD_FUNCPTR(clSetUserEventStatus);
+#endif
+
#undef LOAD_FUNCPTR
return TRUE;
@@ -648,6 +682,20 @@ cl_mem WINAPI wine_clCreateBuffer(cl_context context, cl_mem_flags flags, size_t
return ret;
}
+cl_mem WINAPI wine_clCreateSubBuffer(cl_mem buffer, cl_mem_flags flags,
+ cl_buffer_create_type buffer_create_type, const void * buffer_create_info, cl_int * errcode_ret)
+{
+ cl_mem ret;
+ TRACE("\n");
+ if (!pclCreateSubBuffer)
+ {
+ *errcode_ret = CL_INVALID_VALUE;
+ return NULL;
+ }
+ ret = pclCreateSubBuffer(buffer, flags, buffer_create_type, buffer_create_info, errcode_ret);
+ return ret;
+}
+
cl_mem WINAPI wine_clCreateImage2D(cl_context context, cl_mem_flags flags, cl_image_format * image_format,
size_t image_width, size_t image_height, size_t image_row_pitch, void * host_ptr, cl_int * errcode_ret)
{
@@ -725,6 +773,46 @@ cl_int WINAPI wine_clGetImageInfo(cl_mem image, cl_image_info param_name, size_t
return ret;
}
+typedef struct
+{
+ void WINAPI (*pfn_notify)(cl_mem memobj, void* user_data);
+ void *user_data;
+} MEM_CALLBACK;
+
+static void mem_fn_notify(cl_mem memobj, void* user_data)
+{
+ MEM_CALLBACK *mcb;
+ FIXME("(%p, %p)\n", memobj, user_data);
+ mcb = (MEM_CALLBACK *) user_data;
+ mcb->pfn_notify(memobj, mcb->user_data);
+ HeapFree(GetProcessHeap(), 0, mcb);
+ FIXME("Callback COMPLETED\n");
+}
+
+cl_int WINAPI wine_clSetMemObjectDestructorCallback(cl_mem memobj, void WINAPI (*pfn_notify)(cl_mem, void*), void *user_data)
+{
+ /* FIXME: Based on PROGRAM_CALLBACK/program_fn_notify function. I'm not sure about this. */
+ cl_int ret;
+ FIXME("(%p, %p, %p)\n", memobj, pfn_notify, user_data);
+ if (!pclSetMemObjectDestructorCallback) return CL_INVALID_VALUE;
+ if(pfn_notify)
+ {
+ /* When pfn_notify is provided, clSetMemObjectDestructorCallback is asynchronous */
+ MEM_CALLBACK *mcb;
+ mcb = HeapAlloc(GetProcessHeap(), 0, sizeof(MEM_CALLBACK));
+ mcb->pfn_notify = pfn_notify;
+ mcb->user_data = user_data;
+ ret = pclSetMemObjectDestructorCallback(memobj, mem_fn_notify, user_data);
+ }
+ else
+ {
+ /* When pfn_notify is NULL, clSetMemObjectDestructorCallback is synchronous */
+ ret = pclSetMemObjectDestructorCallback(memobj, NULL, user_data);
+ }
+ FIXME("(%p, %p, %p)=%d\n", memobj, pfn_notify, user_data, ret);
+ return ret;
+}
+
/*---------------------------------------------------------------*/
/* Sampler APIs */
@@ -1009,6 +1097,69 @@ cl_int WINAPI wine_clReleaseEvent(cl_event event)
return ret;
}
+cl_event WINAPI wine_clCreateUserEvent(cl_context context, cl_int * errcode_ret)
+{
+ cl_event ret;
+ TRACE("\n");
+ if (!pclCreateUserEvent)
+ {
+ *errcode_ret = CL_INVALID_CONTEXT;
+ return NULL;
+ }
+ ret = pclCreateUserEvent(context, errcode_ret);
+ return ret;
+}
+
+typedef struct
+{
+ void WINAPI (*pfn_notify)(cl_event event, cl_int num, void* user_data);
+ void *user_data;
+} EVENT_CALLBACK;
+
+static void event_fn_notify(cl_event event, cl_int num, void* user_data)
+{
+ EVENT_CALLBACK *ecb;
+ FIXME("(%p, %d, %p)\n", event, num, user_data);
+ ecb = (EVENT_CALLBACK *) user_data;
+ ecb->pfn_notify(event, num, ecb->user_data);
+ HeapFree(GetProcessHeap(), 0, ecb);
+ FIXME("Callback COMPLETED\n");
+}
+
+cl_int WINAPI wine_clSetEventCallback(cl_event event, cl_int command_exec_callback_type,
+ void WINAPI (*pfn_notify)(cl_event, cl_int, void *), void *user_data)
+{
+ /* FIXME: Based on PROGRAM_CALLBACK/program_fn_notify function. I'm not sure about this. */
+ cl_int ret;
+ FIXME("(%p, %d, %p, %p)\n", event, command_exec_callback_type, pfn_notify, user_data);
+ if (!pclSetEventCallback) return CL_INVALID_EVENT;
+ if(pfn_notify)
+ {
+ /* When pfn_notify is provided, clSetEventCallback is asynchronous */
+ EVENT_CALLBACK *ecb;
+ ecb = HeapAlloc(GetProcessHeap(), 0, sizeof(EVENT_CALLBACK));
+ ecb->pfn_notify = pfn_notify;
+ ecb->user_data = user_data;
+ ret = pclSetEventCallback(event, command_exec_callback_type, event_fn_notify, user_data);
+ }
+ else
+ {
+ /* When pfn_notify is NULL, clSetEventCallback is synchronous */
+ ret = pclSetEventCallback(event, command_exec_callback_type, NULL, user_data);
+ }
+ FIXME("(%p, %d, %p, %p)=%d\n", event, command_exec_callback_type, pfn_notify, user_data, ret);
+ return ret;
+}
+
+cl_int WINAPI wine_clSetUserEventStatus(cl_event event, cl_int execution_status)
+{
+ cl_int ret;
+ TRACE("\n");
+ if (!pclSetUserEventStatus) return CL_INVALID_EVENT;
+ ret = pclSetUserEventStatus(event, execution_status);
+ return ret;
+}
+
/*---------------------------------------------------------------*/
/* Profiling APIs */
@@ -1062,6 +1213,21 @@ cl_int WINAPI wine_clEnqueueReadBuffer(cl_command_queue command_queue, cl_mem bu
return ret;
}
+cl_int WINAPI wine_clEnqueueReadBufferRect(cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read,
+ const size_t * buffer_origin, const size_t * host_origin, const size_t * region,
+ size_t buffer_row_pitch, size_t buffer_slice_pitch, size_t host_row_pitch, size_t host_slice_pitch,
+ void * ptr, cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event)
+{
+ cl_int ret;
+ TRACE("\n");
+ if (!pclEnqueueReadBufferRect) return CL_INVALID_VALUE;
+ ret = pclEnqueueReadBufferRect(command_queue, buffer, blocking_read,
+ buffer_origin, host_origin, region,
+ buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch,
+ ptr, num_events_in_wait_list, event_wait_list, event);
+ return ret;
+}
+
cl_int WINAPI wine_clEnqueueWriteBuffer(cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write,
size_t offset, size_t cb, const void * ptr,
cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event)
@@ -1073,6 +1239,21 @@ cl_int WINAPI wine_clEnqueueWriteBuffer(cl_command_queue command_queue, cl_mem b
return ret;
}
+cl_int WINAPI wine_clEnqueueWriteBufferRect( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read,
+ const size_t * buffer_origin, const size_t * host_origin, const size_t * region,
+ size_t buffer_row_pitch, size_t buffer_slice_pitch, size_t host_row_pitch, size_t host_slice_pitch,
+ const void * ptr, cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event)
+{
+ cl_int ret;
+ TRACE("\n");
+ if (!pclEnqueueWriteBufferRect) return CL_INVALID_VALUE;
+ ret = pclEnqueueWriteBufferRect(command_queue, buffer, blocking_read,
+ buffer_origin, host_origin, region,
+ buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch,
+ ptr, num_events_in_wait_list, event_wait_list, event);
+ return ret;
+}
+
cl_int WINAPI wine_clEnqueueCopyBuffer(cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer,
size_t src_offset, size_t dst_offset, size_t cb,
cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event)
@@ -1084,6 +1265,19 @@ cl_int WINAPI wine_clEnqueueCopyBuffer(cl_command_queue command_queue, cl_mem sr
return ret;
}
+cl_int WINAPI wine_clEnqueueCopyBufferRect(cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer,
+ const size_t * src_origin, const size_t * dst_origin, const size_t * region,
+ size_t src_row_pitch, size_t src_slice_pitch,
+ size_t dst_row_pitch, size_t dst_slice_pitch,
+ cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event)
+{
+ cl_int ret;
+ TRACE("\n");
+ if (!pclEnqueueCopyBufferRect) return CL_INVALID_VALUE;
+ ret = pclEnqueueCopyBufferRect(command_queue, src_buffer, dst_buffer, src_origin, dst_origin, region, src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch, num_events_in_wait_list, event_wait_list, event);
+ return ret;
+}
+
cl_int WINAPI wine_clEnqueueReadImage(cl_command_queue command_queue, cl_mem image, cl_bool blocking_read,
const size_t * origin, const size_t * region,
SIZE_T row_pitch, SIZE_T slice_pitch, void * ptr,
diff --git a/dlls/opencl/opencl.spec b/dlls/opencl/opencl.spec
index ba8ce6e..4782653 100644
--- a/dlls/opencl/opencl.spec
+++ b/dlls/opencl/opencl.spec
@@ -94,3 +94,13 @@
# @ stdcall clGetGLTextureInfo( long long long ptr ptr ) wine_clGetGLTextureInfo
# @ stdcall clEnqueueAcquireGLObjects( long long ptr long ptr ptr ) wine_clEnqueueAcquireGLObjects
# @ stdcall clEnqueueReleaseGLObjects( long long ptr long ptr ptr ) wine_clEnqueueReleaseGLObjects
+
+# OpenCL 1.1
+@ stdcall clCreateSubBuffer( long long long ptr ptr ) wine_clCreateSubBuffer
+@ stdcall clCreateUserEvent( long ptr ) wine_clCreateUserEvent
+@ stdcall clEnqueueCopyBufferRect( long long long ptr ptr ptr long long long long long ptr ptr ) wine_clEnqueueCopyBufferRect
+@ stdcall clEnqueueReadBufferRect( long long long ptr ptr ptr long long long long ptr long ptr ptr ) wine_clEnqueueReadBufferRect
+@ stdcall clEnqueueWriteBufferRect( long long long ptr ptr ptr long long long long ptr long ptr ptr ) wine_clEnqueueWriteBufferRect
+@ stdcall clSetEventCallback( long long ptr ptr ) wine_clSetEventCallback
+@ stdcall clSetMemObjectDestructorCallback( long ptr ptr ) wine_clSetMemObjectDestructorCallback
+@ stdcall clSetUserEventStatus( long long ) wine_clSetUserEventStatus
--
1.9.1

View File

@ -0,0 +1,391 @@
From da060b9c27b02dfa808185ec7938899b7839e942 Mon Sep 17 00:00:00 2001
From: Nakarin Khankham <garuda2550@gmail.com>
Date: Sat, 9 Mar 2019 22:27:52 +0700
Subject: [PATCH 4/5] opencl: Add OpenCL 1.2 implementation.
Signed-off-by: Nakarin Khankham <garuda2550@gmail.com>
---
dlls/opencl/opencl.c | 252 ++++++++++++++++++++++++++++++++++++++++++++++++
dlls/opencl/opencl.spec | 18 ++++
2 files changed, 270 insertions(+)
diff --git a/dlls/opencl/opencl.c b/dlls/opencl/opencl.c
index 41fc71b..fccc45c 100644
--- a/dlls/opencl/opencl.c
+++ b/dlls/opencl/opencl.c
@@ -218,6 +218,39 @@ static cl_int (*pclSetEventCallback)(cl_event event, cl_int command_exec_callbac
static cl_int (*pclSetMemObjectDestructorCallback)(cl_mem memobj, void (*pfn_notify)(cl_mem, void*), void *user_data);
static cl_int (*pclSetUserEventStatus)(cl_event event, cl_int execution_status);
+/* OpenCL 1.2 functions */
+static cl_int (*pclCompileProgram)(cl_program program, cl_uint num_devices, const cl_device_id * device_list, const char * options,
+ cl_uint num_input_headers, const cl_program * input_headers, const char ** header_include_names,
+ void (*pfn_notify)(cl_program program, void * user_data),
+ void * user_data);
+static cl_mem (*pclCreateImage)(cl_context context, cl_mem_flags flags,
+ const cl_image_format * image_format, const cl_image_desc * image_desc, void * host_ptr, cl_int * errcode_ret);
+static cl_program (*pclCreateProgramWithBuiltInKernels)(cl_context context, cl_uint num_devices, const cl_device_id * device_list,
+ const char * kernel_names, cl_int * errcode_ret);
+static cl_int (*pclCreateSubDevices)(cl_device_id in_device, const cl_device_partition_property * properties, cl_uint num_entries,
+ cl_device_id * out_devices, cl_uint * num_devices);
+static cl_int (*pclEnqueueBarrierWithWaitList)(cl_command_queue command_queue, cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list, cl_event * event);
+static cl_int (*pclEnqueueFillBuffer)(cl_command_queue command_queue, cl_mem buffer, const void * pattern, size_t pattern_size, size_t offset, size_t cb,
+ cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event);
+static cl_int (*pclEnqueueFillImage)(cl_command_queue command_queue, cl_mem image, const void * fill_color,
+ const size_t * origin, const size_t * region,
+ cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event);
+static cl_int (*pclEnqueueMarkerWithWaitList)(cl_command_queue command_queue, cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list, cl_event * event);
+static cl_int (*pclEnqueueMigrateMemObjects)(cl_command_queue command_queue, cl_uint num_mem_objects, const cl_mem * mem_objects, cl_mem_migration_flags flags,
+ cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event);
+static void * (*pclGetExtensionFunctionAddressForPlatform)(cl_platform_id platform, const char * function_name);
+static cl_int (*pclGetKernelArgInfo)(cl_kernel kernel, cl_uint arg_indx, cl_kernel_arg_info param_name,
+ size_t param_value_size, void * param_value, size_t * param_value_size_ret);
+static cl_program (*pclLinkProgram)(cl_context context, cl_uint num_devices, const cl_device_id * device_list, const char * options,
+ cl_uint num_input_programs, const cl_program * input_programs,
+ void (* pfn_notify)(cl_program program, void * user_data),
+ void * user_data, cl_int * errcode_ret);
+static cl_int (*pclReleaseDevice)(cl_device_id device);
+static cl_int (*pclRetainDevice)(cl_device_id device);
+static cl_int (*pclUnloadPlatformCompiler)(cl_platform_id platform);
+
static BOOL init_opencl(void);
static BOOL load_opencl_func(void);
@@ -392,6 +425,26 @@ static BOOL load_opencl_func(void)
LOAD_FUNCPTR(clSetUserEventStatus);
#endif
+ /* OpenCL 1.2 functions */
+#ifdef CL_VERSION_1_2
+ LOAD_FUNCPTR(clCompileProgram);
+ /*LOAD_FUNCPTR(clCreateFromGLTexture);*/
+ LOAD_FUNCPTR(clCreateImage);
+ LOAD_FUNCPTR(clCreateProgramWithBuiltInKernels);
+ LOAD_FUNCPTR(clCreateSubDevices);
+ LOAD_FUNCPTR(clEnqueueBarrierWithWaitList);
+ LOAD_FUNCPTR(clEnqueueFillBuffer);
+ LOAD_FUNCPTR(clEnqueueFillImage);
+ LOAD_FUNCPTR(clEnqueueMarkerWithWaitList);
+ LOAD_FUNCPTR(clEnqueueMigrateMemObjects);
+ LOAD_FUNCPTR(clGetExtensionFunctionAddressForPlatform);
+ LOAD_FUNCPTR(clGetKernelArgInfo);
+ LOAD_FUNCPTR(clLinkProgram);
+ LOAD_FUNCPTR(clReleaseDevice);
+ LOAD_FUNCPTR(clRetainDevice);
+ LOAD_FUNCPTR(clUnloadPlatformCompiler);
+#endif
+
#undef LOAD_FUNCPTR
return TRUE;
@@ -507,6 +560,38 @@ cl_int WINAPI wine_clGetDeviceInfo(cl_device_id device, cl_device_info param_nam
return ret;
}
+cl_int WINAPI wine_clCreateSubDevices(cl_device_id in_device, const cl_device_partition_property * properties, cl_uint num_entries,
+ cl_device_id * out_devices, cl_uint * num_devices)
+{
+ cl_int ret;
+ TRACE("(%p, %p, %d, %p, %p)\n", in_device, properties, num_entries, out_devices, num_devices);
+ if (!pclCreateSubDevices) return CL_INVALID_VALUE;
+ ret = pclCreateSubDevices(in_device, properties, num_entries, out_devices, num_devices);
+ TRACE("(%p, %p, %d, %p, %p)=%d\n", in_device, properties, num_entries, out_devices, num_devices, ret);
+ return ret;
+}
+
+cl_int WINAPI wine_clRetainDevice(cl_device_id device)
+{
+ cl_int ret;
+ TRACE("(%p)\n", device);
+ if (!pclRetainDevice) return CL_INVALID_DEVICE;
+ ret = pclRetainDevice(device);
+ TRACE("(%p)=%d\n", device, ret);
+ return ret;
+
+}
+
+cl_int WINAPI wine_clReleaseDevice(cl_device_id device)
+{
+ cl_int ret;
+ TRACE("(%p)\n", device);
+ if (!pclReleaseDevice) return CL_INVALID_DEVICE;
+ ret = pclReleaseDevice(device);
+ TRACE("(%p)=%d\n", device, ret);
+ return ret;
+}
+
/*---------------------------------------------------------------*/
/* Context APIs */
@@ -696,6 +781,20 @@ cl_mem WINAPI wine_clCreateSubBuffer(cl_mem buffer, cl_mem_flags flags,
return ret;
}
+cl_mem WINAPI wine_clCreateImage(cl_context context, cl_mem_flags flags,
+ const cl_image_format * image_format, const cl_image_desc * image_desc, void * host_ptr, cl_int * errcode_ret)
+{
+ cl_mem ret;
+ TRACE("\n");
+ if (!pclCreateImage)
+ {
+ *errcode_ret = CL_INVALID_VALUE;
+ return NULL;
+ }
+ ret = pclCreateImage(context, flags, image_format, image_desc, host_ptr, errcode_ret);
+ return ret;
+}
+
cl_mem WINAPI wine_clCreateImage2D(cl_context context, cl_mem_flags flags, cl_image_format * image_format,
size_t image_width, size_t image_height, size_t image_row_pitch, void * host_ptr, cl_int * errcode_ret)
{
@@ -892,6 +991,20 @@ cl_program WINAPI wine_clCreateProgramWithBinary(cl_context context, cl_uint num
return ret;
}
+cl_program WINAPI wine_clCreateProgramWithBuiltInKernels(cl_context context, cl_uint num_devices, const cl_device_id * device_list,
+ const char * kernel_names, cl_int * errcode_ret)
+{
+ cl_program ret;
+ TRACE("\n");
+ if (!pclCreateProgramWithBuiltInKernels)
+ {
+ *errcode_ret = CL_INVALID_VALUE;
+ return NULL;
+ }
+ ret = pclCreateProgramWithBuiltInKernels(context, num_devices, device_list, kernel_names, errcode_ret);
+ return ret;
+}
+
cl_int WINAPI wine_clRetainProgram(cl_program program)
{
cl_int ret;
@@ -950,6 +1063,60 @@ cl_int WINAPI wine_clBuildProgram(cl_program program, cl_uint num_devices, const
return ret;
}
+cl_int WINAPI wine_clCompileProgram(cl_program program, cl_uint num_devices, const cl_device_id * device_list, const char * options,
+ cl_uint num_input_headers, const cl_program * input_headers, const char ** header_include_names,
+ void WINAPI (*pfn_notify)(cl_program program, void * user_data),
+ void * user_data)
+{
+ cl_int ret;
+ TRACE("\n");
+ if (!pclCompileProgram) return CL_INVALID_VALUE;
+ if(pfn_notify)
+ {
+ /* When pfn_notify is provided, clCompileProgram is asynchronous */
+ PROGRAM_CALLBACK *pcb;
+ pcb = HeapAlloc(GetProcessHeap(), 0, sizeof(PROGRAM_CALLBACK));
+ pcb->pfn_notify = pfn_notify;
+ pcb->user_data = user_data;
+ ret = pclCompileProgram(program, num_devices, device_list, options, num_input_headers, input_headers, header_include_names, program_fn_notify, user_data);
+ }
+ else
+ {
+ /* When pfn_notify is NULL, clCompileProgram is synchronous */
+ ret = pclCompileProgram(program, num_devices, device_list, options, num_input_headers, input_headers, header_include_names, NULL, user_data);
+ }
+ return ret;
+}
+
+cl_program WINAPI wine_clLinkProgram(cl_context context, cl_uint num_devices, const cl_device_id * device_list, const char * options,
+ cl_uint num_input_programs, const cl_program * input_programs,
+ void WINAPI (* pfn_notify)(cl_program program, void * user_data),
+ void * user_data, cl_int * errcode_ret)
+{
+ cl_program ret;
+ TRACE("\n");
+ if (!pclLinkProgram)
+ {
+ *errcode_ret = CL_INVALID_VALUE;
+ return NULL;
+ }
+ if(pfn_notify)
+ {
+ /* When pfn_notify is provided, clLinkProgram is asynchronous */
+ PROGRAM_CALLBACK *pcb;
+ pcb = HeapAlloc(GetProcessHeap(), 0, sizeof(PROGRAM_CALLBACK));
+ pcb->pfn_notify = pfn_notify;
+ pcb->user_data = user_data;
+ ret = pclLinkProgram(context, num_devices, device_list, options, num_input_programs, input_programs, program_fn_notify, user_data, errcode_ret);
+ }
+ else
+ {
+ /* When pfn_notify is NULL, clLinkProgram is synchronous */
+ ret = pclLinkProgram(context, num_devices, device_list, options, num_input_programs, input_programs, NULL, user_data, errcode_ret);
+ }
+ return ret;
+}
+
cl_int WINAPI wine_clUnloadCompiler(void)
{
cl_int ret;
@@ -960,6 +1127,16 @@ cl_int WINAPI wine_clUnloadCompiler(void)
return ret;
}
+cl_int WINAPI wine_clUnloadPlatformCompiler(cl_platform_id platform)
+{
+ cl_int ret;
+ TRACE("()\n");
+ if (!pclUnloadPlatformCompiler) return CL_SUCCESS;
+ ret = pclUnloadPlatformCompiler(platform);
+ TRACE("()=%d\n", ret);
+ return ret;
+}
+
cl_int WINAPI wine_clGetProgramInfo(cl_program program, cl_program_info param_name,
size_t param_value_size, void * param_value, size_t * param_value_size_ret)
{
@@ -1035,6 +1212,16 @@ cl_int WINAPI wine_clSetKernelArg(cl_kernel kernel, cl_uint arg_index, size_t ar
return ret;
}
+cl_int WINAPI wine_clGetKernelArgInfo(cl_kernel kernel, cl_uint arg_indx, cl_kernel_arg_info param_name,
+ size_t param_value_size, void * param_value, size_t * param_value_size_ret)
+{
+ cl_int ret;
+ TRACE("\n");
+ if (!pclGetKernelArgInfo) return CL_INVALID_VALUE;
+ ret = pclGetKernelArgInfo(kernel, arg_indx, param_name, param_value_size, param_value, param_value_size_ret);
+ return ret;
+}
+
cl_int WINAPI wine_clGetKernelInfo(cl_kernel kernel, cl_kernel_info param_name,
size_t param_value_size, void * param_value, size_t * param_value_size_ret)
{
@@ -1254,6 +1441,16 @@ cl_int WINAPI wine_clEnqueueWriteBufferRect( cl_command_queue command_queue, cl_
return ret;
}
+cl_int WINAPI wine_clEnqueueFillBuffer(cl_command_queue command_queue, cl_mem buffer, const void * pattern, size_t pattern_size, size_t offset, size_t cb,
+ cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event)
+{
+ cl_int ret;
+ TRACE("\n");
+ if (!pclEnqueueFillBuffer) return CL_INVALID_VALUE;
+ ret = pclEnqueueFillBuffer(command_queue, buffer, pattern, pattern_size, offset, cb, num_events_in_wait_list, event_wait_list, event);
+ return ret;
+}
+
cl_int WINAPI wine_clEnqueueCopyBuffer(cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer,
size_t src_offset, size_t dst_offset, size_t cb,
cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event)
@@ -1305,6 +1502,17 @@ cl_int WINAPI wine_clEnqueueWriteImage(cl_command_queue command_queue, cl_mem im
return ret;
}
+cl_int WINAPI wine_clEnqueueFillImage(cl_command_queue command_queue, cl_mem image, const void * fill_color,
+ const size_t * origin, const size_t * region,
+ cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event)
+{
+ cl_int ret;
+ TRACE("\n");
+ if (!pclEnqueueFillImage) return CL_INVALID_VALUE;
+ ret = pclEnqueueFillImage(command_queue, image, fill_color, origin, region, num_events_in_wait_list, event_wait_list, event);
+ return ret;
+}
+
cl_int WINAPI wine_clEnqueueCopyImage(cl_command_queue command_queue, cl_mem src_image, cl_mem dst_image,
size_t * src_origin, size_t * dst_origin, size_t * region,
cl_uint num_events_in_wait_list, cl_event * event_wait_list, cl_event * event)
@@ -1379,6 +1587,16 @@ cl_int WINAPI wine_clEnqueueUnmapMemObject(cl_command_queue command_queue, cl_me
return ret;
}
+cl_int WINAPI wine_clEnqueueMigrateMemObjects(cl_command_queue command_queue, cl_uint num_mem_objects, const cl_mem * mem_objects, cl_mem_migration_flags flags,
+ cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event)
+{
+ cl_int ret;
+ TRACE("\n");
+ if (!pclEnqueueMigrateMemObjects) return CL_INVALID_VALUE;
+ ret = pclEnqueueMigrateMemObjects(command_queue, num_mem_objects, mem_objects, flags, num_events_in_wait_list, event_wait_list, event);
+ return ret;
+}
+
cl_int WINAPI wine_clEnqueueNDRangeKernel(cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim,
size_t * global_work_offset, size_t * global_work_size, size_t * local_work_size,
cl_uint num_events_in_wait_list, cl_event * event_wait_list, cl_event * event)
@@ -1430,6 +1648,16 @@ cl_int WINAPI wine_clEnqueueMarker(cl_command_queue command_queue, cl_event * ev
return ret;
}
+cl_int WINAPI wine_clEnqueueMarkerWithWaitList(cl_command_queue command_queue, cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list, cl_event * event)
+{
+ cl_int ret;
+ TRACE("\n");
+ if (!pclEnqueueMarkerWithWaitList) return CL_INVALID_COMMAND_QUEUE;
+ ret = pclEnqueueMarkerWithWaitList(command_queue, num_events_in_wait_list, event_wait_list, event);
+ return ret;
+}
+
cl_int WINAPI wine_clEnqueueWaitForEvents(cl_command_queue command_queue, cl_uint num_events, cl_event * event_list)
{
cl_int ret;
@@ -1448,10 +1676,34 @@ cl_int WINAPI wine_clEnqueueBarrier(cl_command_queue command_queue)
return ret;
}
+cl_int WINAPI wine_clEnqueueBarrierWithWaitList(cl_command_queue command_queue, cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list, cl_event * event)
+{
+ cl_int ret;
+ TRACE("\n");
+ if (!pclEnqueueBarrierWithWaitList) return CL_INVALID_COMMAND_QUEUE;
+ ret = pclEnqueueBarrierWithWaitList(command_queue, num_events_in_wait_list, event_wait_list, event);
+ return ret;
+}
+
/*---------------------------------------------------------------*/
/* Extension function access */
+void * WINAPI wine_clGetExtensionFunctionAddressForPlatform(cl_platform_id platform, const char * function_name)
+{
+ void * ret = NULL;
+ TRACE("(%p, %s)\n", platform, function_name);
+#if 0
+ if (!pclGetExtensionFunctionAddressForPlatform) return NULL;
+ ret = pclGetExtensionFunctionAddressForPlatform(platform, function_name);
+#else
+ FIXME("(%p, %s), extensions support is not implemented\n", platform, function_name);
+#endif
+ TRACE("(%p, %s)=%p\n", platform, function_name, ret);
+ return ret;
+}
+
void * WINAPI wine_clGetExtensionFunctionAddress(const char * func_name)
{
void * ret = 0;
diff --git a/dlls/opencl/opencl.spec b/dlls/opencl/opencl.spec
index 4782653..60dda4d 100644
--- a/dlls/opencl/opencl.spec
+++ b/dlls/opencl/opencl.spec
@@ -104,3 +104,21 @@
@ stdcall clSetEventCallback( long long ptr ptr ) wine_clSetEventCallback
@ stdcall clSetMemObjectDestructorCallback( long ptr ptr ) wine_clSetMemObjectDestructorCallback
@ stdcall clSetUserEventStatus( long long ) wine_clSetUserEventStatus
+
+# OpenCL 1.2
+@ stdcall clCompileProgram( long long ptr str long ptr ptr ptr ptr ) wine_clCompileProgram
+@ stub clCreateFromGLTexture
+@ stdcall clCreateImage( long long ptr ptr ptr ptr ) wine_clCreateImage
+@ stdcall clCreateProgramWithBuiltInKernels( long long ptr str ptr ) wine_clCreateProgramWithBuiltInKernels
+@ stdcall clCreateSubDevices( long ptr long ptr ptr ) wine_clCreateSubDevices
+@ stdcall clEnqueueBarrierWithWaitList( long long ptr ptr ) wine_clEnqueueBarrierWithWaitList
+@ stdcall clEnqueueFillBuffer( long long ptr long long long long ptr ptr ) wine_clEnqueueFillBuffer
+@ stdcall clEnqueueFillImage( long long ptr ptr ptr long ptr ptr ) wine_clEnqueueFillImage
+@ stdcall clEnqueueMarkerWithWaitList( long long ptr ptr ) wine_clEnqueueMarkerWithWaitList
+@ stdcall clEnqueueMigrateMemObjects( long long ptr long long ptr ptr ) wine_clEnqueueMigrateMemObjects
+@ stdcall clGetExtensionFunctionAddressForPlatform( long str ) wine_clGetExtensionFunctionAddressForPlatform
+@ stdcall clGetKernelArgInfo( long long long long ptr ptr ) wine_clGetKernelArgInfo
+@ stdcall clLinkProgram( long long ptr str long ptr ptr ptr ptr ) wine_clLinkProgram
+@ stdcall clReleaseDevice( long ) wine_clReleaseDevice
+@ stdcall clRetainDevice( long ) wine_clRetainDevice
+@ stdcall clUnloadPlatformCompiler( long ) wine_clUnloadPlatformCompiler
--
1.9.1

View File

@ -0,0 +1,55 @@
From e7d44cc8b01ba8b3b54c79d4eaf5ea674ac4e997 Mon Sep 17 00:00:00 2001
From: Nakarin Khankham <garuda2550@gmail.com>
Date: Sat, 9 Mar 2019 22:40:55 +0700
Subject: [PATCH 5/5] opencl: Expose all extensions list to wine.
Ideally we should blacklist each extensions instead.
Signed-off-by: Nakarin Khankham <garuda2550@gmail.com>
---
dlls/opencl/opencl.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/opencl/opencl.c b/dlls/opencl/opencl.c
index fccc45c..d028bcd 100644
--- a/dlls/opencl/opencl.c
+++ b/dlls/opencl/opencl.c
@@ -475,7 +475,7 @@ cl_int WINAPI wine_clGetPlatformInfo(cl_platform_id platform, cl_platform_info p
/* Hide all extensions.
* TODO: Add individual extension support as needed.
*/
- if (param_name == CL_PLATFORM_EXTENSIONS)
+/* if (param_name == CL_PLATFORM_EXTENSIONS)
{
ret = CL_INVALID_VALUE;
@@ -492,7 +492,7 @@ cl_int WINAPI wine_clGetPlatformInfo(cl_platform_id platform, cl_platform_info p
ret = CL_SUCCESS;
}
}
- else
+ else*/
{
ret = pclGetPlatformInfo(platform, param_name, param_value_size, param_value, param_value_size_ret);
}
@@ -527,7 +527,7 @@ cl_int WINAPI wine_clGetDeviceInfo(cl_device_id device, cl_device_info param_nam
/* Hide all extensions.
* TODO: Add individual extension support as needed.
*/
- if (param_name == CL_DEVICE_EXTENSIONS)
+/* if (param_name == CL_DEVICE_EXTENSIONS)
{
ret = CL_INVALID_VALUE;
@@ -544,7 +544,7 @@ cl_int WINAPI wine_clGetDeviceInfo(cl_device_id device, cl_device_info param_nam
ret = CL_SUCCESS;
}
}
- else
+ else*/
{
ret = pclGetDeviceInfo(device, param_name, param_value_size, param_value, param_value_size_ret);
}
--
1.9.1

View File

@ -0,0 +1 @@
Fixes: [46470] opencl: Add support for OpenCL 1.2.

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "f34f13825fd060fda40f0a5b02dc1b420e3a8e1e"
echo "73355cab96de112f5125907424b37289afc6ebe7"
}
# Show version information
@ -249,6 +249,7 @@ patch_enable_all ()
enable_oleaut32_OLEPictureImpl_SaveAsFile="$1"
enable_oleaut32_OleLoadPicture="$1"
enable_oleaut32_OleLoadPictureFile="$1"
enable_opencl_version_1_2="$1"
enable_opengl32_wglChoosePixelFormat="$1"
enable_packager_DllMain="$1"
enable_pdh_PdhLookupPerfNameByIndex_processor="$1"
@ -898,6 +899,9 @@ patch_enable ()
oleaut32-OleLoadPictureFile)
enable_oleaut32_OleLoadPictureFile="$2"
;;
opencl-version_1_2)
enable_opencl_version_1_2="$2"
;;
opengl32-wglChoosePixelFormat)
enable_opengl32_wglChoosePixelFormat="$2"
;;
@ -5286,6 +5290,29 @@ if test "$enable_oleaut32_OleLoadPictureFile" -eq 1; then
) >> "$patchlist"
fi
# Patchset opencl-version_1_2
# |
# | This patchset fixes the following Wine bugs:
# | * [#46470] opencl: Add support for OpenCL 1.2.
# |
# | Modified files:
# | * configure, configure.ac, dlls/opencl/opencl.c, dlls/opencl/opencl.spec, include/config.h.in
# |
if test "$enable_opencl_version_1_2" -eq 1; then
patch_apply opencl-version_1_2/0001-opencl-Add-OpenCL-1.0-function-pointer-loader.patch
patch_apply opencl-version_1_2/0002-opencl-Use-function-pointer-instead-of-call-the-func.patch
patch_apply opencl-version_1_2/0003-opencl-Add-OpenCL-1.1-implementation.patch
patch_apply opencl-version_1_2/0004-opencl-Add-OpenCL-1.2-implementation.patch
patch_apply opencl-version_1_2/0005-opencl-Expose-all-extensions-list-to-wine.patch
(
printf '%s\n' '+ { "Nakarin Khankham", "opencl: Add OpenCL 1.0 function pointer loader.", 1 },';
printf '%s\n' '+ { "Nakarin Khankham", "opencl: Use function pointer instead of call the function directly.", 1 },';
printf '%s\n' '+ { "Nakarin Khankham", "opencl: Add OpenCL 1.1 implementation.", 1 },';
printf '%s\n' '+ { "Nakarin Khankham", "opencl: Add OpenCL 1.2 implementation.", 1 },';
printf '%s\n' '+ { "Nakarin Khankham", "opencl: Expose all extensions list to wine.", 1 },';
) >> "$patchlist"
fi
# Patchset opengl32-wglChoosePixelFormat
# |
# | This patchset fixes the following Wine bugs: