From 65ee13666252db0a474bd26d6cf5ac681cd893e7 Mon Sep 17 00:00:00 2001 From: Alaska Date: Tue, 7 Jan 2025 13:43:59 +0100 Subject: [PATCH] Fix: Cycles kernel build failure when building without subsurface scattering In a recent refactor (1), the subsurface weight was set to be constant, when it can be modified in the case that `__SUBSURFACE__` is false, such as when using the adaptive compilation feature. This commit fixes this issue by rearranging the code so the subsurface weight is never overwritten. (1) blender/blender@dd51c8660b3e295f863933bd9889146680684ce3 Pull Request: https://projects.blender.org/blender/blender/pulls/132620 --- intern/cycles/kernel/svm/closure.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/intern/cycles/kernel/svm/closure.h b/intern/cycles/kernel/svm/closure.h index e331161fd55..8d94e6ca32d 100644 --- a/intern/cycles/kernel/svm/closure.h +++ b/intern/cycles/kernel/svm/closure.h @@ -138,7 +138,11 @@ ccl_device // get Disney principled parameters const float metallic = saturatef(param1); +#ifdef __SUBSURFACE__ const float subsurface_weight = saturatef(param2); +#else + const float subsurface_weight = 0.0f; +#endif const float specular_ior_level = max(stack_load_float(stack, specular_ior_level_offset), 0.0f); const float roughness = saturatef(stack_load_float(stack, roughness_offset)); @@ -450,7 +454,6 @@ ccl_device sd->flag |= bssrdf_setup(sd, bssrdf, path_flag, subsurface_method); } #else - subsurface_weight = 0.0f; (void)data_subsurf; #endif