diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-03-08 01:52:26 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-03-10 06:54:04 +0300 |
commit | cd15d87bfcb4aafb0d4f13dcc902a135f472c9df (patch) | |
tree | e5eaac9ca85975624ba91c7a85d03dc9888873a6 /intern/cycles/kernel/kernel_camera.h | |
parent | f3010e98c343a83e07ff6c2a5437d0043122b083 (diff) |
Code refactor: avoid motion transform copy, remove unused curved code.
The purpose of the previous code refactoring is to make the code more readable,
but combined with this change benchmarks also render about 2-3% faster with an
NVIDIA Titan Xp.
Diffstat (limited to 'intern/cycles/kernel/kernel_camera.h')
-rw-r--r-- | intern/cycles/kernel/kernel_camera.h | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h index 96cdb04d955..66ed9f5fc0f 100644 --- a/intern/cycles/kernel/kernel_camera.h +++ b/intern/cycles/kernel/kernel_camera.h @@ -92,16 +92,10 @@ ccl_device void camera_sample_perspective(KernelGlobals *kg, float raster_x, flo #ifdef __CAMERA_MOTION__ if(kernel_data.cam.have_motion) { -# ifdef __KERNEL_OPENCL__ - const MotionTransform tfm = kernel_data.cam.motion; - transform_motion_interpolate(&cameratoworld, - &tfm, - ray->time); -# else - transform_motion_interpolate(&cameratoworld, - &kernel_data.cam.motion, - ray->time); -# endif + ccl_constant MotionTransform *motion = &kernel_data.cam.motion; + transform_motion_interpolate_constant(&cameratoworld, + motion, + ray->time); } #endif @@ -204,16 +198,10 @@ ccl_device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, fl #ifdef __CAMERA_MOTION__ if(kernel_data.cam.have_motion) { -# ifdef __KERNEL_OPENCL__ - const MotionTransform tfm = kernel_data.cam.motion; - transform_motion_interpolate(&cameratoworld, - &tfm, - ray->time); -# else - transform_motion_interpolate(&cameratoworld, - &kernel_data.cam.motion, - ray->time); -# endif + ccl_constant MotionTransform *motion = &kernel_data.cam.motion; + transform_motion_interpolate_constant(&cameratoworld, + motion, + ray->time); } #endif @@ -282,16 +270,10 @@ ccl_device_inline void camera_sample_panorama(ccl_constant KernelCamera *cam, #ifdef __CAMERA_MOTION__ if(cam->have_motion) { -# ifdef __KERNEL_OPENCL__ - const MotionTransform tfm = cam->motion; - transform_motion_interpolate(&cameratoworld, - &tfm, - ray->time); -# else - transform_motion_interpolate(&cameratoworld, - &cam->motion, - ray->time); -# endif + ccl_constant MotionTransform *motion = &cam->motion; + transform_motion_interpolate_constant(&cameratoworld, + motion, + ray->time); } #endif |