Files
test/intern/cycles/util/guiding.h
Sebastian Herholz 5abf42012d Cycles: Guiding cleaning up and refactoring the guiding code
In detail:
- Direct accesses of state attributes are replaced with the INTEGRATOR_STATE and INTEGRATOR_STATE_WRITE macros.
- Unified the checks for the __PATH_GUIDING define to use #  if defined (__PATH_GUIDING__).
- Even if __PATH_GUIDING__ is defined, we now check if the feature is enabled using if ((kernel_data.kernel_features & KERNEL_FEATURE_PATH_GUIDING)) {. This is important for later GPU ports.
- The kernel usage of the guiding field, surface, and volume sampling distributions is wrapped behind macros for each specific device (atm only CPU). This will make it easier for a GPU port later.
2025-05-22 13:46:30 +02:00

41 lines
704 B
C

/* SPDX-FileCopyrightText: 2022 Blender Foundation
*
* SPDX-License-Identifier: Apache-2.0 */
#pragma once
#if defined(WITH_PATH_GUIDING)
# include <openpgl/cpp/OpenPGL.h> // IWYU pragma: export
# include <openpgl/version.h> // IWYU pragma: export
#endif
#include "util/system.h" // IWYU pragma: keep
CCL_NAMESPACE_BEGIN
static int guiding_device_type()
{
#if defined(WITH_PATH_GUIDING)
# if defined(__ARM_NEON)
return 8;
# else
if (system_cpu_support_avx2()) {
return 8;
}
if (system_cpu_support_sse42()) {
return 4;
}
return 0;
# endif
#else
return 0;
#endif
}
static inline bool guiding_supported()
{
return guiding_device_type() != 0;
}
CCL_NAMESPACE_END