yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
4df7887f9
master
1extern static const bool turnOnFeature; 2extern static const float constValue; 3extern static const uint numthread = 0; 4extern static const int arraySize = -1; 5 6// Main entry-point. Write some value into buffer depending on link 7// time constant. 8[shader("compute")] 9[numthreads(numthread, 1, 1)] 10void computeMain( 11 uint3 sv_dispatchThreadID: SV_DispatchThreadID, 12 uniform RWStructuredBuffer<float> buffer) 13{ 14 int array[arraySize]; 15 16 array[sv_dispatchThreadID.x] = sv_dispatchThreadID.x; 17 if (turnOnFeature) 18 { 19 buffer[array[0]] = constValue; 20 } 21 else 22 { 23 buffer[0] = -1.0; 24 } 25}