yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f02b08490
master
1//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain 2//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -emit-spirv-directly 3//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-cpu -compute -entry computeMain 4//TEST(smoke,compute):COMPARE_COMPUTE(filecheck-buffer=BUF):-dx12 -compute -entry computeMain 5 6//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer 7RWStructuredBuffer<int> outputBuffer; 8 9static int myTwo = 2; 10static int myThree = 1+2; 11 12struct DefaultStructNoInit 13{ 14 int data0 = 0; 15 int data1 = myTwo; 16 int data2 = 2; 17}; 18struct DefaultStructWithInit 19{ 20 int data0 = 3; 21 int data1 = myThree; 22 int data2; 23 __init() 24 { 25 data2 = 3; 26 } 27}; 28struct DefaultStructWithInit2 29{ 30 int data0 = 4; 31 int data1 = 1; 32 int data2 = 1; 33 __init() 34 { 35 data1 = 4; 36 data2 = 4; 37 } 38}; 39[numthreads(1, 1, 1)] 40void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID) 41{ 42 DefaultStructNoInit noInit = DefaultStructNoInit(); 43 noInit.data0 = 2; 44 DefaultStructWithInit withInit = DefaultStructWithInit(); 45 DefaultStructWithInit2 withInit2 = DefaultStructWithInit2(); 46 // BUF: 1 47 outputBuffer[0] = true 48 && noInit.data0 == 2 49 && noInit.data1 == 2 50 && noInit.data2 == 2 51 52 && withInit.data0 == 3 53 && withInit.data1 == 3 54 && withInit.data2 == 3 55 56 && withInit2.data0 == 4 57 && withInit2.data1 == 4 58 && withInit2.data2 == 4 59 ; 60}