layout(binding=0) in texture2D src; | |
layout(binding=1) out texture2D dest; | |
// TODO(skia:13609): we need a mechanism for access levels on src and dst. | |
noinline void desaturate(texture2D src, texture2D dest, half4 color) { | |
color.rgb = half3(dot(color.rgb, half3(0.22, 0.67, 0.11))); | |
write(dest, sk_ThreadPosition.xy, read(src, sk_ThreadPosition.xy)); | |
} | |
void main() { | |
if (sk_ThreadPosition.x < width(src) && sk_ThreadPosition.y < height(src)) { | |
desaturate(src, dest, read(src, sk_ThreadPosition.xy)); | |
} | |
} |