Fix Cycles compilation error with OIDN < 2.2

The enumerator values for various GPU compute platforms were
added starting with OIDN 2.0, with the Metal GPU type added
in OIDN 2.2.

This is an alternative fix to ebb781675d, which does not lead to
unhandled cases in switch statement, and follows the configuration
of OIDN and not Cycles (as OIDN might report devices which are
disabled in local Cycles build).

Pull Request: https://projects.blender.org/blender/blender/pulls/119155
This commit is contained in:
Sergey Sharybin
2024-03-07 11:13:41 +01:00
committed by Sergey Sharybin
parent 0cd414120b
commit 032a24d8ac

View File

@@ -35,19 +35,19 @@ static const char *oidn_device_type_to_string(const OIDNDeviceType type)
return "DEFAULT";
case OIDN_DEVICE_TYPE_CPU:
return "CPU";
# ifdef OIDN_DEVICE_SYCL
/* The initial GPU support was added in OIDN 2.0. */
# if OIDN_VERSION_MAJOR >= 2
case OIDN_DEVICE_TYPE_SYCL:
return "SYCL";
# endif
# ifdef OIDN_DEVICE_CUDA
case OIDN_DEVICE_TYPE_CUDA:
return "CUDA";
# endif
# ifdef OIDN_DEVICE_HIP
case OIDN_DEVICE_TYPE_HIP:
return "HIP";
# endif
# ifdef OIDN_DEVICE_METAL
/* The Metal support was added in OIDN 2.2.*/
# if (OIDN_VERSION_MAJOR > 2) || ((OIDN_VERSION_MAJOR == 2) && (OIDN_VERSION_MINOR >= 2))
case OIDN_DEVICE_TYPE_METAL:
return "METAL";
# endif