summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2017-10-14 13:00:28 -0400
committerRob Clark <[email protected]>2017-10-24 15:33:40 -0400
commit0ca8d53215a8e2991430dbcbc13fbaf5b442318c (patch)
tree79ecc573fa65d30498e3821c4049d34edaec9145 /src/gallium
parent583ce96c9429e23c33daeb7025210ef73ae51688 (diff)
freedreno/ir3: use a flag instead of setting PYTHONPATH
Similar to 848da662224326ccfbe6647bc82f4f89ca22c762, pass an arg to ir3_nir_trig.py to add to python path, rather than using $PYTHONPATH, to prep for meson build support. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/freedreno/Android.gen.mk2
-rw-r--r--src/gallium/drivers/freedreno/Makefile.am2
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_nir_trig.py25
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()