diff --git a/libautoscoper/src/gpu/opencl/OpenCL.cpp b/libautoscoper/src/gpu/opencl/OpenCL.cpp index 986773ec..4ded3d98 100644 --- a/libautoscoper/src/gpu/opencl/OpenCL.cpp +++ b/libautoscoper/src/gpu/opencl/OpenCL.cpp @@ -789,6 +789,19 @@ void Kernel::grid2d(size_t X, size_t Y) grid_[1] = Y * block_[1]; } +void Kernel::grid3d(size_t X, size_t Y, size_t Z) { + if (grid_dim_ && (grid_dim_ != 3)) { + ERROR("Grid dimension was already set and is not 3"); + } else if (!block_dim_) { + ERROR("Must set block dimension before grid"); + } else { + grid_dim_ = 3; + } + grid_[0] = X * block_[0]; + grid_[1] = Y * block_[1]; + grid_[2] = Z * block_[2]; +} + void Kernel::block1d(size_t X) { if (block_dim_ && (block_dim_ != 1)) { @@ -810,6 +823,18 @@ void Kernel::block2d(size_t X, size_t Y) block_[1] = Y; } +void Kernel::block3d(size_t X, size_t Y, size_t Z) +{ + if (block_dim_ && (block_dim_ != 3)) { + ERROR("Block dimension was already set and is not 3"); + } else { + block_dim_ = 3; + } + block_[0] = X; + block_[1] = Y; + block_[2] = Z; +} + void Kernel::addBufferArg(const Buffer* buf) { err_ = clSetKernelArg(kernel_, arg_index_++, sizeof(cl_mem), &buf->buffer_); diff --git a/libautoscoper/src/gpu/opencl/OpenCL.hpp b/libautoscoper/src/gpu/opencl/OpenCL.hpp index 0a4dfa24..cc94fba9 100644 --- a/libautoscoper/src/gpu/opencl/OpenCL.hpp +++ b/libautoscoper/src/gpu/opencl/OpenCL.hpp @@ -86,6 +86,8 @@ class Kernel void block1d(size_t X); void grid2d(size_t X, size_t Y); void block2d(size_t X, size_t Y); + void grid3d(size_t X, size_t Y, size_t Z); + void block3d(size_t X, size_t Y, size_t Z); void launch(); void addBufferArg(const Buffer* buf);