Compositor: Unify references between CPU and GPU tests
This patch removes the references for the GPU tests and uses the CPU references for both CPU and GPU, since they are expected to match. This also unifies the tests scripts into a single script with an argument for execution device.
This commit is contained in:
@@ -884,8 +884,8 @@ else()
|
||||
|
||||
foreach(comp_test ${compositor_tests})
|
||||
add_render_test(
|
||||
compositor_${comp_test}_cpu
|
||||
${CMAKE_CURRENT_LIST_DIR}/compositor_cpu_render_tests.py
|
||||
compositor_cpu_${comp_test}
|
||||
${CMAKE_CURRENT_LIST_DIR}/compositor_render_tests.py
|
||||
--testdir "${TEST_SRC_DIR}/compositor/${comp_test}"
|
||||
--outdir "${TEST_OUT_DIR}/compositor_cpu"
|
||||
)
|
||||
@@ -914,10 +914,11 @@ if(WITH_COMPOSITOR_REALTIME_TESTS)
|
||||
|
||||
foreach(comp_test ${compositor_tests})
|
||||
add_render_test(
|
||||
compositor_${comp_test}_realtime
|
||||
${CMAKE_CURRENT_LIST_DIR}/compositor_realtime_render_tests.py
|
||||
compositor_gpu_${comp_test}
|
||||
${CMAKE_CURRENT_LIST_DIR}/compositor_render_tests.py
|
||||
--testdir "${TEST_SRC_DIR}/compositor/${comp_test}"
|
||||
--outdir "${TEST_OUT_DIR}/compositor_realtime"
|
||||
--outdir "${TEST_OUT_DIR}/compositor_gpu"
|
||||
--gpu
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-FileCopyrightText: 2015-2023 Blender Authors
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
# When run from inside Blender, render and exit.
|
||||
try:
|
||||
import bpy
|
||||
inside_blender = True
|
||||
except ImportError:
|
||||
inside_blender = False
|
||||
|
||||
SET_COMPOSITOR_DEVICE_SCRIPT = "import bpy; " \
|
||||
"bpy.data.scenes[0].render.compositor_device = 'GPU'"
|
||||
|
||||
|
||||
def get_arguments(filepath, output_filepath):
|
||||
return [
|
||||
"--background",
|
||||
"--factory-startup",
|
||||
"--enable-autoexec",
|
||||
"--debug-memory",
|
||||
"--debug-exit-on-error",
|
||||
filepath,
|
||||
"-P", os.path.realpath(__file__),
|
||||
"--python-expr", SET_COMPOSITOR_DEVICE_SCRIPT,
|
||||
"-o", output_filepath,
|
||||
"-F", "PNG",
|
||||
"-f", "1"
|
||||
]
|
||||
|
||||
|
||||
def create_argparse():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Run test script for each blend file in TESTDIR, comparing the render result with known output."
|
||||
)
|
||||
parser.add_argument("--blender", required=True)
|
||||
parser.add_argument("--testdir", required=True)
|
||||
parser.add_argument("--outdir", required=True)
|
||||
parser.add_argument("--oiiotool", required=True)
|
||||
parser.add_argument('--batch', default=False, action='store_true')
|
||||
return parser
|
||||
|
||||
|
||||
def main():
|
||||
parser = create_argparse()
|
||||
args = parser.parse_args()
|
||||
|
||||
from modules import render_report
|
||||
report = render_report.Report("Compositor Realtime", args.outdir, args.oiiotool)
|
||||
report.set_reference_dir("compositor_realtime_renders")
|
||||
|
||||
ok = report.run(args.testdir, args.blender, get_arguments, batch=args.batch)
|
||||
|
||||
sys.exit(not ok)
|
||||
|
||||
|
||||
if not inside_blender and __name__ == "__main__":
|
||||
main()
|
||||
@@ -15,11 +15,12 @@ try:
|
||||
except ImportError:
|
||||
inside_blender = False
|
||||
|
||||
SET_COMPOSITOR_DEVICE_SCRIPT = "import bpy; " \
|
||||
"bpy.data.scenes[0].render.compositor_device = 'CPU'"
|
||||
|
||||
def get_compositor_device_setter_script(execution_device):
|
||||
return f"import bpy; bpy.data.scenes[0].render.compositor_device = '{execution_device}'"
|
||||
|
||||
|
||||
def get_arguments(filepath, output_filepath):
|
||||
def get_arguments(filepath, output_filepath, execution_device):
|
||||
return [
|
||||
"--background",
|
||||
"--factory-startup",
|
||||
@@ -28,7 +29,7 @@ def get_arguments(filepath, output_filepath):
|
||||
"--debug-exit-on-error",
|
||||
filepath,
|
||||
"-P", os.path.realpath(__file__),
|
||||
"--python-expr", SET_COMPOSITOR_DEVICE_SCRIPT,
|
||||
"--python-expr", get_compositor_device_setter_script(execution_device),
|
||||
"-o", output_filepath,
|
||||
"-F", "PNG",
|
||||
"-f", "1"]
|
||||
@@ -42,6 +43,7 @@ def create_argparse():
|
||||
parser.add_argument("--testdir", required=True)
|
||||
parser.add_argument("--outdir", required=True)
|
||||
parser.add_argument("--oiiotool", required=True)
|
||||
parser.add_argument("--gpu", default=False, action='store_true')
|
||||
parser.add_argument('--batch', default=False, action='store_true')
|
||||
return parser
|
||||
|
||||
@@ -51,9 +53,11 @@ def main():
|
||||
args = parser.parse_args()
|
||||
|
||||
from modules import render_report
|
||||
report = render_report.Report("Compositor CPU", args.outdir, args.oiiotool)
|
||||
execution_device = "GPU" if args.gpu else "CPU"
|
||||
report_title = f"Compositor {execution_device}"
|
||||
report = render_report.Report(report_title, args.outdir, args.oiiotool)
|
||||
report.set_pixelated(True)
|
||||
report.set_reference_dir("compositor_cpu_renders")
|
||||
report.set_reference_dir("compositor_renders")
|
||||
|
||||
if os.path.basename(args.testdir) == 'filter':
|
||||
# Temporary change to pass OpenImageDenoise test with both 1.3 and 1.4.
|
||||
@@ -66,7 +70,8 @@ def main():
|
||||
report.set_fail_threshold(0.06)
|
||||
report.set_fail_percent(2)
|
||||
|
||||
ok = report.run(args.testdir, args.blender, get_arguments, batch=args.batch)
|
||||
arguments_callback = lambda filepath, output_filepath: get_arguments(filepath, output_filepath, execution_device)
|
||||
ok = report.run(args.testdir, args.blender, arguments_callback, batch=args.batch)
|
||||
|
||||
sys.exit(not ok)
|
||||
|
||||
Reference in New Issue
Block a user