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