Multi device OpenCL did not work.

case was that cached kernels were used by both devices in separate
threads.

removed the cached kernels.
This commit is contained in:
Jeroen Bakker
2012-07-08 13:03:09 +00:00
parent 4bc818d240
commit 45aeee6a34
3 changed files with 8 additions and 16 deletions

View File

@@ -160,15 +160,13 @@ bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe
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();

View File

@@ -234,15 +234,13 @@ bool DilateDistanceOperation::determineDependingAreaOfInterest(rcti *input, Read
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 @@ void ErodeDistanceOperation::executePixel(float *color, int x, int y, MemoryBuff
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;

View File

@@ -130,15 +130,13 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, Me
}
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;