yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

kaizhangNVFix race-condition and visual artifacts issues (#4152)86a9da157

master
440 B19 linesraw
1// loop-attribs.slang
2// Test that loop attributes are correctly emitted to the resulting HLSL.
3
4//TEST:CROSS_COMPILE:-target dxil-assembly  -entry main -stage fragment -profile sm_6_0 -loop-inversion
5
6float4 main() : SV_Target
7{
8    float sum = 0.0f;
9    
10    [loop]
11    for (int i = 0; i < 100; i++)
12        sum += float(i);
13
14    [unroll(10)]
15    for (int j = 0; j < 100; j++)
16        sum += float(j);
17
18    return float4(sum, 0, 0, 0);
19}