Commit: 0409b40f640ba9611489952c668119ad13025d68 Author: Lukas Stockner Date: Thu Nov 17 01:18:29 2022 +0100 Branches: principled-v2 https://developer.blender.org/rB0409b40f640ba9611489952c668119ad13025d68
Merge remote-tracking branch 'origin/master' into principled-v2 =================================================================== =================================================================== diff --cc intern/cycles/kernel/osl/closures_setup.h index 23f62ec2f3d,ceaf56ccba6..ded0b31ea97 --- a/intern/cycles/kernel/osl/closures_setup.h +++ b/intern/cycles/kernel/osl/closures_setup.h @@@ -211,13 -205,18 +206,11 @@@ ccl_device void osl_closure_microfacet_ bsdf->ior = closure->ior; bsdf->T = closure->T; - static OSL::ustring u_ggx("ggx"); - static OSL::ustring u_default("default"); - /* GGX */ - if (closure->distribution == u_ggx || closure->distribution == u_default) { + if (closure->distribution == make_string("ggx", 11253504724482777663ull) || + closure->distribution == make_string("default", 4430693559278735917ull)) { if (!closure->refract) { - if (closure->alpha_x == closure->alpha_y) { - /* Isotropic */ - sd->flag |= bsdf_microfacet_ggx_isotropic_setup(bsdf); - } - else { - /* Anisotropic */ - sd->flag |= bsdf_microfacet_ggx_setup(bsdf); - } + sd->flag |= bsdf_microfacet_ggx_setup(bsdf); } else { sd->flag |= bsdf_microfacet_ggx_refraction_setup(bsdf); diff --cc intern/cycles/util/math_float2.h index 60686561f9b,ad806d0f08a..bf85c506753 --- a/intern/cycles/util/math_float2.h +++ b/intern/cycles/util/math_float2.h @@@ -170,17 -118,29 +118,24 @@@ ccl_device_inline bool is_zero(const fl return (a.x == 0.0f && a.y == 0.0f); } - ccl_device_inline float distance(const float2 &a, const float2 &b) -ccl_device_inline float average(const float2 a) -{ - return (a.x + a.y) * (1.0f / 2.0f); -} - + ccl_device_inline float dot(const float2 a, const float2 b) { - return len(a - b); + return a.x * b.x + a.y * b.y; } + #endif - ccl_device_inline float dot(const float2 &a, const float2 &b) + ccl_device_inline float len(const float2 a) { - return a.x * b.x + a.y * b.y; + return sqrtf(dot(a, a)); } - ccl_device_inline float cross(const float2 &a, const float2 &b) + #if !defined(__KERNEL_METAL__) + ccl_device_inline float distance(const float2 a, const float2 b) + { + return len(a - b); + } + + ccl_device_inline float cross(const float2 a, const float2 b) { return (a.x * b.y - a.y * b.x); } @@@ -227,12 -187,7 +182,12 @@@ ccl_device_inline float2 as_float2(cons return make_float2(a.x, a.y); } - ccl_device_inline float2 sqrt(const float2 &a) ++ccl_device_inline float2 sqrt(const float2 a) +{ + return make_float2(sqrtf(a.x), sqrtf(a.y)); +} + - ccl_device_inline float2 interp(const float2 &a, const float2 &b, float t) + ccl_device_inline float2 interp(const float2 a, const float2 b, float t) { return a + t * (b - a); } @@@ -249,31 -204,11 +204,26 @@@ ccl_device_inline float2 floor(const fl #endif /* !__KERNEL_METAL__ */ - ccl_device_inline float len(const float2 a) - { - return sqrtf(dot(a, a)); - } - +ccl_device_inline float len_squared(const float2 a) +{ + return dot(a, a); +} + ccl_device_inline float2 safe_divide_float2_float(const float2 a, const float b) { return (b != 0.0f) ? a / b : zero_float2(); } - ccl_device_inline float average(const float2 &a) ++ccl_device_inline float average(const float2 a) +{ + return (a.x + a.y) * (1.0f / 2.0f); +} + - ccl_device_inline float2 sqr(const float2 &a) ++ccl_device_inline float2 sqr(const float2 a) +{ + return a * a; +} + CCL_NAMESPACE_END #endif /* __UTIL_MATH_FLOAT2_H__ */ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs