diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2017-04-21 17:30:24 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2017-04-21 17:30:24 +0300 |
commit | cc2d501642555616f3e8808bdbaa72f9c752e1a1 (patch) | |
tree | a204ffc2ad092c8ab6464ce7e609f885e5c7eaef | |
parent | 111a53f74ccf2cd53e41d7597dfecbab041858a3 (diff) | |
parent | 7e977470f3e3e082082debe8a8b266ffea8dada6 (diff) |
Merge branch 'master' into blender2.8
-rw-r--r-- | CMakeLists.txt | 23 | ||||
-rw-r--r-- | build_files/cmake/Modules/FindGlog.cmake | 226 | ||||
-rw-r--r-- | build_files/cmake/Modules/GTestTesting.cmake | 4 | ||||
-rw-r--r-- | build_files/cmake/macros.cmake | 8 | ||||
-rw-r--r-- | intern/cycles/CMakeLists.txt | 2 | ||||
-rw-r--r-- | intern/cycles/app/CMakeLists.txt | 19 | ||||
-rw-r--r-- | intern/cycles/cmake/external_libs.cmake | 5 | ||||
-rw-r--r-- | intern/cycles/device/device.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/device/device.h | 10 | ||||
-rw-r--r-- | intern/cycles/kernel/closure/bsdf.h | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/closure/bssrdf.h | 9 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_subsurface.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_types.h | 7 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_closure.h | 2 | ||||
-rw-r--r-- | intern/cycles/render/nodes.cpp | 14 | ||||
-rw-r--r-- | intern/cycles/render/nodes.h | 14 | ||||
-rw-r--r-- | intern/cycles/render/shader.cpp | 3 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Matrix.c | 4 | ||||
-rw-r--r-- | source/blenderplayer/CMakeLists.txt | 5 | ||||
-rw-r--r-- | tests/gtests/testing/CMakeLists.txt | 11 | ||||
-rw-r--r-- | tests/python/CMakeLists.txt | 11 |
21 files changed, 338 insertions, 49 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b926842f155..13171ac2780 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -369,7 +369,9 @@ mark_as_advanced(WITH_LIBMV_SCHUR_SPECIALIZATIONS) # Logging/unbit test libraries. option(WITH_SYSTEM_GFLAGS "Use system-wide Gflags instead of a bundled one" OFF) +option(WITH_SYSTEM_GFLOG "Use system-wide Glog instead of a bundled one" OFF) mark_as_advanced(WITH_SYSTEM_GFLAGS) +mark_as_advanced(WITH_SYSTEM_GLOG) # Freestyle option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON) @@ -1333,9 +1335,24 @@ if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING)) set(GFLAGS_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/extern/gflags/src") endif() - set(GLOG_DEFINES - -DGOOGLE_GLOG_DLL_DECL= - ) + if(WITH_SYSTEM_GLOG) + find_package(Glog) + if(NOT GLOG_FOUND) + message(FATAL_ERROR "System wide Glog is requested but was not found") + endif() + # FindGlog does not define this, and we are not even sure what to use here. + set(GLOG_DEFINES) + else() + set(GLOG_DEFINES + -DGOOGLE_GLOG_DLL_DECL= + ) + set(GLOG_LIBRARIES extern_glog) + if(WIN32) + set(GLOG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/glog/src/windows) + else() + set(GLOG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/glog/src) + endif() + endif() endif() #----------------------------------------------------------------------------- diff --git a/build_files/cmake/Modules/FindGlog.cmake b/build_files/cmake/Modules/FindGlog.cmake new file mode 100644 index 00000000000..66c2aab2762 --- /dev/null +++ b/build_files/cmake/Modules/FindGlog.cmake @@ -0,0 +1,226 @@ +# Ceres Solver - A fast non-linear least squares minimizer +# Copyright 2015 Google Inc. All rights reserved. +# http://ceres-solver.org/ +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of Google Inc. nor the names of its contributors may be +# used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# Author: alexs.mac@gmail.com (Alex Stewart) +# + +# FindGlog.cmake - Find Google glog logging library. +# +# This module defines the following variables: +# +# GLOG_FOUND: TRUE iff glog is found. +# GLOG_INCLUDE_DIRS: Include directories for glog. +# GLOG_LIBRARIES: Libraries required to link glog. +# +# The following variables control the behaviour of this module: +# +# GLOG_INCLUDE_DIR_HINTS: List of additional directories in which to +# search for glog includes, e.g: /timbuktu/include. +# GLOG_LIBRARY_DIR_HINTS: List of additional directories in which to +# search for glog libraries, e.g: /timbuktu/lib. +# GFLOG_ROOT_DIR, The base directory to search for Glog. +# This can also be an environment variable. +# +# The following variables are also defined by this module, but in line with +# CMake recommended FindPackage() module style should NOT be referenced directly +# by callers (use the plural variables detailed above instead). These variables +# do however affect the behaviour of the module via FIND_[PATH/LIBRARY]() which +# are NOT re-called (i.e. search for library is not repeated) if these variables +# are set with valid values _in the CMake cache_. This means that if these +# variables are set directly in the cache, either by the user in the CMake GUI, +# or by the user passing -DVAR=VALUE directives to CMake when called (which +# explicitly defines a cache variable), then they will be used verbatim, +# bypassing the HINTS variables and other hard-coded search locations. +# +# GLOG_INCLUDE_DIR: Include directory for glog, not including the +# include directory of any dependencies. +# GLOG_LIBRARY: glog library, not including the libraries of any +# dependencies. + +# If GLOG_ROOT_DIR was defined in the environment, use it. +if(NOT GLOG_ROOT_DIR AND NOT $ENV{GLOG_ROOT_DIR} STREQUAL "") + set(GLOG_ROOT_DIR $ENV{GLOG_ROOT_DIR}) +endif() + +if(DEFINED GLOG_ROOT_DIR) + set(GLOG_ROOT_DIR_INCLUDE "${GLOG_ROOT_DIR}/include") + set(GLOG_ROOT_DIR_LIB "${GLOG_ROOT_DIR}/lib") +endif() + +# Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when +# FindGlog was invoked. +macro(GLOG_RESET_FIND_LIBRARY_PREFIX) + if(MSVC) + set(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}") + endif() +endmacro() + +# Called if we failed to find glog or any of it's required dependencies, +# unsets all public (designed to be used externally) variables and reports +# error message at priority depending upon [REQUIRED/QUIET/<NONE>] argument. +macro(GLOG_REPORT_NOT_FOUND REASON_MSG) + unset(GLOG_FOUND) + unset(GLOG_INCLUDE_DIRS) + unset(GLOG_LIBRARIES) + # Make results of search visible in the CMake GUI if glog has not + # been found so that user does not have to toggle to advanced view. + mark_as_advanced(CLEAR GLOG_INCLUDE_DIR + GLOG_LIBRARY) + + glog_reset_find_library_prefix() + + # Note <package>_FIND_[REQUIRED/QUIETLY] variables defined by FindPackage() + # use the camelcase library name, not uppercase. + if(Glog_FIND_QUIETLY) + message(STATUS "Failed to find glog - " ${REASON_MSG} ${ARGN}) + elseif(Glog_FIND_REQUIRED) + message(FATAL_ERROR "Failed to find glog - " ${REASON_MSG} ${ARGN}) + else() + # Neither QUIETLY nor REQUIRED, use no priority which emits a message + # but continues configuration and allows generation. + message("-- Failed to find glog - " ${REASON_MSG} ${ARGN}) + endif() + return() +endmacro() + +# Handle possible presence of lib prefix for libraries on MSVC, see +# also GLOG_RESET_FIND_LIBRARY_PREFIX(). +if(MSVC) + # Preserve the caller's original values for CMAKE_FIND_LIBRARY_PREFIXES + # s/t we can set it back before returning. + set(CALLERS_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}") + # The empty string in this list is important, it represents the case when + # the libraries have no prefix (shared libraries / DLLs). + set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "" "${CMAKE_FIND_LIBRARY_PREFIXES}") +endif() + +# Search user-installed locations first, so that we prefer user installs +# to system installs where both exist. +list(APPEND GLOG_CHECK_INCLUDE_DIRS + ${GLOG_ROOT_DIR_INCLUDE} + /usr/local/include + /usr/local/homebrew/include # Mac OS X + /opt/local/var/macports/software # Mac OS X. + /opt/local/include + /usr/include + /sw/include # Fink + /opt/csw/include # Blastwave + /opt/lib/glog/include) +# Windows (for C:/Program Files prefix). +list(APPEND GLOG_CHECK_PATH_SUFFIXES + glog/include + glog/Include + Glog/include + Glog/Include) + +list(APPEND GLOG_CHECK_LIBRARY_DIRS + ${GLOG_ROOT_DIR_LIB} + /usr/local/lib + /usr/local/homebrew/lib # Mac OS X. + /opt/local/lib + /usr/lib + /sw/lib # Fink + /opt/csw/lib # Blastwave + /opt/lib/gflags/lib) +# Windows (for C:/Program Files prefix). +list(APPEND GLOG_CHECK_LIBRARY_SUFFIXES + glog/lib + glog/Lib + Glog/lib + Glog/Lib) + +# Search supplied hint directories first if supplied. +find_path(GLOG_INCLUDE_DIR + NAMES glog/logging.h + PATHS ${GLOG_INCLUDE_DIR_HINTS} + ${GLOG_CHECK_INCLUDE_DIRS} + PATH_SUFFIXES ${GLOG_CHECK_PATH_SUFFIXES}) +if(NOT GLOG_INCLUDE_DIR OR + NOT EXISTS ${GLOG_INCLUDE_DIR}) + glog_report_not_found( + "Could not find glog include directory, set GLOG_INCLUDE_DIR " + "to directory containing glog/logging.h") +endif() + +find_library(GLOG_LIBRARY NAMES glog + PATHS ${GLOG_LIBRARY_DIR_HINTS} + ${GLOG_CHECK_LIBRARY_DIRS} + PATH_SUFFIXES ${GLOG_CHECK_LIBRARY_SUFFIXES}) +if(NOT GLOG_LIBRARY OR + NOT EXISTS ${GLOG_LIBRARY}) + glog_report_not_found( + "Could not find glog library, set GLOG_LIBRARY " + "to full path to libglog.") +endif() + +# Mark internally as found, then verify. GLOG_REPORT_NOT_FOUND() unsets +# if called. +set(GLOG_FOUND TRUE) + +# Glog does not seem to provide any record of the version in its +# source tree, thus cannot extract version. + +# Catch case when caller has set GLOG_INCLUDE_DIR in the cache / GUI and +# thus FIND_[PATH/LIBRARY] are not called, but specified locations are +# invalid, otherwise we would report the library as found. +if(GLOG_INCLUDE_DIR AND + NOT EXISTS ${GLOG_INCLUDE_DIR}/glog/logging.h) + glog_report_not_found( + "Caller defined GLOG_INCLUDE_DIR:" + " ${GLOG_INCLUDE_DIR} does not contain glog/logging.h header.") +endif() +# TODO: This regex for glog library is pretty primitive, we use lowercase +# for comparison to handle Windows using CamelCase library names, could +# this check be better? +string(TOLOWER "${GLOG_LIBRARY}" LOWERCASE_GLOG_LIBRARY) +if(GLOG_LIBRARY AND + NOT "${LOWERCASE_GLOG_LIBRARY}" MATCHES ".*glog[^/]*") + glog_report_not_found( + "Caller defined GLOG_LIBRARY: " + "${GLOG_LIBRARY} does not match glog.") +endif() + +# Set standard CMake FindPackage variables if found. +if(GLOG_FOUND) + set(GLOG_INCLUDE_DIRS ${GLOG_INCLUDE_DIR}) + set(GLOG_LIBRARIES ${GLOG_LIBRARY}) +endif() + +glog_reset_find_library_prefix() + +# Handle REQUIRED / QUIET optional arguments. +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GLOG DEFAULT_MSG + GLOG_INCLUDE_DIRS GLOG_LIBRARIES) + +# Only mark internal variables as advanced if we found glog, otherwise +# leave them visible in the standard GUI for the user to set manually. +if(GLOG_FOUND) + mark_as_advanced(FORCE GLOG_INCLUDE_DIR + GLOG_LIBRARY) +endif() diff --git a/build_files/cmake/Modules/GTestTesting.cmake b/build_files/cmake/Modules/GTestTesting.cmake index 9fd082ee402..ba1334d750e 100644 --- a/build_files/cmake/Modules/GTestTesting.cmake +++ b/build_files/cmake/Modules/GTestTesting.cmake @@ -20,7 +20,7 @@ macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST) set(TEST_INC ${_current_include_directories} ${CMAKE_SOURCE_DIR}/tests/gtests - ${CMAKE_SOURCE_DIR}/extern/glog/src + ${GLOG_INCLUDE_DIRS} ${GFLAGS_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/extern/gtest/include ${CMAKE_SOURCE_DIR}/extern/gmock/include @@ -37,7 +37,7 @@ macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST) extern_gmock # needed for glog ${PTHREADS_LIBRARIES} - extern_glog + ${GLOG_LIBRARIES} ${GFLAGS_LIBRARIES}) if(WITH_OPENMP_STATIC) target_link_libraries(${NAME}_test ${OpenMP_LIBRARIES}) diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 433580fd835..c7ada9c3cdf 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -491,6 +491,9 @@ function(setup_liblinks target_link_libraries(${target} ${NDOF_LIBRARIES}) endif() endif() + if(WITH_SYSTEM_GLOG) + target_link_libraries(${target} ${GLOG_LIBRARIES}) + endif() if(WITH_SYSTEM_GFLAGS) target_link_libraries(${target} ${GFLAGS_LIBRARIES}) endif() @@ -663,12 +666,15 @@ function(SETUP_BLENDER_SORTED_LIBS) extern_rangetree extern_wcwidth bf_intern_libmv - extern_glog extern_sdlew bf_intern_glew_mx ) + if(NOT WITH_SYSTEM_GLOG) + list(APPEND BLENDER_SORTED_LIBS extern_glog) + endif() + if(NOT WITH_SYSTEM_GFLAGS) list(APPEND BLENDER_SORTED_LIBS extern_gflags) endif() diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt index 806a8660e8c..c53a9f91cc0 100644 --- a/intern/cycles/CMakeLists.txt +++ b/intern/cycles/CMakeLists.txt @@ -191,7 +191,7 @@ endif() # Logging capabilities using GLog library. if(WITH_CYCLES_LOGGING) add_definitions(-DWITH_CYCLES_LOGGING) - add_definitions(-DGOOGLE_GLOG_DLL_DECL=) + add_definitions(${GLOG_DEFINES}) add_definitions(-DCYCLES_GFLAGS_NAMESPACE=${GFLAGS_NAMESPACE}) include_directories( SYSTEM diff --git a/intern/cycles/app/CMakeLists.txt b/intern/cycles/app/CMakeLists.txt index 231ef58f7ae..08a3931ef46 100644 --- a/intern/cycles/app/CMakeLists.txt +++ b/intern/cycles/app/CMakeLists.txt @@ -35,18 +35,15 @@ if(WITH_CYCLES_OSL) list(APPEND LIBRARIES cycles_kernel_osl) endif() -if(CYCLES_STANDALONE_REPOSITORY) - if(WITH_CYCLES_LOGGING) - list(APPEND LIBRARIES - ${GLOG_LIBRARIES} - ${GFLAGS_LIBRARIES} - ) - endif() -else() +if(NOT CYCLES_STANDALONE_REPOSITORY) list(APPEND LIBRARIES bf_intern_glew_mx bf_intern_guardedalloc) - if(WITH_CYCLES_LOGGING) - list(APPEND LIBRARIES extern_glog ${GFLAGS_LIBRARIES}) - endif() +endif() + +if(WITH_CYCLES_LOGGING) + list(APPEND LIBRARIES + ${GLOG_LIBRARIES} + ${GFLAGS_LIBRARIES} + ) endif() if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI) diff --git a/intern/cycles/cmake/external_libs.cmake b/intern/cycles/cmake/external_libs.cmake index 68e7f0a6eac..df88b91f5ac 100644 --- a/intern/cycles/cmake/external_libs.cmake +++ b/intern/cycles/cmake/external_libs.cmake @@ -135,10 +135,5 @@ if(CYCLES_STANDALONE_REPOSITORY) unset(_lib_DIR) else() - if(WIN32) - set(GLOG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/glog/src/windows) - else() - set(GLOG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/glog/src) - endif() set(LLVM_LIBRARIES ${LLVM_LIBRARY}) endif() diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp index 968af447e29..c024021b4b3 100644 --- a/intern/cycles/device/device.cpp +++ b/intern/cycles/device/device.cpp @@ -66,6 +66,8 @@ std::ostream& operator <<(std::ostream &os, << string_from_bool(requested_features.use_patch_evaluation) << std::endl; os << "Use Transparent Shadows: " << string_from_bool(requested_features.use_transparent) << std::endl; + os << "Use Principled BSDF: " + << string_from_bool(requested_features.use_principled) << std::endl; return os; } diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h index ac06e561795..6051dd8b3eb 100644 --- a/intern/cycles/device/device.h +++ b/intern/cycles/device/device.h @@ -124,6 +124,9 @@ public: /* Use various shadow tricks, such as shadow catcher. */ bool use_shadow_tricks; + /* Per-uber shader usage flags. */ + bool use_principled; + DeviceRequestedFeatures() { /* TODO(sergey): Find more meaningful defaults. */ @@ -141,6 +144,7 @@ public: use_patch_evaluation = false; use_transparent = false; use_shadow_tricks = false; + use_principled = false; } bool modified(const DeviceRequestedFeatures& requested_features) @@ -158,7 +162,8 @@ public: use_integrator_branched == requested_features.use_integrator_branched && use_patch_evaluation == requested_features.use_patch_evaluation && use_transparent == requested_features.use_transparent && - use_shadow_tricks == requested_features.use_shadow_tricks); + use_shadow_tricks == requested_features.use_shadow_tricks && + use_principled == requested_features.use_principled); } /* Convert the requested features structure to a build options, @@ -205,6 +210,9 @@ public: if(!use_shadow_tricks) { build_options += " -D__NO_SHADOW_TRICKS__"; } + if(!use_principled) { + build_options += " -D__NO_PRINCIPLED__"; + } return build_options; } }; diff --git a/intern/cycles/kernel/closure/bsdf.h b/intern/cycles/kernel/closure/bsdf.h index 0302fa9b43e..a6bba8bf74d 100644 --- a/intern/cycles/kernel/closure/bsdf.h +++ b/intern/cycles/kernel/closure/bsdf.h @@ -137,6 +137,7 @@ ccl_device_forceinline int bsdf_sample(KernelGlobals *kg, label = bsdf_hair_transmission_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv, eval, omega_in, &domega_in->dx, &domega_in->dy, pdf); break; +#ifdef __PRINCIPLED__ case CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID: case CLOSURE_BSDF_BSSRDF_PRINCIPLED_ID: label = bsdf_principled_diffuse_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv, @@ -146,6 +147,7 @@ ccl_device_forceinline int bsdf_sample(KernelGlobals *kg, label = bsdf_principled_sheen_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv, eval, omega_in, &domega_in->dx, &domega_in->dy, pdf); break; +#endif /* __PRINCIPLED__ */ #endif #ifdef __VOLUME__ case CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID: @@ -243,6 +245,7 @@ float3 bsdf_eval(KernelGlobals *kg, case CLOSURE_BSDF_HAIR_TRANSMISSION_ID: eval = bsdf_hair_transmission_eval_reflect(sc, sd->I, omega_in, pdf); break; +#ifdef __PRINCIPLED__ case CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID: case CLOSURE_BSDF_BSSRDF_PRINCIPLED_ID: eval = bsdf_principled_diffuse_eval_reflect(sc, sd->I, omega_in, pdf); @@ -250,6 +253,7 @@ float3 bsdf_eval(KernelGlobals *kg, case CLOSURE_BSDF_PRINCIPLED_SHEEN_ID: eval = bsdf_principled_sheen_eval_reflect(sc, sd->I, omega_in, pdf); break; +#endif /* __PRINCIPLED__ */ #endif #ifdef __VOLUME__ case CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID: @@ -323,6 +327,7 @@ float3 bsdf_eval(KernelGlobals *kg, case CLOSURE_BSDF_HAIR_TRANSMISSION_ID: eval = bsdf_hair_transmission_eval_transmit(sc, sd->I, omega_in, pdf); break; +#ifdef __PRINCIPLED__ case CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID: case CLOSURE_BSDF_BSSRDF_PRINCIPLED_ID: eval = bsdf_principled_diffuse_eval_transmit(sc, sd->I, omega_in, pdf); @@ -330,6 +335,7 @@ float3 bsdf_eval(KernelGlobals *kg, case CLOSURE_BSDF_PRINCIPLED_SHEEN_ID: eval = bsdf_principled_sheen_eval_transmit(sc, sd->I, omega_in, pdf); break; +#endif /* __PRINCIPLED__ */ #endif #ifdef __VOLUME__ case CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID: diff --git a/intern/cycles/kernel/closure/bssrdf.h b/intern/cycles/kernel/closure/bssrdf.h index 8363cef53c8..f9236a6e52c 100644 --- a/intern/cycles/kernel/closure/bssrdf.h +++ b/intern/cycles/kernel/closure/bssrdf.h @@ -362,6 +362,7 @@ ccl_device int bssrdf_setup(Bssrdf *bssrdf, ClosureType type) if(bssrdf->radius < BSSRDF_MIN_RADIUS) { /* revert to diffuse BSDF if radius too small */ int flag; +#ifdef __PRINCIPLED__ if(type == CLOSURE_BSSRDF_PRINCIPLED_ID) { float roughness = bssrdf->roughness; float3 N = bssrdf->N; @@ -377,7 +378,9 @@ ccl_device int bssrdf_setup(Bssrdf *bssrdf, ClosureType type) flag = bsdf_principled_diffuse_setup(bsdf); bsdf->type = CLOSURE_BSDF_BSSRDF_PRINCIPLED_ID; } - else { + else +#endif /* __PRINCIPLED__ */ + { DiffuseBsdf *bsdf = (DiffuseBsdf*)bssrdf; bsdf->N = bssrdf->N; flag = bsdf_diffuse_setup(bsdf); @@ -391,7 +394,9 @@ ccl_device int bssrdf_setup(Bssrdf *bssrdf, ClosureType type) bssrdf->sharpness = saturate(bssrdf->sharpness); bssrdf->type = type; - if(type == CLOSURE_BSSRDF_BURLEY_ID || type == CLOSURE_BSSRDF_PRINCIPLED_ID) { + if(type == CLOSURE_BSSRDF_BURLEY_ID || + type == CLOSURE_BSSRDF_PRINCIPLED_ID) + { bssrdf_burley_setup(bssrdf); } diff --git a/intern/cycles/kernel/kernel_subsurface.h b/intern/cycles/kernel/kernel_subsurface.h index fb4a054dcd0..f58eef7a368 100644 --- a/intern/cycles/kernel/kernel_subsurface.h +++ b/intern/cycles/kernel/kernel_subsurface.h @@ -149,6 +149,7 @@ ccl_device void subsurface_scatter_setup_diffuse_bsdf(ShaderData *sd, ShaderClos if(hit) { Bssrdf *bssrdf = (Bssrdf *)sc; +#ifdef __PRINCIPLED__ if(bssrdf->type == CLOSURE_BSSRDF_PRINCIPLED_ID) { PrincipledDiffuseBsdf *bsdf = (PrincipledDiffuseBsdf*)bsdf_alloc(sd, sizeof(PrincipledDiffuseBsdf), weight); @@ -164,6 +165,7 @@ ccl_device void subsurface_scatter_setup_diffuse_bsdf(ShaderData *sd, ShaderClos } else if(CLOSURE_IS_BSDF_BSSRDF(bssrdf->type) || CLOSURE_IS_BSSRDF(bssrdf->type)) +#endif /* __PRINCIPLED__ */ { DiffuseBsdf *bsdf = (DiffuseBsdf*)bsdf_alloc(sd, sizeof(DiffuseBsdf), weight); diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index 9d5cad3f3e1..a744c1d8277 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -78,6 +78,7 @@ CCL_NAMESPACE_BEGIN # define __OSL__ # endif # define __SUBSURFACE__ +# define __PRINCIPLED__ # define __CMJ__ # define __VOLUME__ # define __VOLUME_SCATTER__ @@ -94,6 +95,7 @@ CCL_NAMESPACE_BEGIN # define __VOLUME__ # define __VOLUME_SCATTER__ # define __SUBSURFACE__ +# define __PRINCIPLED__ # define __SHADOW_RECORD_ALL__ # ifndef __SPLIT_KERNEL__ # define __BRANCHED_PATH__ @@ -109,6 +111,7 @@ CCL_NAMESPACE_BEGIN # define __KERNEL_SHADING__ # define __KERNEL_ADV_SHADING__ # define __SUBSURFACE__ +# define __PRINCIPLED__ # define __VOLUME__ # define __VOLUME_SCATTER__ # define __SHADOW_RECORD_ALL__ @@ -134,6 +137,7 @@ CCL_NAMESPACE_BEGIN # define __KERNEL_SHADING__ # define __KERNEL_ADV_SHADING__ # define __SUBSURFACE__ +# define __PRINCIPLED__ # define __VOLUME__ # define __VOLUME_SCATTER__ # define __SHADOW_RECORD_ALL__ @@ -222,6 +226,9 @@ CCL_NAMESPACE_BEGIN #ifdef __NO_SHADOW_TRICKS__ # undef __SHADOW_TRICKS__ #endif +#ifdef __NO_PRINCIPLED__ +# undef __PRINCIPLED__ +#endif /* Random Numbers */ diff --git a/intern/cycles/kernel/svm/svm_closure.h b/intern/cycles/kernel/svm/svm_closure.h index 9a3689a94f4..407f8e784c0 100644 --- a/intern/cycles/kernel/svm/svm_closure.h +++ b/intern/cycles/kernel/svm/svm_closure.h @@ -76,6 +76,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float * float param2 = (stack_valid(param2_offset))? stack_load_float(stack, param2_offset): __uint_as_float(node.w); switch(type) { +#ifdef __PRINCIPLED__ case CLOSURE_BSDF_PRINCIPLED_ID: { uint specular_offset, roughness_offset, specular_tint_offset, anisotropic_offset, sheen_offset, sheen_tint_offset, clearcoat_offset, clearcoat_gloss_offset, eta_offset, transparency_offset, @@ -408,6 +409,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float * break; } +#endif /* __PRINCIPLED__ */ case CLOSURE_BSDF_DIFFUSE_ID: { float3 weight = sd->svm_closure_weight * mix_weight; OrenNayarBsdf *bsdf = (OrenNayarBsdf*)bsdf_alloc(sd, sizeof(OrenNayarBsdf), weight); diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 3f56690d0c1..f9679d52235 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -1791,12 +1791,19 @@ void ConvertNode::compile(OSLCompiler& compiler) assert(0); } +/* Base type for all closure-type nodes */ + +BsdfBaseNode::BsdfBaseNode(const NodeType *node_type) + : ShaderNode(node_type) +{ + special_type = SHADER_SPECIAL_TYPE_CLOSURE; +} + /* BSDF Closure */ BsdfNode::BsdfNode(const NodeType *node_type) -: ShaderNode(node_type) +: BsdfBaseNode(node_type) { - special_type = SHADER_SPECIAL_TYPE_CLOSURE; } void BsdfNode::compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2, ShaderInput *param3, ShaderInput *param4) @@ -2323,9 +2330,8 @@ NODE_DEFINE(PrincipledBsdfNode) } PrincipledBsdfNode::PrincipledBsdfNode() - : ShaderNode(node_type) + : BsdfBaseNode(node_type) { - special_type = SHADER_SPECIAL_TYPE_CLOSURE; closure = CLOSURE_BSDF_PRINCIPLED_ID; distribution = CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID; distribution_orig = NBUILTIN_CLOSURES; diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h index bc488161e3b..a56313bd5d4 100644 --- a/intern/cycles/render/nodes.h +++ b/intern/cycles/render/nodes.h @@ -321,7 +321,14 @@ private: static bool initialized; }; -class BsdfNode : public ShaderNode { +class BsdfBaseNode : public ShaderNode { +public: + BsdfBaseNode(const NodeType *node_type); + + ClosureType closure; +}; + +class BsdfNode : public BsdfBaseNode { public: explicit BsdfNode(const NodeType *node_type); SHADER_NODE_BASE_CLASS(BsdfNode) @@ -333,7 +340,6 @@ public: float3 color; float3 normal; float surface_mix_weight; - ClosureType closure; virtual bool equals(const ShaderNode& /*other*/) { @@ -362,7 +368,7 @@ public: }; /* Disney principled BRDF */ -class PrincipledBsdfNode : public ShaderNode { +class PrincipledBsdfNode : public BsdfBaseNode { public: SHADER_NODE_CLASS(PrincipledBsdfNode) @@ -381,7 +387,7 @@ public: anisotropic_rotation, refraction_roughness; float3 normal, clearcoat_normal, tangent; float surface_mix_weight; - ClosureType closure, distribution, distribution_orig; + ClosureType distribution, distribution_orig; virtual bool equals(const ShaderNode * /*other*/) { diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp index 23eee1916bd..a7d42a4b4a0 100644 --- a/intern/cycles/render/shader.cpp +++ b/intern/cycles/render/shader.cpp @@ -569,6 +569,9 @@ void ShaderManager::get_requested_graph_features(ShaderGraph *graph, if(CLOSURE_IS_VOLUME(bsdf_node->closure)) { requested_features->nodes_features |= NODE_FEATURE_VOLUME; } + else if(CLOSURE_IS_PRINCIPLED(bsdf_node->closure)) { + requested_features->use_principled = true; + } } if(node->has_surface_bssrdf()) { requested_features->use_subsurface = true; diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index bd44e77e7c6..10f428ba355 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -1641,9 +1641,9 @@ static PyObject *Matrix_rotate(MatrixObject *self, PyObject *value) PyDoc_STRVAR(Matrix_decompose_doc, ".. method:: decompose()\n" "\n" -" Return the location, rotation and scale components of this matrix.\n" +" Return the translation, rotation and scale components of this matrix.\n" "\n" -" :return: loc, rot, scale triple.\n" +" :return: trans, rot, scale triple.\n" " :rtype: (:class:`Vector`, :class:`Quaternion`, :class:`Vector`)" ); static PyObject *Matrix_decompose(MatrixObject *self) diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt index 38a287c6537..45a73cae26b 100644 --- a/source/blenderplayer/CMakeLists.txt +++ b/source/blenderplayer/CMakeLists.txt @@ -177,10 +177,13 @@ endif() extern_rangetree extern_wcwidth bf_intern_libmv - extern_glog extern_sdlew ) + if(NOT WITH_SYSTEM_GLOG) + list(APPEND BLENDER_SORTED_LIBS extern_glog) + endif() + if(NOT WITH_SYSTEM_GFLAGS) list(APPEND BLENDER_SORTED_LIBS extern_gflags) endif() diff --git a/tests/gtests/testing/CMakeLists.txt b/tests/gtests/testing/CMakeLists.txt index defa51df664..95ac59e6dce 100644 --- a/tests/gtests/testing/CMakeLists.txt +++ b/tests/gtests/testing/CMakeLists.txt @@ -24,20 +24,11 @@ set(INC . .. + ${GLOG_INCLUDE_DIRS} ${GFLAGS_INCLUDE_DIRS} ../../../extern/gtest/include ) -if(WIN32) - list(APPEND INC - ../../../extern/glog/src/windows - ) -else() - list(APPEND INC - ../../../extern/glog/src - ) -endif() - set(INC_SYS ) diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt index be8f79e8368..9a89ddd6fbc 100644 --- a/tests/python/CMakeLists.txt +++ b/tests/python/CMakeLists.txt @@ -18,7 +18,7 @@ # # ***** END GPL LICENSE BLOCK ***** -# --env-system-scripts allows to run without the install target. +# --env-system-scripts allows to run without the install target. # Use '--write-blend=/tmp/test.blend' to view output @@ -47,7 +47,7 @@ else() set(TEST_BLENDER_EXE ${EXECUTABLE_OUTPUT_PATH}/blender) endif() -# for testing with valgrind prefix: valgrind --track-origins=yes --error-limit=no +# for testing with valgrind prefix: valgrind --track-origins=yes --error-limit=no set(TEST_BLENDER_EXE_BARE ${TEST_BLENDER_EXE}) set(TEST_BLENDER_EXE ${TEST_BLENDER_EXE} --background -noaudio --factory-startup --env-system-scripts ${CMAKE_SOURCE_DIR}/release/scripts) @@ -444,6 +444,13 @@ if(WITH_CYCLES) endif() if(WITH_ALEMBIC) + find_package_wrapper(Alembic) + if(NOT ALEMBIC_FOUND) + message(FATAL_ERROR "Alembic is enabled but cannot be found") + endif() + get_filename_component(real_include_dir ${ALEMBIC_INCLUDE_DIR} REALPATH) + get_filename_component(ALEMBIC_ROOT_DIR ${real_include_dir} DIRECTORY) + add_test(script_alembic_import ${TEST_BLENDER_EXE} --python ${CMAKE_CURRENT_LIST_DIR}/bl_alembic_import_test.py -- |