aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDickby <[email protected]>2023-11-11 16:43:31 +0100
committerGitHub <[email protected]>2023-11-11 15:43:31 +0000
commit844da8db561f00f99d7e861b4b9a8bf51bbcd10c (patch)
treeefff5a07ee6af310181c5fb1ba3df14b0187c678
parentdb82fc5b09db7e80a6195cdc11ac4d05ad4d88f0 (diff)
downloadHyprland-844da8db561f00f99d7e861b4b9a8bf51bbcd10c.tar.gz
Hyprland-844da8db561f00f99d7e861b4b9a8bf51bbcd10c.zip
shaders: Avoid calculating unused values in hsl2rgb. (#3827)
-rw-r--r--src/render/shaders/Textures.hpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/render/shaders/Textures.hpp b/src/render/shaders/Textures.hpp
index daa7bc9b..8108f451 100644
--- a/src/render/shaders/Textures.hpp
+++ b/src/render/shaders/Textures.hpp
@@ -258,19 +258,18 @@ vec3 hsl2rgb(vec3 col) {
float sat = col.y;
float lum = col.z;
- vec3 xt = vec3(rcpsixth * (hue - twothird), 0.0, rcpsixth * (1.0 - hue));
-
- if (hue < twothird) {
- xt.r = 0.0;
- xt.g = rcpsixth * (twothird - hue);
- xt.b = rcpsixth * (hue - onethird);
- }
+ vec3 xt = vec3(0.0);
if (hue < onethird) {
xt.r = rcpsixth * (onethird - hue);
xt.g = rcpsixth * hue;
xt.b = 0.0;
- }
+ } else if (hue < twothird) {
+ xt.r = 0.0;
+ xt.g = rcpsixth * (twothird - hue);
+ xt.b = rcpsixth * (hue - onethird);
+ } else
+ xt = vec3(rcpsixth * (hue - twothird), 0.0, rcpsixth * (1.0 - hue));
xt = min(xt, 1.0);