Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add system and libraries information to render log #328

Merged
merged 3 commits into from
Oct 15, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/appleseed-max-impl/appleseedrenderer/appleseedrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
// appleseed.foundation headers.
#include "foundation/image/canvasproperties.h"
#include "foundation/image/image.h"
#include "foundation/platform/system.h"
#include "foundation/platform/thread.h"
#include "foundation/platform/types.h"
#include "foundation/utility/autoreleaseptr.h"
Expand Down Expand Up @@ -1072,9 +1073,6 @@ void AppleseedRendererPBlockAccessor::Set(

AppleseedRendererClassDesc g_appleseed_renderer_classdesc;
asf::auto_release_ptr<DialogLogTarget> g_dialog_log_target;
#if MAX_RELEASE < 19000
AppleseedRECompatible g_appleseed_renderelement_compatible;
#endif
AppleseedRendererPBlockAccessor g_pblock_accessor;

ParamBlockDesc2 g_param_block_desc(
Expand Down Expand Up @@ -2157,7 +2155,14 @@ int AppleseedRenderer::Render(
}

if (!m_rend_params.inMtlEdit || m_settings.m_log_material_editor_messages)
{
create_log_window();
print_libraries_information();
print_libraries_features();
print_third_party_libraries_information();
asf::System::print_information(asr::global_logger());
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep a single blank line.


if (renderer_settings.m_enable_noise_seed)
{
Expand Down Expand Up @@ -2238,6 +2243,7 @@ int AppleseedRenderer::Render(

if (progress_cb)
progress_cb->SetTitle(L"Rendering...");

if (m_settings.m_low_priority_mode)
{
asf::ProcessPriorityContext background_context(
Expand Down
85 changes: 85 additions & 0 deletions src/appleseed-max-impl/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
#include "renderer/api/texture.h"

// appleseed.foundation headers.
#include "foundation/core/appleseed.h"
#include "foundation/core/thirdparties.h"
#include "foundation/image/canvasproperties.h"
#include "foundation/image/tile.h"
#include "foundation/utility/searchpaths.h"
Expand Down Expand Up @@ -68,6 +70,89 @@
namespace asf = foundation;
namespace asr = renderer;

const char* to_enabled_disabled(const bool value)
{
return value ? "enabled" : "disabled";
}

void print_libraries_information()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print_appleseed_library_information() would be clearer.

{
RENDERER_LOG_INFO(
"appleseed for Autodesk 3ds Max using %s version %s, %s configuration\n"
"compiled on %s at %s using %s version %s\n"
"copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited\n"
"copyright (c) 2014-2019 The appleseedhq Organization\n"
"this software is released under the MIT license (https://opensource.org/licenses/MIT).\n"
"visit https://appleseedhq.net/ for additional information and resources.",
asf::Appleseed::get_lib_name(),
asf::Appleseed::get_lib_version(),
asf::Appleseed::get_lib_configuration(),
asf::Appleseed::get_lib_compilation_date(),
asf::Appleseed::get_lib_compilation_time(),
asf::Compiler::get_compiler_name(),
asf::Compiler::get_compiler_version());
}

void print_libraries_features()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, print_appleseed_library_features() here.

{
const bool WithDisneyMaterial =
#ifdef APPLESEED_WITH_DISNEY_MATERIAL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left-align preprocessor statements.

true;
#else
false;
#endif

const bool WithEmbree =
#ifdef APPLESEED_WITH_EMBREE
true;
#else
false;
#endif

const bool WithSpectralSupport =
#ifdef APPLESEED_WITH_SPECTRAL_SUPPORT
true;
#else
false;
#endif

const bool WithGPUSupport =
#ifdef APPLESEED_WITH_GPU
true;
#else
false;
#endif

RENDERER_LOG_INFO(
"library features:\n"
" Instruction sets %s\n"
" Disney material with SeExpr %s\n"
" Embree %s\n"
" Spectral support %s\n"
" GPU support %s",
asf::Appleseed::get_lib_cpu_features(),
to_enabled_disabled(WithDisneyMaterial),
to_enabled_disabled(WithEmbree),
to_enabled_disabled(WithSpectralSupport),
to_enabled_disabled(WithGPUSupport));
}

void print_third_party_libraries_information()
{
const asf::LibraryVersionArray versions = asf::ThirdParties::get_versions();
RENDERER_LOG_INFO("third party libraries:\n");
for (size_t i = 0, e = versions.size(); i < e; ++i)
{
const asf::APIStringPair& version = versions[i];
const char* lib_name = version.m_first.c_str();
const char* lib_version = version.m_second.c_str();
const size_t lib_name_length = strlen(lib_name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::strlen()

(And yes, the std:: qualifier is missing on appleseed's side.)

const std::string spacing(30 - lib_name_length, ' ');
RENDERER_LOG_INFO(" %s%s%s", lib_name, spacing.c_str(), lib_version);
}
}


void update_map_buttons(IParamMap2* param_map)
{
if (param_map == nullptr)
Expand Down
12 changes: 11 additions & 1 deletion src/appleseed-max-impl/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class Texmap;

void update_map_buttons(IParamMap2* param_map);


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert, we use two blank lines before block comments.

//
// Bitmap functions.
//
Expand Down Expand Up @@ -129,6 +128,17 @@ std::string insert_procedural_texture_and_instance(
renderer::ParamArray texture_params = renderer::ParamArray(),
renderer::ParamArray texture_instance_params = renderer::ParamArray());

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add additional blank line.

//
// Version information functions.
//

extern void print_libraries_information();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extern qualifiers are redundant, you can remove them.


extern void print_libraries_features();

extern const char* to_enabled_disabled(const bool value);

extern void print_third_party_libraries_information();

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add additional blank line.

//
// Implementation.
Expand Down