mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Cycles: Tweaks to avoid compilation error of megakernel
Also moved code out of deep-inside ifdef block, otherwise it was quite confusing.
This commit is contained in:
parent
6f19787e52
commit
3ffb0f6983
2 changed files with 35 additions and 1 deletions
|
|
@ -348,8 +348,9 @@ ccl_device_inline Bssrdf *bssrdf_alloc(ShaderData *sd, float3 weight)
|
|||
{
|
||||
Bssrdf *bssrdf = (Bssrdf*)closure_alloc(sd, sizeof(Bssrdf), CLOSURE_NONE_ID, weight);
|
||||
|
||||
if(!bssrdf)
|
||||
if(bssrdf == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
float sample_weight = fabsf(average(weight));
|
||||
bssrdf->sample_weight = sample_weight;
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue