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:
@@ -55,6 +55,34 @@ static PyObject *pygpu_platform_version_get(PyObject *UNUSED(self))
|
||||
return PyUnicode_FromString(GPU_platform_version());
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(
|
||||
pygpu_platform_device_type_get_doc,
|
||||
".. function:: device_type_get()\n"
|
||||
"\n"
|
||||
" Get GPU device type.\n"
|
||||
"\n"
|
||||
" :return: Device type ('APPLE', 'NVIDIA', 'AMD', 'INTEL', 'SOFTWARE', 'UNKNOWN').\n"
|
||||
" :rtype: str\n");
|
||||
static PyObject *pygpu_platform_device_type_get(PyObject *UNUSED(self))
|
||||
{
|
||||
if (GPU_type_matches(GPU_DEVICE_APPLE, GPU_OS_ANY, GPU_DRIVER_ANY)) {
|
||||
return PyUnicode_FromString("APPLE");
|
||||
}
|
||||
if (GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_ANY, GPU_DRIVER_ANY)) {
|
||||
return PyUnicode_FromString("NVIDIA");
|
||||
}
|
||||
if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY)) {
|
||||
return PyUnicode_FromString("AMD");
|
||||
}
|
||||
if (GPU_type_matches(GPU_DEVICE_INTEL | GPU_DEVICE_INTEL_UHD, GPU_OS_ANY, GPU_DRIVER_ANY)) {
|
||||
return PyUnicode_FromString("INTEL");
|
||||
}
|
||||
if (GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_ANY, GPU_DRIVER_ANY)) {
|
||||
return PyUnicode_FromString("SOFTWARE");
|
||||
}
|
||||
return PyUnicode_FromString("UNKNOWN");
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
@@ -74,6 +102,10 @@ static struct PyMethodDef pygpu_platform__tp_methods[] = {
|
||||
(PyCFunction)pygpu_platform_version_get,
|
||||
METH_NOARGS,
|
||||
pygpu_platform_version_get_doc},
|
||||
{"device_type_get",
|
||||
(PyCFunction)pygpu_platform_device_type_get,
|
||||
METH_NOARGS,
|
||||
pygpu_platform_device_type_get_doc},
|
||||
{NULL, NULL, 0, NULL},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user