MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / Image3D

Method Image3D

include/CL/opencl.hpp:5133–5198  ·  view source on GitHub ↗

! \brief Constructs a 3D Image in a specified context. * * Wraps clCreateImage(). */

Source from the content-addressed store, hash-verified

5131 * Wraps clCreateImage().
5132 */
5133 Image3D(
5134 const Context& context,
5135 cl_mem_flags flags,
5136 ImageFormat format,
5137 size_type width,
5138 size_type height,
5139 size_type depth,
5140 size_type row_pitch = 0,
5141 size_type slice_pitch = 0,
5142 void* host_ptr = nullptr,
5143 cl_int* err = nullptr)
5144 {
5145 cl_int error;
5146 bool useCreateImage;
5147
5148#if CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 120
5149 // Run-time decision based on the actual platform
5150 {
5151 cl_uint version = detail::getContextPlatformVersion(context());
5152 useCreateImage = (version >= 0x10002); // OpenCL 1.2 or above
5153 }
5154#elif CL_HPP_TARGET_OPENCL_VERSION >= 120
5155 useCreateImage = true;
5156#else
5157 useCreateImage = false;
5158#endif
5159
5160#if CL_HPP_TARGET_OPENCL_VERSION >= 120
5161 if (useCreateImage)
5162 {
5163 cl_image_desc desc = {};
5164 desc.image_type = CL_MEM_OBJECT_IMAGE3D;
5165 desc.image_width = width;
5166 desc.image_height = height;
5167 desc.image_depth = depth;
5168 desc.image_row_pitch = row_pitch;
5169 desc.image_slice_pitch = slice_pitch;
5170
5171 object_ = ::clCreateImage(
5172 context(),
5173 flags,
5174 &format,
5175 &desc,
5176 host_ptr,
5177 &error);
5178
5179 detail::errHandler(error, __CREATE_IMAGE_ERR);
5180 if (err != nullptr) {
5181 *err = error;
5182 }
5183 }
5184#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
5185#if CL_HPP_MINIMUM_OPENCL_VERSION < 120
5186 if (!useCreateImage)
5187 {
5188 object_ = ::clCreateImage3D(
5189 context(), flags, &format, width, height, depth, row_pitch,
5190 slice_pitch, host_ptr, &error);

Callers

nothing calls this directly

Calls 3

clCreateImageFunction · 0.85
errHandlerFunction · 0.85

Tested by

no test coverage detected