在cl2.hpp
中,enqueueWriteImage 需要void* ptr
,但调用 C 函数clEnqueueWriteImage
,该函数需要const void* ptr
。为什么?
cl_int enqueueWriteImage(
const Image& image,
cl_bool blocking,
const array<size_type, 3>& origin,
const array<size_type, 3>& region,
size_type row_pitch,
size_type slice_pitch,
void* ptr,
const vector<Event>* events = NULL,
Event* event = NULL) const
{
cl_event tmp;
cl_int err = detail::errHandler(
::clEnqueueWriteImage(//... here the const void* ptr appears
这是有意还是错别字?因为它只调用一个接受const void* ptr
的函数,所以它也可能是 const。
你是对的;这是OpenCL C++绑定中的一个错误。还有其他一些enqueueWrite*
函数存在此问题。我已经为这些标头推送了对 Khronos GitHub 存储库的修复 - 它将包含在下一个版本中。