Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Hallade <xavier.hallade@intel.com>2022-06-22 20:50:30 +0300
committerXavier Hallade <xavier.hallade@intel.com>2022-06-22 20:53:07 +0300
commit8b9b38e1f6930052c0df70bba0f7ad43a4937b44 (patch)
tree3949ad61db12f3a6a8514c8e5b6e8314450db8cf /intern/cycles
parentb465e0b6b475b0ec6d25aed6590b60f8dad2a892 (diff)
Cycles: move oneAPI device name prettification to python UI
and give the same treatment to all device names
Diffstat (limited to 'intern/cycles')
-rw-r--r--intern/cycles/blender/addon/properties.py7
-rw-r--r--intern/cycles/kernel/device/oneapi/kernel.cpp22
2 files changed, 8 insertions, 21 deletions
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++;