summaryrefslogtreecommitdiffstats
path: root/gfx/wr/wrench/script/wrench_with_renderer.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /gfx/wr/wrench/script/wrench_with_renderer.py
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/wr/wrench/script/wrench_with_renderer.py')
-rwxr-xr-xgfx/wr/wrench/script/wrench_with_renderer.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/gfx/wr/wrench/script/wrench_with_renderer.py b/gfx/wr/wrench/script/wrench_with_renderer.py
new file mode 100755
index 0000000000..e2685e8476
--- /dev/null
+++ b/gfx/wr/wrench/script/wrench_with_renderer.py
@@ -0,0 +1,52 @@
+#!/usr/bin/python
+
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import os
+import subprocess
+import sys
+
+
+def is_linux():
+ return sys.platform.startswith('linux')
+
+
+if is_linux():
+ requested_renderer = sys.argv[1]
+ renderer = "default"
+
+ if requested_renderer == 'hardware':
+ pass
+ elif requested_renderer == 'llvmpipe':
+ os.environ["LIBGL_ALWAYS_SOFTWARE"] = "1"
+ os.environ["GALLIUM_DRIVER"] = "llvmpipe"
+ elif requested_renderer == 'softpipe':
+ os.environ["LIBGL_ALWAYS_SOFTWARE"] = "1"
+ os.environ["GALLIUM_DRIVER"] = "softpipe"
+ elif requested_renderer == 'swiftshader':
+ # TODO: Set up LD_LIBRARY_PATH to SwiftShader libraries automatically.
+ renderer = 'es3'
+ else:
+ print('Unknown renderer ' + requested_renderer)
+ sys.exit(1)
+
+ cmd = [
+ 'cargo',
+ 'run',
+ '--release',
+ '--',
+ '--no-block', # Run as fast as possible, for benchmarking
+ '--no-picture-caching', # Disable picture caching, to test rasterization performance
+ '--no-subpixel-aa', # SwiftShader doesn't support dual source blending
+ '--renderer', # Select GL3/ES3 renderer API
+ renderer,
+ 'load'
+ ]
+
+ cmd += sys.argv[2:]
+ print('Running: ' + ' '.join(cmd))
+ subprocess.check_call(cmd)
+else:
+ print('This script is only supported on Linux')