[Gegl-developer] [PATCH 1/2] opencl: Load cl_gl extension functions only if the extension is supported.
- From: Jan Vesely <jan vesely rutgers edu>
- To: gegl-developer-list gnome org
- Subject: [Gegl-developer] [PATCH 1/2] opencl: Load cl_gl extension functions only if the extension is supported.
- Date: Mon, 28 Jul 2014 11:32:23 -0400
These are not available on mesa.
Signed-off-by: Jan Vesely <jan vesely rutgers edu>
---
gegl/opencl/gegl-cl-init.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/gegl/opencl/gegl-cl-init.c b/gegl/opencl/gegl-cl-init.c
index 8a52ff5..da5f97d 100644
--- a/gegl/opencl/gegl-cl-init.c
+++ b/gegl/opencl/gegl-cl-init.c
@@ -501,6 +501,25 @@ gegl_cl_init_load_functions (GError **error)
CL_LOAD_FUNCTION (clReleaseContext)
CL_LOAD_FUNCTION (clReleaseMemObject)
+ return TRUE;
+}
+
+static gboolean
+gegl_cl_gl_init_load_functions (GError **error)
+{
+#ifdef G_OS_WIN32
+ HINSTANCE module = LoadLibrary ("OpenCL.dll");
+#else
+ GModule *module = g_module_open (CL_LIBRARY_NAME, G_MODULE_BIND_LAZY);
+#endif
+
+ if (!module)
+ {
+ GEGL_NOTE (GEGL_DEBUG_OPENCL, "Unable to load OpenCL library");
+ g_set_error (error, GEGL_OPENCL_ERROR, 0, "Unable to load OpenCL library");
+ return FALSE;
+ }
+
CL_LOAD_FUNCTION (clCreateFromGLTexture2D)
CL_LOAD_FUNCTION (clEnqueueAcquireGLObjects)
CL_LOAD_FUNCTION (clEnqueueReleaseGLObjects)
@@ -691,6 +710,10 @@ gegl_cl_init_common (cl_device_type requested_device_type,
return FALSE;
}
+ /* Load extension functions */
+ if (!gegl_cl_gl_init_load_functions (error))
+ return FALSE;
+
/* Create context */
ctx = gegl_clCreateContext (gl_contex_props, 1, &cl_state.device, NULL, NULL, &err);
--
1.9.3
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]