[gegl] operations: use float4 to be OpenCL-1.0 compatible



commit 396ec5b94fe66748d8c0ab090eb9017a151b79f5
Author: Massimo Valentini <mvalentini src gnome org>
Date:   Tue Nov 20 18:45:33 2012 +0100

    operations: use float4 to be OpenCL-1.0 compatible

 operations/common/color-temperature.c |    3 +--
 operations/common/value-invert.c      |   27 ++++++++-------------------
 2 files changed, 9 insertions(+), 21 deletions(-)
---
diff --git a/operations/common/color-temperature.c b/operations/common/color-temperature.c
index 0e2e729..bb134fd 100644
--- a/operations/common/color-temperature.c
+++ b/operations/common/color-temperature.c
@@ -183,8 +183,7 @@ static const char* kernel_source =
 "  int gid = get_global_id(0);                                  \n"
 "  float4 in_v  = in[gid];                                      \n"
 "  float4 out_v;                                                \n"
-"  out_v.xyz = in_v.xyz * (float3) (coeff1, coeff2, coeff3);    \n"
-"  out_v.w   = in_v.w;                                          \n"
+"  out_v = in_v * (float4) (coeff1, coeff2, coeff3, 1.0f);      \n"
 "  out[gid]  =  out_v;                                          \n"
 "}                                                              \n";
 
diff --git a/operations/common/value-invert.c b/operations/common/value-invert.c
index 2403582..5ab1191 100644
--- a/operations/common/value-invert.c
+++ b/operations/common/value-invert.c
@@ -143,28 +143,17 @@ static const char* kernel_source =
 "                                                                   \n"
 "  if (value == 0.0f || delta == 0.0f)                              \n"
 "    {                                                              \n"
-"      out_v.xyz = (float3) (1.0f - value);                         \n"
+"      out_v = (float4) ((1.0f - value),                            \n"
+"                        (1.0f - value),                            \n"
+"                        (1.0f - value),                            \n"
+"                        in_v.w);                                   \n"
 "    }                                                              \n"
 "  else                                                             \n"
 "    {                                                              \n"
-"      if (in_v.x == value)                                         \n"
-"        {                                                          \n"
-"          out_v.xzy = (float3) ((1.0f - in_v.x),                   \n"
-"                                (1.0f - in_v.x) * in_v.z / value,  \n"
-"                                (1.0f - in_v.x) * in_v.y / value); \n"
-"        }                                                          \n"
-"      else if (in_v.y == value)                                    \n"
-"        {                                                          \n"
-"          out_v.yxz = (float3) ((1.0f - in_v.y),                   \n"
-"                                (1.0f - in_v.y) * in_v.x / value,  \n"
-"                                (1.0f - in_v.y) * in_v.z / value); \n"
-"        }                                                          \n"
-"      else                                                         \n"
-"        {                                                          \n"
-"          out_v.zyx = (float3) ((1.0f - in_v.z),                   \n"
-"                                (1.0f - in_v.z) * in_v.y / value,  \n"
-"                                (1.0f - in_v.z) * in_v.x / value); \n"
-"        }                                                          \n"
+"      out_v = (float4) ((1.0f - value) * in_v.x / value,           \n"
+"                        (1.0f - value) * in_v.y / value,           \n"
+"                        (1.0f - value) * in_v.z / value,           \n"
+"                        in_v.w);                                   \n"
 "    }                                                              \n"
 "                                                                   \n"
 "  out_v.w   =  in_v.w;                                             \n"



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