From 467d92b8f1c7231eb801194a94cbaeb75c4d5eab Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 12 Sep 2017 13:33:46 +0500 Subject: Cycles: Tweaks to avoid compilation error of megakernel Also moved code out of deep-inside ifdef block, otherwise it was quite confusing. --- intern/cycles/kernel/kernel_shadow.h | 66 ++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'intern/cycles/kernel/kernel_shadow.h') diff --git a/intern/cycles/kernel/kernel_shadow.h b/intern/cycles/kernel/kernel_shadow.h index 22e085e94da..3a534bbb6be 100644 --- a/intern/cycles/kernel/kernel_shadow.h +++ b/intern/cycles/kernel/kernel_shadow.h @@ -16,6 +16,39 @@ CCL_NAMESPACE_BEGIN +#ifdef __VOLUME__ +typedef struct VolumeState { +# ifdef __SPLIT_KERNEL__ +# else + PathState ps; +# endif +} VolumeState; + +/* Get PathState ready for use for volume stack evaluation. */ +ccl_device_inline PathState *shadow_blocked_volume_path_state( + KernelGlobals *kg, + VolumeState *volume_state, + ccl_addr_space PathState *state, + ShaderData *sd, + Ray *ray) +{ +# ifdef __SPLIT_KERNEL__ + ccl_addr_space PathState *ps = + &kernel_split_state.state_shadow[ccl_global_id(1) * ccl_global_size(0) + ccl_global_id(0)]; +# else + PathState *ps = &volume_state->ps; +# endif + *ps = *state; + /* We are checking for shadow on the "other" side of the surface, so need + * to discard volume we are currently at. + */ + if(dot(sd->Ng, ray->D) < 0.0f) { + kernel_volume_stack_enter_exit(kg, sd, ps->volume_stack); + } + return ps; +} +#endif /* __VOLUME__ */ + /* Attenuate throughput accordingly to the given intersection event. * Returns true if the throughput is zero and traversal can be aborted. */ @@ -119,39 +152,6 @@ ccl_device bool shadow_blocked_opaque(KernelGlobals *kg, # define SHADOW_STACK_MAX_HITS 64 -# ifdef __VOLUME__ -struct VolumeState { -# ifdef __SPLIT_KERNEL__ -# else - PathState ps; -# endif -}; - -/* Get PathState ready for use for volume stack evaluation. */ -ccl_device_inline PathState *shadow_blocked_volume_path_state( - KernelGlobals *kg, - VolumeState *volume_state, - ccl_addr_space PathState *state, - ShaderData *sd, - Ray *ray) -{ -# ifdef __SPLIT_KERNEL__ - ccl_addr_space PathState *ps = - &kernel_split_state.state_shadow[ccl_global_id(1) * ccl_global_size(0) + ccl_global_id(0)]; -# else - PathState *ps = &volume_state->ps; -# endif - *ps = *state; - /* We are checking for shadow on the "other" side of the surface, so need - * to discard volume we are currently at. - */ - if(dot(sd->Ng, ray->D) < 0.0f) { - kernel_volume_stack_enter_exit(kg, sd, ps->volume_stack); - } - return ps; -} -#endif // __VOLUME__ - /* Actual logic with traversal loop implementation which is free from device * specific tweaks. * -- cgit v1.2.3