[gegl] minor fixes



commit bee324be2195d1fb28208d91d427f9f696582a8f
Author: Victor Oliveira <victormatheus gmail com>
Date:   Sat Mar 10 19:29:15 2012 -0300

    minor fixes

 gegl/opencl/gegl-cl-color-kernel.h |    2 +-
 gegl/opencl/gegl-cl-init.c         |   19 ++++++++++++++++---
 2 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/gegl/opencl/gegl-cl-color-kernel.h b/gegl/opencl/gegl-cl-color-kernel.h
index 6a3589e..34c2522 100644
--- a/gegl/opencl/gegl-cl-color-kernel.h
+++ b/gegl/opencl/gegl-cl-color-kernel.h
@@ -6,7 +6,7 @@ static const char* kernel_color_source =
 " *                                                                                       \n"
 " * 0.01 / (2^16 - 1)                                                                     \n"
 " */                                                                                      \n"
-"#define BABL_ALPHA_THRESHOLD 0.000000152590219                                           \n"
+"#define BABL_ALPHA_THRESHOLD 0.0f                                                        \n"
 "                                                                                         \n"
 "float linear_to_gamma_2_2 (float value)                                                  \n"
 "{                                                                                        \n"
diff --git a/gegl/opencl/gegl-cl-init.c b/gegl/opencl/gegl-cl-init.c
index ec80712..7a4bc90 100644
--- a/gegl/opencl/gegl-cl-init.c
+++ b/gegl/opencl/gegl-cl-init.c
@@ -210,13 +210,24 @@ gegl_cl_init (GError **error)
       CL_LOAD_FUNCTION (clReleaseContext)
       CL_LOAD_FUNCTION (clReleaseMemObject)
 
-      gegl_clGetPlatformIDs (1, &cl_state.platform, NULL);
+      err = gegl_clGetPlatformIDs (1, &cl_state.platform, NULL);
+      if(err != CL_SUCCESS)
+        {
+          g_printf("[OpenCL] Could not create platform\n");
+          return FALSE;
+        }
 
       gegl_clGetPlatformInfo (cl_state.platform, CL_PLATFORM_NAME,       sizeof(cl_state.platform_name),    cl_state.platform_name,    NULL);
       gegl_clGetPlatformInfo (cl_state.platform, CL_PLATFORM_VERSION,    sizeof(cl_state.platform_version), cl_state.platform_version, NULL);
       gegl_clGetPlatformInfo (cl_state.platform, CL_PLATFORM_EXTENSIONS, sizeof(cl_state.platform_ext),     cl_state.platform_ext,     NULL);
 
-      gegl_clGetDeviceIDs (cl_state.platform, CL_DEVICE_TYPE_DEFAULT, 1, &cl_state.device, NULL);
+      err = gegl_clGetDeviceIDs (cl_state.platform, CL_DEVICE_TYPE_DEFAULT, 1, &cl_state.device, NULL);
+      if(err != CL_SUCCESS)
+        {
+          g_printf("[OpenCL] Could not create device\n");
+          return FALSE;
+        }
+
       gegl_clGetDeviceInfo(cl_state.device, CL_DEVICE_NAME, sizeof(cl_state.device_name), cl_state.device_name, NULL);
 
       gegl_clGetDeviceInfo (cl_state.device, CL_DEVICE_IMAGE_SUPPORT,      sizeof(cl_bool),  &cl_state.image_support,    NULL);
@@ -311,6 +322,8 @@ gegl_cl_compile_and_build (const char *program_source, const char *kernel_name[]
         {
           char *msg;
           size_t s;
+          cl_int build_errcode = errcode;
+
           CL_SAFE_CALL( errcode = gegl_clGetProgramBuildInfo(cl_data->program,
                                                              gegl_cl_get_device(),
                                                              CL_PROGRAM_BUILD_LOG,
@@ -321,7 +334,7 @@ gegl_cl_compile_and_build (const char *program_source, const char *kernel_name[]
                                                              gegl_cl_get_device(),
                                                              CL_PROGRAM_BUILD_LOG,
                                                              s, msg, NULL) );
-          g_printf("[OpenCL] Build Error:%s\n%s", gegl_cl_errstring(errcode), msg);
+          g_printf("[OpenCL] Build Error:%s\n%s", gegl_cl_errstring(build_errcode), msg);
           g_free (msg);
 
           return NULL;



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