Fix T40379: world MIS causing too much CUDA memory usage.

The kernel for baking the world texture was the same as the one used for
baking. Now that's separate which allows the kernel to reserve much less
memory.
Cycles CUDA: use fewer registers for sm_50 cards for better performance.
fix T40375 Glossy shader bakes different than render

Comments from Brecht Van Lommel:
"""
Currently the viewing direction for each pixel is set to the normal, so
at every pixel glossy is evaluated as if you're looking straight at it.
Blender Internal works the same.
"""

This patch makes baking glossy as viewed from the camera.

Reviewers: brecht

CC: zanqdo

Differential Revision: https://developer.blender.org/D555
Cycles: new camera_direction_from_point

Reviewers: brecht

Differential Revision: https://developer.blender.org/D556
Fix T40344: Levels of Detail not smooth with Armature Modifier

Due to skinning changes for multi-threaded animations, the LOD check was
being done after skinning. Now the LOD check is run before animations.
This means the culling information is a frame old, but this should be
fine.
Fix T40387, image api save and pack did not fire notifiers.
Fix T40362: Projected texture from spotlight doesn't scale with spotsize when changed in-game via Python

GPULamp::winmat needs to be updated after the spot size has changed.
BGE cleanup: Remove unused KX_TrackToActuator::m_tracktime member.
BGE cleanup: Removing some potential memory leaks from KX_NavMeshObject when it fails to build a navmesh.
BGE: Accidentally committed some debug code in 8dafbe.
Fix 40343: Using replace mesh (e.g., LODs) on a skinned mesh crashes.

Need to use parent->AddRef() in a few places.
FCurve: Setting extrapolation needs to recalc handles
Fix T40388: 2.70a - Blender Render - Texture Stack - persistent checkbox state.

Reset 'use_texture' flag of a material tex slot when creating/assigning
a texture to an empty slot.
Fix T40399, OpenCL compile error.
Fix T40383: Keying node doesn't work

We should actually re-consider whether zero-sized kernels are allowed
for edge detection.
Fix T40403: Particles disappear after rendering

Read the comment in ensure_curve_cache, it tells it all.
Style cleanup
Fix T40272: Error setting option flags2 to value fastpskip
Add asserts to BKE_mesh_normals_loop_split
Fix T40405: Blender crashes on FBX export instantly.

This crash can only happen in case faces in same 'smooth fan' have reversed normals.
To support this, we have to always keep a way to get real values in loop_to_poly,
even when loop itself is tagged as done, it might be needed in computation of one of
its neighbor's split normal later.