Cycles: Remove few function arguments needed only for the split kernel
[blender.git] / intern / cycles / kernel / kernel_path_common.h
1 /*
2  * Copyright 2011-2015 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 CCL_NAMESPACE_BEGIN
18
19 ccl_device_inline void kernel_path_trace_setup(KernelGlobals *kg,
20                                                ccl_global uint *rng_state,
21                                                int sample,
22                                                int x, int y,
23                                                ccl_addr_space RNG *rng,
24                                                ccl_addr_space Ray *ray)
25 {
26         float filter_u;
27         float filter_v;
28
29         int num_samples = kernel_data.integrator.aa_samples;
30
31         path_rng_init(kg, rng_state, sample, num_samples, rng, x, y, &filter_u, &filter_v);
32
33         /* sample camera ray */
34
35         float lens_u = 0.0f, lens_v = 0.0f;
36
37         if(kernel_data.cam.aperturesize > 0.0f)
38                 path_rng_2D(kg, rng, sample, num_samples, PRNG_LENS_U, &lens_u, &lens_v);
39
40         float time = 0.0f;
41
42 #ifdef __CAMERA_MOTION__
43         if(kernel_data.cam.shuttertime != -1.0f)
44                 time = path_rng_1D(kg, rng, sample, num_samples, PRNG_TIME);
45 #endif
46
47         camera_sample(kg, x, y, filter_u, filter_v, lens_u, lens_v, time, ray);
48 }
49
50 CCL_NAMESPACE_END