[gegl] weighted-blend: fix opencl kernel to obtain the same result as the C version



commit 703d60edc5e3b72cb2a1c2210d69d659efd723ee
Author: Thomas Manni <thomas manni free fr>
Date:   Tue Aug 6 13:39:49 2019 +0200

    weighted-blend: fix opencl kernel to obtain the same result as the C version
    
    Fixes issue #161

 opencl/weighted-blend.cl   | 2 +-
 opencl/weighted-blend.cl.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/opencl/weighted-blend.cl b/opencl/weighted-blend.cl
index 68cec6312..948041d9a 100644
--- a/opencl/weighted-blend.cl
+++ b/opencl/weighted-blend.cl
@@ -25,5 +25,5 @@ __kernel void cl_weighted_blend(__global const float4 *in,
 
   out_v.xyz = in_weight * in_v.xyz + aux_weight * aux_v.xyz;
   out_v.w = total_alpha;
-  out[gid] = out_v;
+  out[gid] = out_v * ((in_v.w + aux_v.w) > 0.f);
 }
diff --git a/opencl/weighted-blend.cl.h b/opencl/weighted-blend.cl.h
index d51648266..756f37b83 100644
--- a/opencl/weighted-blend.cl.h
+++ b/opencl/weighted-blend.cl.h
@@ -26,6 +26,6 @@ static const char* weighted_blend_cl_source =
 "                                                                              \n"
 "  out_v.xyz = in_weight * in_v.xyz + aux_weight * aux_v.xyz;                  \n"
 "  out_v.w = total_alpha;                                                      \n"
-"  out[gid] = out_v;                                                           \n"
+"  out[gid] = out_v * ((in_v.w + aux_v.w) > 0.f);                              \n"
 "}                                                                             \n"
 ;


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