2022-08-09 03:25:11 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
2022-08-01 08:57:18 +00:00
|
|
|
"""
|
2022-08-09 03:25:11 +00:00
|
|
|
Prints GPU back-end information to the console and exits.
|
2022-08-01 08:57:18 +00:00
|
|
|
|
2022-08-09 03:25:11 +00:00
|
|
|
Use this script as `blender --background --python gpu_info.py`.
|
2022-08-01 08:57:18 +00:00
|
|
|
"""
|
|
|
|
import bpy
|
|
|
|
import gpu
|
|
|
|
import sys
|
|
|
|
|
2022-08-03 21:41:03 +00:00
|
|
|
# Render with workbench to initialize the GPU backend otherwise it would fail when running in
|
2022-08-01 08:57:18 +00:00
|
|
|
# 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())
|
|
|
|
|
2022-08-03 21:41:03 +00:00
|
|
|
sys.exit(0)
|