[gegl/gsoc2011-opencl: 75/78] minor changes



commit 4f183ddd0c450d759e60824f78666f91c047f12d
Author: Victor Oliveira <victormatheus gmail com>
Date:   Tue Jun 21 17:20:15 2011 -0300

    minor changes

 gegl/opencl/gegl-cl-init.c |    9 +++++----
 gegl/opencl/gegl-cl-init.h |    8 ++++++++
 2 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/gegl/opencl/gegl-cl-init.c b/gegl/opencl/gegl-cl-init.c
index 5598bea..46e97d4 100644
--- a/gegl/opencl/gegl-cl-init.c
+++ b/gegl/opencl/gegl-cl-init.c
@@ -149,6 +149,7 @@ gegl_cl_init (GError **error)
       CL_LOAD_FUNCTION (clCreateBuffer)
       CL_LOAD_FUNCTION (clEnqueueWriteBuffer)
       CL_LOAD_FUNCTION (clEnqueueReadBuffer)
+      CL_LOAD_FUNCTION (clEnqueueCopyBuffer)
       CL_LOAD_FUNCTION (clEnqueueNDRangeKernel)
       CL_LOAD_FUNCTION (clFinish)
 
@@ -162,15 +163,15 @@ gegl_cl_init (GError **error)
 
       gegl_clGetPlatformIDs (1, &platform, NULL);
       gegl_clGetPlatformInfo (platform, CL_PLATFORM_NAME, sizeof(buffer), buffer, NULL);
-      printf("Platform Name:%s\n", buffer);
+      g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Platform Name:%s\n", buffer);
       gegl_clGetPlatformInfo (platform, CL_PLATFORM_VERSION, sizeof(buffer), buffer, NULL);
-      printf("Version:%s\n", buffer);
+      g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Version:%s\n", buffer);
       gegl_clGetPlatformInfo (platform, CL_PLATFORM_EXTENSIONS, sizeof(buffer), buffer, NULL);
-      printf("Extensions:%s\n", buffer);
+      g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Extensions:%s\n", buffer);
 
       gegl_clGetDeviceIDs(platform, CL_DEVICE_TYPE_DEFAULT, 1, &device, NULL);
       gegl_clGetDeviceInfo(device, CL_DEVICE_NAME, sizeof(buffer), buffer, NULL);
-      printf("Default Device Name:%s\n", buffer);
+      g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Default Device Name:%s\n", buffer);
 
       ctx = gegl_clCreateContext(0, 1, &device, NULL, NULL, NULL);
       cq  = gegl_clCreateCommandQueue(ctx, device, 0, NULL);
diff --git a/gegl/opencl/gegl-cl-init.h b/gegl/opencl/gegl-cl-init.h
index c817009..c9dcbeb 100644
--- a/gegl/opencl/gegl-cl-init.h
+++ b/gegl/opencl/gegl-cl-init.h
@@ -4,6 +4,14 @@
 #include "gegl-cl-types.h"
 #include <gmodule.h>
 
+#define CL_SAFE_CALL(func)                                          \
+func;                                                               \
+if (errcode != CL_SUCCESS)                                          \
+{                                                                   \
+  g_warning("OpenCL error in %s, Line %u in file %s\nError:%s",     \
+            #func, __LINE__, __FILE__, gegl_cl_errstring(errcode)); \
+}
+
 char *gegl_cl_errstring(cl_int err);
 
 gboolean gegl_cl_init (GError **error);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]