MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCL-CLHPP / Program

Method Program

include/CL/opencl.hpp:6630–6667  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6628#endif // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6629
6630 Program(
6631 const string& source,
6632 bool build = false,
6633 cl_int* err = nullptr)
6634 {
6635 cl_int error;
6636
6637 const char * strings = source.c_str();
6638 const size_type length = source.size();
6639
6640 Context context = Context::getDefault(err);
6641
6642 object_ = CL_(clCreateProgramWithSource)(
6643 context(), (cl_uint)1, &strings, &length, &error);
6644
6645 detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
6646
6647 if (error == CL_SUCCESS && build) {
6648
6649 error = CL_(clBuildProgram)(
6650 object_,
6651 0,
6652 nullptr,
6653#if !defined(CL_HPP_CL_1_2_DEFAULT_BUILD)
6654 "-cl-std=CL2.0",
6655#else
6656 "",
6657#endif // #if !defined(CL_HPP_CL_1_2_DEFAULT_BUILD)
6658 nullptr,
6659 nullptr);
6660
6661 detail::buildErrHandler(error, __BUILD_PROGRAM_ERR, getBuildInfo<CL_PROGRAM_BUILD_LOG>());
6662 }
6663
6664 if (err != nullptr) {
6665 *err = error;
6666 }
6667 }
6668
6669 Program(
6670 const Context& context,

Callers

nothing calls this directly

Calls 3

errHandlerFunction · 0.85
buildErrHandlerFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected