diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2012-07-12 00:51:00 +0400 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2012-07-12 00:51:00 +0400 |
commit | 4fb850c72ee15cf0a305079e8fb6d23f180fb419 (patch) | |
tree | d15b2ecb8f2ed2bb057e6ff04e2e189b347beae1 /source/blender/compositor/operations/COM_OpenCLKernels.cl.h | |
parent | 83d2314edfe2c123c3151884a66c5a6ba2d849f6 (diff) |
Compositor:
re-optimized the Defocus node.
* localized MemoryBuffers
* removed read(x,y) calls
* shuffled some lines in the execute pixel
* added a readNoCheck function to the memorybuffer (only use this when
you are certain you are reading a pixel inside the memorybuffer.
Diffstat (limited to 'source/blender/compositor/operations/COM_OpenCLKernels.cl.h')
-rw-r--r-- | source/blender/compositor/operations/COM_OpenCLKernels.cl.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/source/blender/compositor/operations/COM_OpenCLKernels.cl.h b/source/blender/compositor/operations/COM_OpenCLKernels.cl.h index d57aa1366de..cc18039c5b1 100644 --- a/source/blender/compositor/operations/COM_OpenCLKernels.cl.h +++ b/source/blender/compositor/operations/COM_OpenCLKernels.cl.h @@ -103,16 +103,16 @@ const char * clkernelstoh_COM_OpenCLKernels_cl = "/*\n" \ " float size = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;\n" \ " color_accum = read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate);\n" \ "\n" \ -" for (int ny = miny; ny < maxy; ny += step) {\n" \ -" for (int nx = minx; nx < maxx; nx += step) {\n" \ -" if (nx >= 0 && nx < dimension.s0 && ny >= 0 && ny < dimension.s1) {\n" \ -" inputCoordinate.s0 = nx - offsetInput.s0;\n" \ -" inputCoordinate.s1 = ny - offsetInput.s1;\n" \ -" tempSize = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;\n" \ -" if (size > threshold && tempSize > threshold) {\n" \ -" float dx = nx - realCoordinate.s0;\n" \ -" float dy = ny - realCoordinate.s1;\n" \ -" if (dx != 0 || dy != 0) {\n" \ +" if (size > threshold) {\n" \ +" for (int ny = miny; ny < maxy; ny += step) {\n" \ +" inputCoordinate.s1 = ny - offsetInput.s1;\n" \ +" float dy = ny - realCoordinate.s1;\n" \ +" for (int nx = minx; nx < maxx; nx += step) {\n" \ +" float dx = nx - realCoordinate.s0;\n" \ +" if (dx != 0 || dy != 0) {\n" \ +" inputCoordinate.s0 = nx - offsetInput.s0;\n" \ +" tempSize = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;\n" \ +" if (tempSize > threshold) {\n" \ " if (tempSize >= fabs(dx) && tempSize >= fabs(dy)) {\n" \ " float2 uv = { 256.0f + dx * 256.0f / tempSize, 256.0f + dy * 256.0f / tempSize};\n" \ " bokeh = read_imagef(bokehImage, SAMPLER_NEAREST, uv);\n" \ |