[gegl] opencl: fix a bunch of opencl compilation error with pocl



commit 5bfa7251d606dd242679feaee33e161dee527069
Author: Téo Mazars <teo mazars ensimag fr>
Date:   Thu Oct 31 16:43:25 2013 +0100

    opencl: fix a bunch of opencl compilation error with pocl

 opencl/c2g.cl               |    4 ++--
 opencl/c2g.cl.h             |    4 ++--
 opencl/noise-reduction.cl   |    4 ++--
 opencl/noise-reduction.cl.h |    4 ++--
 opencl/snn-mean.cl          |    4 ++--
 opencl/snn-mean.cl.h        |    4 ++--
 6 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/opencl/c2g.cl b/opencl/c2g.cl
index 6442eeb..6140c91 100644
--- a/opencl/c2g.cl
+++ b/opencl/c2g.cl
@@ -103,8 +103,8 @@ void compute_envelopes(const __global  float4 *src_buf,
         range_sum += range;
     }
 
-    float4 relative_brightness = relative_brightness_sum / iterations;
-    float4 range = range_sum / iterations;
+    float4 relative_brightness = relative_brightness_sum / (float4)(iterations);
+    float4 range = range_sum / (float4)(iterations);
 
     if(max_envelope)
         *max_envelope = pixel + (1.0f - relative_brightness) * range;
diff --git a/opencl/c2g.cl.h b/opencl/c2g.cl.h
index 3831faf..451a176 100644
--- a/opencl/c2g.cl.h
+++ b/opencl/c2g.cl.h
@@ -104,8 +104,8 @@ static const char* c2g_cl_source =
 "        range_sum += range;                                                   \n"
 "    }                                                                         \n"
 "                                                                              \n"
-"    float4 relative_brightness = relative_brightness_sum / iterations;        \n"
-"    float4 range = range_sum / iterations;                                    \n"
+"    float4 relative_brightness = relative_brightness_sum / (float4)(iterations);\n"
+"    float4 range = range_sum / (float4)(iterations);                          \n"
 "                                                                              \n"
 "    if(max_envelope)                                                          \n"
 "        *max_envelope = pixel + (1.0f - relative_brightness) * range;         \n"
diff --git a/opencl/noise-reduction.cl b/opencl/noise-reduction.cl
index 312087b..e84d172 100644
--- a/opencl/noise-reduction.cl
+++ b/opencl/noise-reduction.cl
@@ -3,7 +3,7 @@
 
 #define POW2(a) ((a)*(a))
 
-#define GEN_METRIC(before, center, after) POW2((center) * 2 - (before) - (after))
+#define GEN_METRIC(before, center, after) POW2((center) * (float4)(2.0f) - (before) - (after))
 
 #define BAIL_CONDITION(new,original) ((new) < (original))
 
@@ -60,7 +60,7 @@ __kernel void noise_reduction_cl (__global       float4 *src_buf,
                                             after_pix);
             mask = BAIL_CONDITION (metric_new, metric_reference[axis]) & mask;
           }
-        sum   += mask >0 ? value : 0;
+        sum   += mask >0 ? value : (float4)(0.0);
         count += mask >0 ? 1     : 0;
       }
     dst_buf[dst_offset]   = (sum/convert_float4(count));
diff --git a/opencl/noise-reduction.cl.h b/opencl/noise-reduction.cl.h
index 969fe2a..9794fd8 100644
--- a/opencl/noise-reduction.cl.h
+++ b/opencl/noise-reduction.cl.h
@@ -4,7 +4,7 @@ static const char* noise_reduction_cl_source =
 "                                                                              \n"
 "#define POW2(a) ((a)*(a))                                                     \n"
 "                                                                              \n"
-"#define GEN_METRIC(before, center, after) POW2((center) * 2 - (before) - (after))\n"
+"#define GEN_METRIC(before, center, after) POW2((center) * (float4)(2.0f) - (before) - (after))\n"
 "                                                                              \n"
 "#define BAIL_CONDITION(new,original) ((new) < (original))                     \n"
 "                                                                              \n"
@@ -61,7 +61,7 @@ static const char* noise_reduction_cl_source =
 "                                            after_pix);                       \n"
 "            mask = BAIL_CONDITION (metric_new, metric_reference[axis]) & mask;\n"
 "          }                                                                   \n"
-"        sum   += mask >0 ? value : 0;                                         \n"
+"        sum   += mask >0 ? value : (float4)(0.0);                             \n"
 "        count += mask >0 ? 1     : 0;                                         \n"
 "      }                                                                       \n"
 "    dst_buf[dst_offset]   = (sum/convert_float4(count));                      \n"
diff --git a/opencl/snn-mean.cl b/opencl/snn-mean.cl
index 9802b46..8270e56 100644
--- a/opencl/snn-mean.cl
+++ b/opencl/snn-mean.cl
@@ -62,7 +62,7 @@ __kernel void snn_mean (__global const   float4 *src_buf,
                     break;
             }
         }
-        dst_buf[offset] = accumulated/count;
+        dst_buf[offset] = accumulated/(float4)(count);
         return;
     }
     else if(pairs==1)
@@ -108,7 +108,7 @@ __kernel void snn_mean (__global const   float4 *src_buf,
                     break;
             }
         }
-        dst_buf[offset] = accumulated/count;
+        dst_buf[offset] = accumulated / (float4)(count);
         return;
     }
     return;
diff --git a/opencl/snn-mean.cl.h b/opencl/snn-mean.cl.h
index 21b4935..0aec7e6 100644
--- a/opencl/snn-mean.cl.h
+++ b/opencl/snn-mean.cl.h
@@ -63,7 +63,7 @@ static const char* snn_mean_cl_source =
 "                    break;                                                    \n"
 "            }                                                                 \n"
 "        }                                                                     \n"
-"        dst_buf[offset] = accumulated/count;                                  \n"
+"        dst_buf[offset] = accumulated/(float4)(count);                        \n"
 "        return;                                                               \n"
 "    }                                                                         \n"
 "    else if(pairs==1)                                                         \n"
@@ -109,7 +109,7 @@ static const char* snn_mean_cl_source =
 "                    break;                                                    \n"
 "            }                                                                 \n"
 "        }                                                                     \n"
-"        dst_buf[offset] = accumulated/count;                                  \n"
+"        dst_buf[offset] = accumulated / (float4)(count);                      \n"
 "        return;                                                               \n"
 "    }                                                                         \n"
 "    return;                                                                   \n"


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