Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- I think a better way to handle this is to use a separate temp variable for each LOAD of the uniform, thus replacing each uniform LOAD with a STORE to a temp variable and a LOAD from that. That way we get less register pressure without having to complicate the register allocation or liveness computation algorithms. That is assuming that register pressure on the temporary registers is quite problematic for SM2 or even SM3 shaders since there are so few of them and there is no spilling to save the day.
Of course there is a complication with that, that is preserving "writes" to uniforms. That could be taken into account pretty simply with write tracking, but another option is to do the above optimization only when legacy mode is not set (AFAIU writing to uniforms / globals is only allowed on older d3dx9 / d3dcompiler versions).
Just food for thought. Also, ignore everything if you have something fancier already queued up.