2015-01-22 11:53:49 +01:00
|
|
|
#!/usr/bin/env python3
|
2022-02-10 23:07:11 +01:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
2015-01-22 11:53:49 +01:00
|
|
|
|
|
|
|
import argparse
|
|
|
|
import os
|
2017-08-19 12:09:28 +02:00
|
|
|
import shlex
|
2016-06-14 00:39:49 +02:00
|
|
|
import shutil
|
2015-01-22 11:53:49 +01:00
|
|
|
import subprocess
|
|
|
|
import sys
|
2020-08-05 12:59:28 +02:00
|
|
|
from pathlib import Path
|
2015-01-22 11:53:49 +01:00
|
|
|
|
2021-01-14 12:04:09 +01:00
|
|
|
# List of .blend files that are known to be failing and are not ready to be
|
|
|
|
# tested, or that only make sense on some devices. Accepts regular expressions.
|
2022-01-26 18:37:20 +01:00
|
|
|
BLACKLIST_ALL = [
|
|
|
|
# Blacklisted due overlapping object differences between platforms.
|
|
|
|
"hair_geom_reflection.blend",
|
|
|
|
"hair_geom_transmission.blend",
|
|
|
|
"hair_instancer_uv.blend",
|
|
|
|
"principled_hair_directcoloring.blend",
|
|
|
|
"visibility_particles.blend",
|
|
|
|
]
|
|
|
|
|
2021-01-14 12:04:09 +01:00
|
|
|
BLACKLIST_OSL = [
|
|
|
|
# OSL only supported on CPU.
|
|
|
|
'.*_osl.blend',
|
|
|
|
'osl_.*.blend',
|
|
|
|
]
|
|
|
|
|
|
|
|
BLACKLIST_OPTIX = [
|
2021-10-19 15:02:44 +02:00
|
|
|
# Ray intersection precision issues
|
2021-01-14 12:04:09 +01:00
|
|
|
'T50164.blend',
|
|
|
|
'T43865.blend',
|
|
|
|
]
|
|
|
|
|
|
|
|
BLACKLIST_GPU = [
|
|
|
|
# Uninvestigated differences with GPU.
|
|
|
|
'image_log.blend',
|
|
|
|
'T40964.blend',
|
|
|
|
'T45609.blend',
|
|
|
|
'smoke_color.blend',
|
|
|
|
'bevel_mblur.blend',
|
|
|
|
# Inconsistency between Embree and Hair primitive on GPU.
|
2021-10-19 15:02:44 +02:00
|
|
|
'denoise_hair.blend',
|
2021-01-14 12:04:09 +01:00
|
|
|
'hair_basemesh_intercept.blend',
|
|
|
|
'hair_instancer_uv.blend',
|
2021-10-19 15:02:44 +02:00
|
|
|
'hair_length_info.blend',
|
2021-01-14 12:04:09 +01:00
|
|
|
'hair_particle_random.blend',
|
2022-01-13 17:20:50 +01:00
|
|
|
"hair_transmission.blend",
|
2021-01-14 12:04:09 +01:00
|
|
|
'principled_hair_.*.blend',
|
|
|
|
'transparent_shadow_hair.*.blend',
|
2022-01-13 17:20:50 +01:00
|
|
|
# Inconsistent handling of overlapping objects.
|
|
|
|
"T41143.blend",
|
|
|
|
"visibility_particles.blend",
|
2021-01-14 12:04:09 +01:00
|
|
|
]
|
2015-01-22 11:53:49 +01:00
|
|
|
|
2021-07-06 04:05:27 +02:00
|
|
|
|
2019-05-10 23:00:35 +02:00
|
|
|
def get_arguments(filepath, output_filepath):
|
2019-05-16 15:48:30 +02:00
|
|
|
dirname = os.path.dirname(filepath)
|
|
|
|
basedir = os.path.dirname(dirname)
|
|
|
|
subject = os.path.basename(dirname)
|
|
|
|
|
2019-05-10 23:00:35 +02:00
|
|
|
args = [
|
|
|
|
"--background",
|
2019-05-16 15:48:30 +02:00
|
|
|
"-noaudio",
|
|
|
|
"--factory-startup",
|
|
|
|
"--enable-autoexec",
|
2020-08-26 22:02:02 +02:00
|
|
|
"--debug-memory",
|
|
|
|
"--debug-exit-on-error",
|
2019-05-16 15:48:30 +02:00
|
|
|
filepath,
|
|
|
|
"-E", "CYCLES",
|
|
|
|
"-o", output_filepath,
|
|
|
|
"-F", "PNG"]
|
2017-08-19 12:09:28 +02:00
|
|
|
|
|
|
|
# OSL and GPU examples
|
|
|
|
# custom_args += ["--python-expr", "import bpy; bpy.context.scene.cycles.shading_system = True"]
|
|
|
|
# custom_args += ["--python-expr", "import bpy; bpy.context.scene.cycles.device = 'GPU'"]
|
2019-02-11 18:26:47 +01:00
|
|
|
custom_args = os.getenv('CYCLESTEST_ARGS')
|
2019-05-10 23:00:35 +02:00
|
|
|
if custom_args:
|
|
|
|
args.extend(shlex.split(custom_args))
|
2019-05-16 15:48:30 +02:00
|
|
|
|
2019-05-10 23:00:35 +02:00
|
|
|
if subject == 'bake':
|
|
|
|
args.extend(['--python', os.path.join(basedir, "util", "render_bake.py")])
|
2019-05-16 15:48:30 +02:00
|
|
|
elif subject == 'denoise_animation':
|
2019-05-10 23:00:35 +02:00
|
|
|
args.extend(['--python', os.path.join(basedir, "util", "render_denoise.py")])
|
2019-05-16 15:48:30 +02:00
|
|
|
else:
|
2019-05-10 23:00:35 +02:00
|
|
|
args.extend(["-f", "1"])
|
2015-01-22 11:53:49 +01:00
|
|
|
|
2019-05-10 23:00:35 +02:00
|
|
|
return args
|
2015-01-22 11:53:49 +01:00
|
|
|
|
2020-10-02 02:10:01 +02:00
|
|
|
|
2015-01-22 11:53:49 +01:00
|
|
|
def create_argparse():
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument("-blender", nargs="+")
|
|
|
|
parser.add_argument("-testdir", nargs=1)
|
2017-08-03 16:41:50 +02:00
|
|
|
parser.add_argument("-outdir", nargs=1)
|
2015-01-22 11:53:49 +01:00
|
|
|
parser.add_argument("-idiff", nargs=1)
|
2020-10-28 16:19:03 +01:00
|
|
|
parser.add_argument("-device", nargs=1)
|
2021-01-14 12:24:24 +01:00
|
|
|
parser.add_argument("-blacklist", nargs="*")
|
2015-01-22 11:53:49 +01:00
|
|
|
return parser
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
parser = create_argparse()
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
2019-05-10 23:00:35 +02:00
|
|
|
blender = args.blender[0]
|
2018-02-14 17:33:06 +01:00
|
|
|
test_dir = args.testdir[0]
|
|
|
|
idiff = args.idiff[0]
|
|
|
|
output_dir = args.outdir[0]
|
2020-10-28 16:19:03 +01:00
|
|
|
device = args.device[0]
|
2015-01-22 11:53:49 +01:00
|
|
|
|
2022-01-26 18:37:20 +01:00
|
|
|
blacklist = BLACKLIST_ALL
|
2021-01-14 12:04:09 +01:00
|
|
|
if device != 'CPU':
|
|
|
|
blacklist += BLACKLIST_GPU
|
2021-01-14 12:24:24 +01:00
|
|
|
if device != 'CPU' or 'OSL' in args.blacklist:
|
2021-01-14 12:04:09 +01:00
|
|
|
blacklist += BLACKLIST_OSL
|
|
|
|
if device == 'OPTIX':
|
|
|
|
blacklist += BLACKLIST_OPTIX
|
|
|
|
|
2018-02-14 17:33:06 +01:00
|
|
|
from modules import render_report
|
2021-01-14 12:04:09 +01:00
|
|
|
report = render_report.Report('Cycles', output_dir, idiff, device, blacklist)
|
2018-02-14 17:33:06 +01:00
|
|
|
report.set_pixelated(True)
|
2019-05-06 19:46:32 +02:00
|
|
|
report.set_reference_dir("cycles_renders")
|
2020-10-28 16:19:03 +01:00
|
|
|
if device == 'CPU':
|
|
|
|
report.set_compare_engine('eevee')
|
|
|
|
else:
|
|
|
|
report.set_compare_engine('cycles', 'CPU')
|
2020-08-05 11:20:25 +02:00
|
|
|
|
|
|
|
# Increase threshold for motion blur, see T78777.
|
2020-08-05 12:59:28 +02:00
|
|
|
test_dir_name = Path(test_dir).name
|
|
|
|
if test_dir_name == 'motion_blur':
|
2020-08-05 11:20:25 +02:00
|
|
|
report.set_fail_threshold(0.032)
|
|
|
|
|
2019-05-10 23:00:35 +02:00
|
|
|
ok = report.run(test_dir, blender, get_arguments, batch=True)
|
2015-01-22 11:53:49 +01:00
|
|
|
|
|
|
|
sys.exit(not ok)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|