yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
7dabfa76c
master
1//TEST:COMPILE: -save-core-module slang-core-module.zip 2//TEST:COMPARE_COMPUTE: -compile-arg -load-core-module -compile-arg slang-core-module.zip -shaderobj 3 4struct A 5{ 6 float x; 7 8 float addWith(float y) 9 { 10 return this.x + y; 11 } 12}; 13 14//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 15RWStructuredBuffer<float> outputBuffer; 16 17 18float test(float inVal) 19{ 20 A a; 21 a.x = inVal; 22 return a.addWith(inVal*inVal); 23} 24 25[numthreads(4, 1, 1)] 26void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 27{ 28 uint tid = dispatchThreadID.x; 29 float inVal = float(tid); 30 float outVal = test(inVal); 31 outputBuffer[tid] = outVal; 32}