1layout(local_size_x = 16, local_size_y = 16) in; 2 3layout(binding=0, rgba32f) readonly texture2D texIn; 4layout(binding=1, rgba32f) writeonly texture2D texOut; 5 6half4 desaturate(half4 color) { 7 color.rgb = half3(dot(color.rgb, half3(0.22, 0.67, 0.11))); 8 return color; 9} 10 11void main() { 12 if (sk_GlobalInvocationID.x < textureWidth(texIn) && 13 sk_GlobalInvocationID.y < textureHeight(texIn)) { 14 half4 gray = desaturate(textureRead(texIn, sk_GlobalInvocationID.xy)); 15 textureWrite(texOut, sk_GlobalInvocationID.xy, gray); 16 } 17} 18