[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48726] trunk/blender/source/blender/ compositor/operations: Multi device OpenCL did not work.

Jeroen Bakker j.bakker at atmind.nl
Sun Jul 8 15:03:09 CEST 2012


Revision: 48726
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48726
Author:   jbakker
Date:     2012-07-08 13:03:09 +0000 (Sun, 08 Jul 2012)
Log Message:
-----------
Multi device OpenCL did not work.
case was that cached kernels were used by both devices in separate
threads.

removed the cached kernels.

Modified Paths:
--------------
    trunk/blender/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
    trunk/blender/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
    trunk/blender/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp

Modified: trunk/blender/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_BokehBlurOperation.cpp	2012-07-08 12:23:58 UTC (rev 48725)
+++ trunk/blender/source/blender/compositor/operations/COM_BokehBlurOperation.cpp	2012-07-08 13:03:09 UTC (rev 48726)
@@ -160,15 +160,13 @@
 	return false;
 }
 
-static cl_kernel kernel = 0;
 void BokehBlurOperation::executeOpenCL(OpenCLDevice* device,
                                        MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, 
                                        MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, 
                                        list<cl_kernel> *clKernelsToCleanUp) 
 {
-	if (!kernel) {
-		kernel = device->COM_clCreateKernel("bokehBlurKernel", NULL);
-	}
+	cl_kernel kernel = device->COM_clCreateKernel("bokehBlurKernel", NULL);
+
 	cl_int radius = this->getWidth() * this->m_size / 100.0f;
 	cl_int step = this->getStep();
 	

Modified: trunk/blender/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_DilateErodeOperation.cpp	2012-07-08 12:23:58 UTC (rev 48725)
+++ trunk/blender/source/blender/compositor/operations/COM_DilateErodeOperation.cpp	2012-07-08 13:03:09 UTC (rev 48726)
@@ -234,15 +234,13 @@
 	return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
 }
 
-static cl_kernel dilateKernel = 0;
 void DilateDistanceOperation::executeOpenCL(OpenCLDevice* device,
                                             MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer,
                                             MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp,
                                             list<cl_kernel> *clKernelsToCleanUp)
 {
-	if (!dilateKernel) {
-		dilateKernel = device->COM_clCreateKernel("dilateKernel", NULL);
-	}
+	cl_kernel dilateKernel = device->COM_clCreateKernel("dilateKernel", NULL);
+
 	cl_int distanceSquared = this->m_distance * this->m_distance;
 	cl_int scope = this->m_scope;
 	
@@ -293,15 +291,13 @@
 	color[0] = value;
 }
 
-static cl_kernel erodeKernel = 0;
 void ErodeDistanceOperation::executeOpenCL(OpenCLDevice* device,
                                            MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer,
                                            MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp,
                                            list<cl_kernel> *clKernelsToCleanUp)
 {
-	if (!erodeKernel) {
-		erodeKernel = device->COM_clCreateKernel("erodeKernel", NULL);
-	}
+	cl_kernel erodeKernel = device->COM_clCreateKernel("erodeKernel", NULL);
+
 	cl_int distanceSquared = this->m_distance * this->m_distance;
 	cl_int scope = this->m_scope;
 	

Modified: trunk/blender/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp	2012-07-08 12:23:58 UTC (rev 48725)
+++ trunk/blender/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp	2012-07-08 13:03:09 UTC (rev 48726)
@@ -130,15 +130,13 @@
 
 }
 
-static cl_kernel defocusKernel = 0;
 void VariableSizeBokehBlurOperation::executeOpenCL(OpenCLDevice* device,
                                        MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, 
                                        MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, 
                                        list<cl_kernel> *clKernelsToCleanUp) 
 {
-	if (!defocusKernel) {
-		defocusKernel = device->COM_clCreateKernel("defocusKernel", NULL);
-	}
+	cl_kernel defocusKernel = device->COM_clCreateKernel("defocusKernel", NULL);
+
 	cl_int step = this->getStep();
 	cl_int maxBlur = this->m_maxBlur;
 	cl_float threshold = this->m_threshold;




More information about the Bf-blender-cvs mailing list