unable to unroll loop 报错

unable to unroll loop, loop does not appear to terminate in a timely manner (1024 iterations)
原本代码
for (int i = 0; i < _Loops; i++)
这里的_Loops是运行时,有程序传入的参数,在编译时报错

改写为字面值的最大值
for (int i = 0; i < 50; i++)
{
    ... ...
    if (i >= _Loops)
        break;
}

这个报错是 DirectX shader compiler 报的错

原文地址:https://www.cnblogs.com/Hichy/p/7895840.html