Fix: Error in builds without OCIO
The methods on the `OCIOColorSpaceConversionShader` expect `shader_creator_` to be valid so, in case of a build without OCIO support, ensure we have a valid GPUShaderCreator available. In this case we use the "stub" implementation. Pull Request: https://projects.blender.org/blender/blender/pulls/125631
This commit is contained in:
committed by
Jesse Yurkovich
parent
f638aca941
commit
67186ae8ac
@@ -450,6 +450,11 @@ class GPUShaderCreator : public OCIO::GpuShaderCreator {
|
||||
/* A stub implementation in case OCIO is disabled at build time. */
|
||||
class GPUShaderCreator {
|
||||
public:
|
||||
static std::shared_ptr<GPUShaderCreator> Create(ResultPrecision /* precision */)
|
||||
{
|
||||
return std::make_shared<GPUShaderCreator>();
|
||||
}
|
||||
|
||||
GPUShader *bind_shader_and_resources()
|
||||
{
|
||||
return nullptr;
|
||||
@@ -480,9 +485,9 @@ OCIOColorSpaceConversionShader::OCIOColorSpaceConversionShader(Context &context,
|
||||
{
|
||||
/* Create a GPU shader creator and construct it based on the transforms in the default GPU
|
||||
* processor. */
|
||||
#if defined(WITH_OCIO)
|
||||
shader_creator_ = GPUShaderCreator::Create(context.get_precision());
|
||||
|
||||
#if defined(WITH_OCIO)
|
||||
/* Get a GPU processor that transforms the source color space to the target color space. */
|
||||
try {
|
||||
OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig();
|
||||
@@ -492,10 +497,10 @@ OCIOColorSpaceConversionShader::OCIOColorSpaceConversionShader(Context &context,
|
||||
auto ocio_shader_creator = std::static_pointer_cast<OCIO::GpuShaderCreator>(shader_creator_);
|
||||
gpu_processor->extractGpuShaderInfo(ocio_shader_creator);
|
||||
}
|
||||
catch (OCIO::Exception &e) {
|
||||
catch (const OCIO::Exception &) {
|
||||
}
|
||||
#else
|
||||
UNUSED_VARS(context, source, target);
|
||||
UNUSED_VARS(source, target);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user