sampling extra texture in fp boosts performance !?!

Two shaders - one only uses a texture and its normal map for lighting calculations ( point lights) and the other uses the same 2 textures + an extra texture( doesnt matter what texture…let`s say cube map )

Well the second shader goes faster with about 70 fps ( from 100 to 170 ) … I don`t even use the third texture, I only sample it…

The 2 shaders are EXACTLY the same, only the second one has an extra
TEX tex, fragment.texcoord[2], texture[2], 2D;(or3D , same result)
But it goes almost twice as fast !!

What`s wrong ??

My first guess would be bad, to the point it could be considered broken, compiler.

Presenting more details, such as what language/profile/card/drivers used could help in hunting down this problem.

Yeah, i experienced the same thing, but not that extreme.

If i use specular lighting, my app becomes faster than if i disable specular lighting. Although i don´t sample any more textures, it’s only more ALU instructions.

That’s with ARB_fragment_program on a Radeon 9600XT, latest drivers. But the difference is not that huge, maybe 5%, so i didn’t bother about it.

Strange, though.


I use GL_ARB_fragment_program
radeon 9800 pro, catalyst 5.3 drivers

Even sampling a 1x1 texture results in a perf boost !

I can post a demo if you want…