In transitions, because the 'to' and 'from' are always rendered to
textures, the end result will always have premultiplied alpha. This
would cause alpha to have blackish edges during transition, and cause
semi-transparent images to appear darker than they were supposed to.
To replicate, simply set the transparency of a source to 50%, then
transition between that scene and another scene. The source will appear
to "pop" in and out unnaturally due to the premultiplied alpha effect of
the render targets.
To fix this, the solution is to simply convert premultiplied alpha to
straight alpha in the transition pixel shaders.
This reverts commit 0edaebe192.
The commit was actually less optimal than it was before. Shaders are
always fully unfolded and both sides of a branch are always executed.
Despite that fact, the "avoid branching" commit actually *added* two
extra unnecessary instructions with the same number of actual sample
instructions, making it arguably less optimal than before.
This was tested via the D3DDissamble function.
Branching is not recommended in shaders and only recently gained
widespread support without causing massive branch misprediction issues. Also sampling inside a branch will cause cache misses and additional texture load instructions.
These functions were mistakenly not marked as static. They are not used
outside of their compiled object module files, therefore there's no
reason for them not to be static.