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

Class Image2D

include/CL/opencl.hpp:4784–4984  ·  view source on GitHub ↗

! \brief Class interface for 2D Image Memory objects. * * See Memory for details about copy semantics, etc. * * \see Memory */

Source from the content-addressed store, hash-verified

4782 * \see Memory
4783 */
4784class Image2D : public Image
4785{
4786public:
4787 /*! \brief Constructs a 2D Image in a specified context.
4788 *
4789 * Wraps clCreateImage().
4790 */
4791 Image2D(
4792 const Context& context,
4793 cl_mem_flags flags,
4794 ImageFormat format,
4795 size_type width,
4796 size_type height,
4797 size_type row_pitch = 0,
4798 void* host_ptr = nullptr,
4799 cl_int* err = nullptr)
4800 {
4801 cl_int error;
4802 bool useCreateImage;
4803
4804#if CL_HPP_TARGET_OPENCL_VERSION >= 120 && CL_HPP_MINIMUM_OPENCL_VERSION < 120
4805 // Run-time decision based on the actual platform
4806 {
4807 cl_uint version = detail::getContextPlatformVersion(context());
4808 useCreateImage = (version >= 0x10002); // OpenCL 1.2 or above
4809 }
4810#elif CL_HPP_TARGET_OPENCL_VERSION >= 120
4811 useCreateImage = true;
4812#else
4813 useCreateImage = false;
4814#endif
4815
4816#if CL_HPP_TARGET_OPENCL_VERSION >= 120
4817 if (useCreateImage)
4818 {
4819 cl_image_desc desc = {};
4820 desc.image_type = CL_MEM_OBJECT_IMAGE2D;
4821 desc.image_width = width;
4822 desc.image_height = height;
4823 desc.image_row_pitch = row_pitch;
4824
4825 object_ = ::clCreateImage(
4826 context(),
4827 flags,
4828 &format,
4829 &desc,
4830 host_ptr,
4831 &error);
4832
4833 detail::errHandler(error, __CREATE_IMAGE_ERR);
4834 if (err != nullptr) {
4835 *err = error;
4836 }
4837 }
4838#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
4839#if CL_HPP_MINIMUM_OPENCL_VERSION < 120
4840 if (!useCreateImage)
4841 {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected