#if SQUARE_ROOT_TRANSFORMATION
// Make sure we don't give negative values to sqrt.
val.rgb = sqrt(max(val.rgb, 0.0));
#endif
#if SQUARE_ROOT_TRANSFORMATION
// Make sure we don't give negative values to sqrt.
val.rgb = sqrt(max(val.rgb, 0.0));
#endif
- imageStore(outbuf, coord, val);
+
+#if FLIP_ORIGIN
+ coord.y = imageSize(tex_outbuf).y - coord.y - 1;
+#endif
+
+ imageStore(tex_outbuf, coord, val);