Cycles: Use native saturate function for CUDA
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 27 Apr 2015 19:13:03 +0000 (00:13 +0500)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 27 Apr 2015 19:38:32 +0000 (00:38 +0500)
commitae7d84dbc1936ef7ddd00f9c22d074389f97f04f
tree7103596bc78785ed769e90c1570d654cc14a839d
parent278ff15c7f3c4a91ba049b7a13ecf8a4183ebf67
Cycles: Use native saturate function for CUDA

This more a workaround for CUDA optimizer which can't optimize clamp(x, 0, 1)
into a single instruction and uses 4 instructions instead.

Original patch by @lockal with own modification:

  Don't make changes outside of the kernel. They don't make any difference
  anyway and term saturate() has a bit different meaning outside of kernel.

This gives around 2% of speedup in Barcelona file, but in more complex shader
setups with lots of math nodes with clamping speedup could be much nicer.

Subscribers: dingto

Projects: #cycles

Differential Revision: https://developer.blender.org/D1224
19 files changed:
intern/cycles/kernel/closure/bsdf_microfacet.h
intern/cycles/kernel/closure/bsdf_oren_nayar.h
intern/cycles/kernel/closure/bsdf_toon.h
intern/cycles/kernel/closure/bssrdf.h
intern/cycles/kernel/geom/geom_curve.h
intern/cycles/kernel/kernel_film.h
intern/cycles/kernel/kernel_globals.h
intern/cycles/kernel/kernel_passes.h
intern/cycles/kernel/svm/svm_brick.h
intern/cycles/kernel/svm/svm_closure.h
intern/cycles/kernel/svm/svm_gradient.h
intern/cycles/kernel/svm/svm_image.h
intern/cycles/kernel/svm/svm_math_util.h
intern/cycles/kernel/svm/svm_mix.h
intern/cycles/kernel/svm/svm_musgrave.h
intern/cycles/kernel/svm/svm_ramp.h
intern/cycles/render/buffers.cpp
intern/cycles/render/nodes.cpp
intern/cycles/util/util_math.h