Shader model 3 types of constant registers: Boolean, Float and Integer. The "Float" registers are the most interesting ones, because there are the most of these available: 224 (See docs.microsoft.com/en-us/windows/desktop...-ps-registers-ps-3-0). So ReShade uses them for all uniforms, because the current D3D9 runtime seems to just reinterpret the data as whatever variable type is bound to them. So storing an 32-bit integer in the 32 float bits works nicely. Unfortunately, the "rep" instruction which is used for loops (See docs.microsoft.com/en-us/windows/desktop/direct3dhlsl/rep---ps instruction) requires the repeat counter to be an Integer register. The HLSL compiler silently ignores the fact that ReShade decorated the uniform variable with ": register(cXXX)" and just uses the first available Integer register instead (Yay! Yet another thing to add to the list of things where D3DCompiler messes up). But since ReShade never binds any data to those, it will always hold the value zero and as such the loop is never executed.
Quite honestly I don't know how to fix that. ReShade would have to detect if a uniform variable was used as a loop counter somehow and also allocate an Integer register in that case. Just pushing all uniform variables into integer registers as well doesn't work (there are only 16 of those).
Cheers, crosire =)
The administrator has disabled public write access.