28 lines · plain
1// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -o - -fsyntax-only %s -verify2 3RWBuffer<float> A[10]; // expected-note {{variable 'A' is declared here}} expected-note {{variable 'A' is declared here}} // expected-note {{variable 'A' is declared here}}4RWBuffer<float> B; // expected-note {{variable 'B' is declared here}}5RWBuffer<float> C[10];6 7void test() {8 // expected-error@+1{{assignment to global resource variable 'A' is not allowed}}9 A = C; 10 11 // expected-error@+1{{assignment to global resource variable 'B' is not allowed}}12 B = C[0];13 14 // expected-error@+1{{assignment to global resource variable 'A' is not allowed}}15 A[1] = B;16 17 // expected-error@+1{{assignment to global resource variable 'A' is not allowed}}18 A[1] = C[2];19 20 // local resources are assignable 21 RWBuffer<float> LocalA[10] = A; // ok22 RWBuffer<float> LocalB = B; // ok23 24 // read-write resources can be written to25 A[0][0] = 1.0f; // ok26 B[0] = 2.0f; // ok27}28