yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
cfef0c6f6
master
1//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type 2//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-mtl -output-using-type 3 4 5// CHECK: 1 6// CHECK-NEXT: 1 7// CHECK-NEXT: 1 8// CHECK-NEXT: 1 9 10//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 11RWStructuredBuffer<uint> outputBuffer; 12 13struct S { 14 int foo : 8; 15 int bar : 24; 16}; 17 18// This packs the smaller int into the int64 19struct T { 20 int64_t foo : 33; 21 int bar : 24; 22}; 23 24// This takes two ints to store all the bits 25struct P { 26 int foo : 24; 27 int bar : 24; 28}; 29 30// Even though the smaller field comes first, it's still packed with the larger 31// one 32struct Q { 33 int8_t foo : 1; 34 int64_t bar : 63; 35}; 36 37[numthreads(1, 1, 1)] 38void computeMain() 39{ 40 outputBuffer[0] = sizeof(S) == sizeof(int); 41 outputBuffer[1] = sizeof(T) == sizeof(int64_t); 42 outputBuffer[2] = sizeof(P) == sizeof(int) * 2; 43 outputBuffer[3] = sizeof(Q) == sizeof(int64_t); 44}