using namespace clover;
-PUBLIC cl_command_queue
+CLOVER_API cl_command_queue
clCreateCommandQueue(cl_context d_ctx, cl_device_id d_dev,
cl_command_queue_properties props,
cl_int *r_errcode) try {
auto &ctx = obj(d_ctx);
auto &dev = obj(d_dev);
- if (!ctx.has_device(dev))
+ if (!count(dev, ctx.devices()))
throw error(CL_INVALID_DEVICE);
if (props & ~(CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE |
return NULL;
}
-PUBLIC cl_int
+CLOVER_API cl_int
clRetainCommandQueue(cl_command_queue d_q) try {
obj(d_q).retain();
return CL_SUCCESS;
return e.get();
}
-PUBLIC cl_int
+CLOVER_API cl_int
clReleaseCommandQueue(cl_command_queue d_q) try {
- if (obj(d_q).release())
+ auto &q = obj(d_q);
+
+ q.flush();
+
+ if (q.release())
delete pobj(d_q);
return CL_SUCCESS;
return e.get();
}
-PUBLIC cl_int
+CLOVER_API cl_int
clGetCommandQueueInfo(cl_command_queue d_q, cl_command_queue_info param,
size_t size, void *r_buf, size_t *r_size) try {
property_buffer buf { r_buf, size, r_size };
switch (param) {
case CL_QUEUE_CONTEXT:
- buf.as_scalar<cl_context>() = desc(q.ctx);
+ buf.as_scalar<cl_context>() = desc(q.context());
break;
case CL_QUEUE_DEVICE:
- buf.as_scalar<cl_device_id>() = desc(q.dev);
+ buf.as_scalar<cl_device_id>() = desc(q.device());
break;
case CL_QUEUE_REFERENCE_COUNT:
break;
case CL_QUEUE_PROPERTIES:
- buf.as_scalar<cl_command_queue_properties>() = q.props();
+ buf.as_scalar<cl_command_queue_properties>() = q.properties();
break;
default:
return e.get();
}
-PUBLIC cl_int
+CLOVER_API cl_int
clFlush(cl_command_queue d_q) try {
obj(d_q).flush();
return CL_SUCCESS;