diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-01-31 21:35:00 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-02-12 21:06:35 +0300 |
commit | 1b4961b318f14064bc3c915da7206a74146af95d (patch) | |
tree | fd8168e60333efad3dd0433b5229e2f7f9d97131 /build_files/build_environment/cmake/opencolorio.cmake | |
parent | 6b40ee608c5a1dbe67870fab4b83cce4cc4b54f5 (diff) |
OpenColorIO: upgrade to version 2.0.0
Ref T84819
Build System
============
This is an API breaking new version, and the updated code only builds with
OpenColorIO 2.0 and later. Adding backwards compatibility was too complicated.
* Tinyxml was replaced with Expat, adding a new dependency.
* Yaml-cpp is now built as a dependency on Unix, as was already done on Windows.
* Removed currently unused LCMS code.
* Pystring remains built as part of OCIO itself, since it has no good build system.
* Linux and macOS check for the OpenColorIO verison, and disable it if too old.
Ref D10270
Processors and Transforms
=========================
CPU processors now need to be created to do CPU processing. These are cached
internally, but the cache lookup is not fast enough to execute per pixel or
texture sample, so for performance these are now also exposed in the C API.
The C API for transforms will no longer be needed afer all changes, so remove
it to simplify the API and fallback implementation.
Ref D10271
Display Transforms
==================
Needs a bit more manual work constructing the transform. LegacyViewingPipeline
could also have been used, but isn't really any simpler and since it's legacy
we better not rely on it.
We moved more logic into the opencolorio module, to simplify the API. There is
no need to wrap a dozen functions just to be able to do this in C rather than C++.
It's also tightly coupled to the GPU shader logic, and so should be in the same
module.
Ref D10271
GPU Display Shader
==================
To avoid baking exposure and gamma into the GLSL shader and requiring slow
recompiles when tweaking, we manually apply them in the shader. This leads
to some logic duplicaton between the CPU and GPU display processor, but it
seems unavoidable.
Caching was also changed. Previously this was done both on the imbuf and
opencolorio module levels. Now it's all done in the opencolorio module by
simply matching color space names. We no longer use cacheIDs from OpenColorIO
since computing them is expensive, and they are unlikely to match now that
more is baked into the shader code.
Shaders can now use multiple 2D textures, 3D textures and uniforms, rather
than a single 3D texture. So allocating and binding those adds some code.
Color space conversions for blending with overlays is now hardcoded in the
shader. This was using harcoded numbers anyway, if this every becomes a
general OpenColorIO transform it can be changed, but for now there is no
point to add code complexity.
Ref D10273
CIE XYZ
=======
We need standard CIE XYZ values for rendering effects like blackbody emission.
The relation to the scene linear role is based on OpenColorIO configuration.
In OpenColorIO 2.0 configs roles can no longer have the same name as color
spaces, which means our XYZ role and colorspace in the configuration give an
error.
Instead use the new standard aces_interchange role, which relates scene linear
to a known scene referred color space. Compatibility with the old XYZ role is
preserved, if the configuration file has no conflicting names.
Also includes a non-functional change to the configuraton file to use an
XYZ-to-ACES matrix instead of REC709-to-ACES, makes debugging a little easier
since the matrix is the same one we have in the code now and that is also
found easily in the ACES specs.
Ref D10274
Diffstat (limited to 'build_files/build_environment/cmake/opencolorio.cmake')
-rw-r--r-- | build_files/build_environment/cmake/opencolorio.cmake | 77 |
1 files changed, 30 insertions, 47 deletions
diff --git a/build_files/build_environment/cmake/opencolorio.cmake b/build_files/build_environment/cmake/opencolorio.cmake index 4ad401800d0..7622a2afdaa 100644 --- a/build_files/build_environment/cmake/opencolorio.cmake +++ b/build_files/build_environment/cmake/opencolorio.cmake @@ -18,16 +18,22 @@ set(OPENCOLORIO_EXTRA_ARGS -DOCIO_BUILD_APPS=OFF - -DOCIO_BUILD_PYGLUE=OFF + -DOCIO_BUILD_PYTHON=OFF -DOCIO_BUILD_NUKE=OFF - -DOCIO_USE_BOOST_PTR=OFF - -DOCIO_BUILD_STATIC=ON - -DOCIO_BUILD_SHARED=OFF - -DOCIO_BUILD_TRUELIGHT=OFF + -DOCIO_BUILD_JAVA=OFF + -DBUILD_SHARED_LIBS=OFF -DOCIO_BUILD_DOCS=OFF - -DOCIO_BUILD_PYGLUE=OFF - -DOCIO_BUILD_JNIGLUE=OFF - -DOCIO_STATIC_JNIGLUE=OFF + -DOCIO_BUILD_TESTS=OFF + -DOCIO_BUILD_GPU_TESTS=OFF + -DOCIO_USE_SSE=ON + + # Manually build ext packages except for pystring, which does not have + # a CMake or autotools build system that we can easily use. + -DOCIO_INSTALL_EXT_PACKAGES=MISSING + -DHalf_ROOT=${LIBDIR}/openexr + -DHalf_STATIC_LIBRARY=ON + -Dexpat_ROOT=${LIBDIR}/expat + -Dyaml-cpp_ROOT=${LIBDIR}/yamlcpp ) if(APPLE AND NOT("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")) @@ -41,24 +47,7 @@ if(WIN32) set(OCIO_PATCH opencolorio_win.diff) set(OPENCOLORIO_EXTRA_ARGS ${OPENCOLORIO_EXTRA_ARGS} - -DOCIO_BUILD_TESTS=OFF - -DOCIO_USE_SSE=ON -DOCIO_INLINES_HIDDEN=OFF - -DOCIO_PYGLUE_LINK=OFF - -DOCIO_PYGLUE_RESPECT_ABI=OFF - -DOCIO_PYGLUE_SONAME=OFF - -DOCIO_PYGLUE_LIB_PREFIX=OFF - -DUSE_EXTERNAL_TINYXML=ON - -DTINYXML_INCLUDE_DIR=${LIBDIR}/tinyxml/include - -DTINYXML_LIBRARY=${LIBDIR}/tinyxml/lib/tinyxml${libext} - -DUSE_EXTERNAL_YAML=ON - -DYAML_CPP_FOUND=ON - -DYAML_CPP_VERSION=${YAMLCPP_VERSION} - -DUSE_EXTERNAL_LCMS=ON - -DINC_1=${LIBDIR}/tinyxml/include - -DINC_2=${LIBDIR}/yamlcpp/include - # Lie because ocio cmake is demanding boost even though it is not needed. - -DYAML_CPP_VERSION=0.5.0 ) else() set(OCIO_PATCH opencolorio.diff) @@ -72,48 +61,42 @@ ExternalProject_Add(external_opencolorio DOWNLOAD_DIR ${DOWNLOAD_DIR} URL_HASH MD5=${OPENCOLORIO_HASH} PREFIX ${BUILD_DIR}/opencolorio - PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/opencolorio/src/external_opencolorio < ${PATCH_DIR}/${OCIO_PATCH} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/opencolorio ${DEFAULT_CMAKE_FLAGS} ${OPENCOLORIO_EXTRA_ARGS} INSTALL_DIR ${LIBDIR}/opencolorio ) -if(NOT WIN32) - add_custom_command( - OUTPUT ${LIBDIR}/opencolorio/lib/libtinyxml.a - COMMAND cp ${BUILD_DIR}/opencolorio/src/external_opencolorio-build/ext/dist/lib/libtinyxml.a ${LIBDIR}/opencolorio/lib/libtinyxml.a - COMMAND cp ${BUILD_DIR}/opencolorio/src/external_opencolorio-build/ext/dist/lib/libyaml-cpp.a ${LIBDIR}/opencolorio/lib/libyaml-cpp.a - ) - add_custom_target(external_opencolorio_extra ALL DEPENDS external_opencolorio ${LIBDIR}/opencolorio/lib/libtinyxml.a) -endif() - add_dependencies( external_opencolorio - external_boost + external_yamlcpp + external_expat + external_openexr ) if(WIN32) - add_dependencies( - external_opencolorio - external_tinyxml - external_yamlcpp - - ) if(BUILD_MODE STREQUAL Release) ExternalProject_Add_Step(external_opencolorio after_install COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/opencolorio/include ${HARVEST_TARGET}/opencolorio/include - COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/opencolorio/lib/static ${HARVEST_TARGET}/opencolorio/lib + COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/opencolorio/lib ${HARVEST_TARGET}/opencolorio/lib COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/yamlcpp/lib/libyaml-cppmd.lib ${HARVEST_TARGET}/opencolorio/lib/libyaml-cpp.lib - COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tinyxml/lib/tinyxml.lib ${HARVEST_TARGET}/opencolorio/lib/tinyxml.lib + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/expat/lib/libexpatMD.lib ${HARVEST_TARGET}/opencolorio/lib/libexpatMD.lib + COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/opencolorio/src/external_opencolorio-build/ext/dist/lib/pystring.lib ${HARVEST_TARGET}/opencolorio/lib/pystring.lib DEPENDEES install ) endif() if(BUILD_MODE STREQUAL Debug) ExternalProject_Add_Step(external_opencolorio after_install - COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencolorio/lib/static/Opencolorio.lib ${HARVEST_TARGET}/opencolorio/lib/OpencolorIO_d.lib + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencolorio/lib/Opencolorio.lib ${HARVEST_TARGET}/opencolorio/lib/OpencolorIO_d.lib COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/yamlcpp/lib/libyaml-cppmdd.lib ${HARVEST_TARGET}/opencolorio/lib/libyaml-cpp_d.lib - COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tinyxml/lib/tinyxml.lib ${HARVEST_TARGET}/opencolorio/lib/tinyxml_d.lib + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/expat/lib/libexpatdMD.lib ${HARVEST_TARGET}/opencolorio/lib/libexpatdMD.lib + COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/opencolorio/src/external_opencolorio-build/ext/dist/lib/pystring.lib ${HARVEST_TARGET}/opencolorio/lib/pystring_d.lib DEPENDEES install ) endif() - +else() + ExternalProject_Add_Step(external_opencolorio after_install + COMMAND cp ${LIBDIR}/yamlcpp/lib/libyaml-cpp.a ${LIBDIR}/opencolorio/lib/ + COMMAND cp ${LIBDIR}/expat/lib/libexpat.a ${LIBDIR}/opencolorio/lib/ + COMMAND cp ${BUILD_DIR}/opencolorio/src/external_opencolorio-build/ext/dist/lib/libpystring.a ${LIBDIR}/opencolorio/lib/ + DEPENDEES install + ) endif() |