[gegl] opencl: fixed bug in gegl:opacity



commit 54b444fc88ca28e3c821804642472961ee156d9c
Author: Victor Oliveira <victormatheus gmail com>
Date:   Tue Feb 26 19:27:54 2013 -0300

    opencl: fixed bug in gegl:opacity

 opencl/opacity.cl           |    3 +--
 opencl/opacity.cl.h         |    3 +--
 operations/common/opacity.c |    4 ++--
 3 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/opencl/opacity.cl b/opencl/opacity.cl
index ef17d7d..2038edd 100644
--- a/opencl/opacity.cl
+++ b/opencl/opacity.cl
@@ -18,8 +18,7 @@ __kernel void gegl_opacity_RGBA_float (__global const float4     *in,
   int gid = get_global_id(0);
   float4 in_v  = in [gid];
   float  aux_v = (aux)? aux[gid] : 1.0f;
-  float4 out_v;
-  out_v = (in_v.x, in_v.y, in_v.z, in_v.w * aux_v * value);
+  float4 out_v = (float4)(in_v.x, in_v.y, in_v.z, in_v.w * aux_v * value);
   out[gid]  =  out_v;
 }
 
diff --git a/opencl/opacity.cl.h b/opencl/opacity.cl.h
index 8586e98..06d1560 100644
--- a/opencl/opacity.cl.h
+++ b/opencl/opacity.cl.h
@@ -19,8 +19,7 @@ static const char* opacity_cl_source =
 "  int gid = get_global_id(0);                                                 \n"
 "  float4 in_v  = in [gid];                                                    \n"
 "  float  aux_v = (aux)? aux[gid] : 1.0f;                                      \n"
-"  float4 out_v;                                                               \n"
-"  out_v = (in_v.x, in_v.y, in_v.z, in_v.w * aux_v * value);                   \n"
+"  float4 out_v = (float4)(in_v.x, in_v.y, in_v.z, in_v.w * aux_v * value);    \n"
 "  out[gid]  =  out_v;                                                         \n"
 "}                                                                             \n"
 "                                                                              \n"
diff --git a/operations/common/opacity.c b/operations/common/opacity.c
index 8b850ff..33ae44d 100644
--- a/operations/common/opacity.c
+++ b/operations/common/opacity.c
@@ -219,11 +219,11 @@ cl_process (GeglOperation       *op,
 
   value = GEGL_CHANT_PROPERTIES (op)->value;
 
-  kernel = (GEGL_CHANT_PROPERTIES (op)->chant_data == NULL);
+  kernel = (GEGL_CHANT_PROPERTIES (op)->chant_data == NULL)? 0 : 1;
 
   cl_err = gegl_clSetKernelArg(cl_data->kernel[kernel], 0, sizeof(cl_mem),   (void*)&in_tex);
   CL_CHECK;
-  cl_err = gegl_clSetKernelArg(cl_data->kernel[kernel], 1, sizeof(cl_mem),   (void*)&aux_tex);
+  cl_err = gegl_clSetKernelArg(cl_data->kernel[kernel], 1, sizeof(cl_mem),   (aux_tex)? (void*)&aux_tex : 
NULL);
   CL_CHECK;
   cl_err = gegl_clSetKernelArg(cl_data->kernel[kernel], 2, sizeof(cl_mem),   (void*)&out_tex);
   CL_CHECK;


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