Skip to content

Commit

Permalink
Update clUpdateMutableCommandsKHR binding (#298)
Browse files Browse the repository at this point in the history
In OpenCL-Docs PR KhronosGroup/OpenCL-Docs#1045
the API for `cl_khr_command_buffer_mutable_dispatch` API
`clUpdateMutableCommandsKHR` changed in a breaking way.

When the headers update OpenCL-Headers PR KhronosGroup/OpenCL-Headers#245
the bindings will break if they are not updated to reflect this
change.

Bindings updated in this PR to pass to arrays of templated length to
the C++ method. The underlying `.data()` pointers of these parameters can be
passed through to the OpenCL API.
  • Loading branch information
EwanC committed Sep 6, 2024
1 parent 78eeace commit c58621d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions include/CL/opencl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11827,6 +11827,8 @@ class CommandBufferKhr : public detail::Wrapper<cl_command_buffer_khr>
}

#if defined(cl_khr_command_buffer_mutable_dispatch)
#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION < \
CL_MAKE_VERSION(0, 9, 2)
cl_int updateMutableCommands(const cl_mutable_base_config_khr* mutable_config)
{
if (pfn_clUpdateMutableCommandsKHR == nullptr) {
Expand All @@ -11836,6 +11838,21 @@ class CommandBufferKhr : public detail::Wrapper<cl_command_buffer_khr>
return detail::errHandler(pfn_clUpdateMutableCommandsKHR(object_, mutable_config),
__UPDATE_MUTABLE_COMMANDS_KHR_ERR);
}
#else
template <int ArrayLength>
cl_int updateMutableCommands(std::array<cl_command_buffer_update_type_khr,
ArrayLength> &config_types,
std::array<void *, ArrayLength> &configs) {
if (pfn_clUpdateMutableCommandsKHR == nullptr) {
return detail::errHandler(CL_INVALID_OPERATION,
__UPDATE_MUTABLE_COMMANDS_KHR_ERR);
}
return detail::errHandler(
pfn_clUpdateMutableCommandsKHR(object_, configs.length(),
config_types.data().configs.data()),
__UPDATE_MUTABLE_COMMANDS_KHR_ERR);
}
#endif /* CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION */
#endif /* cl_khr_command_buffer_mutable_dispatch */

private:
Expand Down

0 comments on commit c58621d

Please sign in to comment.