mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
ircd:🆑:data: Add basic property interface wrappings.
This commit is contained in:
parent
60e66cb273
commit
d69f8ffb9c
2 changed files with 34 additions and 0 deletions
|
@ -64,6 +64,10 @@ struct ircd::cl::data
|
|||
void *handle {nullptr};
|
||||
|
||||
public:
|
||||
uint flags() const;
|
||||
size_t size() const;
|
||||
char *ptr() const; // host only
|
||||
|
||||
data(const size_t, const mutable_buffer &, const bool wonly = false); // device rw
|
||||
data(const size_t, const const_buffer &); // device ro
|
||||
data(const mutable_buffer &, const bool wonly = false); // host rw
|
||||
|
|
30
ircd/cl.cc
30
ircd/cl.cc
|
@ -813,6 +813,36 @@ catch(const std::exception &e)
|
|||
return;
|
||||
}
|
||||
|
||||
char *
|
||||
ircd::cl::data::ptr()
|
||||
const
|
||||
{
|
||||
assert(handle);
|
||||
|
||||
char buf[sizeof(void *)] {0};
|
||||
return info<char *>(clGetMemObjectInfo, cl_mem(mutable_cast(handle)), CL_MEM_SIZE, buf);
|
||||
}
|
||||
|
||||
size_t
|
||||
ircd::cl::data::size()
|
||||
const
|
||||
{
|
||||
assert(handle);
|
||||
|
||||
char buf[sizeof(size_t)] {0};
|
||||
return info<size_t>(clGetMemObjectInfo, cl_mem(mutable_cast(handle)), CL_MEM_SIZE, buf);
|
||||
}
|
||||
|
||||
uint
|
||||
ircd::cl::data::flags()
|
||||
const
|
||||
{
|
||||
assert(handle);
|
||||
|
||||
char buf[sizeof(uint)] {0};
|
||||
return info<uint>(clGetMemObjectInfo, cl_mem(mutable_cast(handle)), CL_MEM_FLAGS, buf);
|
||||
}
|
||||
|
||||
//
|
||||
// cl::work (event)
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue