From fd94d2d80fc4b1da6095987e2bef6ec5b42eda8d Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 9 Mar 2015 16:55:17 +0500 Subject: T37832: OpenCL compositing bug in defocus node The issue seems to be caused by the integer overflow. It's actually still needed to investigate why exactly buffer contained such a huge value, but the patch is still legit and seems to be solving the issue just nicely. --- .../compositor/operations/COM_VariableSizeBokehBlurOperation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/compositor') diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp index 4809efd7436..6e4caeef613 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp @@ -200,8 +200,8 @@ void VariableSizeBokehBlurOperation::executeOpenCL(OpenCLDevice *device, const float max_dim = max(m_width, m_height); cl_float scalar = this->m_do_size_scale ? (max_dim / 100.0f) : 1.0f; - maxBlur = (cl_int)sizeMemoryBuffer->getMaximumValue() * scalar; - maxBlur = min(maxBlur, this->m_maxBlur); + maxBlur = (cl_int)min_ff(sizeMemoryBuffer->getMaximumValue() * scalar, + (float)this->m_maxBlur); device->COM_clAttachMemoryBufferToKernelParameter(defocusKernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram); device->COM_clAttachMemoryBufferToKernelParameter(defocusKernel, 1, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputBokehProgram); -- cgit v1.2.3