[Bf-blender-cvs] [8b9b38e1f69] cycles_oneapi: Cycles: move oneAPI device name prettification to python UI
Xavier Hallade
noreply at git.blender.org
Wed Jun 22 19:54:09 CEST 2022
Commit: 8b9b38e1f6930052c0df70bba0f7ad43a4937b44
Author: Xavier Hallade
Date: Wed Jun 22 19:50:30 2022 +0200
Branches: cycles_oneapi
https://developer.blender.org/rB8b9b38e1f6930052c0df70bba0f7ad43a4937b44
Cycles: move oneAPI device name prettification to python UI
and give the same treatment to all device names
===================================================================
M intern/cycles/blender/addon/properties.py
M intern/cycles/kernel/device/oneapi/kernel.cpp
===================================================================
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index 5835d29c088..065a45ac754 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -1567,7 +1567,12 @@ class CyclesPreferences(bpy.types.AddonPreferences):
return
for device in devices:
- box.prop(device, "use", text=device.name)
+ import unicodedata
+ box.prop(device, "use", text=device.name
+ .replace('(TM)', unicodedata.lookup('TRADE MARK SIGN'))
+ .replace('(R)', unicodedata.lookup('REGISTERED SIGN'))
+ .replace('(C)', unicodedata.lookup('COPYRIGHT SIGN'))
+ )
def draw_impl(self, layout, context):
row = layout.row()
diff --git a/intern/cycles/kernel/device/oneapi/kernel.cpp b/intern/cycles/kernel/device/oneapi/kernel.cpp
index 64e3e0a5a23..9a10cb52629 100644
--- a/intern/cycles/kernel/device/oneapi/kernel.cpp
+++ b/intern/cycles/kernel/device/oneapi/kernel.cpp
@@ -684,23 +684,6 @@ static int parse_driver_build_version(const sycl::device &device)
return driver_build_version;
}
-static std::string make_prettier_device_name(const std::string &orig_device_name)
-{
- std::string new_device_name = orig_device_name;
-
- size_t start_pos = new_device_name.find("(R)");
- if (start_pos != std::string::npos) {
- new_device_name.replace(start_pos, 3, "\xC2\xAE");
- }
-
- start_pos = new_device_name.find("(TM)");
- if (start_pos != std::string::npos) {
- new_device_name.replace(start_pos, 4, "\xE2\x84\xA2");
- }
-
- return new_device_name;
-}
-
static std::vector<sycl::device> oneapi_available_devices()
{
bool allow_all_devices = false;
@@ -788,8 +771,7 @@ char *oneapi_device_capabilities()
const std::vector<sycl::device> &oneapi_devices = oneapi_available_devices();
for (const sycl::device &device : oneapi_devices) {
- const std::string &name = make_prettier_device_name(
- device.get_info<sycl::info::device::name>());
+ const std::string &name = device.get_info<sycl::info::device::name>();
capabilities << std::string("\t") << name << "\n";
# define WRITE_ATTR(attribute_name, attribute_variable) \
@@ -874,7 +856,7 @@ void oneapi_iterate_devices(OneAPIDeviceIteratorCallback cb, void *user_ptr)
for (sycl::device &device : devices) {
const std::string &platform_name =
device.get_platform().get_info<sycl::info::platform::name>();
- std::string name = make_prettier_device_name(device.get_info<sycl::info::device::name>());
+ std::string name = device.get_info<sycl::info::device::name>();
std::string id = "ONEAPI_" + platform_name + "_" + name;
(cb)(id.c_str(), name.c_str(), num, user_ptr);
num++;
More information about the Bf-blender-cvs
mailing list