本文整理汇总了C++中opencldevice::pointer::isWritingTo3DTexturesSupported方法的典型用法代码示例。如果您正苦于以下问题:C++ pointer::isWritingTo3DTexturesSupported方法的具体用法?C++ pointer::isWritingTo3DTexturesSupported怎么用?C++ pointer::isWritingTo3DTexturesSupported使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opencldevice::pointer
的用法示例。
在下文中一共展示了pointer::isWritingTo3DTexturesSupported方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: recompileOpenCLCode
void NoneLocalMeans::recompileOpenCLCode(Image::pointer input) {
// Check if there is a need to recompile OpenCL code
if(input->getDimensions() == mDimensionCLCodeCompiledFor &&
input->getDataType() == mTypeCLCodeCompiledFor && !recompile)
return;
recompile = false;
OpenCLDevice::pointer device = getMainDevice();
std::string buildOptions = "";
if(!device->isWritingTo3DTexturesSupported()) {
buildOptions = "-DTYPE=" + getCTypeAsString(mOutputType);
}
buildOptions += " -D WINDOW=";
buildOptions += std::to_string((windowSize-1)/2);
buildOptions += " -D GROUP=";
buildOptions += std::to_string((groupSize-1)/2);
buildOptions += " -D KVERSION=";
buildOptions += std::to_string(k);
buildOptions += " -D EUCLID=";
buildOptions += std::to_string(k);
cl::Program program;
if(input->getDimensions() == 2) {
program = getOpenCLProgram(device, "2D", buildOptions);
} else {
//createOpenCLProgram(std::string(FAST_SOURCE_DIR) + "Algorithms/NoneLocalMeans/NoneLocalMeans3Dgs.cl", "3D");
program = getOpenCLProgram(device, "3D", buildOptions);
}
mKernel = cl::Kernel(program, "noneLocalMeans");
mDimensionCLCodeCompiledFor = input->getDimensions();
mTypeCLCodeCompiledFor = input->getDataType();
}
示例2: execute
void Dilation::execute() {
Image::pointer input = getInputData<Image>();
if(input->getDataType() != TYPE_UINT8) {
throw Exception("Data type of image given to Dilation must be UINT8");
}
Image::pointer output = getOutputData<Image>();
output->createFromImage(input);
SceneGraph::setParentNode(output, input);
output->fill(0);
OpenCLDevice::pointer device = std::dynamic_pointer_cast<OpenCLDevice>(getMainDevice());
cl::CommandQueue queue = device->getCommandQueue();
cl::Program program = getOpenCLProgram(device);
cl::Kernel dilateKernel(program, "dilate");
Vector3ui size = input->getSize();
OpenCLImageAccess::pointer access = input->getOpenCLImageAccess(ACCESS_READ, device);
dilateKernel.setArg(0, *access->get3DImage());
dilateKernel.setArg(2, mSize/2);
if(!device->isWritingTo3DTexturesSupported()) {
OpenCLBufferAccess::pointer access2 = output->getOpenCLBufferAccess(ACCESS_READ_WRITE, device);
dilateKernel.setArg(1, *access2->get());
queue.enqueueNDRangeKernel(
dilateKernel,
cl::NullRange,
cl::NDRange(size.x(), size.y(), size.z()),
cl::NullRange
);
} else {
OpenCLImageAccess::pointer access2 = output->getOpenCLImageAccess(ACCESS_READ_WRITE, device);
dilateKernel.setArg(1, *access2->get3DImage());
queue.enqueueNDRangeKernel(
dilateKernel,
cl::NullRange,
cl::NDRange(size.x(), size.y(), size.z()),
cl::NullRange
);
}
}