[gegl/gsoc2011-opencl] Added gegl_cl_command_queue to return a standard OpenCL command queue



commit f5c56b2dc6c06346cd941b943930101060ad5f5a
Author: Victor Oliveira <victormatheus gmail com>
Date:   Wed Jun 1 16:51:27 2011 -0300

    Added gegl_cl_command_queue to return a standard OpenCL command queue

 gegl/opencl/gegl-cl-init.c |   14 +++++++++++---
 gegl/opencl/gegl-cl-init.h |    2 ++
 2 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/gegl/opencl/gegl-cl-init.c b/gegl/opencl/gegl-cl-init.c
index cd31562..5598bea 100644
--- a/gegl/opencl/gegl-cl-init.c
+++ b/gegl/opencl/gegl-cl-init.c
@@ -61,9 +61,10 @@ char *gegl_cl_errstring(cl_int err) {
 
 static gboolean cl_is_accelerated  = FALSE;
 
-static cl_platform_id platform = NULL;
-static cl_device_id   device   = NULL;
-static cl_context     ctx      = NULL;
+static cl_platform_id   platform = NULL;
+static cl_device_id     device   = NULL;
+static cl_context       ctx      = NULL;
+static cl_command_queue cq       = NULL;
 
 gboolean
 gegl_cl_is_accelerated (void)
@@ -89,6 +90,12 @@ gegl_cl_get_context (void)
   return ctx;
 }
 
+cl_command_queue
+gegl_cl_get_command_queue (void)
+{
+  return cq;
+}
+
 #define CL_LOAD_FUNCTION(func)                                                    \
 if (!g_module_symbol (module, #func, (gpointer *)& gegl_##func))                  \
   {                                                                               \
@@ -166,6 +173,7 @@ gegl_cl_init (GError **error)
       printf("Default Device Name:%s\n", buffer);
 
       ctx = gegl_clCreateContext(0, 1, &device, NULL, NULL, NULL);
+      cq  = gegl_clCreateCommandQueue(ctx, device, 0, NULL);
     }
 
   return TRUE;
diff --git a/gegl/opencl/gegl-cl-init.h b/gegl/opencl/gegl-cl-init.h
index f506288..29af9bc 100644
--- a/gegl/opencl/gegl-cl-init.h
+++ b/gegl/opencl/gegl-cl-init.h
@@ -16,6 +16,8 @@ cl_device_id gegl_cl_get_device (void);
 
 cl_context gegl_cl_get_context (void);
 
+cl_command_queue gegl_cl_get_command_queue (void);
+
 #ifdef __GEGL_CL_INIT_MAIN__
 t_clGetPlatformIDs  gegl_clGetPlatformIDs  = NULL;
 t_clGetPlatformInfo gegl_clGetPlatformInfo = NULL;



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