[gegl] Add OpenCL support for gegl:grey



commit 116bedb850b8eecad43ced5ecdfadca0edc63f90
Author: Zhang Peixuan <zhangpeixuan cn gmail com>
Date:   Tue Mar 6 17:41:10 2012 +0800

    Add OpenCL support for gegl:grey

 operations/common/grey.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/operations/common/grey.c b/operations/common/grey.c
index 8e48373..d2bb3b1 100644
--- a/operations/common/grey.c
+++ b/operations/common/grey.c
@@ -60,6 +60,28 @@ process (GeglOperation       *op,
   return TRUE;
 }
 
+#include "opencl/gegl-cl.h"
+
+static cl_int
+cl_process (GeglOperation       *op,
+            cl_mem               in_tex,
+            cl_mem               out_tex,
+            size_t               global_worksize,
+            const GeglRectangle *roi,
+            gint                 level)
+{
+  cl_int cl_err = 0;
+
+  cl_err = gegl_clEnqueueCopyBuffer(gegl_cl_get_command_queue(),
+                                    in_tex , out_tex , 0 , 0 ,
+                                    global_worksize * sizeof (cl_float2),
+                                    0, NULL, NULL);
+
+  if (CL_SUCCESS != cl_err) return cl_err;
+
+  return cl_err;
+}
+
 
 static void
 gegl_chant_class_init (GeglChantClass *klass)
@@ -71,8 +93,11 @@ gegl_chant_class_init (GeglChantClass *klass)
   point_filter_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
 
   point_filter_class->process = process;
+  point_filter_class->cl_process = cl_process;
   operation_class->prepare = prepare;
 
+  operation_class->opencl_support = TRUE;
+
   gegl_operation_class_set_keys (operation_class,
       "name"       , "gegl:grey",
       "categories" , "color",



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