[gegl/gsoc2011-opencl: 8/14] Loads OpenCL only once
- From: Victor Matheus de Araujo Oliveira <vmaolive src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/gsoc2011-opencl: 8/14] Loads OpenCL only once
- Date: Fri, 20 May 2011 14:22:53 +0000 (UTC)
commit 39643641be112436da06ebcd6b50298de8d78371
Author: Victor Matheus de A. Oliveira <victormatheus gmail com>
Date: Sat May 14 15:12:50 2011 -0300
Loads OpenCL only once
Signed-off-by: Victor Oliveira <victormatheus gmail com>
gegl/opencl/gegl-cl-init.c | 43 +++++++++++++++++++++++--------------------
1 files changed, 23 insertions(+), 20 deletions(-)
---
diff --git a/gegl/opencl/gegl-cl-init.c b/gegl/opencl/gegl-cl-init.c
index 864f783..a3a7cde 100644
--- a/gegl/opencl/gegl-cl-init.c
+++ b/gegl/opencl/gegl-cl-init.c
@@ -40,30 +40,33 @@ gegl_cl_init (GError **error)
cl_uint num_platforms;
int i;
- module = g_module_open ("libOpenCL.so", G_MODULE_BIND_LAZY);
-
- if (!module)
+ if (!cl_is_accelerated)
{
- g_set_error (error, 0, 0,
- "%s", g_module_error ());
- return FALSE;
- }
+ module = g_module_open ("libOpenCL.so", G_MODULE_BIND_LAZY);
- CL_LOAD_FUNCTION (clGetPlatformIDs)
- CL_LOAD_FUNCTION (clGetPlatformInfo)
+ if (!module)
+ {
+ g_set_error (error, 0, 0,
+ "%s", g_module_error ());
+ return FALSE;
+ }
- cl_is_accelerated = TRUE;
+ CL_LOAD_FUNCTION (clGetPlatformIDs)
+ CL_LOAD_FUNCTION (clGetPlatformInfo)
- gegl_clGetPlatformIDs (1024, platforms, &num_platforms);
- for (i=0; i<num_platforms; i++)
- {
- gegl_clGetPlatformInfo (platforms[i], CL_PLATFORM_NAME, sizeof(buffer), buffer, NULL);
- printf("Device ID:%u\n%s\n", i, buffer);
- gegl_clGetPlatformInfo (platforms[i], CL_PLATFORM_VERSION, sizeof(buffer), buffer, NULL);
- printf("Version:%s\n", buffer);
- gegl_clGetPlatformInfo (platforms[i], CL_PLATFORM_EXTENSIONS, sizeof(buffer), buffer, NULL);
- printf("Extensions:%s\n", buffer);
- }
+ cl_is_accelerated = TRUE;
+
+ gegl_clGetPlatformIDs (1024, platforms, &num_platforms);
+ for (i=0; i<num_platforms; i++)
+ {
+ gegl_clGetPlatformInfo (platforms[i], CL_PLATFORM_NAME, sizeof(buffer), buffer, NULL);
+ printf("Device ID:%u\n%s\n", i, buffer);
+ gegl_clGetPlatformInfo (platforms[i], CL_PLATFORM_VERSION, sizeof(buffer), buffer, NULL);
+ printf("Version:%s\n", buffer);
+ gegl_clGetPlatformInfo (platforms[i], CL_PLATFORM_EXTENSIONS, sizeof(buffer), buffer, NULL);
+ printf("Extensions:%s\n", buffer);
+ }
+ }
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]