From e7a88bfe1e77447306cc87d6a40af5d46cd641d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Renaud-Houde?= Date: Sun, 30 Oct 2022 15:52:02 -0400 Subject: [PATCH] Enforce GL_NEAREST with gpu tetrahedral interpolation, fixing #1676. (#1708) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Eric Renaud-Houde Signed-off-by: Eric Renaud-Houde Co-authored-by: RĂ©mi Achard --- src/OpenColorIO/ops/lut3d/Lut3DOpGPU.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/OpenColorIO/ops/lut3d/Lut3DOpGPU.cpp b/src/OpenColorIO/ops/lut3d/Lut3DOpGPU.cpp index c521468c77..786f52961c 100644 --- a/src/OpenColorIO/ops/lut3d/Lut3DOpGPU.cpp +++ b/src/OpenColorIO/ops/lut3d/Lut3DOpGPU.cpp @@ -32,11 +32,17 @@ void GetLut3DGPUShaderProgram(GpuShaderCreatorRcPtr & shaderCreator, ConstLut3DO std::string name(resName.str()); StringUtils::ReplaceInPlace(name, "__", "_"); + Interpolation samplerInterpolation = lutData->getConcreteInterpolation(); + // Enforce GL_NEAREST with shader-generated tetrahedral interpolation. + if (samplerInterpolation == INTERP_TETRAHEDRAL) + { + samplerInterpolation = INTERP_NEAREST; + } // (Using CacheID here to potentially allow reuse of existing textures.) shaderCreator->add3DTexture(name.c_str(), GpuShaderText::getSamplerName(name).c_str(), lutData->getGridSize(), - lutData->getConcreteInterpolation(), + samplerInterpolation, &lutData->getArray()[0]); {