diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-10-03 08:58:41 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-10-03 08:58:41 -0300 |
commit | af4a97bef9bfb06e2737ad709dde157688a94daf (patch) | |
tree | d3c6471da30a8d6c20d10858e78907edd9c886e8 /drivers/gles2/shaders | |
parent | 1b3a10891ebdc6e76a81c8915ba08065311e17d3 (diff) |
missing fils from yesterday comit.
must have made some mistake with git,
not sure why they were not sent..
Diffstat (limited to 'drivers/gles2/shaders')
-rw-r--r-- | drivers/gles2/shaders/copy.glsl | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/gles2/shaders/copy.glsl b/drivers/gles2/shaders/copy.glsl index d8fb03f3a3..ae7185a1d6 100644 --- a/drivers/gles2/shaders/copy.glsl +++ b/drivers/gles2/shaders/copy.glsl @@ -46,6 +46,15 @@ precision mediump int; #endif + +float sRGB_gamma_correct(float c){ + float a = 0.055; + if(c < 0.0031308) + return 12.92*c; + else + return (1.0+a)*pow(c, 1.0/2.4) - a; +} + #define LUM_RANGE 4.0 @@ -407,15 +416,26 @@ void main() { #ifdef USE_SRGB +#if 0 + //this was fast, but was commented out because it looked kind of shitty, might it be fixable? + { //i have my doubts about how fast this is + color.rgb = min(color.rgb,vec3(1.0)); //clamp just in case vec3 S1 = sqrt(color.rgb); vec3 S2 = sqrt(S1); vec3 S3 = sqrt(S2); color.rgb = 0.662002687 * S1 + 0.684122060 * S2 - 0.323583601 * S3 - 0.225411470 * color.rgb; } +#else + + color.r=sRGB_gamma_correct(color.r); + color.g=sRGB_gamma_correct(color.g); + color.b=sRGB_gamma_correct(color.b); + #endif +#endif #ifdef USE_HDR_COPY |