Fix: Ray Portal BSDF changing sd->flag when closure is not allocated
when ray exceeds `max_bounce`, we do not allocate any closure at intersection. However, Ray Portal BSDF still added `SD_BSDF` flag, resulting in undefined behavior in `integrate_surface_bsdf_bssrdf_bounce()`. This part of code was similar to Transparent BSDF, however, Transparent closure was still allocated in this case. To fix the undefined behavior, add `SD_BSDF` flag only when the Ray Portal closure was allocated.
This commit is contained in:
@@ -28,12 +28,12 @@ ccl_device void bsdf_ray_portal_setup(ccl_private ShaderData *sd,
|
||||
}
|
||||
|
||||
sd->closure_transparent_extinction += weight;
|
||||
sd->flag |= SD_BSDF | SD_RAY_PORTAL;
|
||||
|
||||
ccl_private RayPortalClosure *pc = (ccl_private RayPortalClosure *)closure_alloc(
|
||||
sd, sizeof(RayPortalClosure), CLOSURE_BSDF_RAY_PORTAL_ID, weight);
|
||||
|
||||
if (pc) {
|
||||
sd->flag |= SD_BSDF | SD_RAY_PORTAL;
|
||||
if (is_zero(direction)) {
|
||||
direction = -sd->wi;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user