mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 02:05:58 +01:00
shaders: Small optimization in rgb2hsl. (#3831)
This commit is contained in:
parent
ae46fbafe5
commit
6eb2abcb20
1 changed files with 6 additions and 7 deletions
|
@ -238,14 +238,13 @@ vec3 rgb2hsl(vec3 col) {
|
||||||
|
|
||||||
vec3 adds = vec3(((green - blue) / delta), 2.0 + ((blue - red) / delta), 4.0 + ((red - green) / delta));
|
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 += dot(adds, masks);
|
||||||
hue *= deltaGtz;
|
|
||||||
hue /= 6.0;
|
hue /= 6.0;
|
||||||
|
|
||||||
if (hue < 0.0)
|
if (hue < 0.0)
|
||||||
hue += 1.0;
|
hue += 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
return vec3(hue, sat, lum);
|
return vec3(hue, sat, lum);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue