yuv.frag 864 B

1234567891011121314151617181920212223242526272829303132
  1. #ifdef GL_ES
  2. precision highp float;
  3. #endif
  4. uniform sampler2D texture;
  5. uniform mat3 color_matrix;
  6. uniform float inv_gamma;
  7. uniform float blacklevel;
  8. varying vec2 top_left_uv;
  9. varying vec2 top_right_uv;
  10. varying vec2 bottom_left_uv;
  11. varying vec2 bottom_right_uv;
  12. void
  13. main()
  14. {
  15. // Note the coordinates for texture samples need to be a varying, as the
  16. // Mali-400 has this as a fast path allowing 32-bit floats. Otherwise
  17. // they end up as 16-bit floats and that's not accurate enough.
  18. vec4 samples = vec4(texture2D(texture, top_left_uv).r,
  19. texture2D(texture, top_right_uv).r,
  20. texture2D(texture, bottom_left_uv).r,
  21. texture2D(texture, bottom_right_uv).r);
  22. vec3 color = vec3(samples.z, samples.z, samples.z);
  23. //color *= color_matrix;
  24. vec3 gamma_color = pow(color, vec3(inv_gamma));
  25. gl_FragColor = vec4(gamma_color, 1);
  26. }