From a7bcea76d7ff5440750c78e2ef2ae9592fff4e77 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 23 Jun 2025 15:13:59 +0200 Subject: [PATCH] Fix #139769: ACES 2.0 configuration fails with shader errors This code was initially only for OpenColorIO 2.3, and then later removed in the refactor. But it appears to still be needed for 2.4 and configs like this. Pull Request: https://projects.blender.org/blender/blender/pulls/140824 --- .../intern/libocio/libocio_gpu_shader_binder.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/source/blender/imbuf/opencolorio/intern/libocio/libocio_gpu_shader_binder.cc b/source/blender/imbuf/opencolorio/intern/libocio/libocio_gpu_shader_binder.cc index 11a584a184b..629d084895e 100644 --- a/source/blender/imbuf/opencolorio/intern/libocio/libocio_gpu_shader_binder.cc +++ b/source/blender/imbuf/opencolorio/intern/libocio/libocio_gpu_shader_binder.cc @@ -83,8 +83,19 @@ static bool add_gpu_lut_1D2D(internal::GPUTextures &textures, GPU_R16F; internal::GPULutTexture lut; - lut.texture = GPU_texture_create_2d( - texture_name, width, height, 1, format, GPU_TEXTURE_USAGE_SHADER_READ, values); + /* There does not appear to be an explicit way to check if a texture is 1D or 2D. + * It depends on more than height. So check instead by looking at the source. + * The Blender default config does not use 1D textures, but for example + * studio-config-v3.0.0_aces-v2.0_ocio-v2.4.ocio needs this code. */ + std::string sampler1D_name = std::string("sampler1D ") + sampler_name; + if (strstr(shader_desc->getShaderText(), sampler1D_name.c_str()) != nullptr) { + lut.texture = GPU_texture_create_1d( + texture_name, width, 1, format, GPU_TEXTURE_USAGE_SHADER_READ, values); + } + else { + lut.texture = GPU_texture_create_2d( + texture_name, width, height, 1, format, GPU_TEXTURE_USAGE_SHADER_READ, values); + } if (lut.texture == nullptr) { return false; }