yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
9ec6b9168
master
1//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUFFER):-compute -output-using-type 2//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=BUFFER):-vk -compute -output-using-type 3 4//TEST_INPUT:ubuffer(data=[0 0 0 0 0], stride=4):out,name=outputBuffer 5RWStructuredBuffer<int> outputBuffer; 6 7interface IFoo 8{ 9 property float bar1 {get; set;} 10}; 11 12struct Foo : IFoo 13{ 14 uint4 data = 0; 15 property float bar1 16 { 17 get { return asfloat(data.w); } 18 set { data.w = asuint(newValue); } 19 } 20}; 21 22void doThing(inout Foo foo, uint2 ipos) 23{ 24 foo.bar1 = 2; 25 foo.bar1 += 1.0f; 26} 27 28[shader("compute")] 29[numthreads(1, 1, 1)] 30void computeMain(uint2 ipos : SV_DispatchThreadID) 31{ 32 Foo foo = {}; 33 doThing(foo, ipos); 34 // BUFFER: 3 35 outputBuffer[0] = (int)foo.bar1; 36}