[Bf-blender-cvs] [fd94d2d] master: T37832: OpenCL compositing bug in defocus node

Sergey Sharybin noreply at git.blender.org
Mon Mar 9 12:58:53 CET 2015


Commit: fd94d2d80fc4b1da6095987e2bef6ec5b42eda8d
Author: Sergey Sharybin
Date:   Mon Mar 9 16:55:17 2015 +0500
Branches: master
https://developer.blender.org/rBfd94d2d80fc4b1da6095987e2bef6ec5b42eda8d

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.

===================================================================

M	source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp

===================================================================

diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
index 4809efd..6e4caee 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);




More information about the Bf-blender-cvs mailing list