From 81e3e24f7f9940c0a2f31d6e519d55857a9fc909 Mon Sep 17 00:00:00 2001 From: Lee Kerley <154285602+ld-kerley@users.noreply.github.com> Date: Thu, 5 Sep 2024 16:34:43 -0700 Subject: [PATCH] Align smoothstep edge cases with OSL (#1985) Following a conversation on ASWF slack this PR was posted to OSL refining the edge cases for `smoothstep()`. https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/pull/1851 This PR aligns the GLSL/MSL code with this change. --- libraries/stdlib/genglsl/mx_smoothstep_float.glsl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/stdlib/genglsl/mx_smoothstep_float.glsl b/libraries/stdlib/genglsl/mx_smoothstep_float.glsl index 1bca2e4d9b..0b317bdf33 100644 --- a/libraries/stdlib/genglsl/mx_smoothstep_float.glsl +++ b/libraries/stdlib/genglsl/mx_smoothstep_float.glsl @@ -1,9 +1,9 @@ void mx_smoothstep_float(float val, float low, float high, out float result) { - if (val <= low) - result = 0.0; - else if (val >= high) + if (val >= high) result = 1.0; + else if (val <= low) + result = 0.0; else result = smoothstep(low, high, val); }