Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions include/CL/opencl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11028,8 +11028,24 @@ class CommandBufferKhr : public detail::Wrapper<cl_command_buffer_khr>
}
}

explicit CommandBufferKhr(const cl_command_buffer_khr& commandBufferKhr, bool retainObject = false) :
detail::Wrapper<cl_type>(commandBufferKhr, retainObject) { }
explicit CommandBufferKhr(const cl_command_buffer_khr &commandBufferKhr,
bool retainObject = false)
: detail::Wrapper<cl_type>(commandBufferKhr, retainObject) {
vector<CommandQueue> queues = getInfo<CL_COMMAND_BUFFER_QUEUES_KHR>();

if (!queues.empty()) {
/* initialization of addresses to extension functions (it is done only
* once) */
std::call_once(ext_init_, [&] {
initExtensions(queues[0].getInfo<CL_QUEUE_DEVICE>());
});
cl_int error = CL_INVALID_OPERATION;

static_assert(sizeof(cl::CommandQueue) == sizeof(cl_command_queue),
"Size of cl::CommandQueue must be equal to size of "
"cl_command_queue");
}
}

CommandBufferKhr& operator=(const cl_command_buffer_khr& rhs)
{
Expand All @@ -11042,7 +11058,7 @@ class CommandBufferKhr : public detail::Wrapper<cl_command_buffer_khr>
{
if (pfn_clGetCommandBufferInfoKHR == nullptr) {
return detail::errHandler(CL_INVALID_OPERATION,
__GET_COMMAND_BUFFER_INFO_KHR_ERR);
__GET_COMMAND_BUFFER_INFO_KHR_ERR);
}
return detail::errHandler(
detail::getInfo(pfn_clGetCommandBufferInfoKHR, object_, name, param),
Expand All @@ -11055,7 +11071,15 @@ class CommandBufferKhr : public detail::Wrapper<cl_command_buffer_khr>
{
typename detail::param_traits<
detail::cl_command_buffer_info_khr, name>::param_type param;
cl_int result = getInfo(name, &param);

cl_int result = CL_SUCCESS;

if (pfn_clGetCommandBufferInfoKHR == nullptr &&
&::clGetCommandBufferInfoKHR != nullptr)
result = detail::getInfo(&::clGetCommandBufferInfoKHR, object_, name,
&param);
else
result = getInfo(name, &param);
if (err != nullptr) {
*err = result;
}
Expand Down