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@dd51c8660b

Pull Request: https://projects.blender.org/blender/blender/pulls/132620
This commit is contained in:
Alaska
2025-01-07 13:43:59 +01:00
committed by Alaska
parent 019269e2cb
commit 65ee136662

View File

@@ -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