I noticed that on D3D11 any performance difference vanishes if you remove the [unroll] directive
I have also tried this, but for my computers the same bug existed with the exact same performance.
The bug still exists for me even if there is no calculations being done. This seems to be an issue only regarding the driver and how it handles changing constants.
However, at least from my experiments this is just micro-benchmarking some driver aspect and the general performance is fine.
But it does mean that your FPS can be cut in half when changing the constants, which happens between scenes if not recompiling each shader between scenes. That is a big deal of course, but it does not happen on all computers. But it is reproduceable.
I reproduced the issue outside of Ogre as well with a minimal file, and I sent a detailed report to Nvidia about the driver bug.
Here is the minimal reproduceable version outside of Ogre if needed (numlock to toggle the constants, and FPS meter in the top-left):
https://drive.google.com/file/d/1aG5NTv ... sp=sharing
All computers I have tested it on has had around 50% decrease in FPS, simply by just changing the constants.
On some computers, going between two scenes in my game can halve the FPS as well, so this is not a nit-picking issue.