[gegl] Fix segfault caused for lack of input format in box-min and box-max



commit a1baba1e7cd48d97413761965efec754c8d73961
Author: Carlos Zubieta <czubieta dev gmail com>
Date:   Wed Sep 11 06:55:25 2013 -0500

    Fix segfault caused for lack of input format in box-min and box-max

 opencl/box-max.cl.h           |    2 +-
 opencl/box-min.cl             |    2 +-
 opencl/box-min.cl.h           |    2 +-
 operations/workshop/box-max.c |   10 ++++------
 operations/workshop/box-min.c |    9 +++------
 5 files changed, 10 insertions(+), 15 deletions(-)
---
diff --git a/opencl/box-max.cl.h b/opencl/box-max.cl.h
index 7a64f1d..94d3d34 100644
--- a/opencl/box-max.cl.h
+++ b/opencl/box-max.cl.h
@@ -1,4 +1,4 @@
-static const char* box_max_cl_source = 
+static const char* box_max_cl_source =
 "__kernel void kernel_max_hor (__global const float4     *in,                  \n"
 "                              __global       float4     *aux,                 \n"
 "                              int width, int radius)                          \n"
diff --git a/opencl/box-min.cl b/opencl/box-min.cl
index 1828afa..a9aebb1 100644
--- a/opencl/box-min.cl
+++ b/opencl/box-min.cl
@@ -23,7 +23,7 @@ __kernel void kernel_min_hor (__global const float4     *in,
     }
 }
 
-__kernel void kernel_max_ver (__global const float4     *aux,
+__kernel void kernel_min_ver (__global const float4     *aux,
                               __global       float4     *out,
                               int width, int radius)
 {
diff --git a/opencl/box-min.cl.h b/opencl/box-min.cl.h
index 8df03c9..95899b9 100644
--- a/opencl/box-min.cl.h
+++ b/opencl/box-min.cl.h
@@ -1,4 +1,4 @@
-static const char* box_min_cl_source = 
+static const char* box_min_cl_source =
 "__kernel void kernel_min_hor (__global const float4     *in,                  \n"
 "                              __global       float4     *aux,                 \n"
 "                              int width, int radius)                          \n"
diff --git a/operations/workshop/box-max.c b/operations/workshop/box-max.c
index ae52837..e10be1f 100644
--- a/operations/workshop/box-max.c
+++ b/operations/workshop/box-max.c
@@ -160,6 +160,7 @@ static void prepare (GeglOperation *operation)
   area->top   =
   area->bottom = GEGL_CHANT_PROPERTIES (operation)->radius;
   gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+  gegl_operation_set_format (operation, "input", babl_format ("RGBA float"));
 }
 
 #include "opencl/gegl-cl.h"
@@ -303,12 +304,9 @@ process (GeglOperation       *operation,
   GeglRectangle input_rect = gegl_operation_get_required_for_output (operation, "input", result);
 
   if (gegl_cl_is_accelerated ())
-    {
-      if (cl_process (operation, input, output, result))
-        return TRUE;
-      else
-        gegl_cl_disable();
-    }
+    if (cl_process (operation, input, output, result))
+      return TRUE;
+
 
   hor_max ( input, &input_rect, output, result, o->radius);
   ver_max (output,      result, output, result, o->radius);
diff --git a/operations/workshop/box-min.c b/operations/workshop/box-min.c
index 10d50b2..93faa51 100644
--- a/operations/workshop/box-min.c
+++ b/operations/workshop/box-min.c
@@ -160,6 +160,7 @@ static void prepare (GeglOperation *operation)
   area->top   =
   area->bottom = GEGL_CHANT_PROPERTIES (operation)->radius;
   gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+  gegl_operation_set_format (operation, "input", babl_format ("RGBA float"));
 }
 
 #include "opencl/gegl-cl.h"
@@ -303,12 +304,8 @@ process (GeglOperation       *operation,
   GeglRectangle input_rect = gegl_operation_get_required_for_output (operation, "input", result);
 
   if (gegl_cl_is_accelerated ())
-    {
-      if (cl_process (operation, input, output, result))
-        return TRUE;
-      else
-        gegl_cl_disable();
-    }
+    if (cl_process (operation, input, output, result))
+      return TRUE;
 
   hor_min ( input, &input_rect, output, result, o->radius);
   ver_min (output,      result, output, result, o->radius);


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