Tests: Move GPU vendor query function to module, remove dead code for EEVEE
The implementation of this was broken and not actually used for the EEVEE tests, as there is currently no separate reference directory for AMD. Move it to the render report module so it can be reused by different tests. Pull Request: https://projects.blender.org/blender/blender/pulls/148148
This commit is contained in:
29
tests/python/modules/gpu_info.py
Normal file
29
tests/python/modules/gpu_info.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# SPDX-FileCopyrightText: 2022 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
"""
|
||||
Prints GPU back-end information to the console and exits.
|
||||
|
||||
Use this script as `blender --background --python gpu_info.py`.
|
||||
"""
|
||||
import bpy
|
||||
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)
|
||||
|
||||
# Import GPU module only after GPU backend has been initialized.
|
||||
import gpu
|
||||
|
||||
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)
|
||||
@@ -174,6 +174,25 @@ def diff_output(test, oiiotool, fail_threshold, fail_percent, verbose, update):
|
||||
return test
|
||||
|
||||
|
||||
def get_gpu_device_vendor(blender):
|
||||
command = [
|
||||
blender,
|
||||
"--background",
|
||||
"--factory-startup",
|
||||
"--python",
|
||||
str(pathlib.Path(__file__).parent / "gpu_info.py")
|
||||
]
|
||||
try:
|
||||
completed_process = subprocess.run(command, stdout=subprocess.PIPE, universal_newlines=True)
|
||||
for line in completed_process.stdout.splitlines():
|
||||
if line.startswith("GPU_DEVICE_TYPE:"):
|
||||
vendor = line.split(':')[1].upper()
|
||||
return vendor
|
||||
except Exception:
|
||||
return None
|
||||
return None
|
||||
|
||||
|
||||
class Report:
|
||||
__slots__ = (
|
||||
'title',
|
||||
|
||||
Reference in New Issue
Block a user