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
This commit is contained in:
Jeroen Bakker
2022-08-01 10:57:18 +02:00
committed by Jeroen Bakker
parent 6749a4a8f0
commit 3393b7137e
4 changed files with 97 additions and 3 deletions

View File

@@ -3,6 +3,7 @@
import argparse
import os
import pathlib
import shlex
import shutil
import subprocess
@@ -98,6 +99,26 @@ if inside_blender:
print(e)
sys.exit(1)
def get_gpu_device_type(blender):
command = [
blender,
"-noaudio",
"--background"
"--factory-startup",
"--python",
str(pathlib.Path(__file__).parent / "gpu_info.py")
]
try:
completed_process = subprocess.run(command, stdout=subprocess.PIPE)
for line in completed_process.stdout.read_text():
if line.startswith("GPU_DEVICE_TYPE:"):
vendor = line.split(':')[1]
return vendor
except BaseException as e:
return None
return None
def get_arguments(filepath, output_filepath):
return [
@@ -134,10 +155,16 @@ def main():
idiff = args.idiff[0]
output_dir = args.outdir[0]
gpu_device_type = get_gpu_device_type(blender)
reference_override_dir = None
if gpu_device_type == "AMD":
reference_override_dir = "eevee_renders/amd"
from modules import render_report
report = render_report.Report("Eevee", output_dir, idiff)
report.set_pixelated(True)
report.set_reference_dir("eevee_renders")
report.set_reference_override_dir(reference_override_dir)
report.set_compare_engine('cycles', 'CPU')
test_dir_name = Path(test_dir).name