nir: Remove sRGB colorspace conversion round-trip

Graphics / Mesa 3D Graphics Library / Mesa - Matt Turner [gmail.com] - 22 May 2015 13:26 UTC

Some shaders in Civilization V and Beyond Earth do

pow(pow(x, 2.2), 0.454545)

which is converting to and from sRGB colorspace.

A more general rule that replaces pow(pow(a, b), c) with pow(a, b * c) actually regresses two shaders in Sun Temple in which the result of the inner pow is used twice, once by another pow and once by another instruction. Also, since 2.2 * 0.454545 isn't exactly one, the more general pattern would have still left us with a pow, and I'm 2.2 * 0.454545 percent sure that's not what they want.

instructions in affected programs: 934 -> 886 (-5.14%) helped: 16

5614bcc nir: Remove sRGB colorspace conversion round-trip.
src/glsl/nir/nir_opt_algebraic.py | 2 ++
1 file changed, 2 insertions(+)

Upstream: cgit.freedesktop.org


  • Share