Cycles render test: Add ability to control hardware raytracing

Add the ability to control whether or not Hardware Ray Tracing (HWRT)
is enabled during render tests.

This is done by adding `-RT` to the end of the device name in the
Cycles device list. E.g. `HIP-RT`. This is supported with HIP, oneAPI,
and Metal.

Change in behaviour:
If you do not specify `-RT`, then HWRT will be disabled. This results
in a change in behaviour:
1. `METAL` device tests on M3 or newer Macs no longer using MetalRT
2. `ONEAPI` device tests no longer use Embree GPU.

Note: Some tests are failing on some platforms/configurations that can
now be easily tested due to this commit. This does not effect the
build bot automated testing as it does not test these configurations.

These tests have not been blocked from running, primarily to help
developers investigate and fix the issues.

Ref #123012

Pull Request: https://projects.blender.org/blender/blender/pulls/125082
This commit is contained in:
Alaska
2024-09-12 17:56:31 +02:00
committed by Sergey Sharybin
parent bde6f888e2
commit bcf53fd5da

View File

@@ -138,16 +138,25 @@ BLOCKLIST_GPU = [
class CyclesReport(render_report.Report):
def __init__(self, title, output_dir, oiiotool, device=None, blocklist=[], osl=False):
super().__init__(title, output_dir, oiiotool, device=device, blocklist=blocklist)
# Split device name in format "<device_type>[-<RT>]" into individual
# tokens, setting the RT suffix to an empty string if its not specified.
device, suffix = (device.split("-") + [""])[:2]
self.use_hwrt = (suffix == "RT")
super().__init__(title, output_dir, oiiotool, device, blocklist)
if self.use_hwrt:
self.title = self.title + " RT"
self.output_dir = self.output_dir + "_rt"
self.osl = osl
if osl:
if self.osl:
self.title += " OSL"
def _get_render_arguments(self, arguments_cb, filepath, base_output_filepath):
return arguments_cb(filepath, base_output_filepath, self.osl)
return arguments_cb(filepath, base_output_filepath, self.use_hwrt, self.osl)
def get_arguments(filepath, output_filepath, osl=False):
def get_arguments(filepath, output_filepath, use_hwrt=False, osl=False):
dirname = os.path.dirname(filepath)
basedir = os.path.dirname(dirname)
subject = os.path.basename(dirname)
@@ -174,6 +183,17 @@ def get_arguments(filepath, output_filepath, osl=False):
if spp_multiplier:
args.extend(["--python-expr", f"import bpy; bpy.context.scene.cycles.samples *= {spp_multiplier}"])
cycles_pref = "bpy.context.preferences.addons['cycles'].preferences"
use_hwrt_bool_value = "True" if use_hwrt else "False"
use_hwrt_on_off_value = "'ON'" if use_hwrt else "'OFF'"
args.extend([
"--python-expr",
(f"import bpy;"
f"{cycles_pref}.use_hiprt = {use_hwrt_bool_value};"
f"{cycles_pref}.use_oneapirt = {use_hwrt_bool_value};"
f"{cycles_pref}.metalrt = {use_hwrt_on_off_value}")
])
if osl:
args.extend(["--python-expr", "import bpy; bpy.context.scene.cycles.shading_system = True"])