i965: Port INTEL_PRECISE_TRIG=1 to NIR.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 7 Apr 2016 22:04:35 +0000 (15:04 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 12 Apr 2016 01:44:17 +0000 (18:44 -0700)
commitbfd17c76c1267756ea16051cbe174cb23ff49f44
treeb451c81beb61d850f0f726fc8437e81384cb39ee
parentb0dffdc616801a1fd8534502e11ac840369041ab
i965: Port INTEL_PRECISE_TRIG=1 to NIR.

This makes the extra multiply visible to NIR's algebraic optimizations
(for constant reassociation) as well as constant folding.  This means
that when the result of sin/cos are multiplied by an constant, we can
eliminate the extra multiply altogether, reducing the cost of the
workaround.

It also means we only have to implement it one place, rather than in
both backends.

This makes INTEL_PRECISE_TRIG=1 cost nothing on GPUTest/Volplosion,
which has a ton of sin() calls, but always multiplies them by an
immediate constant.  The extra multiply gets folded away.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/Makefile.am
src/mesa/drivers/dri/i965/Makefile.sources
src/mesa/drivers/dri/i965/brw_fs_nir.cpp
src/mesa/drivers/dri/i965/brw_nir.c
src/mesa/drivers/dri/i965/brw_nir.h
src/mesa/drivers/dri/i965/brw_nir_trig_workarounds.py [new file with mode: 0755]
src/mesa/drivers/dri/i965/brw_vec4_nir.cpp