yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
05547e253
master
1//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -output-using-type -shaderobj 2 3//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer 4RWStructuredBuffer<int> outputBuffer : register(u0); 5 6struct PadLadenStruct 7{ 8 double a; 9 uint8_t b; 10}; 11 12// This is to check if the last half can be inserted 'inside' the spare padding of a. It should not be 13struct StructWithArray : IDefaultInitializable 14{ 15 PadLadenStruct a[1]; 16 uint8_t b; 17 18 matrix<half, 3, 3> c; 19 uint8_t d; 20}; 21 22[numthreads(1, 1, 1)] 23void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 24{ 25 StructWithArray s; 26 outputBuffer[0] = __sizeOf(s); 27 28 outputBuffer[1] = __offsetOf(s, s.a); 29 outputBuffer[2] = __offsetOf(s, s.b); 30 outputBuffer[3] = __offsetOf(s, s.c); 31 outputBuffer[4] = __offsetOf(s, s.d); 32 33 outputBuffer[5] = __sizeOf<int>(); 34}