diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-01-29 10:51:18 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-01-29 10:51:18 +0000 |
commit | 726e4bceb8bf5b8123eda80e45a9fdeb016f3790 (patch) | |
tree | 32ed745d6aeb44b4c130f647e49d6627320a3857 /lib/mesa/src/util/format_srgb.h | |
parent | 5c0a71df6e14d3ae04cc0faa6dad6e5d0a01d27a (diff) |
Import Mesa 18.3.2
Diffstat (limited to 'lib/mesa/src/util/format_srgb.h')
-rw-r--r-- | lib/mesa/src/util/format_srgb.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/mesa/src/util/format_srgb.h b/lib/mesa/src/util/format_srgb.h index 34b50afe3..596af56f4 100644 --- a/lib/mesa/src/util/format_srgb.h +++ b/lib/mesa/src/util/format_srgb.h @@ -55,6 +55,20 @@ util_format_linear_to_srgb_helper_table[104]; static inline float +util_format_srgb_to_linear_float(float cs) +{ + if (cs <= 0.0f) + return 0.0f; + else if (cs <= 0.04045f) + return cs / 12.92f; + else if (cs < 1.0f) + return powf((cs + 0.055) / 1.055f, 2.4f); + else + return 1.0f; +} + + +static inline float util_format_linear_to_srgb_float(float cl) { if (cl <= 0.0f) |