diff options
-rw-r--r-- | src/gallium/drivers/freedreno/Android.gen.mk | 2 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/Makefile.am | 2 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/ir3/ir3_nir_trig.py | 25 |
3 files changed, 23 insertions, 6 deletions
diff --git a/src/gallium/drivers/freedreno/Android.gen.mk b/src/gallium/drivers/freedreno/Android.gen.mk index 072cf998aed..17b6fbe1b7e 100644 --- a/src/gallium/drivers/freedreno/Android.gen.mk +++ b/src/gallium/drivers/freedreno/Android.gen.mk @@ -32,7 +32,7 @@ intermediates := $(call local-generated-sources-dir) $(intermediates)/ir3/ir3_nir_trig.c: $(ir3_nir_trig_deps) @mkdir -p $(dir $@) - $(hide) PYTHONPATH=$(MESA_TOP)/src/compiler/nir $(MESA_PYTHON2) $< > $@ + $(hide) $(MESA_PYTHON2) $< -p $(MESA_TOP)/src/compiler/nir > $@ LOCAL_GENERATED_SOURCES += $(addprefix $(intermediates)/, \ $(ir3_GENERATED_FILES)) diff --git a/src/gallium/drivers/freedreno/Makefile.am b/src/gallium/drivers/freedreno/Makefile.am index 128c7fb5990..5cb4c74cb68 100644 --- a/src/gallium/drivers/freedreno/Makefile.am +++ b/src/gallium/drivers/freedreno/Makefile.am @@ -12,7 +12,7 @@ AM_CFLAGS = \ MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D) ir3/ir3_nir_trig.c: ir3/ir3_nir_trig.py $(top_srcdir)/src/compiler/nir/nir_algebraic.py $(MKDIR_GEN) - $(AM_V_GEN) PYTHONPATH=$(top_srcdir)/src/compiler/nir $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/ir3/ir3_nir_trig.py > $@ || ($(RM) $@; false) + $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/ir3/ir3_nir_trig.py -p $(top_srcdir)/src/compiler/nir > $@ || ($(RM) $@; false) noinst_LTLIBRARIES = libfreedreno.la diff --git a/src/gallium/drivers/freedreno/ir3/ir3_nir_trig.py b/src/gallium/drivers/freedreno/ir3/ir3_nir_trig.py index f358f4d6bc4..a0ab9d01903 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_nir_trig.py +++ b/src/gallium/drivers/freedreno/ir3/ir3_nir_trig.py @@ -20,13 +20,30 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -import nir_algebraic +import argparse +import sys trig_workarounds = [ (('fsin', 'x'), ('fsin', ('fsub', ('fmul', 6.283185, ('ffract', ('fadd', ('fmul', 0.159155, 'x'), 0.5))), 3.141593))), (('fcos', 'x'), ('fcos', ('fsub', ('fmul', 6.283185, ('ffract', ('fadd', ('fmul', 0.159155, 'x'), 0.5))), 3.141593))), ] -print '#include "ir3_nir.h"' -print nir_algebraic.AlgebraicPass("ir3_nir_apply_trig_workarounds", - trig_workarounds).render() + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('-p', '--import-path', required=True) + args = parser.parse_args() + sys.path.insert(0, args.import_path) + run() + + +def run(): + import nir_algebraic # pylint: disable=import-error + + print '#include "ir3_nir.h"' + print nir_algebraic.AlgebraicPass("ir3_nir_apply_trig_workarounds", + trig_workarounds).render() + + +if __name__ == '__main__': + main() |