| 1 |
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -o - -fsyntax-only %s -verify |
| 2 |
|
| 3 |
RWBuffer<float> A[10]; // expected-note {{variable 'A' is declared here}} expected-note {{variable 'A' is declared here}} // expected-note {{variable 'A' is declared here}} |
| 4 |
RWBuffer<float> B; // expected-note {{variable 'B' is declared here}} |
| 5 |
RWBuffer<float> C[10]; |
| 6 |
|
| 7 |
void 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; // ok |
| 22 |
RWBuffer<float> LocalB = B; // ok |
| 23 |
|
| 24 |
// read-write resources can be written to |
| 25 |
A[0][0] = 1.0f; // ok |
| 26 |
B[0] = 2.0f; // ok |
| 27 |
} |