diff --git a/src/OpenColorIO/Config.cpp b/src/OpenColorIO/Config.cpp index a17d1dc288..ccfb134b45 100644 --- a/src/OpenColorIO/Config.cpp +++ b/src/OpenColorIO/Config.cpp @@ -4719,20 +4719,29 @@ ConstProcessorRcPtr Config::GetProcessorFromConfigs(const ConstContextRcPtr & sr "the source color space."); } + const char* csName = dstConfig->getDisplayViewColorSpaceName(dstDisplay, dstView); + const char* displayColorSpaceName = View::UseDisplayName(csName) ? dstDisplay : csName; + ConstColorSpaceRcPtr displayColorSpace = dstConfig->getColorSpace(displayColorSpaceName); + if (!displayColorSpace) + { + throw Exception("Can't create the processor for the destination config: " + "display color space not found."); + } + auto p2 = dstConfig->getProcessor(dstContext, dstInterchangeName, dstDisplay, dstView, direction); if (!p2) { throw Exception("Can't create the processor for the destination config " - "and the destination color space."); + "and the destination display view transform."); } ProcessorRcPtr processor = Processor::Create(); processor->getImpl()->setProcessorCacheFlags(srcConfig->getImpl()->m_cacheFlags); - // If the source color spaces is a data space, its corresponding processor + // If either of the color spaces are data spaces, its corresponding processor // will be empty, but need to make sure the entire result is also empty to // better match the semantics of how data spaces are handled. - if (!srcColorSpace->isData()) + if (!srcColorSpace->isData() && !displayColorSpace->isData()) { if (direction == TRANSFORM_DIR_INVERSE) { diff --git a/tests/cpu/Config_tests.cpp b/tests/cpu/Config_tests.cpp index 5d30fda5fc..59d1472dbb 100644 --- a/tests/cpu/Config_tests.cpp +++ b/tests/cpu/Config_tests.cpp @@ -5924,6 +5924,7 @@ ocio_profile_version: 2 displayname: - ! {name: view1, colorspace: displaytest1} - ! {name: view2, view_transform: vt1, display_colorspace: display2} + - ! {name: view3, colorspace: data_space} view_transforms: - ! @@ -6166,6 +6167,13 @@ ocio_profile_version: 2 auto ff4 = OCIO_DYNAMIC_POINTER_CAST(t4); OCIO_CHECK_ASSERT(ff4); + // If one of the spaces is a data space, the whole result must be a no-op. + OCIO_CHECK_NO_THROW(p = OCIO::Config::GetProcessorFromConfigs( + config2, "test2", config1, "displayname", "view3", OCIO::TRANSFORM_DIR_FORWARD)); + OCIO_REQUIRE_ASSERT(p); + group = p->createGroupTransform(); + OCIO_REQUIRE_EQUAL(group->getNumTransforms(), 0); + constexpr const char * SIMPLE_CONFIG3{ R"( ocio_profile_version: 2