Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jbakker>2022-08-01 11:57:18 +0300
committerJeroen Bakker <jeroen@blender.org>2022-08-01 11:57:32 +0300
commit3393b7137e247383477eb38d938239fbb9221680 (patch)
treece0ae31d19aee50eb03dabd6467cb9ccbe64455a /tests/python/gpu_info.py
parent6749a4a8f02900db9f2ecae79820d9b418694706 (diff)
RenderReport: Add option to add platform specific overrides.
Reference images in the reference_override_dir will be chosen before images in reference_dir. This allows platform specific reference images, with a common base. Ignored when set to None. The caller is responsible of setting the reference override dir as the unit test is more aware what the definition of a platform is. Patch adds `gpu.platform.device_type_get` function to get the device type that blender has detected. Reviewed By: brecht Maniphest Tasks: T99046 Differential Revision: https://developer.blender.org/D15265
Diffstat (limited to 'tests/python/gpu_info.py')
-rw-r--r--tests/python/gpu_info.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/python/gpu_info.py b/tests/python/gpu_info.py
new file mode 100644
index 00000000000..1df23d68000
--- /dev/null
+++ b/tests/python/gpu_info.py
@@ -0,0 +1,24 @@
+"""
+ Prints GPU backend information to the console and exits.
+
+ Use this script as `blender --background --python gpu_info.py`.
+"""
+import bpy
+import gpu
+import sys
+
+# Render with workbench to initialize the GPU backend otherwise it would fail when running in
+# background mode as the GPU backend won't be initialized.
+scene = bpy.context.scene
+scene.render.resolution_x = 1
+scene.render.resolution_y = 1
+scene.render.engine = "BLENDER_WORKBENCH"
+bpy.ops.render.render(animation=False, write_still=False)
+
+
+print('GPU_VENDOR:' + gpu.platform.vendor_get())
+print('GPU_RENDERER:' + gpu.platform.renderer_get())
+print('GPU_VERSION:' + gpu.platform.version_get())
+print('GPU_DEVICE_TYPE:' + gpu.platform.device_type_get())
+
+sys.exit(0) \ No newline at end of file