mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-27 18:51:41 +02:00
Remove duplicate definitions of linear2srgb functions in shaders
This commit is contained in:
15
kitty/linear2srgb.glsl
Normal file
15
kitty/linear2srgb.glsl
Normal file
@@ -0,0 +1,15 @@
|
||||
float srgb2linear(float x) {
|
||||
// sRGB to linear conversion
|
||||
float lower = x / 12.92;
|
||||
float upper = pow((x + 0.055f) / 1.055f, 2.4f);
|
||||
|
||||
return mix(lower, upper, step(0.04045f, x));
|
||||
}
|
||||
|
||||
float linear2srgb(float x) {
|
||||
// Linear to sRGB conversion.
|
||||
float lower = 12.92 * x;
|
||||
float upper = 1.055 * pow(x, 1.0f / 2.4f) - 0.055f;
|
||||
|
||||
return mix(lower, upper, step(0.0031308f, x));
|
||||
}
|
||||
Reference in New Issue
Block a user