[gegl] gegl-cl-init: some coding style and cleaning
- From: Michael Murà <mmure src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] gegl-cl-init: some coding style and cleaning
- Date: Mon, 20 Aug 2012 17:49:05 +0000 (UTC)
commit b5ad33127c1aeac8d01b1e3fbe42513d49f3f009
Author: Michael Murà <mure michael gmail com>
Date: Tue Aug 21 02:47:51 2012 +0900
gegl-cl-init: some coding style and cleaning
gegl/opencl/gegl-cl-init.c | 30 +++++++++++++++++++++++++
gegl/opencl/gegl-cl-init.h | 52 ++++++++++---------------------------------
2 files changed, 42 insertions(+), 40 deletions(-)
---
diff --git a/gegl/opencl/gegl-cl-init.c b/gegl/opencl/gegl-cl-init.c
index 06e620b..076748b 100644
--- a/gegl/opencl/gegl-cl-init.c
+++ b/gegl/opencl/gegl-cl-init.c
@@ -109,6 +109,26 @@ const char *gegl_cl_errstring(cl_int err) {
return strings[-err];
}
+typedef struct
+{
+ gboolean is_accelerated;
+ cl_context ctx;
+ cl_platform_id platform;
+ cl_device_id device;
+ cl_command_queue cq;
+ cl_bool image_support;
+ size_t iter_height;
+ size_t iter_width;
+ cl_ulong max_mem_alloc;
+ cl_ulong local_mem_size;
+
+ char platform_name [1024];
+ char platform_version[1024];
+ char platform_ext [1024];
+ char device_name [1024];
+}
+GeglClState;
+
static GeglClState cl_state = {FALSE, NULL, NULL, NULL, NULL, FALSE, 0, 0, 0, 0, "", "", "", ""};
static GHashTable *cl_program_hash = NULL;
@@ -352,6 +372,14 @@ gegl_cl_init (GError **error)
#undef CL_LOAD_FUNCTION
+#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)); \
+}
+
/* XXX: same program_source with different kernel_name[], context or device
* will retrieve the same key
*/
@@ -420,3 +448,5 @@ gegl_cl_compile_and_build (const char *program_source, const char *kernel_name[]
return cl_data;
}
+
+#undef CL_SAFE_CALL
diff --git a/gegl/opencl/gegl-cl-init.h b/gegl/opencl/gegl-cl-init.h
index c5a36d0..2a707f4 100644
--- a/gegl/opencl/gegl-cl-init.h
+++ b/gegl/opencl/gegl-cl-init.h
@@ -21,62 +21,34 @@
#include "gegl-cl-types.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)); \
-}
+const char * gegl_cl_errstring(cl_int err);
-typedef struct
- {
- gboolean is_accelerated;
- cl_context ctx;
- cl_platform_id platform;
- cl_device_id device;
- cl_command_queue cq;
- cl_bool image_support;
- size_t iter_height;
- size_t iter_width;
- cl_ulong max_mem_alloc;
- cl_ulong local_mem_size;
-
- char platform_name [1024];
- char platform_version[1024];
- char platform_ext [1024];
- char device_name [1024];
- }
-GeglClState;
-
-const char *gegl_cl_errstring(cl_int err);
-
-gboolean gegl_cl_init (GError **error);
+gboolean gegl_cl_init (GError **error);
-gboolean gegl_cl_is_accelerated (void);
+gboolean gegl_cl_is_accelerated (void);
-cl_platform_id gegl_cl_get_platform (void);
+cl_platform_id gegl_cl_get_platform (void);
-cl_device_id gegl_cl_get_device (void);
+cl_device_id gegl_cl_get_device (void);
-cl_context gegl_cl_get_context (void);
+cl_context gegl_cl_get_context (void);
-cl_command_queue gegl_cl_get_command_queue (void);
+cl_command_queue gegl_cl_get_command_queue (void);
-cl_ulong gegl_cl_get_local_mem_size (void);
+cl_ulong gegl_cl_get_local_mem_size (void);
-size_t gegl_cl_get_iter_width (void);
+size_t gegl_cl_get_iter_width (void);
-size_t gegl_cl_get_iter_height (void);
+size_t gegl_cl_get_iter_height (void);
typedef struct
{
- cl_program program;
+ cl_program program;
cl_kernel *kernel;
size_t *work_group_size;
} GeglClRunData;
-GeglClRunData *gegl_cl_compile_and_build (const char *program_source,
+GeglClRunData * gegl_cl_compile_and_build (const char *program_source,
const char *kernel_name[]);
#define GEGL_CL_CHUNK_SIZE 1024 * 1024
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]