yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
8086adc90
master
1//TEST:REFLECTION(filecheck=METAL): -target metal 2//TEST(compute, metal):COMPARE_COMPUTE(filecheck-buffer=BUF):-metal -compute -entry computeMain -output-using-type 3//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -output-using-type 4 5 6//METAL: "name": "o", 7//METAL: "binding": {"kind": "constantBuffer", "index": 0}, 8 9//METAL: "name": "gParams", 10//METAL: "binding": {"kind": "constantBuffer", "index": 1}, 11 12 13//METAL: "dir" 14//METAL: "binding": {"kind": "uniform", "offset": 0, "size": 16, "elementStride": 4} 15//METAL: "color" 16//METAL: "binding": {"kind": "uniform", "offset": 16, "size": 16, "elementStride": 4} 17 18struct Params 19{ 20 float3 dir; 21 float4 color; 22} 23 24//TEST_INPUT: ubuffer(data=[0.0], stride=4):out,name o 25RWStructuredBuffer<float> o; 26//TEST_INPUT: set gParams = new Params{{3.0, 4.0, 5.0}, {6.0, 7.0 ,8.0, 9.0}} 27ParameterBlock<Params> gParams; 28 29[numthreads(1,1,1)] 30void computeMain() 31{ 32 // BUF: 3.0 33 o[0] = gParams.dir.x; 34}