yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
00bd481e0
master
1//TEST:SIMPLE(filecheck=CHECK): -entry MainCs -stage compute -profile glsl_450 -target spirv 2//CHECK: OpEntryPoint 3 4RWTexture2D<float4> g_Test; 5 6Texture2D<float4> g_inoutColorReadonly; 7 8[ForceInline] float3 LoadSourceColor(uint2 pixelPos, constexpr int2 offset, int sampleIndex) 9{ 10 float3 color = g_inoutColorReadonly.Load(int3(pixelPos, 0), offset).rgb; 11 12 return color; 13} 14 15[numthreads(16, 16, 1)] 16void MainCs(uint3 groupID: SV_GroupID, uint3 groupThreadID: SV_GroupThreadID) 17{ 18 19 uint2 pixelPos = groupID.xy * int2((16 - 2), (16 - 2)) + groupThreadID.xy - int2(1, 1); 20 float3 color = LoadSourceColor(pixelPos, int2(0, 0), 0).rgb; 21 22 // Note this also doesn't work 23 //[unroll] 24 // for ( int i = 0; i < 3; i++ ) 25 //{ 26 // color+= LoadSourceColor ( pixelPos , int2 ( i%3 , i/3 ) , msaaSampleIndex ) . rgb ; 27 //} 28 g_Test[int2(pixelPos.x / 2, pixelPos.y + 0)] = float4(color, 1.0); 29}