mirror of
https://github.com/hyprwm/Hyprland
synced 2025-02-17 00:22:07 +01:00
shaders: Avoid calculating unused values in hsl2rgb. (#3827)
This commit is contained in:
parent
db82fc5b09
commit
844da8db56
1 changed files with 7 additions and 8 deletions
|
@ -258,19 +258,18 @@ vec3 hsl2rgb(vec3 col) {
|
||||||
float sat = col.y;
|
float sat = col.y;
|
||||||
float lum = col.z;
|
float lum = col.z;
|
||||||
|
|
||||||
vec3 xt = vec3(rcpsixth * (hue - twothird), 0.0, rcpsixth * (1.0 - hue));
|
vec3 xt = vec3(0.0);
|
||||||
|
|
||||||
if (hue < twothird) {
|
|
||||||
xt.r = 0.0;
|
|
||||||
xt.g = rcpsixth * (twothird - hue);
|
|
||||||
xt.b = rcpsixth * (hue - onethird);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hue < onethird) {
|
if (hue < onethird) {
|
||||||
xt.r = rcpsixth * (onethird - hue);
|
xt.r = rcpsixth * (onethird - hue);
|
||||||
xt.g = rcpsixth * hue;
|
xt.g = rcpsixth * hue;
|
||||||
xt.b = 0.0;
|
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);
|
xt = min(xt, 1.0);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue