• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1layout(local_size_x = 16, local_size_y = 16) in;
2
3layout(binding=0, rgba32f) readonly texture2D src;
4layout(binding=1, rgba32f) writeonly texture2D dest;
5
6noinline void desaturate(layout(rgba32f) readonly texture2D src,
7                         layout(rgba32f) writeonly texture2D dest) {
8    half4 color = textureRead(src, sk_GlobalInvocationID.xy);
9    color.rgb = half3(dot(color.rgb, half3(0.22, 0.67, 0.11)));
10    textureWrite(dest, sk_GlobalInvocationID.xy, color);
11}
12
13void main() {
14    if (sk_GlobalInvocationID.x < textureWidth(src) &&
15        sk_GlobalInvocationID.y < textureHeight(src)) {
16        desaturate(src, dest);
17    }
18}
19