Cycles: Remove glog dependency, redirect logs to CLOG

* Add own simple logging system to replace glog, which is no longer
  maintained by Google.
* When building in Blender, integrate with CLOG and print all messages
  through that system instead.
* --log cycles now replaces --debug-cycles. The latter still works but
  is no longer documented.

Pull Request: https://projects.blender.org/blender/blender/pulls/140244
This commit is contained in:
Brecht Van Lommel
2025-06-12 02:19:57 +02:00
parent 370ef854c0
commit 8392ca915b
19 changed files with 314 additions and 207 deletions

View File

@@ -625,7 +625,6 @@ option(WITH_CYCLES "Enable Cycles Render Engine" ON)
option(WITH_CYCLES_OSL "Build Cycles with OpenShadingLanguage support" ON)
option(WITH_CYCLES_PATH_GUIDING "Build Cycles with path guiding support" ON)
option(WITH_CYCLES_EMBREE "Build Cycles with Embree support" ON)
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
option(WITH_CYCLES_DEBUG "Build Cycles with options useful for debugging (e.g., MIS)" OFF)
option(WITH_CYCLES_STANDALONE "Build Cycles standalone application" OFF)
@@ -655,7 +654,6 @@ Run additional Cycles test with OSL enabled"
OFF
)
mark_as_advanced(WITH_CYCLES_KERNEL_ASAN)
mark_as_advanced(WITH_CYCLES_LOGGING)
mark_as_advanced(WITH_CYCLES_DEBUG_NAN)
mark_as_advanced(WITH_CYCLES_NATIVE_ONLY)
mark_as_advanced(WITH_CYCLES_PRECOMPUTE)
@@ -1711,7 +1709,7 @@ set_and_warn_incompatible(WITH_PYTHON_MODULE WITH_GTESTS OFF)
# -----------------------------------------------------------------------------
# Configure `GLog/GFlags`
if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
if(WITH_LIBMV OR WITH_GTESTS)
if(WITH_SYSTEM_GFLAGS)
find_package(Gflags)
if(NOT GFLAGS_FOUND)
@@ -2686,12 +2684,6 @@ elseif(WITH_CYCLES_STANDALONE OR WITH_CYCLES_HYDRA_RENDER_DELEGATE)
add_subdirectory(intern/sky)
add_subdirectory(intern/cycles)
if(WITH_CYCLES_LOGGING)
if(NOT WITH_SYSTEM_GFLAGS)
add_subdirectory(extern/gflags)
endif()
add_subdirectory(extern/glog)
endif()
if(WITH_CUDA_DYNLOAD)
add_subdirectory(extern/cuew)
endif()

View File

@@ -86,7 +86,7 @@ if(WITH_LIBMV)
add_subdirectory(ceres)
endif()
if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
if(WITH_LIBMV OR WITH_GTESTS)
if(NOT WITH_SYSTEM_GFLAGS)
add_subdirectory(gflags)
endif()

View File

@@ -325,18 +325,6 @@ if(WITH_OPENIMAGEDENOISE)
)
endif()
# Logging capabilities using GLog library.
if(WITH_CYCLES_LOGGING)
add_definitions(-DWITH_CYCLES_LOGGING)
add_definitions(${GLOG_DEFINES})
add_definitions(-DCYCLES_GFLAGS_NAMESPACE=${GFLAGS_NAMESPACE})
include_directories(
SYSTEM
${GLOG_INCLUDE_DIRS}
${GFLAGS_INCLUDE_DIRS}
)
endif()
if(WITH_ALEMBIC)
add_definitions(-DWITH_ALEMBIC)
include_directories(

View File

@@ -405,9 +405,8 @@ static void options_parse(const int argc, const char **argv)
ArgParse ap;
bool help = false;
bool profile = false;
bool debug = false;
bool version = false;
int verbosity = 1;
string log_level;
ap.usage("cycles [options] file.xml");
ap.arg("filename").hidden().action([&](auto argv) { options.filepath = argv[0]; });
@@ -442,12 +441,9 @@ static void options_parse(const int argc, const char **argv)
});
ap.arg("--list-devices", &list).help("List information about all available devices");
ap.arg("--profile", &profile).help("Enable profile logging");
#ifdef WITH_CYCLES_LOGGING
ap.arg("--debug", &debug).help("Enable debug logging");
ap.arg("--verbose %d:VERBOSE").help("Set verbosity of the logger").action([&](auto argv) {
parse_int(argv, &verbosity);
});
#endif
ap.arg("--log-level %s:LEVEL")
.help("Log verbosity: fatal, error, warning, info, stats, debug")
.action([&](auto argv) { parse_string(argv, &log_level); });
ap.arg("--help", &help).help("Print help message");
ap.arg("--version", &version).help("Print version number");
@@ -457,9 +453,8 @@ static void options_parse(const int argc, const char **argv)
exit(EXIT_FAILURE);
}
if (debug) {
util_logging_start();
util_logging_verbosity_set(verbosity);
if (!log_level.empty()) {
log_level_set(log_level);
}
if (list) {
@@ -544,7 +539,7 @@ using namespace ccl;
int main(const int argc, const char **argv)
{
util_logging_init(argv[0]);
log_init(argv[0]);
path_init();
options_parse(argc, argv);

View File

@@ -12,9 +12,7 @@ extern "C" {
void *CCL_python_module_init(void);
void CCL_init_logging(const char *argv0);
void CCL_start_debug_logging(void);
void CCL_logging_verbosity_set(const int verbosity);
void CCL_log_init(void);
#ifdef __cplusplus
}

View File

@@ -58,6 +58,7 @@ set(LIB
PRIVATE bf::imbuf
PRIVATE bf::gpu
PRIVATE bf::intern::guardedalloc
PRIVATE bf::intern::clog
PRIVATE bf::render
cycles_bvh
cycles_device
@@ -73,13 +74,6 @@ set(LIB
${PYTHON_LIBRARIES}
)
if(WITH_CYCLES_LOGGING)
list(APPEND LIB
${GLOG_LIBRARIES}
${GFLAGS_LIBRARIES}
)
endif()
set(ADDON_FILES
addon/__init__.py
addon/camera.py

View File

@@ -5,17 +5,59 @@
#include "blender/CCL_api.h"
#include "util/log.h"
void CCL_init_logging(const char *argv0)
{
ccl::util_logging_init(argv0);
}
#include "CLG_log.h"
void CCL_start_debug_logging()
{
ccl::util_logging_start();
}
static CLG_LogRef LOG = {"cycles"};
void CCL_logging_verbosity_set(const int verbosity)
void CCL_log_init()
{
ccl::util_logging_verbosity_set(verbosity);
/* Set callback to pass log messages to CLOG. */
ccl::log_init(
[](const ccl::LogLevel level, const char *file_line, const char *func, const char *msg) {
const CLG_LogType *log_type = CLOG_ENSURE(&LOG);
switch (level) {
case ccl::FATAL:
case ccl::DFATAL:
CLG_log_str(log_type, CLG_SEVERITY_FATAL, file_line, func, msg);
return;
case ccl::ERROR:
case ccl::DERROR:
CLG_log_str(log_type, CLG_SEVERITY_ERROR, file_line, func, msg);
return;
case ccl::WARNING:
case ccl::DWARNING:
CLG_log_str(log_type, CLG_SEVERITY_WARN, file_line, func, msg);
return;
case ccl::INFO:
case ccl::WORK:
case ccl::STATS:
case ccl::DEBUG:
case ccl::UNKNOWN:
CLG_log_str(log_type, CLG_SEVERITY_INFO, file_line, func, msg);
return;
}
});
/* Map log level from CLOG. */
const CLG_LogType *log_type = CLOG_ENSURE(&LOG);
if (log_type->flag & CLG_FLAG_USE) {
switch (log_type->level) {
case 0:
case 1:
ccl::log_level_set(ccl::INFO);
break;
case 2:
ccl::log_level_set(ccl::WORK);
break;
case 3:
ccl::log_level_set(ccl::STATS);
break;
default:
ccl::log_level_set(ccl::DEBUG);
break;
}
}
else {
ccl::log_level_set(ccl::ERROR);
}
}

View File

@@ -85,9 +85,6 @@ macro(cycles_external_libraries_append libraries)
list(APPEND ${libraries} "opengl32")
endif()
endif()
if(WITH_CYCLES_LOGGING)
list(APPEND ${libraries} ${GLOG_LIBRARIES} ${GFLAGS_LIBRARIES})
endif()
if(WITH_CYCLES_OSL)
list(APPEND ${libraries} ${OSL_LIBRARIES})
endif()

View File

@@ -16,10 +16,8 @@
PXR_NAMESPACE_OPEN_SCOPE
#ifdef WITH_CYCLES_LOGGING
TF_DEFINE_ENV_SETTING(CYCLES_LOGGING, false, "Enable Cycles logging")
TF_DEFINE_ENV_SETTING(CYCLES_LOGGING_SEVERITY, 1, "Cycles logging verbosity")
#endif
TF_DEFINE_ENV_SETTING(CYCLES_LOGGING_LEVEL, "warning", "Cycles logging level")
HdCyclesPlugin::HdCyclesPlugin()
{
@@ -28,12 +26,9 @@ HdCyclesPlugin::HdCyclesPlugin()
const std::string rootPath = PXR_NS::ArchAbsPath(plugin->GetResourcePath());
CCL_NS::path_init(std::move(rootPath));
#ifdef WITH_CYCLES_LOGGING
if (TfGetEnvSetting(CYCLES_LOGGING)) {
CCL_NS::util_logging_start();
CCL_NS::util_logging_verbosity_set(TfGetEnvSetting(CYCLES_LOGGING_SEVERITY));
CCL_NS::log_level_set(TfGetEnvSetting(CYCLES_LOGGING_LEVEL));
}
#endif
}
HdCyclesPlugin::~HdCyclesPlugin() {}

View File

@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: Apache-2.0
if(WITH_GTESTS AND WITH_CYCLES_LOGGING)
if(WITH_GTESTS)
# Otherwise we get warnings here that we can't fix in external projects
remove_strict_flags()
endif()
@@ -58,7 +58,7 @@ if(NOT APPLE)
endif()
endif()
if(WITH_GTESTS AND WITH_CYCLES_LOGGING)
if(WITH_GTESTS)
set(INC_SYS )
blender_add_test_suite_executable(cycles "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
endif()

View File

@@ -2,7 +2,6 @@
*
* SPDX-License-Identifier: Apache-2.0 */
#include <glog/logging.h>
#include <gtest/gtest.h>
#include "device/device.h"
@@ -145,16 +144,23 @@ class ShaderGraphBuilder {
/* A ScopedMockLog object intercepts log messages issued during its lifespan,
* to test if the approriate logs are output. */
class ScopedMockLog : google::LogSink {
class ScopedMockLog {
public:
ScopedMockLog()
{
AddLogSink(this);
log_init([](const LogLevel /*level*/,
const char * /*file_line*/,
const char * /*func*/,
const char *msg) {
static thread_mutex mutex;
thread_scoped_lock lock(mutex);
messages.push_back(msg);
});
}
~ScopedMockLog() override
~ScopedMockLog()
{
RemoveLogSink(this);
log_init(nullptr);
messages.free_memory();
}
@@ -182,19 +188,6 @@ class ScopedMockLog : google::LogSink {
private:
static vector<string> messages;
void send(google::LogSeverity /*severity*/,
const char * /*full_filename*/,
const char * /*base_filename*/,
int /*line*/,
const tm * /*tm_time*/,
const char *message,
size_t /*message_len*/) override
{
static thread_mutex mutex;
thread_scoped_lock lock(mutex);
messages.push_back(message);
}
};
vector<string> ScopedMockLog::messages;
@@ -230,15 +223,14 @@ class RenderGraph : public testing::Test {
/* Initialize logging after the creation of the essential resources. This way the logging
* mock sink does not warn about uninteresting messages which happens prior to the setup of
* the actual mock sinks. */
util_logging_start();
util_logging_verbosity_set(5);
log_level_set(DEBUG);
}
void TearDown() override
{
/* Effectively disable logging, so that the next test suit starts in an environment which is
* not logging by default. */
util_logging_verbosity_set(0);
log_level_set(FATAL);
scene.reset();
device_cpu.reset();

View File

@@ -3,9 +3,9 @@
* SPDX-License-Identifier: Apache-2.0 */
#include "util/log.h"
#include "util/math.h"
#include "util/string.h"
#include "util/time.h"
#include <cstdio>
#ifdef _MSC_VER
@@ -14,59 +14,122 @@
CCL_NAMESPACE_BEGIN
#ifdef WITH_CYCLES_LOGGING
static bool is_verbosity_set()
LogLevel LOG_LEVEL = DWARNING;
static LogFunction LOG_FUNCTION;
static double LOG_START_TIME = time_dt();
const char *log_level_to_string(const LogLevel level)
{
using CYCLES_GFLAGS_NAMESPACE::GetCommandLineOption;
string verbosity;
if (!GetCommandLineOption("v", &verbosity)) {
return false;
switch (level) {
case FATAL:
case DFATAL:
return "FATAL";
case ERROR:
case DERROR:
return "ERROR";
case WARNING:
case DWARNING:
return "WARNING";
case INFO:
return "INFO";
case WORK:
return "WORK";
case STATS:
return "STATS";
case DEBUG:
return "DEBUG";
case UNKNOWN:
return "UNKNOWN";
}
return verbosity != "0";
}
#endif
void util_logging_init(const char *argv0)
{
#ifdef WITH_CYCLES_LOGGING
using CYCLES_GFLAGS_NAMESPACE::SetCommandLineOption;
google::InitGoogleLogging(argv0);
SetCommandLineOption("logtostderr", "1");
if (!is_verbosity_set()) {
SetCommandLineOption("v", "0");
}
SetCommandLineOption("stderrthreshold", "0");
SetCommandLineOption("minloglevel", "0");
#else
(void)argv0;
#endif
return "";
}
void util_logging_start()
LogLevel log_string_to_level(const string &str)
{
#ifdef WITH_CYCLES_LOGGING
using CYCLES_GFLAGS_NAMESPACE::SetCommandLineOption;
SetCommandLineOption("logtostderr", "1");
if (!is_verbosity_set()) {
SetCommandLineOption("v", "2");
const std::string str_lower = string_to_lower(str);
if (str_lower == "fatal") {
return FATAL;
}
SetCommandLineOption("stderrthreshold", "0");
SetCommandLineOption("minloglevel", "0");
#endif
if (str_lower == "error") {
return ERROR;
}
if (str_lower == "warning") {
return WARNING;
}
if (str_lower == "info") {
return FATAL;
}
if (str_lower == "work") {
return WORK;
}
if (str_lower == "stats") {
return STATS;
}
if (str_lower == "debug") {
return DEBUG;
}
return UNKNOWN;
}
void util_logging_verbosity_set(const int verbosity)
void log_init(const LogFunction func)
{
#ifdef WITH_CYCLES_LOGGING
using CYCLES_GFLAGS_NAMESPACE::SetCommandLineOption;
char val[10];
snprintf(val, sizeof(val), "%d", verbosity);
SetCommandLineOption("v", val);
#else
(void)verbosity;
#endif
LOG_FUNCTION = func;
LOG_START_TIME = time_dt();
}
void log_level_set(const LogLevel level)
{
LOG_LEVEL = level;
}
void log_level_set(const std::string &level)
{
const LogLevel new_level = log_string_to_level(level);
if (new_level == UNKNOWN) {
LOG(ERROR) << "Unknown log level specified: " << level;
return;
}
LOG_LEVEL = new_level;
}
static void log_default(const LogLevel level, const std::string &time_str, const char *msg)
{
if (level >= INFO) {
printf("%s | %s\n", time_str.c_str(), msg);
}
else {
fflush(stdout);
fprintf(stderr, "%s | %s: %s\n", time_str.c_str(), log_level_to_string(level), msg);
}
}
void _log_message(const LogLevel level, const char *file_line, const char *func, const char *msg)
{
assert(level <= LOG_LEVEL);
if (LOG_FUNCTION) {
LOG_FUNCTION(level, file_line, func, msg);
return;
}
const std::string time_str = time_human_readable_from_seconds(time_dt() - LOG_START_TIME);
if (strchr(msg, '\n') == nullptr) {
log_default(level, time_str, msg);
return;
}
vector<string> lines;
string_split(lines, msg, "\n", false);
for (const string &line : lines) {
log_default(level, time_str, line.c_str());
}
if (level == FATAL || level == DFATAL) {
abort();
}
}
std::ostream &operator<<(std::ostream &os, const int2 &value)

View File

@@ -4,89 +4,154 @@
#pragma once
#if defined(WITH_CYCLES_LOGGING) && !defined(__KERNEL_GPU__)
# include <gflags/gflags.h> // IWYU pragma: export
# include <glog/logging.h> // IWYU pragma: export
#endif
#include "util/defines.h"
#include "util/string.h"
#include "util/types.h"
#include <iosfwd>
#include <sstream>
CCL_NAMESPACE_BEGIN
#if !defined(WITH_CYCLES_LOGGING) || defined(__KERNEL_GPU__)
class StubStream {
enum LogLevel {
FATAL = 0,
DFATAL = 1,
ERROR = 2,
DERROR = 3,
WARNING = 4,
DWARNING = 5,
INFO = 6,
WORK = 7,
STATS = 8,
DEBUG = 9,
UNKNOWN = -1,
};
const char *log_level_to_string(const LogLevel level);
LogLevel log_string_to_level(const string &str);
using LogFunction = void (*)(const LogLevel level,
const char *file_line,
const char *func,
const char *msg);
void log_init(const LogFunction func = nullptr);
void log_level_set(const LogLevel level);
void log_level_set(const string &level);
void _log_message(const LogLevel level, const char *file_line, const char *func, const char *msg);
class LogMessage {
public:
template<class T> StubStream &operator<<(const T &)
LogMessage(enum LogLevel level, const char *file_line, const char *func)
: level_(level), file_line_(file_line), func_(func)
{
return *this;
}
~LogMessage()
{
_log_message(level_, file_line_, func_, stream_.str().c_str());
}
std::ostream &stream()
{
return stream_;
}
protected:
LogLevel level_;
const char *file_line_;
const char *func_;
std::stringstream stream_;
};
class LogMessageVoidify {
public:
LogMessageVoidify() {}
void operator&(const StubStream &) {}
};
extern LogLevel LOG_LEVEL;
# define LOG_SUPPRESS() (true) ? ((void)0) : LogMessageVoidify() & StubStream()
# define LOG(severity) LOG_SUPPRESS()
# define VLOG(severity) LOG_SUPPRESS()
# define VLOG_IF(severity, condition) LOG_SUPPRESS()
# define VLOG_IS_ON(severity) false
#define LOG_STRINGIFY_APPEND(a, b) "" a #b
#define LOG_STRINGIFY(x) LOG_STRINGIFY_APPEND("", x)
# define CHECK(expression) LOG_SUPPRESS()
#ifdef NDEBUG
# define VLOG_IF(level, condition) \
if constexpr (level != DFATAL && level != DERROR && level != DWARNING) \
if (LIKELY(!(level <= LOG_LEVEL && (condition)))) \
; \
else \
LogMessage(level, __FILE__ ":" LOG_STRINGIFY(__LINE__), __func__).stream()
#else
# define VLOG_IF(level, condition) \
if (LIKELY(!(level <= LOG_LEVEL && (condition)))) \
; \
else \
LogMessage(level, __FILE__ ":" LOG_STRINGIFY(__LINE__), __func__).stream()
#endif
# define CHECK_NOTNULL(expression) (expression)
// TODO: remove distinction
#define VLOG(level) VLOG_IF(level, true)
#define LOG(level) VLOG_IF(level, true)
# define CHECK_NEAR(actual, expected, eps) LOG_SUPPRESS()
#define VLOG_IS_ON(level) ((level) <= LOG_LEVEL)
# define CHECK_GE(a, b) LOG_SUPPRESS()
# define CHECK_NE(a, b) LOG_SUPPRESS()
# define CHECK_EQ(a, b) LOG_SUPPRESS()
# define CHECK_GT(a, b) LOG_SUPPRESS()
# define CHECK_LT(a, b) LOG_SUPPRESS()
# define CHECK_LE(a, b) LOG_SUPPRESS()
#define CHECK(expression) VLOG_IF(FATAL, !(expression))
#define CHECK_OP(op, a, b) VLOG_IF(FATAL, !((a)op(b)))
#define CHECK_GE(a, b) CHECK_OP(>=, a, b)
#define CHECK_NE(a, b) CHECK_OP(!=, a, b)
#define CHECK_EQ(a, b) CHECK_OP(==, a, b)
#define CHECK_GT(a, b) CHECK_OP(>, a, b)
#define CHECK_LT(a, b) CHECK_OP(<, a, b)
#define CHECK_LE(a, b) CHECK_OP(<=, a, b)
#ifndef NDEBUG
template<typename T> T DCheckNotNull(T &&t, const char *expression)
{
if (t == nullptr) {
LOG(FATAL) << "Failed " << expression << "is not null";
}
return std::forward<T>(t);
}
# define DCHECK(expression) VLOG_IF(DFATAL, !(expression)) << LOG_STRINGIFY(expression) << " "
# define DCHECK_NOTNULL(expression) DCheckNotNull(expression, LOG_STRINGIFY(expression))
# define DCHECK_OP(op, a, b) \
VLOG_IF(DFATAL, !((a)op(b))) << "Failed " << LOG_STRINGIFY(a) << " (" << a << ") " \
<< LOG_STRINGIFY(op) << " " << LOG_STRINGIFY(b) << " (" << b \
<< ") "
# define DCHECK_GE(a, b) DCHECK_OP(>=, a, b)
# define DCHECK_NE(a, b) DCHECK_OP(!=, a, b)
# define DCHECK_EQ(a, b) DCHECK_OP(==, a, b)
# define DCHECK_GT(a, b) DCHECK_OP(>, a, b)
# define DCHECK_LT(a, b) DCHECK_OP(<, a, b)
# define DCHECK_LE(a, b) DCHECK_OP(<=, a, b)
#else
# define LOG_SUPPRESS() VLOG_IF(DEBUG, false)
# define DCHECK(expression) LOG_SUPPRESS()
# define DCHECK_NOTNULL(expression) (expression)
# define DCHECK_NEAR(actual, expected, eps) LOG_SUPPRESS()
# define DCHECK_GE(a, b) LOG_SUPPRESS()
# define DCHECK_NE(a, b) LOG_SUPPRESS()
# define DCHECK_EQ(a, b) LOG_SUPPRESS()
# define DCHECK_GT(a, b) LOG_SUPPRESS()
# define DCHECK_LT(a, b) LOG_SUPPRESS()
# define DCHECK_LE(a, b) LOG_SUPPRESS()
# define LOG_ASSERT(expression) LOG_SUPPRESS()
#endif
/* Verbose logging categories. */
/* Warnings. */
#define VLOG_WARNING VLOG(1)
#define VLOG_WARNING VLOG(WARNING)
/* Info about devices, scene contents and features used. */
#define VLOG_INFO VLOG(2)
#define VLOG_INFO_IS_ON VLOG_IS_ON(2)
#define VLOG_INFO VLOG(INFO)
#define VLOG_INFO_IS_ON VLOG_IS_ON(INFO)
/* Work being performed and timing/memory stats about that work. */
#define VLOG_WORK VLOG(3)
#define VLOG_WORK_IS_ON VLOG_IS_ON(3)
#define VLOG_WORK VLOG(WORK)
#define VLOG_WORK_IS_ON VLOG_IS_ON(WORK)
/* Detailed device timing stats. */
#define VLOG_DEVICE_STATS VLOG(4)
#define VLOG_DEVICE_STATS_IS_ON VLOG_IS_ON(4)
#define VLOG_DEVICE_STATS VLOG(STATS)
#define VLOG_DEVICE_STATS_IS_ON VLOG_IS_ON(STATS)
/* Verbose debug messages. */
#define VLOG_DEBUG VLOG(5)
#define VLOG_DEBUG_IS_ON VLOG_IS_ON(5)
#define VLOG_DEBUG VLOG(DEBUG)
#define VLOG_DEBUG_IS_ON VLOG_IS_ON(DEBUG)
struct int2;
struct float3;
void util_logging_init(const char *argv0);
void util_logging_start();
void util_logging_verbosity_set(const int verbosity);
std::ostream &operator<<(std::ostream &os, const int2 &value);
std::ostream &operator<<(std::ostream &os, const float3 &value);

View File

@@ -16,5 +16,5 @@ set PYTHONPATH=
set DEBUGLOGS="%temp%\blender\debug_logs"
mkdir "%DEBUGLOGS%" > NUL 2>&1
"%~dp0\blender" --debug --debug-cycles --verbose 8 --log-level -1 --python-expr "import bpy; bpy.context.preferences.filepaths.temporary_directory=r'%DEBUGLOGS%'; bpy.ops.wm.sysinfo(filepath=r'%DEBUGLOGS%\blender_system_info.txt')" > "%DEBUGLOGS%\blender_debug_output.txt" 2>&1 < %0
"%~dp0\blender" --debug --log cycles --log-level 4 --python-expr "import bpy; bpy.context.preferences.filepaths.temporary_directory=r'%DEBUGLOGS%'; bpy.ops.wm.sysinfo(filepath=r'%DEBUGLOGS%\blender_system_info.txt')" > "%DEBUGLOGS%\blender_debug_output.txt" 2>&1 < %0
explorer "%DEBUGLOGS%"

View File

@@ -17,5 +17,5 @@ set DEBUGLOGS="%temp%\blender\debug_logs"
set VK_LOADER_DEBUG=all
mkdir "%DEBUGLOGS%" > NUL 2>&1
"%~dp0\blender" --debug --debug-gpu --debug-cycles --python-expr "import bpy; bpy.context.preferences.filepaths.temporary_directory=r'%DEBUGLOGS%'; bpy.ops.wm.sysinfo(filepath=r'%DEBUGLOGS%\blender_system_info.txt')" > "%DEBUGLOGS%\blender_debug_output.txt" 2>&1 < %0
"%~dp0\blender" --debug --debug-gpu --log cycles --python-expr "import bpy; bpy.context.preferences.filepaths.temporary_directory=r'%DEBUGLOGS%'; bpy.ops.wm.sysinfo(filepath=r'%DEBUGLOGS%\blender_system_info.txt')" > "%DEBUGLOGS%\blender_debug_output.txt" 2>&1 < %0
explorer "%DEBUGLOGS%"

View File

@@ -16,5 +16,5 @@ set PYTHONPATH=
set DEBUGLOGS="%temp%\blender\debug_logs"
mkdir "%DEBUGLOGS%" > NUL 2>&1
"%~dp0\blender" --debug --debug-cycles --python-expr "import bpy; bpy.context.preferences.filepaths.temporary_directory=r'%DEBUGLOGS%'; bpy.ops.wm.sysinfo(filepath=r'%DEBUGLOGS%\blender_system_info.txt')" > "%DEBUGLOGS%\blender_debug_output.txt" 2>&1 < %0
"%~dp0\blender" --debug --log cycles --python-expr "import bpy; bpy.context.preferences.filepaths.temporary_directory=r'%DEBUGLOGS%'; bpy.ops.wm.sysinfo(filepath=r'%DEBUGLOGS%\blender_system_info.txt')" > "%DEBUGLOGS%\blender_debug_output.txt" 2>&1 < %0
explorer "%DEBUGLOGS%"

View File

@@ -52,10 +52,7 @@ endif()
if(WITH_CYCLES)
add_definitions(-DWITH_CYCLES)
if(WITH_CYCLES_LOGGING)
list(APPEND INC ../../intern/cycles/blender)
add_definitions(-DWITH_CYCLES_LOGGING)
endif()
list(APPEND INC ../../intern/cycles/blender)
endif()
if(WITH_OPENGL_BACKEND)

View File

@@ -93,7 +93,9 @@
#ifdef WITH_LIBMV
# include "libmv-capi.h"
#elif defined(WITH_CYCLES_LOGGING)
#endif
#ifdef WITH_CYCLES
# include "CCL_api.h"
#endif
@@ -405,8 +407,6 @@ int main(int argc,
#ifdef WITH_LIBMV
libmv_initLogging(argv[0]);
#elif defined(WITH_CYCLES_LOGGING)
CCL_init_logging(argv[0]);
#endif
#if defined(WITH_TBB_MALLOC) && defined(_MSC_VER) && defined(NDEBUG) && defined(WITH_GMP)
@@ -496,6 +496,10 @@ int main(int argc,
/* Continue with regular initialization, no need to use "early" exit. */
app_init_data.early_exit = nullptr;
#ifdef WITH_CYCLES
CCL_log_init();
#endif
/* Must be initialized after #BKE_appdir_init to account for color-management paths. */
IMB_init();
/* Keep after #ARG_PASS_SETTINGS since debug flags are checked. */

View File

@@ -69,7 +69,7 @@
# include "libmv-capi.h"
# endif
# ifdef WITH_CYCLES_LOGGING
# ifdef WITH_CYCLES
# include "CCL_api.h"
# endif
@@ -90,7 +90,6 @@
struct BuildDefs {
bool win32;
bool with_cycles;
bool with_cycles_logging;
bool with_ffmpeg;
bool with_freestyle;
bool with_libmv;
@@ -117,9 +116,6 @@ static void build_defs_init(BuildDefs *build_defs, bool force_all)
# ifdef WITH_CYCLES
build_defs->with_cycles = true;
# endif
# ifdef WITH_CYCLES_LOGGING
build_defs->with_cycles_logging = true;
# endif
# ifdef WITH_FFMPEG
build_defs->with_ffmpeg = true;
# endif
@@ -741,9 +737,6 @@ static void print_help(bArgs *ba, bool all)
if (defs.with_libmv) {
BLI_args_print_arg_doc(ba, "--debug-libmv");
}
if (defs.with_cycles_logging) {
BLI_args_print_arg_doc(ba, "--debug-cycles");
}
BLI_args_print_arg_doc(ba, "--debug-memory");
BLI_args_print_arg_doc(ba, "--debug-jobs");
BLI_args_print_arg_doc(ba, "--debug-python");
@@ -1393,9 +1386,6 @@ static int arg_handle_debug_mode_all(int /*argc*/, const char ** /*argv*/, void
G.debug |= G_DEBUG_ALL;
# ifdef WITH_LIBMV
libmv_startDebugLogging();
# endif
# ifdef WITH_CYCLES_LOGGING
CCL_start_debug_logging();
# endif
return 0;
}
@@ -1416,9 +1406,8 @@ static const char arg_handle_debug_mode_cycles_doc[] =
"Enable debug messages from Cycles.";
static int arg_handle_debug_mode_cycles(int /*argc*/, const char ** /*argv*/, void * /*data*/)
{
# ifdef WITH_CYCLES_LOGGING
CCL_start_debug_logging();
# endif
const char *cycles_filter = "cycles.*";
CLG_type_filter_include(cycles_filter, strlen(cycles_filter));
return 0;
}
@@ -2094,10 +2083,6 @@ static int arg_handle_verbosity_set(int argc, const char **argv, void * /*data*/
# ifdef WITH_LIBMV
libmv_setLoggingVerbosity(level);
# elif defined(WITH_CYCLES_LOGGING)
CCL_logging_verbosity_set(level);
# else
(void)level;
# endif
return 1;
@@ -2821,7 +2806,7 @@ void main_args_setup(bContext *C, bArgs *ba, bool all)
if (defs.with_libmv) {
BLI_args_add(ba, nullptr, "--debug-libmv", CB(arg_handle_debug_mode_libmv), nullptr);
}
if (defs.with_cycles_logging) {
if (defs.with_cycles) {
BLI_args_add(ba, nullptr, "--debug-cycles", CB(arg_handle_debug_mode_cycles), nullptr);
}
BLI_args_add(ba, nullptr, "--debug-memory", CB(arg_handle_debug_mode_memory_set), nullptr);