[Bf-blender-cvs] [68347715d82] cycles_path_guiding: Disable AVX2 guiding device until new OpenPGL version, minor code refactor.
Brecht Van Lommel
noreply at git.blender.org
Tue Sep 20 21:00:37 CEST 2022
Commit: 68347715d8248b7be67b31640c6260cb00247f09
Author: Brecht Van Lommel
Date: Tue Sep 20 17:57:06 2022 +0200
Branches: cycles_path_guiding
https://developer.blender.org/rB68347715d8248b7be67b31640c6260cb00247f09
Disable AVX2 guiding device until new OpenPGL version, minor code refactor.
===================================================================
M intern/cycles/device/cpu/device_impl.cpp
M intern/cycles/util/guiding.h
===================================================================
diff --git a/intern/cycles/device/cpu/device_impl.cpp b/intern/cycles/device/cpu/device_impl.cpp
index deaa2edb755..363cf3c0058 100644
--- a/intern/cycles/device/cpu/device_impl.cpp
+++ b/intern/cycles/device/cpu/device_impl.cpp
@@ -42,6 +42,7 @@
#include "util/debug.h"
#include "util/foreach.h"
#include "util/function.h"
+#include "util/guiding.h"
#include "util/log.h"
#include "util/map.h"
#include "util/openimagedenoise.h"
@@ -286,19 +287,12 @@ void *CPUDevice::get_guiding_device() const
{
#ifdef WITH_PATH_GUIDING
if (!guiding_device) {
-# if defined(__ARM_NEON)
- guiding_device = make_unique<openpgl::cpp::Device>(PGL_DEVICE_TYPE_CPU_8);
-# else
- if (system_cpu_support_avx2()) {
+ if (guiding_device_type() == 8) {
guiding_device = make_unique<openpgl::cpp::Device>(PGL_DEVICE_TYPE_CPU_8);
}
- else if (system_cpu_support_sse41()) {
+ else if (guiding_device_type() == 4) {
guiding_device = make_unique<openpgl::cpp::Device>(PGL_DEVICE_TYPE_CPU_4);
}
- else {
- guiding_device = nullptr;
- }
-# endif
}
return guiding_device.get();
#else
diff --git a/intern/cycles/util/guiding.h b/intern/cycles/util/guiding.h
index 4da7d3c0122..d466501b535 100644
--- a/intern/cycles/util/guiding.h
+++ b/intern/cycles/util/guiding.h
@@ -1,26 +1,40 @@
/* SPDX-License-Identifier: Apache-2.0
* Copyright 2022 Blender Foundation */
-#ifndef __UTIL_GUIDING_H__
-#define __UTIL_GUIDING_H__
+#pragma once
+
+#ifdef WITH_PATH_GUIDING
+# include <openpgl/version.h>
+#endif
#include "util/system.h"
CCL_NAMESPACE_BEGIN
-static inline bool guiding_supported()
+static int guiding_device_type()
{
#ifdef WITH_PATH_GUIDING
# if defined(__ARM_NEON)
- return true;
+ return 8;
# else
- return system_cpu_support_sse41();
+# if OPENPGL_VERSION_MINOR >= 4
+ if (system_cpu_support_avx2()) {
+ return 8;
+ }
+# endif
+ if (system_cpu_support_sse41()) {
+ return 4;
+ }
+ return 0;
# endif
#else
- return false;
+ return 0;
#endif
}
-CCL_NAMESPACE_END
+static inline bool guiding_supported()
+{
+ return guiding_device_type() != 0;
+}
-#endif /* __UTIL_GUIDING_H__ */
+CCL_NAMESPACE_END
More information about the Bf-blender-cvs
mailing list