diff options
author | Dickby <[email protected]> | 2023-11-11 18:20:18 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2023-11-11 17:20:18 +0000 |
commit | 6eb2abcb20b967daaeeb7f109005e9fa817bc70c (patch) | |
tree | 0732d87cd244b17991dc093f27801be3e6a1d6fa | |
parent | ae46fbafe5ba2d707e3d2897de74bf5a1d7397c6 (diff) | |
download | Hyprland-6eb2abcb20b967daaeeb7f109005e9fa817bc70c.tar.gz Hyprland-6eb2abcb20b967daaeeb7f109005e9fa817bc70c.zip |
shaders: Small optimization in rgb2hsl. (#3831)
-rw-r--r-- | src/render/shaders/Textures.hpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/render/shaders/Textures.hpp b/src/render/shaders/Textures.hpp index 8108f451..e32712fa 100644 --- a/src/render/shaders/Textures.hpp +++ b/src/render/shaders/Textures.hpp @@ -238,14 +238,13 @@ vec3 rgb2hsl(vec3 col) { vec3 adds = vec3(((green - blue) / delta), 2.0 + ((blue - red) / delta), 4.0 + ((red - green) / delta)); - float deltaGtz = (delta > 0.0) ? 1.0 : 0.0; + if (delta > 0.0) { + hue += dot(adds, masks); + hue /= 6.0; - hue += dot(adds, masks); - hue *= deltaGtz; - hue /= 6.0; - - if (hue < 0.0) - hue += 1.0; + if (hue < 0.0) + hue += 1.0; + } return vec3(hue, sat, lum); } |