blob: 948e433853cbd91d874a48cc8dc734dc2550a288 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-d3d11 -output-using-type
struct Test {
RWStructuredBuffer<int> val;
__subscript(int x, int y)->int
{
get { return val[x * 3 + y]; }
[nonmutating] set { val[x * 3 + y] = newValue; }
}
}
Test test;
//TEST_INPUT: set test = {out ubuffer(data=[0 0 0 0 0 0 0 0 0], stride=4)};
[numthreads(1, 1, 1)]
void computeMain()
{
// test[0,0] should be a valid l-value here because although `test` is
// a read-only parameter, the `set` accessor is marked as `nonmutating`,
// which means that it can be called even when `test` is not mutable.
// CHECK: 1
test[0,0] = 1;
}
|