Found an interesting bug that manifests both on AMD and Nvidia, albeit differently. Expression:
//int v=2;
abs(2047483673*v) % 16807
executed in a fragment shader results in the following values (for int v=2):
CPU: 13457
Nvidia: -13457 (‘v’ a uniform), 13457 (‘v’ a constant, compile-time evaluation)
AMD 4xxx: 13460 (‘v’ a uniform), 13456 (‘v’ a constant, compile-time evaluation)
AMD 5xxx: 13456 (‘v’ a uniform), 13456
On Nvidia apparently the abs() in there brings the problem forward, without it it works fine (in GLSL the result of integer modulo is undefined for negative operands).
On AMD it looks like it’s being approximated somehow.
I’ve discovered it while making a randomizer algorithm, and getting different results everywhere.
Since no way of reporting bugs to Nvidia works for me, even though I’m a registered developer there, I’m putting it here.