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

Trying out OCIO v2 #468

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
build
Debug
Release
*build*/*
etc/SuperBuild/.vs
etc/SuperBuild/CMakeSettings.json
*Debug*/*
*Release*/*
RelWithDebInfo
docs/doxygen
*~
.git
.vscode

.vs
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ set(TIFF_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(PNG_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(ILMBASE_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(OPENEXR_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(OCIO_SHARED_LIBS ${BUILD_SHARED_LIBS})
# Static linking for OCIO needs extra configuration. Dynamic only for now
# set(OCIO_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(OTIO_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(FFmpeg_SHARED_LIBS ON)

Expand Down
7 changes: 3 additions & 4 deletions etc/SuperBuild/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.18)
cmake_policy(SET CMP0091 NEW)
cmake_policy(SET CMP0097 NEW)
cmake_policy(SET CMP0135 NEW)


project(DJV-SuperBuild)

Expand All @@ -19,7 +21,6 @@ set(DJV_THIRD_PARTY_curl FALSE CACHE BOOL "Build curl")
set(DJV_THIRD_PARTY_FFmpeg FALSE CACHE BOOL "Build FFmpeg")
set(DJV_THIRD_PARTY_JPEG TRUE CACHE BOOL "Build JPEG")
set(DJV_THIRD_PARTY_TIFF TRUE CACHE BOOL "Build TIFF")
set(DJV_THIRD_PARTY_OpenEXR TRUE CACHE BOOL "Build OpenEXR")
set(DJV_THIRD_PARTY_OpenVDB FALSE CACHE BOOL "Build OpenVDB")
set(DJV_THIRD_PARTY_OpenCV FALSE CACHE BOOL "Build OpenCV")
set(DJV_THIRD_PARTY_OpenImageIO FALSE CACHE BOOL "Build OpenImageIO")
Expand Down Expand Up @@ -71,6 +72,7 @@ list(APPEND DJV_THIRD_PARTY_DEPS RtAudio)
#list(APPEND DJV_THIRD_PARTY_DEPS Imath)
list(APPEND DJV_THIRD_PARTY_DEPS IlmBase)
list(APPEND DJV_THIRD_PARTY_DEPS PNG)
list(APPEND DJV_THIRD_PARTY_DEPS OpenEXR)
list(APPEND DJV_THIRD_PARTY_DEPS OCIO)
#list(APPEND DJV_THIRD_PARTY_DEPS OTIO)
list(APPEND DJV_THIRD_PARTY_DEPS FreeType)
Expand Down Expand Up @@ -115,9 +117,6 @@ endif()
if(DJV_THIRD_PARTY_TIFF)
list(APPEND DJV_THIRD_PARTY_DEPS TIFF)
endif()
if(DJV_THIRD_PARTY_OpenEXR)
list(APPEND DJV_THIRD_PARTY_DEPS OpenEXR)
endif()
if(DJV_THIRD_PARTY_OpenVDB)
list(APPEND DJV_THIRD_PARTY_DEPS OpenVDB)
endif()
Expand Down
2 changes: 1 addition & 1 deletion etc/SuperBuild/ZLIB-patch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)

project(zlib C)

set(VERSION "1.2.11")
set(VERSION "1.2.12")

option(ASM686 "Enable building i686 assembly implementation")
option(AMD64 "Enable building amd64 assembly implementation")
Expand Down
37 changes: 17 additions & 20 deletions etc/SuperBuild/cmake/Modules/BuildOCIO.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,26 @@ set(OCIO_ARGS
-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DCMAKE_INSTALL_LIBDIR=lib
-DCMAKE_PREFIX_PATH=${CMAKE_INSTALL_PREFIX}
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_POLICY_DEFAULT_CMP0091:STRING=NEW
-DCMAKE_FIND_FRAMEWORK=${CMAKE_FIND_FRAMEWORK}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY}
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DBUILD_SHARED_LIBS=ON
-DOCIO_BUILD_APPS=OFF
-DOCIO_BUILD_NUKE=OFF
-DOCIO_BUILD_JAVA=OFF
-DOCIO_BUILD_DOCS=OFF
-DOCIO_BUILD_TESTS=OFF
-DOCIO_BUILD_PYGLUE=OFF
-DOCIO_STATIC_JNIGLUE=OFF
-DYAML_CPP_OBJECT_LIB_EMBEDDED=ON
-DTINYXML_OBJECT_LIB_EMBEDDED=ON)
if(BUILD_SHARED_LIBS)
set(OCIO_ARGS ${OCIO_ARGS} -DOCIO_BUILD_SHARED=ON -DOCIO_BUILD_STATIC=OFF)
else()
set(OCIO_ARGS ${OCIO_ARGS} -DOCIO_BUILD_SHARED=OFF -DOCIO_BUILD_STATIC=ON)
endif()
if(CMAKE_CXX_STANDARD)
set(OCIO_ARGS ${OCIO_ARGS} -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD})
endif()
-DOCIO_BUILD_GPU_TESTS=OFF
-DOCIO_BUILD_PYTHON=OFF
-DOCIO_USE_OPENEXR_HALF=ON
-DOCIO_INSTALL_EXT_PACKAGES=ALL
)


cmake_host_system_information(RESULT HAS_SSE2 QUERY HAS_SSE2)
set(OCIO_ARGS ${OCIO_ARGS} -DOCIO_USE_SSE=${HAS_SSE2})
if(APPLE)
Expand All @@ -45,9 +40,11 @@ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/OCIO/src/OCIO-build/ext)
ExternalProject_Add(
OCIO
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/OCIO
URL "http://github.com/imageworks/OpenColorIO/archive/v1.1.1.tar.gz"
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/OCIO-patch/src/core/CMakeLists.txt
${CMAKE_CURRENT_BINARY_DIR}/OCIO/src/OCIO/src/core/CMakeLists.txt
CMAKE_ARGS ${OCIO_ARGS})
# Currently only works on master branch
GIT_REPOSITORY https://github.com/AcademySoftwareFoundation/OpenColorIO.git
GIT_TAG main
# URL "https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/refs/tags/v2.1.2.zip"
# SOURCE_DIR "D:/code/OpenColorIO/"
CMAKE_ARGS ${OCIO_ARGS}
STEP_TARGETS install)

2 changes: 1 addition & 1 deletion etc/SuperBuild/cmake/Modules/BuildZLIB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ endif()
ExternalProject_Add(
ZLIB
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/ZLIB
URL http://www.zlib.net/zlib-1.2.11.tar.gz
URL http://www.zlib.net/zlib-1.2.12.tar.gz
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/ZLIB-patch/CMakeLists.txt
${CMAKE_CURRENT_BINARY_DIR}/ZLIB/src/ZLIB/CMakeLists.txt
Expand Down
2 changes: 1 addition & 1 deletion etc/SuperBuild/tests/FSeqTest/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ int main(int argc, char* argv[])
{
FSeqFileName components;
fseqFileNameInit(&components);
fseqFileNameSplit("/tmp/render.1.exr", &components, FSEQ_STRING_LEN);
fseqFileNameSplit("/tmp/render.1.exr", &components, FSEQ_STRING_LEN, NULL);
std::cout << "path: " << components.path << std::endl;
std::cout << "base: " << components.base << std::endl;
std::cout << "number: " << components.number << std::endl;
Expand Down
12 changes: 9 additions & 3 deletions etc/SuperBuild/tests/OCIOTest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
find_package(OCIO REQUIRED)
find_package(OpenColorIO REQUIRED)

set(source main.cpp)

add_executable(OCIOTest ${header} ${source})
target_link_libraries(OCIOTest OCIO)
add_executable(OCIOTest ${source})


find_package(OpenColorIO REQUIRED)
include(CMakePrintHelpers)
cmake_print_variables(OCIO_INCLUDE_DIRS)
include_directories (${OCIO_INCLUDE_DIRS})
target_link_libraries (OCIOTest ${OCIO_LIBRARIES})

add_test(OCIOTest OCIOTest)
2 changes: 2 additions & 0 deletions lib/djvAV/ThumbnailSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

#include <future>

#include <djvAV/IO.h>

namespace djv
{
namespace System
Expand Down
11 changes: 10 additions & 1 deletion lib/djvOCIO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,20 @@ set(source
OCIO.cpp
OCIOSystem.cpp)


if(NOT BUILD_SHARED_LIBS)
add_compile_definitions(OpenColorIO_SKIP_IMPORTS)
endif()

add_library(djvOCIO ${header} ${source})

find_package(OCIO REQUIRED)
include_directories (${OCIO_INCLUDES})
set(LIBRARIES
djvGL
OCIO)
${OCIO_LIBRARIES})
target_link_libraries(djvOCIO ${LIBRARIES})

set_target_properties(
djvOCIO
PROPERTIES
Expand Down
4 changes: 2 additions & 2 deletions lib/djvOCIO/OCIOSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,8 @@ namespace djv
const char* viewName = ocioConfig->getView(displayName, j);
View view;
view.name = viewName;
view.colorSpace = ocioConfig->getDisplayColorSpaceName(displayName, viewName);
view.looks = ocioConfig->getDisplayLooks(displayName, viewName);
view.colorSpace = ocioConfig->getDisplayViewColorSpaceName(displayName, viewName);
view.looks = ocioConfig->getDisplayViewLooks(displayName, viewName);
display.views.push_back(view);
}
displays.push_back(display);
Expand Down
19 changes: 12 additions & 7 deletions lib/djvRender2D/Render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1274,21 +1274,26 @@ namespace djv
colorSpaceData.lut3D.reset(new LUT3D);
auto config = _OCIO::GetCurrentConfig();
auto processor = config->getProcessor(options.colorSpace.input.c_str(), options.colorSpace.output.c_str());
_OCIO::GpuShaderDesc shaderDesc;
shaderDesc.setLanguage(_OCIO::GPU_LANGUAGE_GLSL_1_3);

auto gpu = processor->getOptimizedLegacyGPUProcessor(_OCIO::OPTIMIZATION_DEFAULT, colorSpaceData.lut3D->getEdgeLen());
auto shaderDesc = _OCIO::GpuShaderDesc::CreateShaderDesc();

shaderDesc->setLanguage(_OCIO::GPU_LANGUAGE_GLSL_1_3);
std::stringstream ss;
ss << "colorSpace" << colorSpaceData.id;
shaderDesc.setFunctionName(ss.str().c_str());
shaderDesc.setLut3DEdgeLen(colorSpaceData.lut3D->getEdgeLen());
colorSpaceData.shaderSource = processor->getGpuShaderText(shaderDesc);
shaderDesc->setFunctionName(ss.str().c_str());
shaderDesc->setResourcePrefix("ocio_");
gpu->extractGpuShaderInfo(shaderDesc);

colorSpaceData.shaderSource = shaderDesc->getShaderText();
size_t index = colorSpaceData.shaderSource.find("texture3D");
if (index != std::string::npos)
{
colorSpaceData.shaderSource.replace(index, std::string("texture3D").size(), "texture");
}
auto data = colorSpaceData.lut3D->getData();
processor->getGpuLut3D(data, shaderDesc);
colorSpaceData.lut3D->copy();
// processor->getGpuLut3D(data, shaderDesc);
// colorSpaceData.lut3D->copy();
colorSpaceCache[options.colorSpace] = colorSpaceData;
shader.reset();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/djvScene3D/OpenNURBS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <djvGeom/TriangleMesh.h>

#include <djvCore/StringFormat.h>
#include <djvCore/StringFunc.h>
#include <djvCore/String.h>

#include <opennurbs/opennurbs.h>

Expand Down
2 changes: 1 addition & 1 deletion lib/djvSystem/Path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ namespace djv
{
FSeqFileNameSizes sizes;
fseqFileNameSizesInit(&sizes);
fseqFileNameParseSizes(in.c_str(), &sizes, FSEQ_STRING_LEN);
fseqFileNameParseSizes(in.c_str(), &sizes, FSEQ_STRING_LEN, NULL);
path = in.substr(0, sizes.path);
base = in.substr(sizes.path, sizes.base);
number = in.substr(sizes.path + static_cast<size_t>(sizes.base), sizes.number);
Expand Down