On Tuesday 03 June 2008 10:42:39 you wrote:
Am Dienstag, 3. Juni 2008 10:02:26 schrieb Fabian Bieler:
The shader compiler can also do better optimization with hard-coded constants (particularly if the constants are 0 or 1). I've seen the nvidia-compiler remove entire code paths because of this in a hl2-shader.
Really? Do you have any evidence for this? In that case we might want to use Vitaliys original patch which just changed the precision of the printed float, since the patches I just sent break this ability. Henri and I considered them as theoretical, since the HLSL compiler or shader author would have removed those codepaths already
I did some testing using the Half-Life 2 intro and outro (dxlevel 81). Attached is a spreadsheet with the instruction and register counts of the compiled shaders (aquired via __GL_WriteProgramObjectAssembly). The difference is not as big as I expected (I stumbled over one of the more significant cases (fasm_164_0.txt of the outro: 13 vs. 9 instructions) some time ago and made a wrong extrapolation ;-)).