Skip to content

Commit

Permalink
Update clUpdateMutableCommandsKHR binding
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 Aug 1, 2024
1 parent afbd082 commit ed46a01
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 @@ -11549,6 +11549,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 @@ -11558,6 +11560,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 ed46a01

Please sign in to comment.