summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/clover/api/event.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/clover/api/event.cpp')
-rw-r--r--src/gallium/state_trackers/clover/api/event.cpp55
1 files changed, 34 insertions, 21 deletions
diff --git a/src/gallium/state_trackers/clover/api/event.cpp b/src/gallium/state_trackers/clover/api/event.cpp
index 0a9a1d6ccb3..cd3159f28ac 100644
--- a/src/gallium/state_trackers/clover/api/event.cpp
+++ b/src/gallium/state_trackers/clover/api/event.cpp
@@ -27,12 +27,13 @@
using namespace clover;
PUBLIC cl_event
-clCreateUserEvent(cl_context ctx, cl_int *errcode_ret) try {
+clCreateUserEvent(cl_context _ctx, cl_int *errcode_ret) try {
+ UNWRAP_ICD_PARAM_CONTEXT(ctx)
if (!ctx)
throw error(CL_INVALID_CONTEXT);
ret_error(errcode_ret, CL_SUCCESS);
- return new soft_event(*ctx, {}, false);
+ return WRAP_ICD_EVENT(new soft_event(*ctx, {}, false));
} catch(error &e) {
ret_error(errcode_ret, e);
@@ -40,7 +41,8 @@ clCreateUserEvent(cl_context ctx, cl_int *errcode_ret) try {
}
PUBLIC cl_int
-clSetUserEventStatus(cl_event ev, cl_int status) {
+clSetUserEventStatus(cl_event _ev, cl_int status) {
+ UNWRAP_ICD_PARAM_EVENT(ev);
if (!dynamic_cast<soft_event *>(ev))
return CL_INVALID_EVENT;
@@ -63,11 +65,12 @@ clWaitForEvents(cl_uint num_evs, const cl_event *evs) try {
if (!num_evs || !evs)
throw error(CL_INVALID_VALUE);
- std::for_each(evs, evs + num_evs, [&](const cl_event ev) {
+ std::for_each(evs, evs + num_evs, [&](const cl_event _ev) {
+ UNWRAP_ICD_PARAM_EVENT(ev);
if (!ev)
throw error(CL_INVALID_EVENT);
- if (&ev->ctx != &evs[0]->ctx)
+ if (&ev->ctx != &UNWRAP_ICD_OBJECT(evs[0])->ctx)
throw error(CL_INVALID_CONTEXT);
if (ev->status() < 0)
@@ -77,7 +80,8 @@ clWaitForEvents(cl_uint num_evs, const cl_event *evs) try {
// Create a temporary soft event that depends on all the events in
// the wait list
ref_ptr<soft_event> sev = transfer(
- new soft_event(evs[0]->ctx, { evs, evs + num_evs }, true));
+ new soft_event(UNWRAP_ICD_OBJECT(evs[0])->ctx,
+ { evs, evs + num_evs }, true));
// ...and wait on it.
sev->wait();
@@ -89,17 +93,18 @@ clWaitForEvents(cl_uint num_evs, const cl_event *evs) try {
}
PUBLIC cl_int
-clGetEventInfo(cl_event ev, cl_event_info param,
+clGetEventInfo(cl_event _ev, cl_event_info param,
size_t size, void *buf, size_t *size_ret) {
+ UNWRAP_ICD_PARAM_EVENT(ev);
if (!ev)
return CL_INVALID_EVENT;
switch (param) {
case CL_EVENT_COMMAND_QUEUE:
- return scalar_property<cl_command_queue>(buf, size, size_ret, ev->queue());
+ return scalar_property<clover::command_queue*>(buf, size, size_ret, ev->queue());
case CL_EVENT_CONTEXT:
- return scalar_property<cl_context>(buf, size, size_ret, &ev->ctx);
+ return scalar_property<clover::context*>(buf, size, size_ret, &ev->ctx);
case CL_EVENT_COMMAND_TYPE:
return scalar_property<cl_command_type>(buf, size, size_ret, ev->command());
@@ -116,10 +121,11 @@ clGetEventInfo(cl_event ev, cl_event_info param,
}
PUBLIC cl_int
-clSetEventCallback(cl_event ev, cl_int type,
+clSetEventCallback(cl_event _ev, cl_int type,
void (CL_CALLBACK *pfn_event_notify)(cl_event, cl_int,
void *),
void *user_data) try {
+ UNWRAP_ICD_PARAM_EVENT(ev);
if (!ev)
throw error(CL_INVALID_EVENT);
@@ -129,10 +135,10 @@ clSetEventCallback(cl_event ev, cl_int type,
// Create a temporary soft event that depends on ev, with
// pfn_event_notify as completion action.
ref_ptr<soft_event> sev = transfer(
- new soft_event(ev->ctx, { ev }, true,
+ new soft_event(ev->ctx, { _ev }, true,
[=](event &) {
ev->wait();
- pfn_event_notify(ev, ev->status(), user_data);
+ pfn_event_notify(_ev, ev->status(), user_data);
}));
return CL_SUCCESS;
@@ -142,7 +148,8 @@ clSetEventCallback(cl_event ev, cl_int type,
}
PUBLIC cl_int
-clRetainEvent(cl_event ev) {
+clRetainEvent(cl_event _ev) {
+ UNWRAP_ICD_PARAM_EVENT(ev);
if (!ev)
return CL_INVALID_EVENT;
@@ -151,7 +158,8 @@ clRetainEvent(cl_event ev) {
}
PUBLIC cl_int
-clReleaseEvent(cl_event ev) {
+clReleaseEvent(cl_event _ev) {
+ UNWRAP_ICD_PARAM_EVENT(ev);
if (!ev)
return CL_INVALID_EVENT;
@@ -162,14 +170,15 @@ clReleaseEvent(cl_event ev) {
}
PUBLIC cl_int
-clEnqueueMarker(cl_command_queue q, cl_event *ev) try {
+clEnqueueMarker(cl_command_queue _q, cl_event *ev) try {
+ UNWRAP_ICD_PARAM_COMMAND_QUEUE(q);
if (!q)
throw error(CL_INVALID_COMMAND_QUEUE);
if (!ev)
throw error(CL_INVALID_VALUE);
- *ev = new hard_event(*q, CL_COMMAND_MARKER, {});
+ *ev = WRAP_ICD_EVENT(new hard_event(*q, CL_COMMAND_MARKER, {}));
return CL_SUCCESS;
@@ -178,7 +187,8 @@ clEnqueueMarker(cl_command_queue q, cl_event *ev) try {
}
PUBLIC cl_int
-clEnqueueBarrier(cl_command_queue q) {
+clEnqueueBarrier(cl_command_queue _q) {
+ UNWRAP_ICD_PARAM_COMMAND_QUEUE(q);
if (!q)
return CL_INVALID_COMMAND_QUEUE;
@@ -187,15 +197,17 @@ clEnqueueBarrier(cl_command_queue q) {
}
PUBLIC cl_int
-clEnqueueWaitForEvents(cl_command_queue q, cl_uint num_evs,
+clEnqueueWaitForEvents(cl_command_queue _q, cl_uint num_evs,
const cl_event *evs) try {
+ UNWRAP_ICD_PARAM_COMMAND_QUEUE(q);
if (!q)
throw error(CL_INVALID_COMMAND_QUEUE);
if (!num_evs || !evs)
throw error(CL_INVALID_VALUE);
- std::for_each(evs, evs + num_evs, [&](const cl_event ev) {
+ std::for_each(evs, evs + num_evs, [&](const cl_event _ev) {
+ UNWRAP_ICD_PARAM_EVENT(ev);
if (!ev)
throw error(CL_INVALID_EVENT);
@@ -216,13 +228,14 @@ clEnqueueWaitForEvents(cl_command_queue q, cl_uint num_evs,
}
PUBLIC cl_int
-clGetEventProfilingInfo(cl_event ev, cl_profiling_info param,
+clGetEventProfilingInfo(cl_event _ev, cl_profiling_info param,
size_t size, void *buf, size_t *size_ret) {
return CL_PROFILING_INFO_NOT_AVAILABLE;
}
PUBLIC cl_int
-clFinish(cl_command_queue q) try {
+clFinish(cl_command_queue _q) try {
+ UNWRAP_ICD_PARAM_COMMAND_QUEUE(q);
if (!q)
throw error(CL_INVALID_COMMAND_QUEUE);