mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd:🆑:kern: Add argument setter template for various/integral inputs.
This commit is contained in:
parent
6ca5f8b18f
commit
dbf19fcf4b
2 changed files with 17 additions and 0 deletions
|
@ -111,6 +111,8 @@ struct ircd::cl::kern
|
|||
|
||||
public:
|
||||
void arg(const int, data &);
|
||||
void arg(const int, const const_buffer &);
|
||||
template<class T> void arg(const int, const T &);
|
||||
|
||||
template<class... argv> kern(code &, const string_view &name, argv&&...);
|
||||
kern(code &, const string_view &name);
|
||||
|
@ -259,6 +261,14 @@ ircd::cl::kern::kern(code &c,
|
|||
this->arg(i, *datas[i]);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline void
|
||||
ircd::cl::kern::arg(const int pos,
|
||||
const T &val)
|
||||
{
|
||||
arg(pos, const_buffer(&val, 1));
|
||||
}
|
||||
|
||||
inline
|
||||
ircd::cl::exec::exec(kern &kern,
|
||||
const opts &opts,
|
||||
|
|
|
@ -805,6 +805,13 @@ ircd::cl::kern::arg(const int i,
|
|||
call(clSetKernelArg, cl_kernel(handle), i, sizeof(cl_mem), &data_handle);
|
||||
}
|
||||
|
||||
void
|
||||
ircd::cl::kern::arg(const int i,
|
||||
const const_buffer &buf)
|
||||
{
|
||||
call(clSetKernelArg, cl_kernel(handle), i, ircd::size(buf), ircd::data(buf));
|
||||
}
|
||||
|
||||
//
|
||||
// code
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue