mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
ircd:🆑 Add subbuffer region handles to interface.
This commit is contained in:
parent
6621a5fc4f
commit
cb45dcc840
2 changed files with 15 additions and 0 deletions
|
@ -76,6 +76,7 @@ struct ircd::cl::data
|
|||
data(const size_t, const const_buffer &); // device ro
|
||||
data(const mutable_buffer &, const bool wonly = false); // host rw
|
||||
data(const const_buffer &); // host ro
|
||||
data(data &, const pair<size_t, off_t> &); // subbuffer
|
||||
data(const data &) = delete;
|
||||
data() = default;
|
||||
data(data &&) noexcept;
|
||||
|
|
14
ircd/cl.cc
14
ircd/cl.cc
|
@ -1246,6 +1246,20 @@ ircd::cl::data::data(const const_buffer &buf)
|
|||
throw_on_error(err);
|
||||
}
|
||||
|
||||
ircd::cl::data::data(data &master,
|
||||
const pair<size_t, off_t> &slice)
|
||||
{
|
||||
cl_mem_flags flags {0};
|
||||
|
||||
cl_buffer_region region {0};
|
||||
region.origin = slice.second;
|
||||
region.size = slice.first;
|
||||
|
||||
int err {CL_SUCCESS};
|
||||
handle = clCreateSubBuffer(cl_mem(master.handle), flags, CL_BUFFER_CREATE_TYPE_REGION, ®ion, &err);
|
||||
throw_on_error(err);
|
||||
}
|
||||
|
||||
ircd::cl::data::data(data &&o)
|
||||
noexcept
|
||||
:handle{std::move(o.handle)}
|
||||
|
|
Loading…
Reference in a new issue