copy.frag raw

   1  #version 310 es
   2  
   3  // SPDX-License-Identifier: Unlicense OR MIT
   4  
   5  precision highp float;
   6  
   7  layout(location = 0) out vec4 fragColor;
   8  
   9  layout(binding = 0) uniform sampler2D tex;
  10  
  11  precision mediump float;
  12  
  13  vec3 sRGBtoRGB(vec3 rgb) {
  14  	bvec3 cutoff = greaterThanEqual(rgb, vec3(0.04045));
  15  	vec3 below = rgb/vec3(12.92);
  16  	vec3 above = pow((rgb + vec3(0.055))/vec3(1.055), vec3(2.4));
  17  	return mix(below, above, cutoff);
  18  }
  19  
  20  void main() {
  21  	vec4 texel = texelFetch(tex, ivec2(gl_FragCoord.xy), 0);
  22  	vec3 rgb = sRGBtoRGB(texel.rgb);
  23  	fragColor = vec4(rgb, texel.a);
  24  }
  25