0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-02 18:18:56 +02:00

ircd:🆑:data: Add basic property interface wrappings.

This commit is contained in:
Jason Volk 2021-03-17 17:12:58 -07:00
parent 60e66cb273
commit d69f8ffb9c
2 changed files with 34 additions and 0 deletions

View file

@ -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

View file

@ -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)
//