1layout(binding=0) readonly texture2D src; 2layout(binding=1) writeonly texture2D dest; 3layout(binding=2) texture2D multipurpose; 4 5void needs_all_access(texture2D t) {} 6 7void overload(readonly texture2D t) {} 8void overload(writeonly texture2D t, int) {} 9 10void main() { 11 needs_all_access(src); // BAD 12 needs_all_access(dest); // BAD 13 needs_all_access(multipurpose); // OK 14 15 read(dest, sk_GlobalInvocationID.xy); // BAD 16 write(src, sk_GlobalInvocationID.xy, half4(1)); // BAD 17 18 overload(src); // OK: overload(readonly texture2D t) exists 19 overload(src, 1); // BAD: overload(readonly texture2D t, int) missing 20 overload(dest); // BAD: overload(writeonly texture2D t) missing 21 overload(dest, 1); // OK: overload(writeonly texture2D t, int) exists 22} 23 24void function_param_honors_all_access(texture2D t) { 25 needs_all_access(t); // OK 26 width(t); // OK 27 read(t, sk_GlobalInvocationID.xy); // OK 28 write(t, sk_GlobalInvocationID.xy, half4(1)); // OK 29} 30 31void function_param_honors_readonly(readonly texture2D t) { 32 needs_all_access(t); // BAD 33 width(t); // OK 34 read(t, sk_GlobalInvocationID.xy); // OK 35 write(t, sk_GlobalInvocationID.xy, half4(1)); // BAD 36} 37 38void function_param_honors_writeonly(writeonly texture2D t) { 39 needs_all_access(t); // BAD 40 width(t); // OK 41 read(t, sk_GlobalInvocationID.xy); // BAD 42 write(t, sk_GlobalInvocationID.xy, half4(1)); // OK 43} 44 45/*%%* 46expected 'texture2D', but found 'readonlyTexture2D' 47expected 'texture2D', but found 'writeonlyTexture2D' 48no match for read(writeonlyTexture2D, uint2) 49no match for write(readonlyTexture2D, uint2, half4) 50no match for overload(readonlyTexture2D, int) 51no match for overload(writeonlyTexture2D) 52expected 'texture2D', but found 'readonlyTexture2D' 53no match for write(readonlyTexture2D, uint2, half4) 54expected 'texture2D', but found 'writeonlyTexture2D' 55no match for read(writeonlyTexture2D, uint2) 56*%%*/ 57