Cycles Development Updates

https://developer.blender.org/P366
(the patch is outdated, it does not work with the current master)