diff options
author | Ray Molenkamp <github@lazydodo.com> | 2022-11-03 18:51:29 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2022-11-03 18:51:29 +0300 |
commit | e306f1fffc3bd3766a757e51981a2af91637369a (patch) | |
tree | 9a6623c8a37bf4834cf4111819ba69a2a877c7d9 /intern/cycles | |
parent | 33f8c515d163fb74b6e983faced884ecf0d34ca3 (diff) | |
parent | 41c692ee2f0f5a92d6162e65652e6f8d399df1a9 (diff) |
Merge remote-tracking branch 'origin/master' into tmp-vfx-platform-2023
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/device/CMakeLists.txt | 3 | ||||
-rw-r--r-- | intern/cycles/kernel/CMakeLists.txt | 7 | ||||
-rw-r--r-- | intern/cycles/test/CMakeLists.txt | 1 | ||||
-rw-r--r-- | intern/cycles/test/util_md5_test.cpp | 16 | ||||
-rw-r--r-- | intern/cycles/util/md5.cpp | 9 |
5 files changed, 30 insertions, 6 deletions
diff --git a/intern/cycles/device/CMakeLists.txt b/intern/cycles/device/CMakeLists.txt index 5296d819e42..bfca3ab6aea 100644 --- a/intern/cycles/device/CMakeLists.txt +++ b/intern/cycles/device/CMakeLists.txt @@ -224,7 +224,8 @@ include_directories(SYSTEM ${INC_SYS}) cycles_add_library(cycles_device "${LIB}" ${SRC}) if(WITH_CYCLES_DEVICE_ONEAPI) - # Need to have proper rebuilding in case of changes in cycles_kernel_oneapi due external project behaviour + # Need to have proper rebuilding in case of changes + # in cycles_kernel_oneapi due external project behavior. add_dependencies(cycles_device cycles_kernel_oneapi) endif() diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt index 81c5f593974..3779fdc697a 100644 --- a/intern/cycles/kernel/CMakeLists.txt +++ b/intern/cycles/kernel/CMakeLists.txt @@ -866,8 +866,8 @@ if(WITH_CYCLES_DEVICE_ONEAPI) else() list(APPEND sycl_compiler_flags -fPIC) - # We avoid getting __FAST_MATH__ to be defined when building on CentOS 7 until the compilation crash - # it triggers at either AoT or JIT stages gets fixed. + # We avoid getting __FAST_MATH__ to be defined when building on CentOS 7 until the compilation + # crash it triggers at either AoT or JIT stages gets fixed. list(APPEND sycl_compiler_flags -fhonor-nans) # add $ORIGIN to cycles_kernel_oneapi.so rpath so libsycl.so and @@ -881,7 +881,8 @@ if(WITH_CYCLES_DEVICE_ONEAPI) OUTPUT ${cycles_kernel_oneapi_lib} COMMAND ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${sycl_compiler_root}/../lib:${OCLOC_INSTALL_DIR}/lib:${IGC_INSTALL_DIR}/lib" - "PATH=${OCLOC_INSTALL_DIR}/bin:${sycl_compiler_root}:$ENV{PATH}" # env PATH is for compiler to find ld + # `$ENV{PATH}` is for compiler to find `ld`. + "PATH=${OCLOC_INSTALL_DIR}/bin:${sycl_compiler_root}:$ENV{PATH}" ${SYCL_COMPILER} $<$<CONFIG:Debug>:-g>$<$<CONFIG:RelWithDebInfo>:-g> ${sycl_compiler_flags} DEPENDS ${cycles_oneapi_kernel_sources}) endif() diff --git a/intern/cycles/test/CMakeLists.txt b/intern/cycles/test/CMakeLists.txt index b126247de5f..c3ae81ed1db 100644 --- a/intern/cycles/test/CMakeLists.txt +++ b/intern/cycles/test/CMakeLists.txt @@ -34,6 +34,7 @@ set(SRC render_graph_finalize_test.cpp util_aligned_malloc_test.cpp util_math_test.cpp + util_md5_test.cpp util_path_test.cpp util_string_test.cpp util_task_test.cpp diff --git a/intern/cycles/test/util_md5_test.cpp b/intern/cycles/test/util_md5_test.cpp new file mode 100644 index 00000000000..abc147b70a1 --- /dev/null +++ b/intern/cycles/test/util_md5_test.cpp @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: Apache-2.0 + * Copyright 2011-2022 Blender Foundation */ + +#include "testing/testing.h" + +#include "util/md5.h" + +CCL_NAMESPACE_BEGIN + +TEST(util, util_md5_string) +{ + /* The hash is calculated using `echo -n "Hello, World\!" | md5 | tr '[:lower:]' '[:upper:]'`. */ + EXPECT_EQ(util_md5_string("Hello, World!"), "65A8E27D8879283831B664BD8B7F0AD4"); +} + +CCL_NAMESPACE_END diff --git a/intern/cycles/util/md5.cpp b/intern/cycles/util/md5.cpp index 1c7e6b9bf3e..3342d7a509a 100644 --- a/intern/cycles/util/md5.cpp +++ b/intern/cycles/util/md5.cpp @@ -347,13 +347,18 @@ void MD5Hash::finish(uint8_t digest[16]) string MD5Hash::get_hex() { + constexpr char kHexDigits[] = { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; + uint8_t digest[16]; char buf[16 * 2 + 1]; finish(digest); - for (int i = 0; i < 16; i++) - sprintf(buf + i * 2, "%02X", (unsigned int)digest[i]); + for (int i = 0; i < 16; i++) { + buf[i * 2 + 0] = kHexDigits[digest[i] / 0x10]; + buf[i * 2 + 1] = kHexDigits[digest[i] % 0x10]; + } buf[sizeof(buf) - 1] = '\0'; return string(buf); |