Commit 3d24ed13 authored by Amy spark's avatar Amy spark 👉
Browse files

OpenColorIO: support VFX Platform CY2021 and newer

This commits enables the new optimized GPU pipeline only with the GLES
support patch upstream.

These are scheduled for the next 2.1.x release along with 2.2, so I'll
target those versions.

BUG: 435474
parent 4962149c
From c9b6bf0510e905d117095a878556af800b7f814e Mon Sep 17 00:00:00 2001
From: "L. E. Segovia" <amy@amyspark.me>
Date: Fri, 26 Feb 2021 11:58:52 +0000
Subject: [PATCH 1/2] Fix MinGW and MSVC detection
---
CMakeLists.txt | 19 +++++++++++++------
export/OpenColorIO/OpenColorIO.h | 8 ++++----
src/core/CMakeLists.txt | 6 ++----
src/core/OCIOYaml.cpp | 6 +++---
src/core/Platform.cpp | 2 +-
src/core/UnitTest.cpp | 4 ++--
src/core/UnitTest.h | 4 ++--
src/core_tests/CMakeLists.txt | 2 +-
src/pyglue/CMakeLists.txt | 2 +-
9 files changed, 29 insertions(+), 24 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e4f3119..44fc747 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,6 +9,12 @@ if(NOT DEFINED CMAKE_FIRST_RUN)
SET(CMAKE_FIRST_RUN 1 CACHE INTERNAL "")
endif()
+if (WIN32)
+ set(PATCH myptch)
+else()
+ set(PATCH patch)
+endif ()
+
###############################################################################
### GLOBAL ###
@@ -29,7 +35,7 @@ option(OCIO_INLINES_HIDDEN "Specify whether to build with -fvisibility-inlines-h
# Use boost's shared_ptr by default on Windows (as <VS2010 doesn't have it),
# Use std::tr1::shared_ptr by default on other platforms
-option(OCIO_USE_BOOST_PTR "Set to ON to enable boost shared_ptr (necessary when tr1 is not available)" WIN32)
+option(OCIO_USE_BOOST_PTR "Set to ON to enable boost shared_ptr (necessary when tr1 is not available)" MSVC)
option(OCIO_PYGLUE_LINK "If ON, link the Python module to the core shared library" OFF)
option(OCIO_PYGLUE_RESPECT_ABI "If ON, the Python module install path includes Python UCS version" OFF)
@@ -135,7 +141,7 @@ endif()
if(CMAKE_COMPILER_IS_GNUCXX)
# Enable a bunch of compiler warnings...
# http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wshadow -Wconversion -Wcast-qual -Wformat=2")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow -Wconversion -Wcast-qual -Wformat=2 -Wno-unused-function -Wno-deprecated-declarations")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
endif(CMAKE_COMPILER_IS_GNUCXX)
@@ -231,7 +237,7 @@ else(USE_EXTERNAL_TINYXML)
INSTALL_DIR ext/dist
CMAKE_ARGS ${TINYXML_CMAKE_ARGS}
)
- if(WIN32)
+ if(MSVC)
set(TINYXML_STATIC_LIBRARIES ${PROJECT_BINARY_DIR}/ext/dist/lib/tinyxml.lib)
else()
set(TINYXML_STATIC_LIBRARIES ${PROJECT_BINARY_DIR}/ext/dist/lib/libtinyxml.a)
@@ -348,11 +354,12 @@ else(USE_EXTERNAL_YAML) ## provide 2 ways to build this dependency
set(YAML_CPP_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ext/dist/include)
set(YAML_CPP_LIBRARY_DIRS ${PROJECT_BINARY_DIR}/ext/dist/lib)
add_library(YAML_CPP_LIB STATIC IMPORTED)
- if(WIN32)
+ if(MSVC)
set(YAML_CPP_STATIC_DEBUG_LIBRARIES ${PROJECT_BINARY_DIR}/ext/dist/lib/libyaml-cppmdd.lib)
set(YAML_CPP_STATIC_OPTIMIZED_LIBRARIES ${PROJECT_BINARY_DIR}/ext/dist/lib/libyaml-cppmd.lib)
+ set_property(TARGET YAML_CPP_LIB PROPERTY IMPORTED_LOCATION ${YAML_CPP_STATIC_OPTIMIZED_LIBRARIES})
set_property(TARGET YAML_CPP_LIB PROPERTY IMPORTED_LOCATION_DEBUG ${YAML_CPP_STATIC_DEBUG_LIBRARIES})
- set_property(TARGET YAML_CPP_LIB PROPERTY IMPORTED_LOCATION_RELEASE ${YAML_CPP_STATIC_OPTIMIZED_LIBRARIES})
+ set_property(TARGET YAML_CPP_LIB PROPERTY IMPORTED_CONFIGURATIONS "Release;Debug")
else()
set(YAML_CPP_STATIC_GENERAL_LIBRARIES ${PROJECT_BINARY_DIR}/ext/dist/lib/libyaml-cpp.a)
set_property(TARGET YAML_CPP_LIB PROPERTY IMPORTED_LOCATION ${YAML_CPP_STATIC_GENERAL_LIBRARIES})
@@ -415,7 +422,7 @@ endif()
messageonce("SSE Optimizations: ${OCIO_USE_SSE}")
if(OCIO_USE_SSE)
- if(WIN32)
+ if(MSVC)
# SSE instructions are automatically compiled into 64-bit applications so enabling the option is redundant and
# actually produces an unknown option warning in Visual Studio.
if(NOT CMAKE_CL_64)
diff --git a/export/OpenColorIO/OpenColorIO.h b/export/OpenColorIO/OpenColorIO.h
index 1c699c1..ff1554c 100644
--- a/export/OpenColorIO/OpenColorIO.h
+++ b/export/OpenColorIO/OpenColorIO.h
@@ -101,16 +101,16 @@ OCIO_NAMESPACE_ENTER
private:
//Add pragma warnings, STL member is private and not consumed by client of DLL
- #ifdef _WIN32
+ #ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4251)
- #endif // _WIN32
+ #endif // _MSC_VER
std::string msg_;
- #ifdef _WIN32
+ #ifdef _MSC_VER
#pragma warning(pop)
- #endif // _WIN32
+ #endif // _MSC_VER
};
//!cpp:class:: An exception class for errors detected at
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 1eb691b..2681217 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -18,13 +18,11 @@ list(APPEND core_export_headers ${CMAKE_BINARY_DIR}/export/OpenColorABI.h)
# Process all warnings as errors
-if(WIN32)
+if(MSVC)
# On debug mode there are other kinds of warning...
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
set(EXTERNAL_COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS} /WX")
endif()
-else()
- set(EXTERNAL_COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS} -Werror")
endif()
# SHARED
@@ -48,7 +46,7 @@ if(OCIO_BUILD_SHARED)
target_link_libraries(OpenColorIO ${EXTERNAL_LIBRARIES})
endif()
- if(WIN32)
+ if(MSVC)
# Mute a design issue where the Exception public class inherits
# from a STL Exception. STL classes are never supposed to
# be exported among different dynamic libraries.
diff --git a/src/core/OCIOYaml.cpp b/src/core/OCIOYaml.cpp
index 68fcef6..24c7afd 100644
--- a/src/core/OCIOYaml.cpp
+++ b/src/core/OCIOYaml.cpp
@@ -30,7 +30,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <OpenColorIO/OpenColorIO.h>
-#ifndef WIN32
+#ifndef _MSC_VER
// fwd declare yaml-cpp visibility
#pragma GCC visibility push(hidden)
@@ -67,14 +67,14 @@ namespace YAML {
#endif
-#ifdef WIN32
+#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable: 4146 )
#endif
#include <yaml-cpp/yaml.h>
-#ifdef WIN32
+#ifdef _MSC_VER
#pragma warning( pop )
#endif
diff --git a/src/core/Platform.cpp b/src/core/Platform.cpp
index d5d322f..9af8c61 100644
--- a/src/core/Platform.cpp
+++ b/src/core/Platform.cpp
@@ -18,7 +18,7 @@ OCIO_NAMESPACE_ENTER
//
void getenv (const char* name, std::string& value)
{
-#ifdef WINDOWS
+#ifdef _MSC_VER
// To remove the security compilation warning, the _dupenv_s method
// must be used (instead of the getenv). The improvement is that
// the buffer length is now under control to mitigate buffer overflow attacks.
diff --git a/src/core/UnitTest.cpp b/src/core/UnitTest.cpp
index 5a60923..d887a3f 100644
--- a/src/core/UnitTest.cpp
+++ b/src/core/UnitTest.cpp
@@ -31,14 +31,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef OCIO_UNIT_TEST
-#ifndef WIN32
+#ifndef _MSC_VER
#pragma GCC visibility push(default)
#endif
#include <unittest.h> // OIIO unit tests header
OIIO_TEST_APP(OpenColorIO_Core_Unit_Tests)
-#ifndef WIN32
+#ifndef _MSC_VER
#pragma GCC visibility pop
#endif
diff --git a/src/core/UnitTest.h b/src/core/UnitTest.h
index fd86a9e..82fd4e3 100644
--- a/src/core/UnitTest.h
+++ b/src/core/UnitTest.h
@@ -31,13 +31,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef OCIO_UNIT_TEST
-#ifndef WIN32
+#ifndef _MSC_VER
#pragma GCC visibility push(default)
#endif
#include <unittest.h> // OIIO unit tests header
-#ifndef WIN32
+#ifndef _MSC_VER
#pragma GCC visibility pop
#endif
diff --git a/src/core_tests/CMakeLists.txt b/src/core_tests/CMakeLists.txt
index a5c563d..78cb78b 100644
--- a/src/core_tests/CMakeLists.txt
+++ b/src/core_tests/CMakeLists.txt
@@ -11,7 +11,7 @@ include_directories(
${EXTERNAL_INCLUDE_DIRS}
)
-if(WIN32)
+if(MSVC)
# Hack to get around the "Debug" and "Release" sub directories
# cmake tries to add with Windows VC+++ IDE
diff --git a/src/pyglue/CMakeLists.txt b/src/pyglue/CMakeLists.txt
index a90ca1c..eda8ead 100644
--- a/src/pyglue/CMakeLists.txt
+++ b/src/pyglue/CMakeLists.txt
@@ -13,7 +13,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-strict-aliasing -Wno-missing-field-initializers")
endif()
-if(WIN32)
+if(MSVC)
# Mute a design issue where the Exception public class inherits
# from a STL Exception. STL classes are never supposed to
# be exported among different dynamic libraries.
@@ -23,7 +23,7 @@ endif()
# Process all warnings as errors
# Unfortunately Windows still has a warning
if(UNIX)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
+# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
endif()
find_package(PythonLibs)
--
2.30.1.windows.1
From 12bfe5a25ae02b04a9c4aa2b2cc40e9e92061b82 Mon Sep 17 00:00:00 2001
From: "L. E. Segovia" <13498015+amyspark@users.noreply.github.com>
Date: Tue, 24 Mar 2020 22:58:02 -0300
Subject: [PATCH 2/2] Auto-disable SSE if the compiler target doesn't support
it (#970)
* Auto-disable SSE if the compiler target doesn't support it
This allows non-x86 targets to compile out of the box.
Fixes #940
Signed-off-by: L. E. Segovia <13498015+amyspark@users.noreply.github.com>
* Typo fix
Signed-off-by: L. E. Segovia <13498015+amyspark@users.noreply.github.com>
* Drop legacy CMake if() syntax
Signed-off-by: L. E. Segovia <13498015+amyspark@users.noreply.github.com>
(cherry picked from commit 31d131d821a4a96d6042517bf47590ce428ab479)
---
CMakeLists.txt | 6 ++++++
share/cmake/CheckSSEFeatures.cmake | 27 +++++++++++++++++++++++++++
2 files changed, 33 insertions(+)
create mode 100644 share/cmake/CheckSSEFeatures.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 44fc747..f46781c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -374,6 +374,12 @@ if(YAML_CPP_VERSION VERSION_LESS "0.5.0")
set(YAML_CPP_COMPILE_FLAGS "-DOLDYAML")
endif()
+include(CheckSSEFeatures)
+if(NOT HAVE_SSE2)
+ message(STATUS "Disabling SSE optimizations, as the target doesn't support them")
+ set(OCIO_USE_SSE OFF)
+endif(NOT HAVE_SSE2)
+
###############################################################################
### Externals ###
diff --git a/share/cmake/CheckSSEFeatures.cmake b/share/cmake/CheckSSEFeatures.cmake
new file mode 100644
index 0000000..5d8a5e4
--- /dev/null
+++ b/share/cmake/CheckSSEFeatures.cmake
@@ -0,0 +1,27 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright Contributors to the OpenColorIO Project.
+
+include(CheckCXXSourceCompiles)
+
+if (NOT CMAKE_SIZE_OF_VOID_P EQUAL 8)
+ if (MSVC)
+ set(CMAKE_REQUIRED_FLAGS "/arch:SSE2")
+ else ()
+ set(CMAKE_REQUIRED_FLAGS "-msse2")
+ endif ()
+endif (NOT CMAKE_SIZE_OF_VOID_P EQUAL 8)
+
+check_cxx_source_compiles ("
+ #include <emmintrin.h>
+ int main ()
+ {
+ __m128d a, b;
+ double vals[2] = {0};
+ a = _mm_loadu_pd (vals);
+ b = _mm_add_pd (a,a);
+ _mm_storeu_pd (vals,b);
+ return (0);
+ }"
+ HAVE_SSE2)
+
+MARK_AS_ADVANCED (HAVE_SSE2)
--
2.30.1.windows.1
diff --git a/src/core/Config.cpp b/src/core/Config.cpp
index f5cb379..cec39be 100644
--- a/src/core/Config.cpp
+++ b/src/core/Config.cpp
@@ -330,7 +330,6 @@ OCIO_NAMESPACE_ENTER
sanitytext_ = rhs.sanitytext_;
cacheids_ = rhs.cacheids_;
- cacheidnocontext_ = cacheidnocontext_;
}
return *this;
}
From 72c23a39d8691ce17efb96960ad81c97546ef0bc Mon Sep 17 00:00:00 2001
From: Dmitry Kazakov <dimula73@gmail.com>
Date: Sat, 11 Sep 2021 13:19:20 +0300
Subject: [PATCH] Remove Werror to fix build on GCC11
---
src/core/CMakeLists.txt | 2 --
src/pyglue/CMakeLists.txt | 6 ------
2 files changed, 8 deletions(-)
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 1eb691b..cff9bd8 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -23,8 +23,6 @@ if(WIN32)
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
set(EXTERNAL_COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS} /WX")
endif()
-else()
- set(EXTERNAL_COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS} -Werror")
endif()
# SHARED
diff --git a/src/pyglue/CMakeLists.txt b/src/pyglue/CMakeLists.txt
index a90ca1c..b1f0361 100644
--- a/src/pyglue/CMakeLists.txt
+++ b/src/pyglue/CMakeLists.txt
@@ -20,12 +20,6 @@ if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4275")
endif()
-# Process all warnings as errors
-# Unfortunately Windows still has a warning
-if(UNIX)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
-endif()
-
find_package(PythonLibs)
if(NOT PYTHONLIBS_FOUND)
message(FATAL "Python libraries were not found, exiting.")
--
2.20.1.windows.1
SET(EXTPREFIX_ocio "${EXTPREFIX}" )
set(ext_ocio_PATCH_COMMAND "")
if(APPLE)
set(ext_ocio_PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/0003-macOS-fixWarnings.patch)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
set(SSE_OPTIMIZATIONS_STRING "-DCMAKE_OSX_ARCHITECTURES=arm64")
endif()
endif()
# OCIO tarball has files with CRLF, this confuses patch on POSIX.
if (WIN32)
set(ext_ocio_PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/0001-Fix-MinGW-and-MSVC-detection.patch)
else()
set(ext_ocio_PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/0004-Remove-Werror-to-fix-build-on-GCC11.patch)
endif()
set(ext_ocio_PATCH_COMMAND ${ext_ocio_PATCH_COMMAND}
COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/0002-Auto-disable-SSE-if-the-compiler-target-doesn-t-supp.patch
)
ExternalProject_Add(
ext_ocio
DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
URL https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/v1.1.1.tar.gz
URL_MD5 23d8b9ac81599305539a5a8674b94a3d
URL https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/445c45b0160d55b3334fb7530c1164e041a0e34f.tar.gz
URL_HASH SHA256=7bbc20f5340ee1f59ca649dc0297536912d73ce01d18a967ce7bfe4acaed1820
INSTALL_DIR ${EXTPREFIX_ocio}
PATCH_COMMAND ${ext_ocio_PATCH_COMMAND}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_ocio} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DOCIO_BUILD_APPS=OFF -DOCIO_BUILD_TRUELIGHT=OFF -DOCIO_BUILD_NUKE=OFF -DOCIO_BUILD_DOCS=OFF -DOCIO_BUILD_TESTS=OFF -DOCIO_BUILD_PYGLUE=OFF -DOCIO_BUILD_STATIC_JNIGLUE=OFF ${SSE_OPTIMIZATIONS_STRING}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_ocio} -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DOCIO_BUILD_NUKE:BOOL=OFF -DOCIO_BUILD_DOCS:BOOL=OFF -DOCIO_BUILD_TESTS:BOOL=OFF -DOCIO_BUILD_GPU_TESTS:BOOL=OFF -DOCIO_BUILD_PYTHON:BOOL=OFF -DOCIO_INSTALL_EXT_PACKAGES=MISSING ${SSE_OPTIMIZATIONS_STRING}
UPDATE_COMMAND ""
DEPENDS ext_boost
)
......@@ -821,13 +821,17 @@ if (FFTW3_FOUND)
endif()
endif()
find_package(OpenColorIO)
find_package(OpenColorIO 1.1.1)
set_package_properties(OpenColorIO PROPERTIES
DESCRIPTION "The OpenColorIO Library"
URL "https://www.opencolorio.org"
TYPE OPTIONAL
PURPOSE "Required by the Krita LUT docker")
macro_bool_to_01(OpenColorIO_FOUND HAVE_OCIO)
if (OPENCOLORIO_VERSION VERSION_GREATER_EQUAL "2.0.0")
set(HAVE_OCIO_V2 TRUE)
endif()
configure_file(config-ocio.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-ocio.h)
set_package_properties(PythonLibrary PROPERTIES
DESCRIPTION "Python Library"
......@@ -1107,7 +1111,6 @@ add_subdirectory(krita)
configure_file(KoConfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/KoConfig.h )
configure_file(config_convolution.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config_convolution.h)
configure_file(config-ocio.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-ocio.h )
check_function_exists(powf HAVE_POWF)
configure_file(config-powf.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-powf.h)
......
......@@ -3,5 +3,5 @@
/* Define if you have ocio, the OpenColorIO Library */
#cmakedefine HAVE_OCIO 1
/* Define if OpenColorIO is v2.0 and higher */
#cmakedefine HAVE_OCIO_V2 1
......@@ -7,8 +7,10 @@
uniform sampler2D texture0;
#ifdef USE_OCIO
#ifndef USE_OCIO_V2
uniform sampler3D texture1;
#endif
#endif
in vec4 v_textureCoordinate;
out vec4 fragColor;
......@@ -122,7 +124,11 @@ void main() {
}
#ifdef USE_OCIO
#ifdef USE_OCIO_V2
fragColor = OCIODisplay(col);
#else /* USE_OCIO_V2 */
fragColor = OCIODisplay(col, texture1);
#endif /* USE_OCIO_V2 */
#else /* USE_OCIO */
fragColor = col;
#endif /* USE_OCIO */
......
......@@ -9,7 +9,9 @@ uniform sampler2D texture0;
varying mediump vec4 v_textureCoordinate;
#ifdef USE_OCIO
#ifndef USE_OCIO_V2
uniform sampler3D texture1;
#endif
#endif /* USE_OCIO */
......@@ -18,7 +20,11 @@ void main() {
#ifdef USE_OCIO
#ifdef USE_OCIO_V2
gl_FragColor = OCIODisplay(col);
#else /* USE_OCIO_V2 */
gl_FragColor = OCIODisplay(col, texture1);
#endif /* USE_OCIO_V2 */
#else /* USE_OCIO */
gl_FragColor = col;
#endif /* USE_OCIO */
......
......@@ -14,6 +14,9 @@
struct KisExposureGammaCorrectionInterface;
class QOpenGLFunctions;
class QOpenGLShaderProgram;
/**
* @brief The KisDisplayFilter class is the base class for filters that
* are applied by the canvas to the projection before displaying.
......@@ -25,7 +28,7 @@ public:
explicit KisDisplayFilter(QObject *parent = 0);
virtual QString program() const = 0;
virtual GLuint lutTexture() const = 0;
virtual void setupTextures(QOpenGLFunctions *f, QOpenGLShaderProgram *program) const = 0;
virtual void filter(quint8 *pixels, quint32 numPixels) = 0;
virtual void approximateInverseTransformation(quint8 *pixels, quint32 numPixels) = 0;
virtual void approximateForwardTransformation(quint8 *pixels, quint32 numPixels) = 0;
......
......@@ -44,6 +44,8 @@
#include <QOpenGLFunctions_2_1>
#endif
#include <config-ocio.h>
#define NEAR_VAL -1000.0
#define FAR_VAL 1000.0
......@@ -833,9 +835,7 @@ void KisOpenGLCanvas2::drawImage(const QRect &updateRect)
const int imageRows = maxRow - minRow + 1;
if (d->displayFilter) {
glActiveTexture(GL_TEXTURE0 + 1);
glBindTexture(GL_TEXTURE_3D, d->displayFilter->lutTexture());
d->displayShader->setUniformValue(d->displayShader->location(Uniform::Texture1), 1);
d->displayFilter->setupTextures(this, d->displayShader);
}
const int firstCloneX = qFloor(qreal(firstColumn) / imageColumns);
......
......@@ -9,6 +9,8 @@
#include "opengl/kis_opengl.h"
#include "kis_config.h"
#include <config-ocio.h>
#include <QFile>
#include <QMessageBox>
#include <KLocalizedString>
......@@ -51,7 +53,6 @@ KisShaderProgram *KisOpenGLShaderLoader::loadShader(QString vertPath, QString fr
// XXX Check can be removed and set to the MAC version after we move to Qt5.7
#ifdef Q_OS_MACOS
vertSource.append(KisOpenGL::hasOpenGL3() ? "#version 150 core\n" : "#version 120\n");
// OpenColorIO doesn't support the new GLSL version yet.
vertSource.append("#define texture2D texture\n");
vertSource.append("#define texture3D texture\n");
#else
......@@ -76,7 +77,6 @@ KisShaderProgram *KisOpenGLShaderLoader::loadShader(QString vertPath, QString fr
// XXX Check can be removed and set to the MAC version after we move to Qt5.7
#ifdef Q_OS_MACOS
fragSource.append(KisOpenGL::hasOpenGL3() ? "#version 150 core\n" : "#version 120\n");
// OpenColorIO doesn't support the new GLSL version yet.
fragSource.append("#define texture2D texture\n");
fragSource.append("#define texture3D texture\n");
#else
......@@ -86,7 +86,7 @@ KisShaderProgram *KisOpenGLShaderLoader::loadShader(QString vertPath, QString fr
"precision mediump float;\n"
"precision mediump sampler3D;\n");
// OpenColorIO doesn't support the new GLSL version yet.
// OpenColorIO doesn't support OpenGL ES.
fragSource.append("#define texture2D texture\n");
fragSource.append("#define texture3D texture\n");
} else {
......@@ -138,6 +138,9 @@ KisShaderProgram *KisOpenGLShaderLoader::loadDisplayShader(QSharedPointer<KisDis
bool haveDisplayFilter = displayFilter && !displayFilter->program().isEmpty();
if (haveDisplayFilter) {
fragHeader.append("#define USE_OCIO\n");
#ifdef HAVE_OCIO_V2
fragHeader.append("#define USE_OCIO_V2\n");
#endif
fragHeader.append(displayFilter->program().toLatin1());
}
......
......@@ -3,7 +3,6 @@ add_subdirectory(tests)
set(KRITA_LUTDOCKER_SOURCES
lutdocker.cpp
lutdocker_dock.cpp
ocio_display_filter.cpp
black_white_point_chooser.cpp
)
......@@ -11,7 +10,21 @@ ki18n_wrap_ui(KRITA_LUTDOCKER_SOURCES
wdglut.ui
)