Make the ray self primitives store and restore reliable for cases when
the intersect_shadow kernel is called multiple times:
- Light object and primitive are stored in dedicated fields in the
state. This adds 2 integers per state.
- The self object and primitive are used from the previous intersection
when the intersect_shadow is called multiple times.
There is more detailed explanation added in the code.
The issue was introduced by the light refactor to be objects in #134846.
Pull Request: https://projects.blender.org/blender/blender/pulls/135573